enhance: move add new graph to switch graph

This commit is contained in:
Tienson Qin
2025-05-25 23:29:38 +08:00
parent 16e2692b08
commit 03de1aed53
3 changed files with 26 additions and 26 deletions

View File

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

View File

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

View File

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