瀏覽代碼

enhance: move add new graph to switch graph

Tienson Qin 4 月之前
父節點
當前提交
03de1aed53
共有 3 個文件被更改,包括 26 次插入26 次删除
  1. 1 2
      capacitor.config.ts
  2. 24 24
      src/main/capacitor/app.cljs
  3. 1 0
      src/main/capacitor/app.css

+ 1 - 2
capacitor.config.ts

@@ -9,8 +9,7 @@ const config: CapacitorConfig = {
   webDir: 'static/capacitor',
   loggingBehavior: 'debug',
   server: {
-      url: "https://192.168.10.208:3002",
-      cleartext: true
+      androidScheme: 'http',
   },
   plugins: {
     StatusBar: {

+ 24 - 24
src/main/capacitor/app.cljs

@@ -36,29 +36,29 @@
                           "Select a Graph")]
     [:<>
      (ionic/ion-button
-      {:fill "clear" :mode "ios"
-       :class "border-none w-full rounded-lg font-semibold pt-2"
+      {:fill "clear"
+       :mode "ios"
+       :class "border-none w-full rounded-lg"
        :on-click (fn []
-                   (ui/open-modal! "Switch graph"
-                                   {:type :action-sheet
-                                    :buttons (for [repo graphs]
-                                               {:text (some-> (:url repo) (string/replace #"^logseq_db_" ""))
-                                                :role (:url repo)})
-                                    :inputs []
-                                    :on-action (fn [e]
-                                                 (when-let [url (:role e)]
-                                                   (when (string/starts-with? url "logseq_db_")
-                                                     (fstate/pub-event! [:graph/switch url]))))}))}
-      short-repo-name)
-
-     (ionic/ion-button
-      {:class "relative -left-2 pt-1.5 opacity-50"
-       :on-click (fn []
-                   (when-let [db-name (js/prompt "Create new db")]
-                     (when-not (string/blank? db-name)
-                       (-> (repo-handler/new-db! db-name)
-                           (p/then #())))))}
-      (ionic/tabler-icon "plus" {:size 24}))]))
+                   (let [buttons (concat
+                                  (for [repo graphs]
+                                    {:text (some-> (:url repo) (string/replace #"^logseq_db_" ""))
+                                     :role (:url repo)})
+                                  [{:text "Add new graph"
+                                    :role "add-new-graph"}])]
+                     (ui/open-modal! "Switch graph"
+                                     {:type :action-sheet
+                                      :buttons buttons
+                                      :inputs []
+                                      :on-action (fn [e]
+                                                   (when-let [role (:role e)]
+                                                     (if (= "add-new-graph" role)
+                                                       (when-let [db-name (js/prompt "Create new db")]
+                                                         (when-not (string/blank? db-name)
+                                                           (repo-handler/new-db! db-name)))
+                                                       (when (string/starts-with? role "logseq_db_")
+                                                         (fstate/pub-event! [:graph/switch role])))))})))}
+      short-repo-name)]))
 
 (rum/defc bottom-tabs
   []
@@ -157,14 +157,14 @@
                                                                 (let [val (.-value (.-detail e))]
                                                                   (apply-date! val)
                                                                   (close!)))}))))))}
-                           [:span {:slot "icon-only"} (ionic/tabler-icon "calendar-month" {:size 26})])
+                           [:span {:slot "icon-only"} (ionic/tabler-icon "calendar-month" {:size 24})])
 
                           (ionic/ion-button {:fill "clear"}
                                             (ionic/ion-nav-link
                                              {:routerDirection "forward"
                                               :class "w-full"
                                               :component settings/page}
-                                             [:span {:slot "icon-only"} (ionic/tabler-icon "dots-circle-horizontal" {:size 26})])))))
+                                             [:span {:slot "icon-only"} (ionic/tabler-icon "dots" {:size 24})])))))
 
        ;; main content
      (if db-restoring?

+ 1 - 0
src/main/capacitor/app.css

@@ -133,4 +133,5 @@ ion-textarea {
 
 :root {
     --ls-page-title-size: 26px;
+    --ion-color-primary: #000000;
 }