Browse Source

enhance: quick add animation

Tienson Qin 1 week ago
parent
commit
bcf3c9bc57

+ 4 - 1
src/main/frontend/components/quick_add.cljs

@@ -50,7 +50,10 @@
                          (when-not mobile? (shui/shortcut ["mod" "e"]))
                          "Add to today")]]
         [:div.ls-quick-add.flex.flex-1.flex-col.w-full.gap-4
-         [:div.border-b.pb-4.flex.flex-row.justify-between.gap-4.items-center
+         [:div.flex.flex-row.justify-between.gap-4.items-center
+          {:class (if mobile?
+                    "pt-4"
+                    "border-b pb-4")}
           [:div.font-medium
            "Quick add"]
           (when mobile? add-button)]

+ 2 - 1
src/main/frontend/handler/editor.cljs

@@ -72,6 +72,7 @@
             [logseq.outliner.property :as outliner-property]
             [logseq.shui.dialog.core :as shui-dialog]
             [logseq.shui.popup.core :as shui-popup]
+            [logseq.shui.ui :as shui]
             [promesa.core :as p]
             [rum.core :as rum]))
 
@@ -4066,7 +4067,7 @@
              (move-blocks! children today-last-child {:sibling? true})
              (move-blocks! children today {:sibling? false})))
          (state/close-modal!)
-         (shui-popup/hide!)
+         (shui/popup-hide!)
          (when (seq children)
            (notification/show! "Blocks added to today!" :success)))))))
 

+ 9 - 10
src/main/frontend/handler/notification.cljs

@@ -27,15 +27,14 @@
    (show! content status clear? uid timeout nil))
   ([content status clear? uid timeout close-cb]
    (assert (keyword? status) "status should be a keyword")
-   ;; (let [contents (state/get-notification-contents)
-   ;;       uid (or uid (keyword (util/unique-id)))]
-   ;;   (state/set-state! :notification/contents (assoc contents
-   ;;                                                   uid {:content content
-   ;;                                                        :status status
-   ;;                                                        :close-cb close-cb}))
+   (let [contents (state/get-notification-contents)
+         uid (or uid (keyword (util/unique-id)))]
+     (state/set-state! :notification/contents (assoc contents
+                                                     uid {:content content
+                                                          :status status
+                                                          :close-cb close-cb}))
 
-   ;;   (when (and (not= status :error) (not (false? clear?)))
-   ;;     (js/setTimeout #(clear! uid) (or timeout 2000)))
+     (when (and (not= status :error) (not (false? clear?)))
+       (js/setTimeout #(clear! uid) (or timeout 2000)))
 
-   ;;   uid)
-   ))
+     uid)))

+ 3 - 11
src/main/mobile/components/popup.cljs

@@ -43,14 +43,10 @@
 
 (defn- handle-native-sheet-state!
   [^js data]
-  (let [presented? (.-presented data)
-        presenting? (.-presenting data)
+  (let [presenting? (.-presenting data)
         dismissing? (.-dismissing data)]
     (cond
       presenting?
-      nil
-
-      presented?
       (when (mobile-state/quick-add-open?)
         (editor-handler/quick-add-open-last-block!))
 
@@ -108,16 +104,12 @@
   (cond
     (= :download-rtc-graph (first args))
     (do
-      (when (mobile-util/native-ios?)
-        (dismiss-native-sheet!))
-      (mobile-state/set-popup! nil)
+      (dismiss-native-sheet!)
       (mobile-state/redirect-to-tab! "home"))
 
     :else
     (if (and @*last-popup-modal? (not (= (first args) :editor.commands/commands)))
-      (if (mobile-util/native-ios?)
-        (dismiss-native-sheet!)
-        (mobile-state/set-popup! nil))
+      (dismiss-native-sheet!)
       (apply shui-popup/hide! args))))
 
 (set! shui/popup-show! popup-show!)