diff --git a/src/cljs/orcpub/dnd/e5/events.cljs b/src/cljs/orcpub/dnd/e5/events.cljs index 61ce26eb7..2908cbcd7 100644 --- a/src/cljs/orcpub/dnd/e5/events.cljs +++ b/src/cljs/orcpub/dnd/e5/events.cljs @@ -3816,6 +3816,23 @@ (fn [db [_ id]] (assoc-in db [::char5e/delete-confirmation-shown? id] false))) +(reg-event-db + ::char5e/show-delete-plugin-confirmation + (fn [db _] + (assoc-in db [::char5e/delete-plugin-confirmation-shown?] true))) + +(reg-event-db + ::char5e/hide-delete-plugin-confirmation + (fn [db _] + (assoc-in db [::char5e/delete-plugin-confirmation-shown?] false))) + +;to-do probably should reach into plugins and delete one at the time instead of brute forcing it. +(reg-event-db + ::char5e/delete-all-plugins + (fn [db _] + (js/localStorage.removeItem "plugins") + (js/location.reload))) + (reg-event-fx ::char5e/don-armor (fn [{:keys [db]} [_ id armor-kw]] diff --git a/src/cljs/orcpub/dnd/e5/subs.cljs b/src/cljs/orcpub/dnd/e5/subs.cljs index da187ab75..0f7068658 100644 --- a/src/cljs/orcpub/dnd/e5/subs.cljs +++ b/src/cljs/orcpub/dnd/e5/subs.cljs @@ -1221,6 +1221,11 @@ (fn [db [_ id]] (get-in db [::char5e/delete-confirmation-shown? id]))) +(reg-sub + ::char5e/delete-plugin-confirmation-shown? + (fn [db _] + (get-in db [::char5e/delete-plugin-confirmation-shown?]))) + (reg-sub ::char5e/newb-char-data (fn [db _] diff --git a/src/cljs/orcpub/dnd/e5/views.cljs b/src/cljs/orcpub/dnd/e5/views.cljs index 66efd5b1d..bcea3630e 100644 --- a/src/cljs/orcpub/dnd/e5/views.cljs +++ b/src/cljs/orcpub/dnd/e5/views.cljs @@ -7338,9 +7338,24 @@ (defn my-content [] [:div.main-text-color [:div.flex.justify-cont-end + [:button.form-button.m-r-10.m-b-10 + {:on-click (make-event-handler ::char/show-delete-plugin-confirmation)} + "Delete All"] [:button.form-button.m-r-10.m-b-10 {:on-click (make-event-handler ::e5/export-all-plugins)} "Export All"]] + [:div.flex.justify-cont-end + (if @(subscribe [::char/delete-plugin-confirmation-shown?]) + [:div.p-20.flex.justify-cont-end + [:div + [:div.m-b-10 "Are you sure you want to delete ALL Option sources?"] + [:div.flex + [:button.form-button + {:on-click (make-event-handler ::char/hide-delete-plugin-confirmation)} + "cancel"] + [:span.link-button + {:on-click (make-event-handler ::char/delete-all-plugins)} + "delete"]]]])] [:div.item-list (let [plugins (sort @(subscribe [::e5/plugins]))] (doall