From f84c2ec9f58670dd733d704c9b6dcd39bcd90fb3 Mon Sep 17 00:00:00 2001 From: Jamie Caprani Date: Mon, 27 Feb 2023 13:49:37 +0000 Subject: [PATCH] chore: add old edit option to communities options (#15131) --- src/status_im/communities/core.cljs | 2 +- .../menus/community_options/view.cljs | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/status_im/communities/core.cljs b/src/status_im/communities/core.cljs index 2c37b5df32..f9f2863e42 100644 --- a/src/status_im/communities/core.cljs +++ b/src/status_im/communities/core.cljs @@ -427,7 +427,7 @@ (navigation/navigate-to :community-create nil))) (rf/defn open-edit-community - {:events [::open-edit-community]} + {:events [::open-edit-community :communities/open-edit-community]} [{:keys [db] :as cofx} id] (let [{:keys [name description images permissions color]} (get-in db [:communities id]) {:keys [access]} permissions] diff --git a/src/status_im2/contexts/communities/menus/community_options/view.cljs b/src/status_im2/contexts/communities/menus/community_options/view.cljs index 66e17109cb..eb4bc7ea0e 100644 --- a/src/status_im2/contexts/communities/menus/community_options/view.cljs +++ b/src/status_im2/contexts/communities/menus/community_options/view.cljs @@ -101,7 +101,8 @@ {:icon :i/edit :label (i18n/label :t/edit-community) :accessibility-label :edit-community - :on-press #(js/alert (str "implement action" id))}) + :on-press #(rf/dispatch [:communities/open-edit-community id] + (rf/dispatch [:bottom-sheet/hide]))}) (defn not-joined-options [id token-gated?] @@ -149,18 +150,14 @@ (defn get-context-drawers [{:keys [id]}] - (let [community (rf/sub [:communities/community id]) - token-gated? (:token-gated? community) - joined? (:joined community) - admin? (:admin community) - request-sent? (pos? (:requested-to-join-at community)) - muted? (:muted community) - banned? (:banList community)] + (let [{:keys [token-gated? admin joined requested-to-join-at + muted banList]} (rf/sub [:communities/community id]) + request-sent? (pos? requested-to-join-at)] (cond - joined? (joined-options id token-gated? muted?) - admin? (owner-options id token-gated? muted?) + admin (owner-options id token-gated? muted) + joined (joined-options id token-gated? muted) request-sent? (join-request-sent-options id token-gated?) - banned? (banned-options id token-gated?) + banList (banned-options id token-gated?) :else (not-joined-options id token-gated?)))) (defn community-options-bottom-sheet