diff --git a/tl/src/tl/subs.cljs b/tl/src/tl/subs.cljs index fd1a253..d7ba369 100644 --- a/tl/src/tl/subs.cljs +++ b/tl/src/tl/subs.cljs @@ -83,7 +83,7 @@ (->> (:groups scene) (keep (fn [[gid g]] (when (and (= :annotation (:type g)) (= ctx (:parent g))) - (let [src-segs (when-not (get-in g [:meta :hidden]) (scene/resolve scene gid)) + (let [src-segs (scene/resolve scene gid) bars (scene/merge-bars (mapcat (fn [{[a b] :src}] (scene/pieces segs a b)) src-segs)) reason (scene/broken-reason scene gid) diff --git a/tl/src/tl/views.cljs b/tl/src/tl/views.cljs index 39eb4de..4963f56 100644 --- a/tl/src/tl/views.cljs +++ b/tl/src/tl/views.cljs @@ -796,27 +796,53 @@ (if (seq anns) (doall (for [a anns] - ^{:key (:id a)} - [:div.ann {:id (str "ann-" (name (:id a))) - :class (when (contains? active-set (:id a)) "active") - :style {"--ann-color" (:color a)}} - [:div.ann-head - [:div.ann-title - [:span.ann-swatch {:style {:background (:color a)}}] - (when (:broken a) [:span {:title (:reason a)} "△ "]) (:name a) - (when (seq (:script a)) [:span.script-badge {:title "linked to script"} "¶"])] - [:div.ann-actions - [jump-control open a scene segs] - [:button.expand-btn {:title "Expand" :on-click #(rf/dispatch [::events/expand (:id a)])} - "⤢" (when (pos? (:nested a)) [:span.nest-badge (:nested a)])] - (when authed? - [:button.edit-btn {:title "Edit" - :on-click #(rf/dispatch [::events/edit-draft (:id a)])} "✎"]) - (when authed? - [:button.del-btn {:title "Delete" - :on-click #(when (js/confirm (str "Delete \"" (:name a) "\"?")) - (rf/dispatch [::events/delete-annotation (:id a)]))} "✕"])]] - (when (not-empty (:content a)) [content-display scene ctx (:content a)])])) + (let [grp (get-in scene [:groups (:id a)])] + ^{:key (:id a)} + (if (:hidden a) + ;; Hidden annotation: small collapsed card + (r/with-let [hov? (r/atom false)] + [:div.ann {:id (str "ann-" (name (:id a))) + :class (when (contains? active-set (:id a)) "active") + :style (merge {"--ann-color" (:color a)} + {:opacity 0.4 + :background "var(--desktop)" + :background-size "2px 2px" + :min-height "28px" + :display "flex" + :align-items "center" + :justify-content "space-between" + :padding "2px 8px"}) + :on-mouse-enter #(reset! hov? true) + :on-mouse-leave #(reset! hov? false)} + [:span.ann-title {:style {:font-size 12}} + [:span.ann-swatch {:style {:background (:color a)}}] + (:name a)] + (when @hov? + [:button.edit-btn {:title "Unhide" + :on-click #(rf/dispatch [::events/put-group (:id a) + (update grp :meta dissoc :hidden)])} + "Unhide"])]) + ;; Normal annotation: full card + [:div.ann {:id (str "ann-" (name (:id a))) + :class (when (contains? active-set (:id a)) "active") + :style {"--ann-color" (:color a)}} + [:div.ann-head + [:div.ann-title + [:span.ann-swatch {:style {:background (:color a)}}] + (when (:broken a) [:span {:title (:reason a)} "△ "]) (:name a) + (when (seq (:script a)) [:span.script-badge {:title "linked to script"} "¶"])] + [:div.ann-actions + [jump-control open a scene segs] + [:button.expand-btn {:title "Expand" :on-click #(rf/dispatch [::events/expand (:id a)])} + "⤢" (when (pos? (:nested a)) [:span.nest-badge (:nested a)])] + (when authed? + [:button.edit-btn {:title "Edit" + :on-click #(rf/dispatch [::events/edit-draft (:id a)])} "✎"]) + (when authed? + [:button.del-btn {:title "Delete" + :on-click #(when (js/confirm (str "Delete \"" (:name a) "\"?")) + (rf/dispatch [::events/delete-annotation (:id a)]))} "✕"])]] + (when (not-empty (:content a)) [content-display scene ctx (:content a)])])))) [:div.ann-empty "No annotations here."])])))) (defn- to-frame [v len]