|
|
@@ -62,7 +62,7 @@
|
|
|
[e]
|
|
|
(when-let [target (.. e -target)]
|
|
|
(let [rect (.. target getBoundingClientRect)]
|
|
|
- (- (.. e -pageY) (.. rect -top)))))
|
|
|
+ (- (.. e -pageY) (.. rect -top)))))
|
|
|
|
|
|
(defn- move-up?
|
|
|
[e]
|
|
|
@@ -235,60 +235,61 @@
|
|
|
[:div.nav-header.flex.gap-1.flex-col
|
|
|
(if-let [page (:page default-home)]
|
|
|
(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"})
|
|
|
+ {: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"})
|
|
|
(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 route-handler/go-to-journals!
|
|
|
- :icon "calendar"}))
|
|
|
+ {: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 route-handler/go-to-journals!
|
|
|
+ :icon "calendar"}))
|
|
|
|
|
|
(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"})
|
|
|
+ {: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"})
|
|
|
|
|
|
(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 "whiteboard"
|
|
|
- :title "Whiteboards"
|
|
|
- :href (rfe/href :whiteboards)
|
|
|
- :icon "artboard"})]]
|
|
|
+ {: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"})
|
|
|
+
|
|
|
+ (when (state/enable-whiteboards?)
|
|
|
+ (sidebar-item
|
|
|
+ {:class "whiteboard"
|
|
|
+ :title "Whiteboards"
|
|
|
+ :href (rfe/href :whiteboards)
|
|
|
+ :icon "artboard"}))]]
|
|
|
|
|
|
(favorites t)
|
|
|
|
|
|
(when (and left-sidebar-open? (not config/publishing?)) (recent-pages t))
|
|
|
|
|
|
(when-not (mobile-util/native-platform?)
|
|
|
- [:nav.px-2 {:aria-label "Sidebar"
|
|
|
- :class "new-page"}
|
|
|
- (when-not config/publishing?
|
|
|
- [:a.item.group.flex.items-center.px-2.py-2.text-sm.font-medium.rounded-md.new-page-link
|
|
|
- {:on-click (fn []
|
|
|
- (and (util/sm-breakpoint?)
|
|
|
- (state/toggle-left-sidebar!))
|
|
|
- (state/pub-event! [:go/search]))}
|
|
|
- (ui/icon "circle-plus mr-3" {:style {:font-size 20}})
|
|
|
- [:span.flex-1 (t :right-side-bar/new-page)]])])]]))
|
|
|
+ [:nav.px-2 {:aria-label "Sidebar"
|
|
|
+ :class "new-page"}
|
|
|
+ (when-not config/publishing?
|
|
|
+ [:a.item.group.flex.items-center.px-2.py-2.text-sm.font-medium.rounded-md.new-page-link
|
|
|
+ {:on-click (fn []
|
|
|
+ (and (util/sm-breakpoint?)
|
|
|
+ (state/toggle-left-sidebar!))
|
|
|
+ (state/pub-event! [:go/search]))}
|
|
|
+ (ui/icon "circle-plus mr-3" {:style {:font-size 20}})
|
|
|
+ [:span.flex-1 (t :right-side-bar/new-page)]])])]]))
|
|
|
|
|
|
(rum/defc left-sidebar < rum/reactive
|
|
|
[{:keys [left-sidebar-open? route-match]}]
|
|
|
@@ -350,7 +351,7 @@
|
|
|
[:div.cp__sidebar-main-content
|
|
|
{:data-is-margin-less-pages margin-less-pages?
|
|
|
:data-is-full-width (or margin-less-pages?
|
|
|
- (contains? #{:all-files :all-pages :my-publishing} route-name))}
|
|
|
+ (contains? #{:all-files :all-pages :my-publishing} route-name))}
|
|
|
|
|
|
(when show-recording-bar?
|
|
|
(recording-bar))
|
|
|
@@ -432,7 +433,7 @@
|
|
|
(state/sidebar-add-block! current-repo db-id block-type)))
|
|
|
(reset! sidebar-inited? true))))
|
|
|
(when (state/mobile?)
|
|
|
- (state/set-state! :mobile/show-tabbar? true))
|
|
|
+ (state/set-state! :mobile/show-tabbar? true))
|
|
|
state)}
|
|
|
[]
|
|
|
(let [default-home (get-default-home-if-valid)
|
|
|
@@ -630,6 +631,6 @@
|
|
|
:db-restoring? db-restoring?})
|
|
|
[:a#download.hidden]
|
|
|
(when
|
|
|
- (and (not config/mobile?)
|
|
|
- (not config/publishing?))
|
|
|
- (help-button))])))
|
|
|
+ (and (not config/mobile?)
|
|
|
+ (not config/publishing?))
|
|
|
+ (help-button))])))
|