Parcourir la source

fix: routes for all graphs and import note

Tienson Qin il y a 1 semaine
Parent
commit
cd4af15633

+ 4 - 1
src/main/frontend/components/repo.cljs

@@ -336,7 +336,10 @@
 
    (when-not config/publishing?
      (shui/button {:size :sm :variant :ghost
-                   :on-click #(route-handler/redirect-to-all-graphs)}
+                   :on-click (fn []
+                               (if (util/mobile?)
+                                 (state/pub-event! [:mobile/set-tab "settings"])
+                                 (route-handler/redirect-to-all-graphs)))}
                   (shui/tabler-icon "layout-2") [:span (t :all-graphs)]))])
 
 (rum/defcs repos-dropdown-content < rum/reactive

+ 0 - 10
src/main/mobile/core.cljs

@@ -3,7 +3,6 @@
   (:require ["react-dom/client" :as rdc]
             [clojure.string :as string]
             [frontend.background-tasks]
-            [frontend.components.imports :as imports]
             [frontend.db.async :as db-async]
             [frontend.handler :as fhandler]
             [frontend.handler.db-based.rtc-background-tasks]
@@ -11,7 +10,6 @@
             [frontend.state :as state]
             [frontend.util :as util]
             [lambdaisland.glogi :as log]
-            [logseq.shui.ui :as shui]
             [mobile.components.app :as app]
             [mobile.components.selection-toolbar :as selection-toolbar]
             [mobile.events]
@@ -66,14 +64,6 @@
                                         {:children? false
                                          :skip-refresh? true})))))
 
-           :graphs
-           (mobile-state/set-tab! "settings")
-
-           :import
-           (shui/popup-show! nil (fn []
-                                   (imports/importer {}))
-                             {:id :import})
-
            nil)))
 
    ;; set to false to enable HistoryAPI

+ 5 - 0
src/main/mobile/events.cljs

@@ -6,6 +6,7 @@
             [logseq.shui.ui :as shui]
             [mobile.components.recorder :as recorder]
             [mobile.init :as init]
+            [mobile.state :as mobile-state]
             [reitit.frontend.easy :as rfe]))
 
 (defmethod events/handle :mobile/clear-edit [_]
@@ -24,3 +25,7 @@
 
 (defmethod events/handle :mobile/redirect-to [[_ {:keys [k params query]}]]
   (rfe/push-state k params query))
+
+(defmethod events/handle :mobile/set-tab [[_ tab]]
+  (when tab
+    (mobile-state/set-tab! tab)))

+ 5 - 4
src/main/mobile/routes.cljs

@@ -1,6 +1,7 @@
 (ns mobile.routes
   "Routes used in mobile app"
-  (:require [frontend.components.page :as page]))
+  (:require [frontend.components.imports :as imports]
+            [frontend.components.page :as page]))
 
 (def routes
   [["/"
@@ -10,7 +11,7 @@
      :view (fn [route-match]
              [:div.mt-6
               (page/page-cp (assoc route-match :mobile-page? true))])}]
-   ["/graphs"
-    {:name :graphs}]
    ["/import"
-    {:name :import}]])
+    {:name :import
+     :view (fn []
+             (imports/importer {}))}]])