enhance(mobile): redirect to journals tab when switched graph

This commit is contained in:
charlie
2025-06-26 15:33:54 +08:00
parent b68c305872
commit 586c72647b
3 changed files with 15 additions and 5 deletions

View File

@@ -199,8 +199,10 @@
nil))
[current-tab])
(ion/tabs
{:onIonTabsDidChange (fn [^js e]
(state/set-tab! (.-tab (.-detail e))))}
{:id "app-ion-tabs"
:onIonTabsDidChange (fn [^js e]
(state/set-tab! (.-tab (.-detail e))
(.-target e)))}
(ion/tab
{:tab "home"}
(ion/content

View File

@@ -2,9 +2,11 @@
(:require [frontend.rum :as r]))
(defonce *tab (atom "home"))
(defonce *tabs-el (atom nil))
(defn set-tab!
[tab]
(reset! *tab tab))
[tab ^js tabs]
(reset! *tab tab)
(reset! *tabs-el tabs))
(defn use-tab [] (r/use-atom *tab))
(defonce *modal-data (atom nil))
@@ -20,3 +22,6 @@
(defn set-popup!
[data]
(reset! *popup-data data))
(defn redirect-to-tab! [name]
(some-> @*tabs-el (.select name)))

View File

@@ -34,6 +34,7 @@
[frontend.mobile.util :as mobile-util]
[frontend.modules.instrumentation.sentry :as sentry-event]
[frontend.state :as state]
[capacitor.state :as cc-state]
[frontend.ui :as ui]
[frontend.util :as util]
[goog.dom :as gdom]
@@ -86,7 +87,9 @@
{:id :https-proxy-panel :center? true :class "lg:max-w-2xl"}))
(defmethod events/handle :redirect-to-home [_]
(page-handler/create-today-journal!))
(page-handler/create-today-journal!)
(when (util/capacitor-new?)
(cc-state/redirect-to-tab! "home")))
(defmethod events/handle :page/show-delete-dialog [[_ selected-rows ok-handler]]
(shui/dialog-open!