mirror of https://github.com/logseq/logseq
hide journals in page graph
add "Show Journals" toggle in page-graph-inner add :right-side-bar/show-journals in en and it (dicts.cljc) add "include-journals" parameter to db/get-pages-that-mentioned-page add "show-journal" parameter to graph-handler/build-page-graphpull/6120/head
parent
37f1d738b9
commit
83d51ab23f
|
@ -434,6 +434,7 @@
|
|||
(defonce *orphan-pages? (atom true))
|
||||
(defonce *builtin-pages? (atom nil))
|
||||
(defonce *excluded-pages? (atom true))
|
||||
(defonce *show-journals-in-page-graph? (atom nil))
|
||||
|
||||
(rum/defc ^:large-vars/cleanup-todo graph-filters < rum/reactive
|
||||
[graph settings n-hops]
|
||||
|
@ -630,9 +631,22 @@
|
|||
graph (update graph :nodes #(filter-graph-nodes % search-graph-filters))]
|
||||
(global-graph-inner graph settings theme)))
|
||||
|
||||
(rum/defc page-graph-inner < rum/static
|
||||
(rum/defc page-graph-inner < rum/reactive
|
||||
[_page graph dark?]
|
||||
(let [ show-journals-in-page-graph? (rum/react *show-journals-in-page-graph?) ]
|
||||
[:div.sidebar-item.flex-col
|
||||
[:div.flex.items-center.justify-between.mb-0
|
||||
[:span (t :right-side-bar/show-journals)]
|
||||
[:div.mt-1
|
||||
(ui/toggle show-journals-in-page-graph? ;my-val;
|
||||
(fn []
|
||||
(let [value (not show-journals-in-page-graph?)]
|
||||
(reset! *show-journals-in-page-graph? value)
|
||||
;(set-setting! :show-journals-in-page-graph? value)
|
||||
))
|
||||
true)]
|
||||
]
|
||||
|
||||
(graph/graph-2d {:nodes (:nodes graph)
|
||||
:links (:links graph)
|
||||
:width 600
|
||||
|
@ -640,7 +654,7 @@
|
|||
:dark? dark?
|
||||
:register-handlers-fn
|
||||
(fn [graph]
|
||||
(graph-register-handlers graph (atom nil) (atom nil) dark?))})])
|
||||
(graph-register-handlers graph (atom nil) (atom nil) dark?))})]))
|
||||
|
||||
(rum/defc page-graph < db-mixins/query rum/reactive
|
||||
[]
|
||||
|
@ -650,9 +664,10 @@
|
|||
(date/today))
|
||||
theme (:ui/theme @state/state)
|
||||
dark? (= theme "dark")
|
||||
show-journals-in-page-graph (rum/react *show-journals-in-page-graph?)
|
||||
graph (if (util/uuid-string? page)
|
||||
(graph-handler/build-block-graph (uuid page) theme)
|
||||
(graph-handler/build-page-graph page theme))]
|
||||
(graph-handler/build-page-graph page theme show-journals-in-page-graph))]
|
||||
(when (seq (:nodes graph))
|
||||
(page-graph-inner page graph dark?))))
|
||||
|
||||
|
|
|
@ -1120,18 +1120,23 @@
|
|||
;; get pages who mentioned this page
|
||||
;; TODO: use :block/_refs
|
||||
(defn get-pages-that-mentioned-page
|
||||
[repo page]
|
||||
[repo page include-journals]
|
||||
(when (conn/get-db repo)
|
||||
(let [page-id (:db/id (db-utils/entity [:block/name (util/safe-page-name-sanity-lc page)]))
|
||||
pages (page-alias-set repo page)
|
||||
query-base '[:find ?mentioned-page-name
|
||||
:in $ ?pages ?page-name
|
||||
:where
|
||||
[?block :block/refs ?p]
|
||||
[(contains? ?pages ?p)]
|
||||
[?block :block/page ?mentioned-page]
|
||||
[?mentioned-page :block/name ?mentioned-page-name]]
|
||||
query (if include-journals
|
||||
query-base
|
||||
(conj query-base '[?mentioned-page :block/journal? false]))
|
||||
|
||||
mentioned-pages (->> (react/q repo [:frontend.db.react/page<-pages page-id] {:use-cache? false}
|
||||
'[:find ?mentioned-page-name
|
||||
:in $ ?pages ?page-name
|
||||
:where
|
||||
[?block :block/refs ?p]
|
||||
[(contains? ?pages ?p)]
|
||||
[?block :block/page ?mentioned-page]
|
||||
[?mentioned-page :block/name ?mentioned-page-name]]
|
||||
query
|
||||
pages
|
||||
page)
|
||||
react
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
:right-side-bar/all-pages "All pages"
|
||||
:right-side-bar/flashcards "Flashcards"
|
||||
:right-side-bar/new-page "New page"
|
||||
:right-side-bar/show-journals "Show Journals"
|
||||
:left-side-bar/journals "Journals"
|
||||
:left-side-bar/new-page "New page"
|
||||
:left-side-bar/nav-favorites "Favorites"
|
||||
|
@ -3204,6 +3205,7 @@
|
|||
:right-side-bar/all-pages "Tutte le pagine"
|
||||
:right-side-bar/flashcards "Flashcard"
|
||||
:right-side-bar/new-page "Nuova pagina"
|
||||
:right-side-bar/show-journals "Mostra diari"
|
||||
:left-side-bar/journals "Diario"
|
||||
:left-side-bar/new-page "Nuova pagina"
|
||||
:left-side-bar/nav-favorites "Preferiti"
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
:page-name->original-name page-name->original-name})))))
|
||||
|
||||
(defn build-page-graph
|
||||
[page theme]
|
||||
[page theme show-journal]
|
||||
(let [dark? (= "dark" theme)]
|
||||
(when-let [repo (state/get-current-repo)]
|
||||
(let [page (util/page-name-sanity-lc page)
|
||||
|
@ -128,7 +128,7 @@
|
|||
tags (:tags (:block/properties page-entity))
|
||||
tags (remove #(= page %) tags)
|
||||
ref-pages (db/get-page-referenced-pages repo page)
|
||||
mentioned-pages (db/get-pages-that-mentioned-page repo page)
|
||||
mentioned-pages (db/get-pages-that-mentioned-page repo page show-journal)
|
||||
namespaces (db/get-all-namespace-relation repo)
|
||||
links (concat
|
||||
namespaces
|
||||
|
@ -148,7 +148,7 @@
|
|||
(let [ref-pages (-> (map first (db/get-page-referenced-pages repo page))
|
||||
(set)
|
||||
(set/intersection other-pages))
|
||||
mentioned-pages (-> (map first (db/get-pages-that-mentioned-page repo page))
|
||||
mentioned-pages (-> (map first (db/get-pages-that-mentioned-page repo page show-journal))
|
||||
(set)
|
||||
(set/intersection other-pages))]
|
||||
(concat
|
||||
|
|
Loading…
Reference in New Issue