Browse Source

enhance(dev): add src/main/mobile to separate linter

Added to keep file graph code and other anti-patterns out of new mobile app
Gabriel Horner 3 months ago
parent
commit
cd655174aa

+ 1 - 0
CODEBASE_OVERVIEW.md

@@ -52,6 +52,7 @@ This is overview of this repository's most important directories and files.
     - `src/main/frontend/worker/` contains code for the separate worker asset.
     - `src/main/frontend/common/` contains common code shared by the worker asset and the frontend.
   - `src/main/logseq/` contains the api used by plugins.
+  - `src/main/mobile/` contains code for new mobile app.
   - `src/dev-cljs/` contains some development utilities.
 
 - `deps/` contains ClojureScript dependencies or libraries used by the frontend.

+ 9 - 3
scripts/src/logseq/tasks/dev/db_and_file_graphs.clj

@@ -19,7 +19,9 @@
          "frontend.handler.db-based."
          "frontend.worker.handler.page.db-based"
          "frontend.components.property" "frontend.components.class"
-         "frontend.components.db-based" "frontend.components.objects" "frontend.components.query.view"]))
+         "frontend.components.db-based" "frontend.components.objects" "frontend.components.query.view"
+         "mobile.core" "mobile.events" "mobile.externals" "mobile.init" "mobile.ionic" "mobile.state"
+         "mobile.components"]))
 
 (def file-graph-ns
   "Namespaces or parent namespaces _only_ for file graphs"
@@ -57,7 +59,8 @@
          "src/main/frontend/components/objects.cljs"
          "src/main/frontend/components/db_based"
          "src/main/frontend/components/query/view.cljs"
-         "src/electron/electron/db.cljs"]))
+         "src/electron/electron/db.cljs"
+         "src/main/mobile"]))
 
 (def file-graph-paths
   "Paths _only_ for file graphs"
@@ -136,7 +139,10 @@
                              ;; The next 3 are from components.property.value
                              "{:block/name page-title})"
                              "(when-not (db/get-page journal)"
-                             "(let [value (if datetime? (tc/to-long d) (db/get-page journal))]"}
+                             "(let [value (if datetime? (tc/to-long d) (db/get-page journal))]"
+                             ;; :block/name ones from src/main/mobile
+                             "(if-let [journal (db/get-page page-name)]"
+                             "(p/then #(mobile-state/open-block-modal! (db/get-page page-name)))))))]"}
         res (grep-many file-concepts db-graph-paths)
         invalid-lines (when (= 0 (:exit res))
                         (remove #(some->> (string/split % #":\s+") second string/trim (contains? allowed-exceptions))

+ 0 - 2
src/main/mobile/components/app.cljs

@@ -4,7 +4,6 @@
             [clojure.string :as string]
             [frontend.components.journal :as journal]
             [frontend.components.rtc.indicator :as rtc-indicator]
-            [frontend.config :as config]
             [frontend.date :as date]
             [frontend.db :as db]
             [frontend.db.conn :as db-conn]
@@ -137,7 +136,6 @@
                      (when (and repo
                                 (ldb/get-graph-rtc-uuid (db/get-db))
                                 (user-handler/logged-in?)
-                                (config/db-based-graph? repo)
                                 (user-handler/team-member?))
                        [:<>
                   ;; (rum/with-key (rtc-collaborators)

+ 2 - 2
src/main/mobile/components/modal.cljs

@@ -7,7 +7,7 @@
             [frontend.handler.page :as page-handler]
             [frontend.state :as state]
             [frontend.ui :as ui]
-            [logseq.db :as ldb]
+            [logseq.db.frontend.entity-util :as entity-util]
             [mobile.components.ui :as mobile-ui]
             [mobile.init :as init]
             [mobile.ionic :as ion]
@@ -49,7 +49,7 @@
                           {:on-click (fn []
                                        (mobile-ui/open-modal!
                                         (str "⚠️ Are you sure you want to delete this "
-                                             (if (ldb/page? block) "page" "block")
+                                             (if (entity-util/page? block) "page" "block")
                                              "?")
                                         {:type :alert
                                          :on-action (fn [{:keys [role]}]