Переглянути джерело

enhance(ux): show block metadata when hovering on bullet

Tienson Qin 8 місяців тому
батько
коміт
74886f9fab

+ 2 - 1
deps/db/src/logseq/db/frontend/property.cljs

@@ -553,7 +553,8 @@
                                            :hide? true}}
      :logseq.property/created-by-ref {:title "Node created by"
                                       :schema {:type :entity
-                                               :hide? true}}
+                                               :hide? true}
+                                      :queryable? true}
      :logseq.property/used-template {:title "Used template"
                                      :schema {:type :node
                                               :public? false

+ 34 - 24
src/main/frontend/components/block.cljs

@@ -2151,30 +2151,40 @@
                                         (assoc :class "selected"))
                          (when
                           order-list?
-                           [:label (str order-list-idx ".")])])]]]
-         (cond
-           (and (or (mobile-util/native-platform?)
-                    (:ui/show-empty-bullets? (state/get-config))
-                    collapsed?
-                    collapsable?
-                    (< (- (util/time-ms) (:block/created-at block)) 500))
-                (not doc-mode?))
-           bullet
-
-           (or
-            (and empty-content?
-                 (not edit?)
-                 (not (:block.temp/top? block))
-                 (not (:block.temp/bottom? block))
-                 (not (util/react *control-show?))
-                 (not (:logseq.property/created-from-property  block)))
-            (and doc-mode?
-                 (not collapsed?)
-                 (not (util/react *control-show?))))
-           [:span.bullet-container]
-
-           :else
-           bullet)))]))
+                           [:label (str order-list-idx ".")])])]]
+             bullet' (cond
+                       (and (or (mobile-util/native-platform?)
+                                (:ui/show-empty-bullets? (state/get-config))
+                                collapsed?
+                                collapsable?
+                                (< (- (util/time-ms) (:block/created-at block)) 500))
+                            (not doc-mode?))
+                       bullet
+
+                       (or
+                        (and empty-content?
+                             (not edit?)
+                             (not (:block.temp/top? block))
+                             (not (:block.temp/bottom? block))
+                             (not (util/react *control-show?))
+                             (not (:logseq.property/created-from-property  block)))
+                        (and doc-mode?
+                             (not collapsed?)
+                             (not (util/react *control-show?))))
+                       [:span.bullet-container]
+
+                       :else
+                       bullet)]
+         (if (config/db-based-graph?)
+           (ui/tippy
+            {:html (fn []
+                     [:div.flex.flex-col.gap-1.p-2
+                      (when-let [created-by (and (ldb/get-graph-rtc-uuid (db/get-db)) (:logseq.property/created-by-ref block))]
+                        [:div (:block/title created-by)])
+                      [:div "Created: " (date/int->local-time-2 (:block/created-at block))]
+                      [:div "Last edited: " (date/int->local-time-2 (:block/updated-at block))]])}
+            bullet')
+           bullet')))]))
 
 (rum/defc dnd-separator
   [move-to block-content?]