mirror of https://github.com/logseq/logseq
Switch repo should re-render multiple pages
parent
6b5e42d762
commit
3c50444b8f
|
@ -1,21 +1,21 @@
|
|||
(ns frontend.components.agenda
|
||||
(:require [rum.core :as rum]
|
||||
[frontend.format.block :as block]
|
||||
[clojure.string :as string]
|
||||
[frontend.components.sidebar :as sidebar]
|
||||
[frontend.components.content :as content]
|
||||
[frontend.components.hiccup :as hiccup]
|
||||
[frontend.state :as state]
|
||||
[frontend.db :as db]))
|
||||
|
||||
(rum/defc agenda < rum/reactive
|
||||
[]
|
||||
(let [tasks (db/get-agenda)]
|
||||
[:div#agenda
|
||||
[:h1.title "Agenda"]
|
||||
[:div#agenda
|
||||
[:h1.title "Agenda"]
|
||||
(let [current-repo (state/sub :git/current-repo)
|
||||
tasks (db/get-agenda current-repo)]
|
||||
(if (seq tasks)
|
||||
[:div.ml-1
|
||||
(let [tasks (block/sort-tasks tasks)
|
||||
id "agenda"]
|
||||
(content/content id :org
|
||||
{:hiccup (hiccup/->hiccup tasks {:id id})}))]
|
||||
"Empty")]))
|
||||
"Empty"))])
|
||||
|
|
|
@ -24,12 +24,13 @@
|
|||
[:div.flex-1
|
||||
[:h1.title
|
||||
"All files"]
|
||||
(let [files (db/get-files (state/get-current-repo))]
|
||||
(for [file files]
|
||||
(let [file-id (util/url-encode file)]
|
||||
[:div {:key file-id}
|
||||
[:a {:href (str "/file/" file-id)}
|
||||
file]])))])
|
||||
(when-let [current-repo (state/sub :git/current-repo)]
|
||||
(let [files (db/get-files current-repo)]
|
||||
(for [file files]
|
||||
(let [file-id (util/url-encode file)]
|
||||
[:div {:key file-id}
|
||||
[:a {:href (str "/file/" file-id)}
|
||||
file]]))))])
|
||||
|
||||
(rum/defcs file < rum/reactive
|
||||
[state]
|
||||
|
|
|
@ -72,9 +72,10 @@
|
|||
[:div.flex-1
|
||||
[:h1.title
|
||||
"All Pages"]
|
||||
(let [pages (db/get-pages (state/get-current-repo))]
|
||||
(for [page pages]
|
||||
(let [page-id (util/url-encode page)]
|
||||
[:div {:key page-id}
|
||||
[:a {:href (str "/page/" page-id)}
|
||||
page]])))])
|
||||
(when-let [current-repo (state/sub :git/current-repo)]
|
||||
(let [pages (db/get-pages current-repo)]
|
||||
(for [page pages]
|
||||
(let [page-id (util/url-encode page)]
|
||||
[:div {:key page-id}
|
||||
[:a {:href (str "/page/" page-id)}
|
||||
page]]))))])
|
||||
|
|
|
@ -560,9 +560,9 @@
|
|||
;; time duration
|
||||
;; TODO: posh doesn't support or query
|
||||
(defn get-agenda
|
||||
([]
|
||||
(get-agenda :week))
|
||||
([time]
|
||||
([repo]
|
||||
(get-agenda (state/get-current-repo) :week))
|
||||
([repo time]
|
||||
;; TODO:
|
||||
(let [duration (case time
|
||||
:today []
|
||||
|
@ -576,7 +576,7 @@
|
|||
:where
|
||||
[?h :heading/marker ?marker]
|
||||
[(?pred $ ?marker)]]
|
||||
(get-conn (state/get-current-repo) false)
|
||||
(get-conn repo false)
|
||||
pred)
|
||||
react
|
||||
seq-flatten
|
||||
|
|
Loading…
Reference in New Issue