           :library-id library-id
           :team-id team-id
           :on-delete-selected
-          (fn []
-            (when (-> @state :selected count (> 0))
-              (modal/show!
-               confirm-dialog
-               {:on-accept #(st/emit! (dlib/batch-delete-item section library-id (:selected @state)))
-                :message (str "Are you sure you want to delete " (-> @state :selected count) " items?")
-                :accept-text "Delete"})
-              )
-            )
-          }]
+            (when-not (empty? (:selected @state))
+              (fn []
+                (modal/show!
+                  confirm-dialog
+                  {:on-accept #(do (st/emit! (dlib/batch-delete-item section library-id (:selected @state)))
+                                   (swap! state assoc :selected #{}))
+                   :message (str "Are you sure you want to delete " (-> @state :selected count) " items?")
+                   :accept-text "Delete"})))}]
         [:*
          (if (> (count items) 0)
            [:div.library-page-cards-container

                   (fn []
                     (modal/show!
                      confirm-dialog
                      {:on-accept #(st/emit! (dlib/delete-item :images library-id id))
                       :message "Are you sure you want to delete this image?"
                       :accept-text "Delete"}))]]}]]]))

(mf/defc library-color-card
  [{:keys [item on-select on-unselect]}]
  (let [{:keys [ id content library-id modified-at]} item
        locale (i18n/use-locale)
        state (mf/use-state {:is-open false})
        handle-change (fn []
                        (swap! state update :selected not)
                        (if (:selected @state)

        [:input {:type "checkbox"
                 :id (str "color-" id)
                 :on-change handle-change
                 :value (:selected @state)}]
        [:label {:for (str "color-" id)}]]
       [:div.library-card-image
        { :style { :background-color content }}]
