From f6de99ea7bf5c8d407849e3f599e443468d338a0 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Fri, 5 Sep 2025 16:43:54 +0800 Subject: [PATCH] fix(mobile): don't open sidebar when editing or selected --- src/main/mobile/components/app.cljs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/mobile/components/app.cljs b/src/main/mobile/components/app.cljs index 11c08465e2..e1313d7d79 100644 --- a/src/main/mobile/components/app.cljs +++ b/src/main/mobile/components/app.cljs @@ -34,16 +34,12 @@ :auto-capitalize "off" :auto-correct "false"}]) -(rum/defc journals - [] - (ui-component/classic-app-container-wrap - [:div.pt-3 - (journal/all-journals)])) - -(defn- modal-popup-exists? +(defn- sidebar-not-allowed-to-open? [] (or (seq @mobile-state/*modal-blocks) - (seq @mobile-state/*popup-data))) + (seq @mobile-state/*popup-data) + (:mobile/show-action-bar? @state/state) + (state/editing?))) (defn- setup-sidebar-touch-swipe! [] @@ -58,7 +54,7 @@ max-vertical-drift 50 on-touch-start (fn [^js e] - (when-not (modal-popup-exists?) + (when-not (sidebar-not-allowed-to-open?) (let [t (aget e "touches" 0)] (reset! sidebar-initial-open? (mobile-state/left-sidebar-open?)) (reset! touch-start-x (.-pageX t)) @@ -68,7 +64,7 @@ (reset! max-x 0)))) on-touch-move (fn [^js e] - (when-not (modal-popup-exists?) + (when-not (sidebar-not-allowed-to-open?) (let [t (aget e "touches" 0) _ (reset! max-x (max (.-pageX t) @max-x)) dx (- (.-pageX t) @touch-start-x) @@ -114,11 +110,17 @@ (.removeEventListener js/document "touchend" on-touch-end) (.removeEventListener js/document "touchcancel" on-touch-end)))) -(rum/defc home-inner - [*page db-restoring? current-tab] +(rum/defc journals + [] (hooks/use-effect! (fn [] (setup-sidebar-touch-swipe!)) []) + (ui-component/classic-app-container-wrap + [:div.pt-3 + (journal/all-journals)])) + +(rum/defc home-inner + [*page db-restoring? current-tab] [:div {:id "app-main-content" :ref *page}