From 9dacc9e8af056f2a168d895bbb686d96b24df760 Mon Sep 17 00:00:00 2001 From: Parvesh Monu Date: Fri, 9 Feb 2024 23:32:58 +0530 Subject: [PATCH] error and app freezing when deselecting account (#18759) --- .../addresses_for_permissions/style.cljs | 6 ---- .../addresses_for_permissions/view.cljs | 29 +++++++++---------- translations/en.json | 1 + 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/status_im/contexts/communities/actions/addresses_for_permissions/style.cljs b/src/status_im/contexts/communities/actions/addresses_for_permissions/style.cljs index 727dddc294..f3e508e0fd 100644 --- a/src/status_im/contexts/communities/actions/addresses_for_permissions/style.cljs +++ b/src/status_im/contexts/communities/actions/addresses_for_permissions/style.cljs @@ -8,12 +8,6 @@ :padding-horizontal 20 :padding-vertical 12}) -(def error-message - {:flex-direction :row - :gap 4 - :justify-content :center - :margin-bottom 8}) - (def highest-role {:flex-direction :row :gap 4 diff --git a/src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs b/src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs index 8fb3d79b44..bd2d4da638 100644 --- a/src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs +++ b/src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs @@ -53,8 +53,9 @@ {:keys [highest-permission-role]} (rf/sub [:community/token-gated-overview id]) accounts (rf/sub [:wallet/accounts-with-customization-color]) selected-addresses (rf/sub [:communities/selected-permission-addresses id]) - highest-role-text (i18n/label (communities.utils/role->translation-key - highest-permission-role))] + highest-role-text (when highest-permission-role + (i18n/label (communities.utils/role->translation-key + highest-permission-role)))] [rn/safe-area-view {:style style/container} [quo/drawer-top {:type :context-tag @@ -73,7 +74,7 @@ :key-fn :address :data accounts}] - (when (and highest-permission-role (seq selected-addresses)) + (if (and highest-permission-role (seq selected-addresses)) [rn/view {:style style/highest-role} [quo/text @@ -84,19 +85,15 @@ {:type :icon :icon :i/members :size 24 - :context highest-role-text}]]) - - (when (empty? selected-addresses) - [rn/view - {:style style/error-message} - [quo/icon - :i/info - {:color colors/danger-50 - :size 16}] - [quo/text - {:size :paragraph-2 - :style {:color colors/danger-50}} - (i18n/label :t/no-addresses-selected)]]) + :context highest-role-text}]] + [quo/info-message + {:type :error + :size :default + :icon :i/info + :style {:justify-content :center}} + (if (empty? selected-addresses) + (i18n/label :t/no-addresses-selected) + (i18n/label :t/addresses-dont-contain-tokens-needed))]) [rn/view {:style style/buttons} [quo/button diff --git a/translations/en.json b/translations/en.json index c6d13c4c74..7ef4a20d8e 100644 --- a/translations/en.json +++ b/translations/en.json @@ -2265,6 +2265,7 @@ "eligible-to-join-as": "Eligible to join as", "you-not-eligible-to-join": "You’re not eligible to join", "you-hold-number-of-hold-tokens-of-these": "You hold {{number-of-hold-tokens}} of these:", + "addresses-dont-contain-tokens-needed": "These addresses don’t contain tokens needed to join", "token-gated-communities": "Token gated communities", "read-more": "Read more", "token-gated-communities-info": "Here will be something relevant about this topic. This will help the user get more context and therefore have a better understanding of it.",