mirror of
https://github.com/logseq/logseq.git
synced 2026-04-26 23:25:05 +00:00
wip: Demo switch to use db graph
This commit is contained in:
@@ -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})))
|
||||
(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 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?)])
|
||||
(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 "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"})]]
|
||||
(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
|
||||
|
||||
Reference in New Issue
Block a user