Răsfoiți Sursa

enhance: add links for chat<->page

Tienson Qin 2 ani în urmă
părinte
comite
30eb58cab0

+ 3 - 0
src/main/frontend/components/ai.cljs

@@ -116,6 +116,9 @@
     [:div.chat
      (conversations conversation-id)
      [:div.flex.flex-1.flex-col
+      (when conversation-id
+        [:div.p-2.opacity-70.hover:opacity-100.overflow-x-hidden
+         (block/page-cp {} (db/entity conversation-id))])
       (conversation conversation-id)
       (input)]]))
 

+ 13 - 0
src/main/frontend/components/page.cljs

@@ -26,6 +26,7 @@
             [frontend.handler.notification :as notification]
             [frontend.handler.page :as page-handler]
             [frontend.handler.route :as route-handler]
+            [frontend.handler.ai :as ai-handler]
             [frontend.mixins :as mixins]
             [frontend.mobile.util :as mobile-util]
             [frontend.search :as search]
@@ -438,9 +439,21 @@
                  :on-mouse-leave (fn [e]
                                    (page-mouse-leave e *control-show?))}
                 (page-blocks-collapse-control title *control-show? *all-collapsed?)])
+
              (when-not whiteboard?
                [:div.ls-page-title.flex-1.flex-row.w-full
                 (page-title page-name icon title format fmt-journal?)])
+
+             (when (= "chat" (:block/type page))
+               [:div.px-2
+                (ui/button
+                  (ui/icon "wand")
+                  :small? true
+                  :intent "link"
+                  :on-click (fn []
+                              (ai-handler/open-chat)
+                              (state/set-state! :chat/current-conversation (:db/id page))))])
+
              (when (not config/publishing?)
                (when config/lsp-enabled?
                  [:div.flex.flex-row