|
|
@@ -52,22 +52,13 @@
|
|
|
(page-handler/add-page-to-recent! repo page-original-name)
|
|
|
(db/get-page-blocks repo page-name)))))
|
|
|
|
|
|
-(rum/defc page-conflict-file-warning
|
|
|
- [file-path blocks]
|
|
|
- [:div.conflict-files-warning-it
|
|
|
- [:a {:title "Go to change the page title"
|
|
|
- :key file-path
|
|
|
- :href (rfe/href :file {:path file-path})} file-path]])
|
|
|
-
|
|
|
(rum/defc page-blocks-cp < rum/reactive
|
|
|
db-mixins/query
|
|
|
[repo page file-path page-name page-original-name encoded-page-name sidebar? journal? block? block-id format]
|
|
|
(let [raw-page-blocks (get-blocks repo page-name page-original-name block? block-id)
|
|
|
grouped-blocks-by-file (into {} (for [[k v] (db-utils/group-by-file raw-page-blocks)]
|
|
|
[(:file/path (db-utils/entity (:db/id k))) v]))
|
|
|
- raw-page-blocks (if (contains? grouped-blocks-by-file file-path)
|
|
|
- (get grouped-blocks-by-file file-path)
|
|
|
- raw-page-blocks)
|
|
|
+ raw-page-blocks (get grouped-blocks-by-file file-path raw-page-blocks)
|
|
|
page-blocks (block-handler/with-dummy-block raw-page-blocks format
|
|
|
(if (empty? raw-page-blocks)
|
|
|
(let [content (db/get-file repo file-path)]
|
|
|
@@ -87,15 +78,17 @@
|
|
|
:editor-box editor/box}
|
|
|
hiccup-config (common-handler/config-with-document-mode hiccup-config)
|
|
|
hiccup (block/->hiccup page-blocks hiccup-config {})]
|
|
|
-
|
|
|
[:div.page-blocks-inner
|
|
|
-
|
|
|
- ;; more than one file conflict
|
|
|
- (when (seq (dissoc grouped-blocks-by-file file-path))
|
|
|
- [:div.conflict-files-warning-wrap
|
|
|
- [:h3 "⚠️ Those pages have the same title, you might want to only keep one file: "]
|
|
|
- (for [[file-path blocks] (into (sorted-map) grouped-blocks-by-file)]
|
|
|
- (page-conflict-file-warning file-path blocks))])
|
|
|
+ (when (and (seq grouped-blocks-by-file)
|
|
|
+ (> (count grouped-blocks-by-file) 1))
|
|
|
+ (ui/admonition
|
|
|
+ :warning
|
|
|
+ [:div.text-sm
|
|
|
+ [:p.font-medium "Those pages have the same title, you might want to only keep one file."]
|
|
|
+ [:ol
|
|
|
+ (for [[file-path blocks] (into (sorted-map) grouped-blocks-by-file)]
|
|
|
+ [:li [:a {:key file-path
|
|
|
+ :href (rfe/href :file {:path file-path})} file-path]])]]))
|
|
|
|
|
|
(rum/with-key
|
|
|
(content/content page-name
|
|
|
@@ -433,8 +426,7 @@
|
|
|
(block/block-parents config repo block-id format)]))
|
|
|
|
|
|
;; blocks
|
|
|
- [:div.page-blocks-root
|
|
|
- (page-blocks-cp repo page file-path page-name page-original-name encoded-page-name sidebar? journal? block? block-id format)]]]
|
|
|
+ (page-blocks-cp repo page file-path page-name page-original-name encoded-page-name sidebar? journal? block? block-id format)]]
|
|
|
|
|
|
(when-not block?
|
|
|
(today-queries repo today? sidebar?))
|