slight refactor for clarity

This commit is contained in:
Mike Travers
2022-08-28 22:29:38 -07:00
committed by Tienson Qin
parent 46e3b3fc08
commit 6a48bbe08b
2 changed files with 18 additions and 16 deletions

View File

@@ -245,7 +245,10 @@
: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!
:on-click-handler (fn [e]
(if (gobj/get e "shiftKey")
(route-handler/sidebar-journals!)
(route-handler/go-to-journals!)))
:icon "calendar"})))
(when (state/enable-flashcards? (state/get-current-repo))

View File

@@ -9,7 +9,6 @@
[frontend.state :as state]
[logseq.graph-parser.text :as text]
[frontend.util :as util]
[goog.object :as gobj]
[reitit.frontend.easy :as rfe]))
(defn redirect!
@@ -137,21 +136,21 @@
(state/set-search-mode! search-mode))
(state/pub-event! [:go/search]))
(defn sidebar-journals!
[]
(state/sidebar-add-block!
(state/get-current-repo)
(:db/id (db/get-page (date/today)))
:page))
(defn go-to-journals!
[e]
(if (gobj/get e "shiftKey") ;TODO pretty sure this test should be sidebar.cljs
(do
(state/sidebar-add-block!
(state/get-current-repo)
(:db/id (db/get-page (date/today)))
:page))
(do
(state/set-journals-length! 3)
(let [route (if (state/custom-home-page?)
:all-journals
:home)]
(redirect! {:to route}))
(util/scroll-to-top))))
[]
(state/set-journals-length! 3)
(let [route (if (state/custom-home-page?)
:all-journals
:home)]
(redirect! {:to route}))
(util/scroll-to-top))
(defn- redirect-to-file!
[page]