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',
loggingBehavior: 'debug',
server: {
url: "https://192.168.10.208:3002",
cleartext: true
androidScheme: 'http',
},
plugins: {
StatusBar: {

View File

@@ -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?

View File

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