From 6534f3423623343258323d22817c36fd492772bb Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 7 Nov 2022 21:46:24 +0800 Subject: [PATCH] fix: select directory --- .../components/onboarding/setups.cljs | 18 +++------- src/main/frontend/components/widgets.cljs | 36 +++++-------------- src/main/frontend/mobile/graph_picker.cljs | 23 ++++++------ 3 files changed, 25 insertions(+), 52 deletions(-) diff --git a/src/main/frontend/components/onboarding/setups.cljs b/src/main/frontend/components/onboarding/setups.cljs index b0c0d586a8..351e659859 100644 --- a/src/main/frontend/components/onboarding/setups.cljs +++ b/src/main/frontend/components/onboarding/setups.cljs @@ -43,15 +43,9 @@ [] [:div.mobile-intro (cond - (mobile-util/native-ios?) - [:div - [:ul - [:li "Save them in " [:span.font-bold "iCloud Drive's Logseq directory"] ", and sync them across devices using iCloud."] - [:li "Save them in Logseq's directory of your device's local storage."]]] - (mobile-util/native-android?) [:div - "You can save them in your local storage, and use any third-party sync service to keep your notes sync with other devices. " + "You can save them in your local storage, and use Logseq Sync or any third-party sync service to keep your notes sync with other devices. " "If you prefer to use Dropbox to sync your notes, you can use " [:a {:href "https://play.google.com/store/apps/details?id=com.ttxapps.dropsync" :target "_blank"} @@ -75,12 +69,10 @@ (setups-container :picker - [:article.flex - [:section.a - [:strong "Let’s get you set up."] - [:small (str "Where on your " DEVICE " do you want to save your work?") - (when (and (mobile-util/native-platform?) (not native-ios?)) - (mobile-intro))] + [:article.flex.w-full + [:section.a. + (when (and (mobile-util/native-platform?) (not native-ios?)) + (mobile-intro)) (if native-ios? ;; TODO: open for all native mobile platforms diff --git a/src/main/frontend/components/widgets.cljs b/src/main/frontend/components/widgets.cljs index dcdfd3df3e..c2cac3641f 100644 --- a/src/main/frontend/components/widgets.cljs +++ b/src/main/frontend/components/widgets.cljs @@ -6,7 +6,8 @@ [frontend.ui :as ui] [rum.core :as rum] [frontend.config :as config] - [frontend.mobile.util :as mobile-util])) + [frontend.mobile.util :as mobile-util] + [frontend.state :as state])) (rum/defc add-local-directory [] @@ -16,33 +17,14 @@ (if (mobile-util/native-platform?) [:div.text-sm (ui/button "Open a local directory" - :on-click #(page-handler/ls-dir-files! shortcut/refresh!)) + :on-click #(state/pub-event! [:graph/setup-a-repo])) [:hr] - [:ol - [:li - [:div.font-bold.mb-2 "How to sync my notes?"] - (if (mobile-util/native-android?) - [:div - [:p "We're developing our built-in paid Logseq Sync, but you can use any third-party sync service to keep your notes sync with other devices."] - [:p "If you prefer to use Dropbox to sync your notes, you can use " - [:a {:href "https://play.google.com/store/apps/details?id=com.ttxapps.dropsync" - :target "_blank"} - "Dropsync"] - ". Or you can use " - [:a {:href "https://play.google.com/store/apps/details?id=dk.tacit.android.foldersync.lite" - :target "_blank"} - "FolderSync"] - "."]] - [:div - [:p "You can sync your graphs by using iCloud. Please choose an existing graph or create a new graph in your iCloud Drive's Logseq directory."] - [:p "We're developing our built-in paid Logseq Sync. Stay tuned."]])] - - [:li.mt-8 - [:div.font-bold.mb-2 "I need some help"] - [:p "πŸ‘‹ Join our Forum to chat with the makers and our helpful community members."] - (ui/button "Join the community" - :href "https://discuss.logseq.com" - :target "_blank")]]] + [:div + [:div.font-bold.mb-2 "I need some help"] + [:p "πŸ‘‹ Join our Forum to chat with the makers and our helpful community members."] + (ui/button "Join the community" + :href "https://discuss.logseq.com" + :target "_blank")]] [:div.cp__widgets-open-local-directory [:div.select-file-wrap.cursor (when nfs-supported? diff --git a/src/main/frontend/mobile/graph_picker.cljs b/src/main/frontend/mobile/graph_picker.cljs index 53d025f177..387b9d2e83 100644 --- a/src/main/frontend/mobile/graph_picker.cljs +++ b/src/main/frontend/mobile/graph_picker.cljs @@ -21,15 +21,14 @@ (rum/defc toggle-item [{:keys [on? title on-toggle]}] (ui/button - [:span.flex.items-center.justify-between.w-full.py-1 - [:strong title] - (ui/icon (if on? "toggle-right" "toggle-left"))] - - :class (str "toggle-item " (when on? "is-on")) - :intent "logseq" - :on-mouse-down #(util/stop %) - :on-click #(when (fn? on-toggle) - (on-toggle (not on?))))) + [:span.flex.items-center.justify-between.w-full.py-1 + [:strong title] + (ui/toggle on? (fn []) true)] + :class (str "toggle-item " (when on? "is-on")) + :intent "logseq" + :on-mouse-down #(util/stop %) + :on-click #(when (fn? on-toggle) + (on-toggle (not on?))))) (rum/defc ^:large-vars/cleanup-todo graph-picker-cp [{:keys [onboarding-and-home? logged? native-icloud?] :as opts}] @@ -91,7 +90,7 @@ (case step ;; step 0 :init - [:div.flex.flex-col.w-full.space-y-3 + [:div.flex.flex-col.w-full.space-y-6 (ui/button [:span.flex.items-center.justify-between.w-full.py-1 [:strong "Create a new graph"] @@ -139,8 +138,8 @@ [:div.flex.justify-between.items-center.pt-2 (ui/button [:span.flex.items-center (ui/icon "chevron-left" {:size 18}) "Back"] - :intent "logseq" - :on-click #(set-step! :init)) + :intent "logseq" + :on-click #(set-step! :init)) (ui/button "Create" :on-click