fix: cards using async db query

This commit is contained in:
Tienson Qin
2024-09-23 22:56:52 +08:00
committed by rcmerci
parent 5547506fad
commit db92683d70
3 changed files with 127 additions and 108 deletions

View File

@@ -335,60 +335,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 (state/enable-flashcards? (state/get-current-repo))
[: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}