|
|
@@ -130,70 +130,86 @@
|
|
|
"platform="
|
|
|
(js/encodeURIComponent platform))))
|
|
|
|
|
|
-(rum/defc dropdown-menu < rum/reactive
|
|
|
- < {:key-fn #(identity "repos-dropdown-menu")}
|
|
|
+(rum/defc toolbar-dots-menu < rum/reactive
|
|
|
[{:keys [current-repo t]}]
|
|
|
(let [page-menu (page-menu/page-menu nil)
|
|
|
page-menu-and-hr (when (seq page-menu)
|
|
|
(concat page-menu [{:hr true}]))
|
|
|
- login? (and (state/sub :auth/id-token) (user-handler/logged-in?))]
|
|
|
- (ui/dropdown-with-links
|
|
|
- (fn [{:keys [toggle-fn]}]
|
|
|
- [:button.button.icon.toolbar-dots-btn
|
|
|
- {:on-click toggle-fn
|
|
|
- :title (t :header/more)}
|
|
|
- (ui/icon "dots" {:size ui/icon-size})])
|
|
|
- (->>
|
|
|
- [(when (state/enable-editing?)
|
|
|
- {:title (t :settings)
|
|
|
- :options {:on-click state/open-settings!}
|
|
|
- :icon (ui/icon "settings")})
|
|
|
-
|
|
|
- (when config/lsp-enabled?
|
|
|
- {:title (t :plugins)
|
|
|
- :options {:on-click #(plugin-handler/goto-plugins-dashboard!)}
|
|
|
- :icon (ui/icon "apps")})
|
|
|
-
|
|
|
- (when config/lsp-enabled?
|
|
|
- {:title (t :themes)
|
|
|
- :options {:on-click #(plugins/open-select-theme!)}
|
|
|
- :icon (ui/icon "palette")})
|
|
|
-
|
|
|
- (when current-repo
|
|
|
- {:title (t :export-graph)
|
|
|
- :options {:on-click #(shui/dialog-open! export/export)}
|
|
|
- :icon (ui/icon "database-export")})
|
|
|
-
|
|
|
- (when (and current-repo (state/enable-editing?))
|
|
|
- {:title (t :import)
|
|
|
- :options {:href (rfe/href :import)}
|
|
|
- :icon (ui/icon "file-upload")})
|
|
|
-
|
|
|
- (when-not config/publishing?
|
|
|
- {:title [:div.flex-row.flex.justify-between.items-center
|
|
|
- [:span (t :join-community)]]
|
|
|
- :options {:href "https://discuss.logseq.com"
|
|
|
- :title (t :discourse-title)
|
|
|
- :target "_blank"}
|
|
|
- :icon (ui/icon "brand-discord")})
|
|
|
-
|
|
|
- (when config/publishing?
|
|
|
- {:title (t :toggle-theme)
|
|
|
- :options {:on-click #(state/toggle-theme!)}
|
|
|
- :icon (ui/icon "bulb")})
|
|
|
-
|
|
|
- (when login? {:hr true})
|
|
|
- (when login?
|
|
|
- {:item [:span.flex.flex-col.relative.group.pt-1
|
|
|
- [:b.leading-none (user-handler/username)]
|
|
|
- [:small.opacity-70 (user-handler/email)]
|
|
|
- [:i.absolute.opacity-0.group-hover:opacity-100.text-red-rx-09
|
|
|
- {:class "right-1 top-3" :title (t :logout)}
|
|
|
- (ui/icon "logout")]]
|
|
|
- :options {:on-click #(user-handler/logout)}})]
|
|
|
- (concat page-menu-and-hr)
|
|
|
- (remove nil?))
|
|
|
- {})))
|
|
|
+ login? (and (state/sub :auth/id-token) (user-handler/logged-in?))
|
|
|
+ items (fn []
|
|
|
+ (->>
|
|
|
+ [(when (state/enable-editing?)
|
|
|
+ {:title (t :settings)
|
|
|
+ :options {:on-click state/open-settings!}
|
|
|
+ :icon (ui/icon "settings")})
|
|
|
+
|
|
|
+ (when config/lsp-enabled?
|
|
|
+ {:title (t :plugins)
|
|
|
+ :options {:on-click #(plugin-handler/goto-plugins-dashboard!)}
|
|
|
+ :icon (ui/icon "apps")})
|
|
|
+
|
|
|
+ (when config/lsp-enabled?
|
|
|
+ {:title (t :themes)
|
|
|
+ :options {:on-click #(plugins/open-select-theme!)}
|
|
|
+ :icon (ui/icon "palette")})
|
|
|
+
|
|
|
+ (when current-repo
|
|
|
+ {:title (t :export-graph)
|
|
|
+ :options {:on-click #(shui/dialog-open! export/export)}
|
|
|
+ :icon (ui/icon "database-export")})
|
|
|
+
|
|
|
+ (when (and current-repo (state/enable-editing?))
|
|
|
+ {:title (t :import)
|
|
|
+ :options {:href (rfe/href :import)}
|
|
|
+ :icon (ui/icon "file-upload")})
|
|
|
+
|
|
|
+ (when-not config/publishing?
|
|
|
+ {:title [:div.flex-row.flex.justify-between.items-center
|
|
|
+ [:span (t :join-community)]]
|
|
|
+ :options {:href "https://discuss.logseq.com"
|
|
|
+ :title (t :discourse-title)
|
|
|
+ :target "_blank"}
|
|
|
+ :icon (ui/icon "brand-discord")})
|
|
|
+
|
|
|
+ (when config/publishing?
|
|
|
+ {:title (t :toggle-theme)
|
|
|
+ :options {:on-click #(state/toggle-theme!)}
|
|
|
+ :icon (ui/icon "bulb")})
|
|
|
+
|
|
|
+ (when login? {:hr true})
|
|
|
+ (when login?
|
|
|
+ {:item [:span.flex.flex-col.relative.group.pt-1
|
|
|
+ [:b.leading-none (user-handler/username)]
|
|
|
+ [:small.opacity-70 (user-handler/email)]
|
|
|
+ [:i.absolute.opacity-0.group-hover:opacity-100.text-red-rx-09
|
|
|
+ {:class "right-1 top-3" :title (t :logout)}
|
|
|
+ (ui/icon "logout")]]
|
|
|
+ :options {:on-click #(user-handler/logout)}})]
|
|
|
+ (concat page-menu-and-hr)
|
|
|
+ (remove nil?)))]
|
|
|
+ [:button.button.icon.toolbar-dots-btn
|
|
|
+ {:title (t :header/more)
|
|
|
+ :on-click (fn [^js e]
|
|
|
+ (shui/popup-show! (.-target e)
|
|
|
+ (fn [{:keys [id]}]
|
|
|
+ (for [{:keys [hr item title options icon]} (items)]
|
|
|
+ (let [on-click' (:on-click options)]
|
|
|
+ (if hr
|
|
|
+ (shui/dropdown-menu-separator)
|
|
|
+ (shui/dropdown-menu-item
|
|
|
+ (assoc options
|
|
|
+ :on-click (fn [^js e]
|
|
|
+ (when on-click'
|
|
|
+ (when-not (false? (on-click' e))
|
|
|
+ (shui/popup-hide! id)))))
|
|
|
+ (or item
|
|
|
+ [:span.flex.items-center.gap-1.w-full
|
|
|
+ icon [:div title]]))))))
|
|
|
+ {:align "end"
|
|
|
+ :as-dropdown? true
|
|
|
+ :content-props {:class "w-64"
|
|
|
+ :align-offset -32}}))}
|
|
|
+ (ui/icon "dots" {:size ui/icon-size})]))
|
|
|
|
|
|
(rum/defc back-and-forward
|
|
|
< {:key-fn #(identity "nav-history-buttons")}
|
|
|
@@ -333,7 +349,7 @@
|
|
|
[:a.text-sm.font-medium.button {:href (rfe/href :graph)}
|
|
|
(t :graph)])
|
|
|
|
|
|
- (dropdown-menu {:t t
|
|
|
+ (toolbar-dots-menu {:t t
|
|
|
:current-repo current-repo
|
|
|
:default-home default-home})
|
|
|
|