Просмотр исходного кода

wip: Demo switch to use db graph

Tienson Qin 1 год назад
Родитель
Сommit
b9f9fa0ca6

+ 2 - 1
deps/db/src/logseq/db/frontend/entity_util.cljs

@@ -5,4 +5,5 @@
 (defn db-based-graph?
   "Whether the current graph is db-only"
   [db]
-  (= "db" (:kv/value (d/entity db :logseq.kv/db-type))))
+  (when db
+    (= "db" (:kv/value (d/entity db :logseq.kv/db-type)))))

+ 2 - 1
deps/db/src/logseq/db/sqlite/util.cljs

@@ -50,7 +50,8 @@
 
 (defn db-based-graph?
   [graph-name]
-  (string/starts-with? graph-name db-version-prefix))
+  (when graph-name
+    (string/starts-with? graph-name db-version-prefix)))
 
 (defn local-file-based-graph?
   [s]

+ 1 - 1
deps/publishing/src/logseq/publishing/html.cljs

@@ -147,7 +147,7 @@ generated index.html string and assets used by the html"
         asset-filenames (remove nil? asset-filenames')
 
         db-str (dt/write-transit-str db)
-        repo-name (if db-graph? (str sqlite-util/db-version-prefix "Logseq demo") "Logseq demo")
+        repo-name (if db-graph? (str sqlite-util/db-version-prefix "Demo") "Demo")
         ;; The repo-name is used by the client and thus determines whether
         ;; it's a db graph or not
         state (assoc app-state

+ 58 - 63
src/main/frontend/components/container.cljs

@@ -5,13 +5,11 @@
             [frontend.components.find-in-page :as find-in-page]
             [frontend.components.header :as header]
             [frontend.components.journal :as journal]
-            [frontend.components.onboarding :as onboarding]
             [frontend.components.plugins :as plugins]
             [frontend.components.repo :as repo]
             [frontend.components.right-sidebar :as right-sidebar]
             [frontend.components.select :as select]
             [frontend.components.theme :as theme]
-            [frontend.components.widgets :as widgets]
             [frontend.components.dnd :as dnd-component]
             [frontend.components.icon :as icon]
             [frontend.components.handbooks :as handbooks]
@@ -357,59 +355,59 @@
         (repo/repos-dropdown)
 
         [:div.nav-header.flex.flex-col.mt-1
-         (let [page (:page default-home)]
-           (if (and page (not (state/enable-journals? (state/get-current-repo))))
-             (sidebar-item
-              {:class "home-nav"
-               :title page
-               :on-click-handler route-handler/redirect-to-home!
-               :active (and (not srs-open?)
-                            (= route-name :page)
-                            (= page (get-in route-match [:path-params :name])))
-               :icon "home"
-               :shortcut :go/home})
-             (sidebar-item
-              {:class "journals-nav"
-               :active (and (not srs-open?)
-                            (or (= route-name :all-journals) (= route-name :home)))
-               :title (t :left-side-bar/journals)
-               :on-click-handler (fn [e]
-                                   (if (gobj/get e "shiftKey")
-                                     (route-handler/sidebar-journals!)
-                                     (route-handler/go-to-journals!)))
-               :icon "calendar"
-               :shortcut :go/journals})))
-
-         (when enable-whiteboards?
-           (when (or config/dev? (not db-based?))
-             (sidebar-item
-              {:class "whiteboard"
-               :title (t :right-side-bar/whiteboards)
-               :href (rfe/href :whiteboards)
-               :on-click-handler (fn [_e] (whiteboard-handler/onboarding-show))
-               :active (and (not srs-open?) (#{:whiteboard :whiteboards} route-name))
-               :icon "whiteboard"
-               :icon-extension? true
-               :shortcut :go/whiteboards})))
-
-         (when (and (state/enable-flashcards? (state/get-current-repo)) (not db-based?))
-           [:div.flashcards-nav
-            (flashcards srs-open?)])
-
-         (sidebar-item
-          {:class "graph-view-nav"
-           :title (t :right-side-bar/graph-view)
-           :href (rfe/href :graph)
-           :active (and (not srs-open?) (= route-name :graph))
-           :icon "hierarchy"
-           :shortcut :go/graph-view})
-
-         (sidebar-item
-          {:class "all-pages-nav"
-           :title (t :right-side-bar/all-pages)
-           :href (rfe/href :all-pages)
-           :active (and (not srs-open?) (= route-name :all-pages))
-           :icon "files"})]]
+           (let [page (:page default-home)]
+             (if (and page (not (state/enable-journals? (state/get-current-repo))))
+               (sidebar-item
+                {:class "home-nav"
+                 :title page
+                 :on-click-handler route-handler/redirect-to-home!
+                 :active (and (not srs-open?)
+                              (= route-name :page)
+                              (= page (get-in route-match [:path-params :name])))
+                 :icon "home"
+                 :shortcut :go/home})
+               (sidebar-item
+                {:class "journals-nav"
+                 :active (and (not srs-open?)
+                              (or (= route-name :all-journals) (= route-name :home)))
+                 :title (t :left-side-bar/journals)
+                 :on-click-handler (fn [e]
+                                     (if (gobj/get e "shiftKey")
+                                       (route-handler/sidebar-journals!)
+                                       (route-handler/go-to-journals!)))
+                 :icon "calendar"
+                 :shortcut :go/journals})))
+
+           (when enable-whiteboards?
+             (when (or config/dev? (not db-based?))
+               (sidebar-item
+                {:class "whiteboard"
+                 :title (t :right-side-bar/whiteboards)
+                 :href (rfe/href :whiteboards)
+                 :on-click-handler (fn [_e] (whiteboard-handler/onboarding-show))
+                 :active (and (not srs-open?) (#{:whiteboard :whiteboards} route-name))
+                 :icon "whiteboard"
+                 :icon-extension? true
+                 :shortcut :go/whiteboards})))
+
+           (when (and (state/enable-flashcards? (state/get-current-repo)) (not db-based?))
+             [:div.flashcards-nav
+              (flashcards srs-open?)])
+
+           (sidebar-item
+            {:class "graph-view-nav"
+             :title (t :right-side-bar/graph-view)
+             :href (rfe/href :graph)
+             :active (and (not srs-open?) (= route-name :graph))
+             :icon "hierarchy"
+             :shortcut :go/graph-view})
+
+           (sidebar-item
+            {:class "all-pages-nav"
+             :title (t :right-side-bar/all-pages)
+             :href (rfe/href :all-pages)
+             :active (and (not srs-open?) (= route-name :all-pages))
+             :icon "files"})]]
 
        [:div.nav-contents-container.flex.flex-col.gap-1.pt-1
         {:on-scroll on-contents-scroll}
@@ -557,8 +555,8 @@
   [{:keys [route-match margin-less-pages? route-name indexeddb-support? db-restoring? main-content show-action-bar? show-recording-bar?]}]
   (let [left-sidebar-open? (state/sub :ui/left-sidebar-open?)
         onboarding-and-home? (and (or (nil? (state/get-current-repo)) (config/demo-graph?))
-                               (not config/publishing?)
-                               (= :home route-name))
+                                  (not config/publishing?)
+                                  (= :home route-name))
         margin-less-pages?   (or (and (mobile-util/native-platform?) onboarding-and-home?) margin-less-pages?)]
     [:div#main-container.cp__sidebar-main-layout.flex-1.flex
      {:class (util/classnames [{:is-left-sidebar-open left-sidebar-open?}])}
@@ -586,10 +584,6 @@
        (mobile-bar)
        (footer/footer)
 
-       (when (and (not (mobile-util/native-platform?))
-                  (contains? #{:page :home} route-name))
-         (widgets/demo-graph-alert))
-
        (cond
          (not indexeddb-support?)
          nil
@@ -614,8 +608,9 @@
                                      :else 120)}}
           main-content])
 
-       (when onboarding-and-home?
-         (onboarding/intro onboarding-and-home?))]]]))
+       (comment
+         (when onboarding-and-home?
+           (onboarding/intro onboarding-and-home?)))]]]))
 
 (defonce sidebar-inited? (atom false))
 ;; TODO: simplify logic

+ 1 - 16
src/main/frontend/components/header.cljs

@@ -246,15 +246,8 @@
 
 (rum/defc ^:large-vars/cleanup-todo header < rum/reactive
   [{:keys [open-fn current-repo default-home new-block-mode]}]
-  (let [repos (->> (state/sub [:me :repos])
-                   (remove #(= (:url %) config/demo-repo)))
-        _ (state/sub [:user/info :UserGroups])
+  (let [_ (state/sub [:user/info :UserGroups])
         electron-mac? (and util/mac? (util/electron?))
-        show-open-folder? (and (nfs/supported?)
-                               (or (empty? repos)
-                                   (nil? (state/sub :git/current-repo)))
-                               (not (mobile-util/native-platform?))
-                               (not config/publishing?))
         left-menu (left-menu-button {:on-click (fn []
                                                  (open-fn)
                                                  (state/set-left-sidebar-open!
@@ -332,14 +325,6 @@
       (when-not (mobile-util/native-platform?)
         (new-block-mode))
 
-      (when (and show-open-folder? (util/electron?))
-        [:a.text-sm.font-medium.button.icon.add-graph-btn.flex.items-center
-         {:on-click #(route-handler/redirect! {:to :repo-add})}
-         (ui/icon "folder-plus")
-         (when-not config/mobile?
-           [:span.ml-1 {:style {:margin-top (if electron-mac? 0 2)}}
-            (t :on-boarding/add-graph)])])
-
       (when config/publishing?
         [:a.text-sm.font-medium.button {:href (rfe/href :graph)}
          (t :graph)])

+ 1 - 7
src/main/frontend/components/onboarding.cljs

@@ -1,13 +1,7 @@
 (ns frontend.components.onboarding
   (:require [frontend.context.i18n :refer [t]]
-            [rum.core :as rum]
             [frontend.ui :as ui]
-            [frontend.state :as state]
-            [frontend.components.onboarding.setups :as setups]))
-
-(rum/defc intro
-  [onboarding-and-home?]
-  (setups/picker onboarding-and-home?))
+            [frontend.state :as state]))
 
 (defn help
   []

+ 2 - 107
src/main/frontend/components/onboarding/setups.cljs

@@ -1,19 +1,6 @@
 (ns frontend.components.onboarding.setups
-  (:require [frontend.state :as state]
-            [rum.core :as rum]
-            [frontend.ui :as ui]
-            [frontend.context.i18n :refer [t]]
-            [frontend.components.widgets :as widgets]
-            [frontend.handler.page :as page-handler]
-            [frontend.util :as util]
-            [frontend.handler.file-based.nfs :as nfs]
-            [frontend.mobile.util :as mobile-util]
-            [frontend.mobile.graph-picker :as graph-picker]
-            [frontend.modules.shortcut.core :as shortcut]
-            [frontend.handler.user :as user-handler]
-            [clojure.string :as string]))
-
-(def DEVICE (if (util/mobile?) (t :on-boarding/section-phone) (t :on-boarding/section-computer)))
+  (:require [frontend.context.i18n :refer [t]]
+            [rum.core :as rum]))
 
 (rum/defc setups-container
   [flag content]
@@ -33,95 +20,3 @@
          (t :on-boarding/importing-main-desc))]
 
       content])])
-
-(rum/defc mobile-intro
-  []
-  [:div.mobile-intro
-   (cond
-     (mobile-util/native-android?)
-     [:div.px-4
-      "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"}
-       "Dropsync"]
-      ". Or you can use "
-      [:a {:href "https://play.google.com/store/apps/details?id=dk.tacit.android.foldersync.lite"
-           :target "_blank"}
-       "FolderSync"]
-      "."]
-
-     :else
-     nil)])
-
-(rum/defcs picker < rum/reactive
-  [_state onboarding-and-home?]
-  (let [parsing?       (state/sub :repo/parsing-files?)
-        _              (state/sub :auth/id-token)
-        native-ios?    (mobile-util/native-ios?)
-        native-icloud? (not (string/blank? (state/sub [:mobile/container-urls :iCloudContainerUrl])))
-        logged?        (user-handler/logged-in?)]
-
-    (setups-container
-      :picker
-      [: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
-          (graph-picker/graph-picker-cp {:onboarding-and-home? onboarding-and-home?
-                                         :logged? logged?
-                                         :native-icloud? native-icloud?})
-
-          (if (or (nfs/supported?) (mobile-util/native-platform?))
-            [:div.choose.flex.flex-col.items-center
-             {:on-click #(page-handler/ls-dir-files!
-                           (fn []
-                             (shortcut/refresh!)))}
-             [:i]
-             [:div.control
-              [:label.action-input.flex.items-center.justify-center.flex-col
-               {:disabled parsing?}
-
-               (if parsing?
-                 (ui/loading "")
-                 [[:strong (t :on-boarding/section-btn-title)]
-                  [:small (t :on-boarding/section-btn-desc)]])]]]
-            [:div.px-5
-             (ui/admonition :warning
-               (widgets/native-fs-api-alert))
-             [:div.choose.flex.flex-col.items-center
-              (ui/button "Open a DB-based Graph"
-                :on-click #(state/pub-event! [:graph/new-db-graph]))]]))]
-       [:section.b.flex.items-center.flex-col
-        [:p.flex
-         [:i.as-flex-center (ui/icon "zoom-question" {:style {:fontSize "22px"}})]
-         [:span.flex-1.flex.flex-col
-          [:strong (t :on-boarding/section-title)]
-          [:small.opacity-60 (t :on-boarding/section-desc)]]]
-
-        [:p.text-sm.pt-5.tracking-wide
-         [:span (str (t :on-boarding/section-tip-1 DEVICE))]
-         [:br]
-         [:span (t :on-boarding/section-tip-2)]]
-
-        [:ul
-         (for [[title label icon]
-               [[(t :on-boarding/section-assets) "/assets" "whiteboard"]
-                [(t :on-boarding/section-journals) "/journals" "calendar-plus"]
-                [(t :on-boarding/section-pages) "/pages" "page"]
-                []
-                [(t :on-boarding/section-app) "/logseq" "tool"]
-                [(t :on-boarding/section-config) "/logseq/config.edn"]]]
-           (if-not title
-             [:li.hr]
-             [:li
-              {:key title}
-              [:i.as-flex-center
-               {:class (when (string/ends-with? label ".edn") "is-file")}
-               (when icon (ui/icon icon))]
-              [:span
-               [:strong.uppercase title]
-               [:small.opacity-50 label]]]))]]])))

+ 95 - 94
src/main/frontend/components/repo.cljs

@@ -1,6 +1,5 @@
 (ns frontend.components.repo
-  (:require [frontend.components.widgets :as widgets]
-            [frontend.config :as config]
+  (:require [frontend.config :as config]
             [frontend.context.i18n :refer [t]]
             [frontend.db :as db]
             [frontend.handler.repo :as repo-handler]
@@ -151,48 +150,51 @@
         repos (state/sub [:me :repos])
         repos (util/distinct-by :url repos)
         remotes (concat
-                  (state/sub :rtc/graphs)
-                  (state/sub [:file-sync/remote-graphs :graphs]))
+                 (state/sub :rtc/graphs)
+                 (state/sub [:file-sync/remote-graphs :graphs]))
         remotes-loading? (state/sub [:file-sync/remote-graphs :loading])
         repos (if (and login? (seq remotes))
                 (repo-handler/combine-local-&-remote-graphs repos remotes) repos)
         repos (remove #(= (:url %) config/demo-repo) repos)
         {remote-graphs true local-graphs false} (group-by (comp boolean :remote?) repos)]
-    (if (seq repos)
-      [:div#graphs
-       [:h1.title (t :graph/all-graphs)]
-
-       [:div.pl-1.content.mt-3
-
-        [:div
-         [:h2.text-lg.font-medium.my-4 (t :graph/local-graphs)]
-         (when (seq local-graphs)
-           (repos-inner local-graphs))
-
-         [:div.flex.flex-row.my-4
+    [:div#graphs
+     [:h1.title (t :graph/all-graphs)]
+
+     [:div.pl-1.content.mt-3
+
+      [:div
+       [:h2.text-lg.font-medium.my-4 (t :graph/local-graphs)]
+       (when (seq local-graphs)
+         (repos-inner local-graphs))
+
+       [:div.flex.flex-row.my-4
+        (if util/web-platform?
+          [:div.mr-8
+           (ui/button
+            "Create a new graph"
+            :on-click #(state/pub-event! [:graph/new-db-graph]))]
           (when (or (nfs-handler/supported?)
-                  (mobile-util/native-platform?))
+                    (mobile-util/native-platform?))
             [:div.mr-8
              (ui/button
-               (t :open-a-directory)
-               :on-click #(state/pub-event! [:graph/setup-a-repo]))])]]
+              (t :open-a-directory)
+              :on-click #(state/pub-event! [:graph/setup-a-repo]))]))]]
 
-        (when (and (file-sync/enable-sync?) login?)
+      (when (and (file-sync/enable-sync?) login?)
+        [:div
+         [:hr]
+         [:div.flex.align-items.justify-between
+          [:h2.text-lg.font-medium.my-4 (t :graph/remote-graphs)]
           [:div
-           [:hr]
-           [:div.flex.align-items.justify-between
-            [:h2.text-lg.font-medium.my-4 (t :graph/remote-graphs)]
-            [:div
-             (ui/button
-               [:span.flex.items-center "Refresh"
-                (when remotes-loading? [:small.pl-2 (ui/loading nil)])]
-               :background "gray"
-               :disabled remotes-loading?
-               :on-click (fn []
-                           (file-sync/load-session-graphs)
-                           (rtc-handler/<get-remote-graphs)))]]
-           (repos-inner remote-graphs)])]]
-      (widgets/add-graph))))
+           (ui/button
+            [:span.flex.items-center "Refresh"
+             (when remotes-loading? [:small.pl-2 (ui/loading nil)])]
+            :background "gray"
+            :disabled remotes-loading?
+            :on-click (fn []
+                        (file-sync/load-session-graphs)
+                        (rtc-handler/<get-remote-graphs)))]]
+         (repos-inner remote-graphs)])]]))
 
 (defn- check-multiple-windows?
   [state]
@@ -247,7 +249,7 @@
    {:on-click #(shui/popup-hide!)}
 
    (when (and (not db-based?)
-           (not (config/demo-graph?)))
+              (not (config/demo-graph?)))
      [:<>
       (shui/button {:size :sm :variant :ghost
                     :title (t :sync-from-local-files-detail)
@@ -267,17 +269,17 @@
                                (if (or (nfs-handler/supported?) (mobile-util/native-platform?))
                                  (state/pub-event! [:graph/setup-a-repo])
                                  (route-handler/redirect-to-all-graphs)))}
-       (shui/tabler-icon "folder-plus")
-       [:span (t :new-graph)]))
+                  (shui/tabler-icon "folder-plus")
+                  [:span (t :new-graph)]))
 
    (shui/button {:size :sm :variant :ghost
                  :on-click #(state/pub-event! [:graph/new-db-graph])}
-                (shui/tabler-icon "database-plus") [:span "Create a new graph"])
+     (shui/tabler-icon "database-plus") [:span (if util/electron? "Create db graph" "Create new graph")])
 
    (shui/button {:size :sm :variant :ghost
                  :on-click (fn [] (route-handler/redirect! {:to :import}))}
-     (shui/tabler-icon "database-import")
-     [:span (t :import-notes)])
+                (shui/tabler-icon "database-import")
+                [:span (t :import-notes)])
 
    (shui/button {:size :sm :variant :ghost
                  :on-click #(route-handler/redirect-to-all-graphs)}
@@ -316,60 +318,59 @@
                                           (file-sync/load-session-graphs)
                                           (rtc-handler/<get-remote-graphs))}
                              (ui/icon "refresh" {:size 15}))))])]
-      (when (seq repos)
-        (let [remote? (and current-repo (:remote? (first (filter #(= current-repo (:url %)) repos))))
-              repo-name (when current-repo (db/get-repo-name current-repo))
-              short-repo-name (if current-repo
-                                (db/get-short-repo-name repo-name)
-                                "Select a Graph")]
-          (shui/trigger-as :a
-            {:tab-index 0
-             :class "item cp__repos-select-trigger"
-             :on-pointer-down
-             (fn [^js e]
-               (check-multiple-windows? state)
-               (some-> (.-target e)
-                 (.closest "a.item")
-                 (shui/popup-show!
-                   (fn [{:keys [id]}]
-                     [:<>
-                      (header-fn)
-                      [:div.cp__repos-list-wrap
-                       (for [{:keys [hr item hover-detail title options icon]} (items-fn)]
-                         (let [on-click' (:on-click options)
-                               href' (:href options)]
-                           (if hr
-                             (shui/dropdown-menu-separator)
-                             (shui/dropdown-menu-item
-                               (assoc options
-                                 :title hover-detail
-                                 :on-click (fn [^js e]
-                                             (when on-click'
-                                               (when-not (false? (on-click' e))
-                                                 (shui/popup-hide! id)))))
-                               (or item
-                                 (if href'
-                                   [:a.flex.items-center.w-full
-                                    {:href href' :on-click #(shui/popup-hide! id)
-                                     :style {:color "inherit"}} title]
-                                   [:span.flex.items-center.gap-1.w-full
-                                    icon [:div title]]))))))]
-                      (repos-footer multiple-windows? db-based?)])
-                   {:as-dropdown? true
-                    :auto-focus? false
-                    :align "start"
-                    :content-props {:class (str "repos-list " (when (<= (count repos) 1) " no-repos"))
-                                    :data-mode (when db-based? "db")}})))
-             :title repo-name}                              ;; show full path on hover
-            [:div.flex.relative.graph-icon.rounded
-             (shui/tabler-icon "database" {:size 15})]
-
-            [:div.repo-switch.pr-2.whitespace-nowrap
-             [:span.repo-name.font-medium
-              [:span.repo-text.overflow-hidden.text-ellipsis
-               (if (config/demo-graph? short-repo-name) "Demo" short-repo-name)]
-              (when remote? [:span.pl-1 (ui/icon "cloud")])]
-             [:span.dropdown-caret]]))))))
+      (let [remote? (and current-repo (:remote? (first (filter #(= current-repo (:url %)) repos))))
+            repo-name (when current-repo (db/get-repo-name current-repo))
+            short-repo-name (if current-repo
+                              (db/get-short-repo-name repo-name)
+                              "Select a Graph")]
+        (shui/trigger-as :a
+                         {:tab-index 0
+                          :class "item cp__repos-select-trigger"
+                          :on-pointer-down
+                          (fn [^js e]
+                            (check-multiple-windows? state)
+                            (some-> (.-target e)
+                                    (.closest "a.item")
+                                    (shui/popup-show!
+                                     (fn [{:keys [id]}]
+                                       [:<>
+                                        (header-fn)
+                                        [:div.cp__repos-list-wrap
+                                         (for [{:keys [hr item hover-detail title options icon]} (items-fn)]
+                                           (let [on-click' (:on-click options)
+                                                 href' (:href options)]
+                                             (if hr
+                                               (shui/dropdown-menu-separator)
+                                               (shui/dropdown-menu-item
+                                                (assoc options
+                                                       :title hover-detail
+                                                       :on-click (fn [^js e]
+                                                                   (when on-click'
+                                                                     (when-not (false? (on-click' e))
+                                                                       (shui/popup-hide! id)))))
+                                                (or item
+                                                    (if href'
+                                                      [:a.flex.items-center.w-full
+                                                       {:href href' :on-click #(shui/popup-hide! id)
+                                                        :style {:color "inherit"}} title]
+                                                      [:span.flex.items-center.gap-1.w-full
+                                                       icon [:div title]]))))))]
+                                        (repos-footer multiple-windows? db-based?)])
+                                     {:as-dropdown? true
+                                      :auto-focus? false
+                                      :align "start"
+                                      :content-props {:class (str "repos-list " (when (<= (count repos) 1) " no-repos"))
+                                                      :data-mode (when db-based? "db")}})))
+                          :title repo-name}                              ;; show full path on hover
+                         [:div.flex.relative.graph-icon.rounded
+                          (shui/tabler-icon "database" {:size 15})]
+
+                         [:div.repo-switch.pr-2.whitespace-nowrap
+                          [:span.repo-name.font-medium
+                           [:span.repo-text.overflow-hidden.text-ellipsis
+                            (if (config/demo-graph? short-repo-name) "Demo" short-repo-name)]
+                           (when remote? [:span.pl-1 (ui/icon "cloud")])]
+                          [:span.dropdown-caret]])))))
 
 (defn invalid-graph-name-warning
   []

+ 1 - 1
src/main/frontend/components/select.cljs

@@ -205,7 +205,7 @@
                           [:div.mb-2 (t :select.graph/empty-placeholder-description)]
                           (ui/button
                            (t :select.graph/add-graph)
-                           :href (rfe/href :repo-add)
+                            :href (rfe/href :graphs)
                            :on-click state/close-modal!)])}
    :graph-remove
    {:items-fn (fn []

+ 1 - 1
src/main/frontend/components/settings.cljs

@@ -446,7 +446,7 @@
                           [:div (t :settings-page/custom-date-format-notification)]
                           :warning false)
                         (state/close-modal!)
-                        (route-handler/redirect! {:to :repos}))))}
+                        (route-handler/redirect! {:to :graphs}))))}
       (for [format (sort (date/journal-title-formatters))]
         [:option {:key format} format])]]]])
 

+ 1 - 4
src/main/frontend/components/theme.cljs

@@ -112,14 +112,11 @@
        (when-not db-restoring?
          (let [repos (state/get-repos)]
            (if-not (or
-                    ;; demo graph only
-                    (and (= 1 (count repos)) (:example? (first repos))
-                         (not (util/mobile?)))
                     ;; not in publishing mode
                     config/publishing?
                     ;; other graphs exists
                     (seq repos))
-             (route-handler/redirect! {:to :repo-add})
+             (route-handler/redirect! {:to :graphs})
              (do
                (ui-handler/restore-right-sidebar-state!)
                (set-restored-sidebar? true))))))

+ 0 - 101
src/main/frontend/components/widgets.cljs

@@ -1,101 +0,0 @@
-(ns frontend.components.widgets
-  (:require [frontend.context.i18n :refer [t]]
-            [frontend.handler.page :as page-handler]
-            [frontend.handler.file-based.nfs :as nfs]
-            [frontend.modules.shortcut.core :as shortcut]
-            [frontend.ui :as ui]
-            [rum.core :as rum]
-            [frontend.config :as config]
-            [frontend.mobile.util :as mobile-util]
-            [frontend.state :as state]))
-
-
-(rum/defc native-fs-api-alert
-  []
-  [:p "It seems that your browser doesn't support the "
-   [:a {:href   "https://web.dev/file-system-access/"
-        :target "_blank"}
-    "new native filesystem API"]
-   [:span ", please use any Chromium 86+ based browser like Chrome, Vivaldi, Edge, etc. Notice that the API doesn't support mobile browsers at the moment."]])
-
-(rum/defc add-local-directory
-  []
-  [:div.flex.flex-col
-   [:h1.title (t :on-boarding/add-graph)]
-   (let [nfs-supported? (or (nfs/supported?) (mobile-util/native-platform?))]
-     (if (mobile-util/native-platform?)
-       [:div.text-sm
-        (ui/button "Open a local directory"
-                   :on-click #(state/pub-event! [:graph/setup-a-repo]))
-        [:hr]
-        [: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")]]
-       ;; non-mobile
-       [:div.cp__widgets-open-local-directory
-        [:div.select-file-wrap.cursor
-         (when nfs-supported?
-           {:on-click #(page-handler/ls-dir-files! shortcut/refresh!)})
-         [:div
-          [:h1.title (t :on-boarding/open-local-dir)]
-          [:p (t :on-boarding/new-graph-desc-1)]
-          [:p (t :on-boarding/new-graph-desc-2)]
-          [:ul
-           [:li (t :on-boarding/new-graph-desc-3)]
-           [:li (t :on-boarding/new-graph-desc-4)]
-           [:li (t :on-boarding/new-graph-desc-5)]]
-          (when-not nfs-supported?
-            (ui/admonition :warning (native-fs-api-alert)))]]]))])
-
-(rum/defc android-permission-alert
-  []
-  (when (mobile-util/native-android?)
-    [:div.flex.flex-col
-     [:h1.title "Storage access permission"]
-     [:div.text-sm
-      [:div
-       [:p "Logseq needs the permission to access your device storage. Read "
-        [:a {:href "https://developer.android.com/about/versions/11/privacy/storage#all-files-access"
-             :target "_blank"}
-         "more"]
-        "."]
-       [:div
-        (ui/button "Grant Permission"
-          :on-click #(page-handler/ls-dir-files! shortcut/refresh!))]
-       [:p.mb-1 "Note:"]
-       [:ol
-        [:li "We will never access files outside of your graph folders you choose."]
-        [:li "If you have granted the permission, you don't need to do it again."]]]
-      [:hr]]]))
-
-(rum/defcs add-graph <
-  [state & {:keys [graph-types]
-            :or {graph-types [:local]}}]
-  (let [generate-f (fn [x]
-                     (case x
-                       :local
-                       [(rum/with-key (android-permission-alert)
-                          "android-permission-alert")
-                        (rum/with-key (add-local-directory)
-                          "add-local-directory")]
-
-                       nil))
-        available-graph (->> (set graph-types)
-                             (keep generate-f)
-                             (vec)
-                             (interpose [:b.mt-10.mb-5.opacity-50 "OR"]))]
-    [:div.p-8.flex.flex-col
-     available-graph
-     (ui/button "Open a DB-based Graph"
-                :on-click #(state/pub-event! [:graph/new-db-graph]))]))
-
-(rum/defc demo-graph-alert
-  []
-  (when (and (config/demo-graph?)
-             (not config/publishing?))
-    (ui/admonition
-     :warning
-     [:p (t :on-boarding/demo-graph)])))

+ 0 - 10
src/main/frontend/components/widgets.css

@@ -1,10 +0,0 @@
-.cp__widgets {
-    &-open-local-directory {
-        .select-file-wrap {
-            padding: 50px;
-            border: dashed 2px;
-            border-radius: var(--border-radius-m);
-            justify-content: center;
-        }
-    }
-}

+ 29 - 33
src/main/frontend/config.cljs

@@ -337,7 +337,7 @@
   []
   (or (state/get-whiteboards-directory) default-whiteboards-directory))
 
-(defonce demo-repo "Logseq demo")
+(defonce demo-repo "Demo")
 
 (defn demo-graph?
   "Demo graph or nil graph?"
@@ -401,48 +401,44 @@
 
 (defn get-repo-dir
   [repo-url]
-  (let [db-based? (db-based-graph? repo-url)]
-    (cond
-      (nil? repo-url)
-      (do
-        (js/console.error "BUG: nil repo")
-        nil)
+  (when repo-url
+    (let [db-based? (db-based-graph? repo-url)]
+      (cond
+        (and (util/electron?) db-based-graph?)
+        (get-local-dir repo-url)
 
-      (and (util/electron?) db-based-graph?)
-      (get-local-dir repo-url)
+        db-based?
+        (str "memory:///"
+             (string/replace-first repo-url db-version-prefix ""))
 
-      db-based?
-      (str "memory:///"
-           (string/replace-first repo-url db-version-prefix ""))
+        (and (util/electron?) (local-file-based-graph? repo-url))
+        (get-local-dir repo-url)
 
-      (and (util/electron?) (local-file-based-graph? repo-url))
-      (get-local-dir repo-url)
-
-      (and (mobile-util/native-platform?) (local-file-based-graph? repo-url))
-      (let [dir (get-local-dir repo-url)]
-        (if (string/starts-with? dir "file://")
-          dir
-          (path/path-join "file://" dir)))
+        (and (mobile-util/native-platform?) (local-file-based-graph? repo-url))
+        (let [dir (get-local-dir repo-url)]
+          (if (string/starts-with? dir "file://")
+            dir
+            (path/path-join "file://" dir)))
 
     ;; Special handling for demo graph
-      (= repo-url demo-repo)
-      "memory:///local"
+        (= repo-url demo-repo)
+        "memory:///local"
 
     ;; nfs, browser-fs-access
     ;; Format: logseq_local_{dir-name}
-      (local-file-based-graph? repo-url)
-      (string/replace-first repo-url local-db-prefix "")
+        (local-file-based-graph? repo-url)
+        (string/replace-first repo-url local-db-prefix "")
 
      ;; unit test
-      (= repo-url "test-db")
-      "/test-db"
-
-      :else
-      (do
-        (js/console.error "Unknown Repo URL type:" repo-url)
-        (str "/"
-             (->> (take-last 2 (string/split repo-url #"/"))
-                  (string/join "_")))))))
+        (= repo-url "test-db")
+        "/test-db"
+
+        :else
+        (do
+          (js/console.error "Unknown Repo URL type:" repo-url)
+          (str "/"
+               (->> (take-last 2 (string/split repo-url #"/"))
+                    (string/join "_"))))))))
 
 (defn get-string-repo-dir
   [repo-dir]

+ 1 - 1
src/main/frontend/db/model.cljs

@@ -39,7 +39,7 @@
 
 (defn get-all-pages
   [repo]
-  (let [db (conn/get-db repo)]
+  (when-let [db (conn/get-db repo)]
     (ldb/get-all-pages db)))
 
 (defn get-all-page-titles

+ 0 - 2
src/main/frontend/fs/watcher_handler.cljs

@@ -69,8 +69,6 @@
           ;; on the client to correctly identify it
             repo (cond
                    global-dir repo
-                 ;; FIXME(andelf): hack for demo graph, demo graph does not bind to local directory
-                   (string/starts-with? dir "memory://") "Logseq demo"
                    :else (config/get-local-repo dir))
             repo-dir (config/get-local-dir repo)
             {:keys [mtime ctime]} stat

+ 5 - 16
src/main/frontend/handler.cljs

@@ -24,7 +24,6 @@
             [frontend.handler.page :as page-handler]
             [frontend.handler.plugin-config :as plugin-config-handler]
             [frontend.handler.repo :as repo-handler]
-            [frontend.handler.file-based.repo :as file-repo-handler]
             [frontend.handler.repo-config :as repo-config-handler]
             [frontend.handler.ui :as ui-handler]
             [frontend.handler.user :as user-handler]
@@ -42,7 +41,6 @@
             [cljs-bean.core :as bean]
             [frontend.handler.test :as test]
             [frontend.persist-db.browser :as db-browser]
-            [frontend.db.async :as db-async]
             [frontend.persist-db :as persist-db]))
 
 (defn- set-global-error-notification!
@@ -69,7 +67,7 @@
     (js/setInterval f 5000)))
 
 (defn restore-and-setup!
-  [repo repos]
+  [repo]
   (when repo
     (-> (p/let [_ (db-restore/restore-graph! repo)]
           (repo-config-handler/start {:repo repo}))
@@ -89,18 +87,7 @@
                 ;; install after config is restored
                 (shortcut/refresh!)
 
-                (p/let [files (db-async/<get-files config/demo-repo)]
-                  (cond
-                    (and (not (seq files))
-                         ;; Not native local directory
-                         (not (some config/local-file-based-graph? (map :url repos)))
-                         (not (mobile-util/native-platform?))
-                         (not (config/db-based-graph? repo)))
-                    ;; will execute `(state/set-db-restoring! false)` inside
-                    (file-repo-handler/setup-demo-repo-if-not-exists!)
-
-                    :else
-                    (state/set-db-restoring! false))))))))
+                (state/set-db-restoring! false))))))
         (p/then
          (fn []
            (js/console.log "db restored, setting up repo hooks")
@@ -199,7 +186,9 @@
                _ (state/set-repos! repos)
                _ (mobile-util/hide-splash) ;; hide splash as early as ui is stable
                repo (or (state/get-current-repo) (:url (first repos)))
-               _ (restore-and-setup! repo repos)]
+               _ (if (empty? repos)
+                   (repo-handler/new-db! config/demo-repo)
+                   (restore-and-setup! repo))]
          (when (util/electron?)
            (persist-db/run-export-periodically!))
          (when (mobile-util/native-platform?)

+ 1 - 4
src/main/frontend/handler/events.cljs

@@ -147,10 +147,7 @@
 (defmethod handle :graph/added [[_ repo {:keys [empty-graph?]}]]
   (search-handler/rebuild-indices!)
   (plugin-handler/hook-plugin-app :graph-after-indexed {:repo repo :empty-graph? empty-graph?})
-  (when (state/setups-picker?)
-    (if empty-graph?
-      (route-handler/redirect! {:to :import :query-params {:from "picker"}})
-      (route-handler/redirect-to-home!)))
+  (route-handler/redirect-to-home!)
   (when-let [dir-name (and (not (config/db-based-graph? repo)) (config/get-repo-dir repo))]
     (fs/watch-dir! dir-name))
   (file-sync-restart!))

+ 1 - 1
src/main/frontend/handler/file_based/nfs.cljs

@@ -107,7 +107,7 @@
               _ (when (fn? picked-root-fn) (picked-root-fn root-dir))
               repo (str config/local-db-prefix root-dir)]
         (state/set-loading-files! repo true)
-        (when-not (or (state/home?) (state/setups-picker?))
+        (when-not (state/home?)
           (route-handler/redirect-to-home! false))
         (reset! *repo repo)
         (when-not (string/blank? root-dir)

+ 42 - 80
src/main/frontend/handler/file_based/repo.cljs

@@ -1,12 +1,8 @@
 (ns frontend.handler.file-based.repo
   "Repo fns for creating, loading and parsing file graphs"
-  (:require [clojure.string :as string]
-            [frontend.config :as config]
-            [frontend.context.i18n :refer [t]]
-            [frontend.date :as date]
+  (:require [frontend.config :as config]
             [frontend.db :as db]
             [frontend.fs :as fs]
-            [frontend.fs.nfs :as nfs]
             [frontend.handler.file :as file-handler]
             [frontend.handler.repo-config :as repo-config-handler]
             [frontend.handler.common.file :as file-common-handler]
@@ -22,7 +18,6 @@
             [clojure.core.async :as async]
             [medley.core :as medley]
             [logseq.common.path :as path]
-            [logseq.db :as ldb]
             [clojure.core.async.interop :refer [p->c]]))
 
 (defn- create-contents-file
@@ -56,48 +51,50 @@
       (when-not file-exists?
         (file-common-handler/reset-file! repo-url path default-content)))))
 
-(defn- create-dummy-notes-page
-  [repo-url content]
-  (spec/validate :repos/url repo-url)
-  (let [repo-dir (config/get-repo-dir repo-url)
-        file-rpath (str (config/get-pages-directory) "/how_to_make_dummy_notes.md")]
-    (p/let [_ (fs/mkdir-if-not-exists (path/path-join repo-dir (config/get-pages-directory)))
-            _file-exists? (fs/create-if-not-exists repo-url repo-dir file-rpath content)]
-      (file-common-handler/reset-file! repo-url file-rpath content))))
+(comment
+  (defn- create-dummy-notes-page
+   [repo-url content]
+   (spec/validate :repos/url repo-url)
+   (let [repo-dir (config/get-repo-dir repo-url)
+         file-rpath (str (config/get-pages-directory) "/how_to_make_dummy_notes.md")]
+     (p/let [_ (fs/mkdir-if-not-exists (path/path-join repo-dir (config/get-pages-directory)))
+             _file-exists? (fs/create-if-not-exists repo-url repo-dir file-rpath content)]
+       (file-common-handler/reset-file! repo-url file-rpath content)))))
 
-(defn- create-today-journal-if-not-exists
-  [repo-url {:keys [content]}]
-  (spec/validate :repos/url repo-url)
-  (when (state/enable-journals? repo-url)
-    (let [repo-dir (config/get-repo-dir repo-url)
-          format (state/get-preferred-format repo-url)
-          title (date/today)
-          file-name (date/journal-title->default title)
-          default-content (util/default-content-with-title format)
-          template (state/get-default-journal-template)
-          template (when (and template
-                              (not (string/blank? template)))
-                     template)
-          content (cond
-                    content
-                    content
+(comment
+  (defn- create-today-journal-if-not-exists
+   [repo-url {:keys [content]}]
+   (spec/validate :repos/url repo-url)
+   (when (state/enable-journals? repo-url)
+     (let [repo-dir (config/get-repo-dir repo-url)
+           format (state/get-preferred-format repo-url)
+           title (date/today)
+           file-name (date/journal-title->default title)
+           default-content (util/default-content-with-title format)
+           template (state/get-default-journal-template)
+           template (when (and template
+                               (not (string/blank? template)))
+                      template)
+           content (cond
+                     content
+                     content
 
-                    template
-                    (str default-content template)
+                     template
+                     (str default-content template)
 
-                    :else
-                    default-content)
-          file-rpath (path/path-join (config/get-journals-directory) (str file-name "."
-                                                                          (config/get-file-extension format)))
-          page-exists? (ldb/get-page (db/get-db) title)
-          empty-blocks? (db/page-empty? repo-url (util/page-name-sanity-lc title))]
-      (when (or empty-blocks? (not page-exists?))
-        (p/let [_ (nfs/check-directory-permission! repo-url)
-                _ (fs/mkdir-if-not-exists (path/path-join repo-dir (config/get-journals-directory)))
-                file-exists? (fs/file-exists? repo-dir file-rpath)]
-          (when-not file-exists?
-            (p/let [_ (file-common-handler/reset-file! repo-url file-rpath content)]
-              (fs/create-if-not-exists repo-url repo-dir file-rpath content))))))))
+                     :else
+                     default-content)
+           file-rpath (path/path-join (config/get-journals-directory) (str file-name "."
+                                                                           (config/get-file-extension format)))
+           page-exists? (ldb/get-page (db/get-db) title)
+           empty-blocks? (db/page-empty? repo-url (util/page-name-sanity-lc title))]
+       (when (or empty-blocks? (not page-exists?))
+         (p/let [_ (nfs/check-directory-permission! repo-url)
+                 _ (fs/mkdir-if-not-exists (path/path-join repo-dir (config/get-journals-directory)))
+                 file-exists? (fs/file-exists? repo-dir file-rpath)]
+           (when-not file-exists?
+             (p/let [_ (file-common-handler/reset-file! repo-url file-rpath content)]
+               (fs/create-if-not-exists repo-url repo-dir file-rpath content)))))))))
 
 
 (defn create-config-file-if-not-exists
@@ -337,38 +334,3 @@
                                                 :refresh? refresh?
                                                 :re-render-opts {:clear-all-query-state? true}))
             (load-contents add-or-modify-files options)))))))
-
-(defn- setup-demo-repo-if-not-exists-impl!
-  []
-  ;; loop query if js/window.pfs is ready, interval 100ms
-  (if js/window.pfs
-    (let [repo config/demo-repo
-          repo-dir (config/get-repo-dir repo)]
-      (p/do! (fs/mkdir-if-not-exists repo-dir) ;; create memory://local
-             (state/set-current-repo! repo)
-             (db/start-db-conn! repo {})
-             (when-not config/publishing?
-               (let [dummy-notes (t :tutorial/dummy-notes)]
-                 (create-dummy-notes-page repo dummy-notes)))
-             (when-not config/publishing?
-               (let [tutorial (t :tutorial/text)
-                     tutorial (string/replace-first tutorial "$today" (date/today))]
-                 (create-today-journal-if-not-exists repo {:content tutorial})))
-             (create-config-file-if-not-exists repo)
-             (create-contents-file repo)
-             (create-custom-theme repo)
-             (state/set-db-restoring! false)
-             (ui-handler/re-render-root!)))
-    (p/then (p/delay 100) ;; TODO Junyi remove the string
-            setup-demo-repo-if-not-exists-impl!)))
-
-(defn setup-demo-repo-if-not-exists!
-  "Setup demo repo, i.e. `demo-repo`"
-  []
-  ;; ensure `(state/set-db-restoring! false)` at exit
-  (-> (setup-demo-repo-if-not-exists-impl!)
-      (p/timeout 3000)
-      (p/catch (fn []
-                 (prn "setup-demo-repo failed! timeout 3000ms")))
-      (p/finally (fn []
-                   (state/set-db-restoring! false)))))

+ 12 - 16
src/main/frontend/handler/repo.cljs

@@ -45,13 +45,15 @@
        (state/delete-repo! repo)
        (when switch-graph?
          (if (= current-repo url)
-           (when-let [graph (:url (first (state/get-repos)))]
-             (notification/show! (str "Removed graph "
-                                      (pr-str (text-util/get-graph-name-from-path url))
-                                      ". Redirecting to graph "
-                                      (pr-str (text-util/get-graph-name-from-path graph)))
-                                 :success)
-             (state/pub-event! [:graph/switch graph {:persist? false}]))
+           (do
+             (state/set-current-repo! nil)
+             (when-let [graph (:url (first (state/get-repos)))]
+              (notification/show! (str "Removed graph "
+                                       (pr-str (text-util/get-graph-name-from-path url))
+                                       ". Redirecting to graph "
+                                       (pr-str (text-util/get-graph-name-from-path graph)))
+                                  :success)
+              (state/pub-event! [:graph/switch graph {:persist? false}])))
            (notification/show! (str "Removed graph " (pr-str (text-util/get-graph-name-from-path url))) :success)))))))
 
 (defn start-repo-db-if-not-exists!
@@ -120,15 +122,8 @@
                              (util-fs/inflate-graphs-info nfs-dbs)
 
                              :else
-                             nfs-dbs))
-          nfs-dbs (seq (bean/->clj nfs-dbs))]
-    (cond
-      (seq nfs-dbs)
-      nfs-dbs
-
-      :else
-      [{:url config/demo-repo
-        :example? true}])))
+                             nfs-dbs))]
+    (seq (bean/->clj nfs-dbs))))
 
 (defn combine-local-&-remote-graphs
   [local-repos remote-repos]
@@ -198,6 +193,7 @@
           ;; TODO: handle global graph
            _ (state/pub-event! [:init/commands])
            _ (when-not file-graph-import? (state/pub-event! [:page/create (date/today) {:redirect? false}]))]
+     (state/pub-event! [:shortcut/refresh])
      (route-handler/redirect-to-home!)
      (ui-handler/re-render-root!)
      (graph-handler/settle-metadata-to-local! {:created-at (js/Date.now)})

+ 3 - 5
src/main/frontend/handler/route.cljs

@@ -43,7 +43,7 @@
 
 (defn redirect-to-all-graphs
   []
-  (redirect! {:to :repos}))
+  (redirect! {:to :graphs}))
 
 (defn redirect-to-whiteboard-dashboard!
   []
@@ -111,10 +111,8 @@
     "Logseq"
     :whiteboards
     (t :whiteboards)
-    :repos
-    "Repos"
-    :repo-add
-    "Add another repo"
+    :graphs
+    "Graphs"
     :graph
     (t :graph)
     :all-files

+ 1 - 1
src/main/frontend/modules/shortcut/config.cljs

@@ -430,7 +430,7 @@
                                                          (state/set-state! :ui/open-select :graph-remove))
                                              :binding []}
 
-   :graph/add                               {:fn      (fn [] (route-handler/redirect! {:to :repo-add}))
+   :graph/add                               {:fn      (fn [] (route-handler/redirect! {:to :graphs}))
                                              :binding []}
 
    :graph/db-add                            {:fn #(state/pub-event! [:graph/new-db-graph])

+ 1 - 1
src/main/frontend/page.cljs

@@ -98,7 +98,7 @@
               [:p "You can also go to "
                [:a {:title "All graphs"
                     :on-click (fn []
-                                (set! (.-href js/window.location) (rfe/href :repos))
+                                (set! (.-href js/window.location) (rfe/href :graphs))
                                 (.reload js/window.location))}
                 "All graphs"]
                " to switch to another graph."])

+ 1 - 6
src/main/frontend/routes.cljs

@@ -3,7 +3,6 @@
   (:require [frontend.components.file :as file]
             [frontend.components.home :as home]
             [frontend.components.journal :as journal]
-            [frontend.components.onboarding.setups :as setups]
             [frontend.components.page :as page]
             [frontend.components.all-pages :as all-pages]
             ;; [frontend.components.all-pages2 :as all-pages]
@@ -27,17 +26,13 @@
      :view home/home}]
 
    ["/graphs"
-    {:name :repos
+    {:name :graphs
      :view repo/repos}]
 
    ["/whiteboards"
     {:name :whiteboards
      :view whiteboard/whiteboard-dashboard}]
 
-   ["/repo/add"
-    {:name :repo-add
-     :view setups/picker}]
-
    ["/page/:name"
     {:name :page
      :view (fn [route-match]

+ 1 - 6
src/main/frontend/state.cljs

@@ -890,10 +890,6 @@ Similar to re-frame subscriptions"
   []
   (= :whiteboards (get-current-route)))
 
-(defn setups-picker?
-  []
-  (= :repo-add (get-current-route)))
-
 (defn get-current-page
   []
   (when (= :page (get-current-route))
@@ -907,8 +903,7 @@ Similar to re-frame subscriptions"
 (defn get-current-repo
   "Returns the current repo URL, or else open demo graph"
   []
-  (or (:git/current-repo @state)
-      "Logseq demo"))
+  (:git/current-repo @state))
 
 (defn get-remote-file-graphs
   []

+ 0 - 8
src/main/frontend/util.cljc

@@ -984,14 +984,6 @@
 (defonce linux? #?(:cljs goog.userAgent/LINUX
                    :clj nil))
 
-(defn default-content-with-title
-  [text-format]
-  (case (name text-format)
-    "org"
-    "* "
-
-    "- "))
-
 #?(:cljs
    (defn get-first-block-by-id
      [block-id]

+ 3 - 2
src/main/frontend/worker/db_worker.cljs

@@ -207,8 +207,9 @@
             initial-data-exists? (d/entity @conn :logseq.class/Root)]
         (swap! *datascript-conns assoc repo conn)
         (swap! *client-ops-conns assoc repo client-ops-conn)
-        (when (and config (not initial-data-exists?))
-          (let [initial-data (sqlite-create-graph/build-db-initial-data config)]
+        (when-not initial-data-exists?
+          (let [config (or config {})
+                initial-data (sqlite-create-graph/build-db-initial-data config)]
             (d/transact! conn initial-data {:initial-db? true})))
 
         (when-not (ldb/page-exists? @conn common-config/views-page-name "hidden")