|
|
@@ -20,7 +20,7 @@
|
|
|
(rum/defc block-modal
|
|
|
[]
|
|
|
(let [[{:keys [open? block]}] (mobile-state/use-singleton-modal)
|
|
|
- close! #(swap! mobile-state/*singleton-modal assoc :open? false)
|
|
|
+ close! #(reset! mobile-state/*singleton-modal nil)
|
|
|
block (when-let [id (:block/uuid block)]
|
|
|
(db/entity [:block/uuid id]))
|
|
|
open? (and open? block)
|
|
|
@@ -62,54 +62,60 @@
|
|
|
|
|
|
[:div.app-silk-scroll-content-inner
|
|
|
[:div.flex.justify-between.items-center.block-modal-page-header
|
|
|
- [:a.opacity-40.active:opacity-60.px-2
|
|
|
- {:on-pointer-down close!}
|
|
|
- (shui/tabler-icon "chevron-down" {:size 18 :stroke 3})]
|
|
|
+ (shui/button
|
|
|
+ {:variant :text
|
|
|
+ :size :sm
|
|
|
+ :on-click close!
|
|
|
+ :class "-ml-2"}
|
|
|
+ (shui/tabler-icon "chevron-down" {:size 24}))
|
|
|
|
|
|
- [:span.flex.items-center.gap-2
|
|
|
+ [:span.flex.items-center
|
|
|
(when-let [block-id-str (str (:block/uuid block))]
|
|
|
- [:a.active:opacity-80.pr-1
|
|
|
- {:class (if favorited? "opacity-80 !text-yellow-800" "opacity-40")
|
|
|
+ (shui/button
|
|
|
+ {:variant :text
|
|
|
+ :size :sm
|
|
|
+ :class (when favorited? "!text-yellow-800")
|
|
|
:on-click #(-> (if favorited?
|
|
|
(page-handler/<unfavorite-page! block-id-str)
|
|
|
(page-handler/<favorite-page! block-id-str))
|
|
|
(p/then (fn [] (set-favorited! (not favorited?)))))}
|
|
|
- (shui/tabler-icon (if favorited? "star-filled" "star") {:size 18 :stroke 2})])
|
|
|
- [:a.opacity-40.active:opacity-60.pr-1
|
|
|
- {:on-pointer-down (fn []
|
|
|
- (mobile-ui/open-popup!
|
|
|
- (fn []
|
|
|
- [:div.-mx-2
|
|
|
- (ui/menu-link
|
|
|
- {:on-click #(mobile-ui/close-popup!)}
|
|
|
- [:span.text-lg.flex.gap-2.items-center
|
|
|
- (shui/tabler-icon "copy" {:class "opacity-80" :size 22})
|
|
|
- "Copy"])
|
|
|
+ (shui/tabler-icon (if favorited? "star-filled" "star") {:size 20})))
|
|
|
+ (shui/button
|
|
|
+ {:variant :text
|
|
|
+ :size :sm
|
|
|
+ :on-click (fn []
|
|
|
+ (mobile-ui/open-popup!
|
|
|
+ (fn []
|
|
|
+ [:div.-mx-2
|
|
|
+ (ui/menu-link
|
|
|
+ {:on-click #(mobile-ui/close-popup!)}
|
|
|
+ [:span.text-lg.flex.gap-2.items-center
|
|
|
+ (shui/tabler-icon "copy" {:class "opacity-80" :size 22})
|
|
|
+ "Copy"])
|
|
|
|
|
|
- (ui/menu-link
|
|
|
- {:on-click #(-> (shui/dialog-confirm!
|
|
|
- (str "⚠️ Are you sure you want to delete this "
|
|
|
- (if (entity-util/page? block) "page" "block")
|
|
|
- "?"))
|
|
|
- (p/then
|
|
|
- (fn []
|
|
|
- (mobile-ui/close-popup!)
|
|
|
- (some->
|
|
|
- (:block/uuid block)
|
|
|
- (page-handler/<delete!
|
|
|
- (fn [] (close!))
|
|
|
- {:error-handler
|
|
|
- (fn [{:keys [msg]}]
|
|
|
- (notification/show! msg :warning))})))))}
|
|
|
- [:span.text-lg.flex.gap-2.items-center.text-red-700
|
|
|
- (shui/tabler-icon "trash" {:class "opacity-80" :size 22})
|
|
|
- "Delete"])])
|
|
|
- {:title "Actions"
|
|
|
- :type :action-sheet}))}
|
|
|
- (shui/tabler-icon "dots-vertical" {:size 18 :stroke 2})]]]
|
|
|
+ (ui/menu-link
|
|
|
+ {:on-click #(-> (shui/dialog-confirm!
|
|
|
+ (str "⚠️ Are you sure you want to delete this "
|
|
|
+ (if (entity-util/page? block) "page" "block")
|
|
|
+ "?"))
|
|
|
+ (p/then
|
|
|
+ (fn []
|
|
|
+ (mobile-ui/close-popup!)
|
|
|
+ (some->
|
|
|
+ (:block/uuid block)
|
|
|
+ (page-handler/<delete!
|
|
|
+ (fn [] (close!))
|
|
|
+ {:error-handler
|
|
|
+ (fn [{:keys [msg]}]
|
|
|
+ (notification/show! msg :warning))})))))}
|
|
|
+ [:span.text-lg.flex.gap-2.items-center.text-red-700
|
|
|
+ (shui/tabler-icon "trash" {:class "opacity-80" :size 22})
|
|
|
+ "Delete"])])
|
|
|
+ {:title "Actions"
|
|
|
+ :type :action-sheet}))}
|
|
|
+ (shui/tabler-icon "dots-vertical" {:size 20}))]]
|
|
|
|
|
|
;; block page content
|
|
|
[:div.block-modal-page-content
|
|
|
- (when open?
|
|
|
- (mobile-ui/classic-app-container-wrap
|
|
|
- (page/page-cp (db/entity [:block/uuid (:block/uuid block)]))))]])))))))))
|
|
|
+ (mobile-ui/classic-app-container-wrap
|
|
|
+ (page/page-cp (db/entity [:block/uuid (:block/uuid block)])))]])))))))))
|