From dcbd2c1477d1d7e28d6ff74d3eebbd28f5189918 Mon Sep 17 00:00:00 2001 From: charlie Date: Thu, 24 Jul 2025 15:03:52 +0800 Subject: [PATCH] enhance(mobile): improve settings options --- src/main/mobile/components/app.cljs | 23 ++++++++++++++----- src/main/mobile/components/modal.cljs | 9 ++++---- src/main/mobile/components/settings.cljs | 28 ++---------------------- 3 files changed, 24 insertions(+), 36 deletions(-) diff --git a/src/main/mobile/components/app.cljs b/src/main/mobile/components/app.cljs index 9e5a2c1d32..491632b0ea 100644 --- a/src/main/mobile/components/app.cljs +++ b/src/main/mobile/components/app.cljs @@ -223,11 +223,24 @@ (= tab "settings") (assoc - :right-render [:<> - (shui/button {:variant :icon :size :sm} - (shui/tabler-icon "plus" {:size 23})) - (shui/button {:variant :icon :size :sm} - (shui/tabler-icon "dots" {:size 23}))]))) + :right-render + [:<> + (shui/button + {:variant :icon :size :sm + :on-click (fn [] + (ui-component/open-popup! + (fn [] + [:div.-mx-2 + (ui/menu-link {:on-click #(user-handler/logout)} + [:span.text-lg.flex.gap-2.items-center.text-red-700 + (shui/tabler-icon "logout" {:class "opacity-80" :size 22}) + "Logout"]) + (ui/menu-link {:on-click #(js/window.open "https://github.com/logseq/db-test/issues")} + [:span.text-lg.flex.gap-2.items-center + (shui/tabler-icon "bug" {:class "opacity-70" :size 22}) + "Report bug"])]) + {:title "Actions"}))} + (shui/tabler-icon "dots" {:size 23}))]))) ;; app tabs (ui-silk/app-silk-tabs) diff --git a/src/main/mobile/components/modal.cljs b/src/main/mobile/components/modal.cljs index 81aececb60..21a7d24518 100644 --- a/src/main/mobile/components/modal.cljs +++ b/src/main/mobile/components/modal.cljs @@ -70,17 +70,16 @@ {:error-handler (fn [{:keys [msg]}] (notification/show! msg :warning))})))))} - [:span.text-lg.flex.gap-2.items-center - (shui/tabler-icon "trash" {:class "opacity-80" :size 18}) + [:span.text-lg.flex.gap-2.items-center.text-red-700 + (shui/tabler-icon "trash" {:class "opacity-80" :size 22}) "Delete"]) (ui/menu-link {:on-click #(mobile-ui/close-popup!)} [:span.text-lg.flex.gap-2.items-center - (shui/tabler-icon "copy" {:class "opacity-80" :size 18}) + (shui/tabler-icon "copy" {:class "opacity-80" :size 22}) "Copy"])]) - {:title "Actions" - :modal-props {:initialBreakpoint 0.3}}))} + {:title "Actions"}))} (shui/tabler-icon "dots-vertical" {:size 18 :stroke 2})]] ;; block page content diff --git a/src/main/mobile/components/settings.cljs b/src/main/mobile/components/settings.cljs index 2131a3ae68..5745bd9a21 100644 --- a/src/main/mobile/components/settings.cljs +++ b/src/main/mobile/components/settings.cljs @@ -26,32 +26,8 @@ (rum/defc page < rum/reactive [] - (let [login? (and (state/sub :auth/id-token) (user-handler/logged-in?))] - ;(let [buttons (->> [(when login? - ; {:text "Logout" :role "logout"}) - ; {:text "Report bug" :role "report-bug"}] - ; (remove nil?))] - ; (ion/buttons {:slot "end"} - ; (ion/button - ; {:size "small" - ; :fill "clear" - ; :on-click (fn [_e] - ; (ui-component/open-modal! "Settings" - ; {:type :action-sheet - ; :buttons buttons - ; :inputs [] - ; :on-action (fn [e] - ; (when-let [role (:role e)] - ; (case role - ; "logout" - ; (user-handler/logout) - ; "report-bug" - ; (js/window.open "https://github.com/logseq/db-test/issues" "_blank") - ; nil))) - ; :modal-props {:class "graph-switcher"}}))} - ; [:span.text-muted-foreground {:slot "icon-only"} - ; (ion/tabler-icon "dots" {:size 20})]))) - + (let [login? (and (state/sub :auth/id-token) + (user-handler/logged-in?))] [:div.app-index-settings (user-profile login?) [:div.mt-8