|
5 | 5 | [react-native.gesture :as gesture]
|
6 | 6 | [status-im.common.password-authentication.view :as password-authentication]
|
7 | 7 | [status-im.contexts.communities.actions.accounts-selection.style :as style]
|
| 8 | + [status-im.contexts.communities.actions.addresses-for-permissions.view :as addresses-for-permissions] |
| 9 | + [status-im.contexts.communities.actions.airdrop-addresses.view :as airdrop-addresses] |
8 | 10 | [status-im.contexts.communities.actions.community-rules.view :as community-rules]
|
9 | 11 | [status-im.contexts.communities.utils :as communities.utils]
|
10 | 12 | [utils.i18n :as i18n]
|
11 | 13 | [utils.re-frame :as rf]))
|
12 | 14 |
|
13 |
| -(defn- join-community-and-navigate-back |
14 |
| - [id] |
15 |
| - (rf/dispatch [:password-authentication/show {:content (fn [] [password-authentication/view])} |
16 |
| - {:label (i18n/label :t/join-open-community) |
17 |
| - :on-press #(rf/dispatch [:communities/request-to-join-with-addresses |
18 |
| - {:community-id id :password %}])}]) |
19 |
| - (rf/dispatch [:navigate-back])) |
20 |
| - |
21 | 15 | (defn view
|
22 | 16 | []
|
23 |
| - (let [{id :community-id} (rf/sub [:get-screen-params]) |
24 |
| - {:keys [name color images]} (rf/sub [:communities/community id]) |
25 |
| - airdrop-account (rf/sub [:communities/airdrop-account id]) |
26 |
| - selected-accounts (rf/sub [:communities/selected-permission-accounts id]) |
27 |
| - {:keys [highest-permission-role]} (rf/sub [:community/token-gated-overview id]) |
28 |
| - highest-role-text (i18n/label (communities.utils/role->translation-key |
29 |
| - highest-permission-role |
30 |
| - :t/member))] |
31 |
| - [rn/safe-area-view {:style style/container} |
32 |
| - [quo/page-nav |
33 |
| - {:text-align :left |
34 |
| - :icon-name :i/close |
35 |
| - :on-press #(rf/dispatch [:navigate-back]) |
36 |
| - :accessibility-label :back-button}] |
37 |
| - [quo/page-top |
38 |
| - {:title (i18n/label :t/request-to-join) |
39 |
| - :description :context-tag |
40 |
| - :context-tag {:type :community |
41 |
| - :size 24 |
42 |
| - :community-logo (get-in images [:thumbnail :uri]) |
43 |
| - :community-name name}}] |
44 |
| - [gesture/scroll-view |
45 |
| - [:<> |
46 |
| - [quo/text |
47 |
| - {:style style/section-title |
48 |
| - :accessibility-label :community-rules-title |
49 |
| - :weight :semi-bold |
50 |
| - :size :paragraph-1} |
51 |
| - (i18n/label :t/address-to-share)] |
52 |
| - [quo/category |
53 |
| - {:list-type :settings |
54 |
| - :data [{:title (i18n/label :t/join-as-a {:role highest-role-text}) |
55 |
| - :on-press #(rf/dispatch [:open-modal :addresses-for-permissions |
56 |
| - {:community-id id}]) |
57 |
| - :description :text |
58 |
| - :action :arrow |
59 |
| - :label :preview |
60 |
| - :label-props {:type :accounts |
61 |
| - :data selected-accounts} |
62 |
| - :description-props {:text (i18n/label :t/all-addresses)}} |
63 |
| - {:title (i18n/label :t/for-airdrops) |
64 |
| - :on-press #(rf/dispatch [:open-modal :airdrop-addresses |
65 |
| - {:community-id id}]) |
66 |
| - :description :text |
67 |
| - :action :arrow |
68 |
| - :label :preview |
69 |
| - :label-props {:type :accounts |
70 |
| - :data [airdrop-account]} |
71 |
| - :description-props {:text (:name airdrop-account)}}]}] |
72 |
| - [quo/text |
73 |
| - {:style style/section-title |
74 |
| - :accessibility-label :community-rules-title |
75 |
| - :weight :semi-bold |
76 |
| - :size :paragraph-1} |
77 |
| - (i18n/label :t/community-rules)] |
78 |
| - [community-rules/view id]]] |
79 |
| - [rn/view {:style (style/bottom-actions)} |
80 |
| - [quo/slide-button |
81 |
| - {:size :size-48 |
82 |
| - :track-text (i18n/label :t/slide-to-request-to-join) |
83 |
| - :track-icon :i/face-id |
84 |
| - :customization-color color |
85 |
| - :on-complete #(join-community-and-navigate-back id)}]]])) |
| 17 | + (let [{id :community-id} (rf/sub [:get-screen-params]) |
| 18 | + show-addresses-for-permissions (fn [] |
| 19 | + (rf/dispatch [:show-bottom-sheet |
| 20 | + {:community-id id |
| 21 | + :content addresses-for-permissions/view}])) |
| 22 | + show-airdrop-addresses (fn [] |
| 23 | + (rf/dispatch [:show-bottom-sheet |
| 24 | + {:community-id id |
| 25 | + :content airdrop-addresses/view}])) |
| 26 | + navigate-back #(rf/dispatch [:navigate-back]) |
| 27 | + join-and-go-back (fn [] |
| 28 | + (rf/dispatch [:password-authentication/show |
| 29 | + {:content (fn [] [password-authentication/view])} |
| 30 | + {:label (i18n/label :t/join-open-community) |
| 31 | + :on-press |
| 32 | + #(rf/dispatch |
| 33 | + [:communities/request-to-join-with-addresses |
| 34 | + {:community-id id :password %}])}]) |
| 35 | + (navigate-back))] |
| 36 | + (fn [] |
| 37 | + (let [{:keys [name color images]} (rf/sub [:communities/community id]) |
| 38 | + airdrop-account (rf/sub [:communities/airdrop-account id]) |
| 39 | + selected-accounts (rf/sub [:communities/selected-permission-accounts id]) |
| 40 | + {:keys [highest-permission-role]} (rf/sub [:community/token-gated-overview id]) |
| 41 | + highest-role-text (i18n/label (communities.utils/role->translation-key |
| 42 | + highest-permission-role |
| 43 | + :t/member))] |
| 44 | + [rn/safe-area-view {:style style/container} |
| 45 | + [quo/page-nav |
| 46 | + {:text-align :left |
| 47 | + :icon-name :i/close |
| 48 | + :on-press navigate-back |
| 49 | + :accessibility-label :back-button}] |
| 50 | + [quo/page-top |
| 51 | + {:title (i18n/label :t/request-to-join) |
| 52 | + :description :context-tag |
| 53 | + :context-tag {:type :community |
| 54 | + :size 24 |
| 55 | + :community-logo (get-in images [:thumbnail :uri]) |
| 56 | + :community-name name}}] |
| 57 | + [gesture/scroll-view |
| 58 | + [:<> |
| 59 | + [quo/text |
| 60 | + {:style style/section-title |
| 61 | + :accessibility-label :community-rules-title |
| 62 | + :weight :semi-bold |
| 63 | + :size :paragraph-1} |
| 64 | + (i18n/label :t/address-to-share)] |
| 65 | + [quo/category |
| 66 | + {:list-type :settings |
| 67 | + :data [{:title (i18n/label :t/join-as-a {:role highest-role-text}) |
| 68 | + :on-press show-addresses-for-permissions |
| 69 | + :description :text |
| 70 | + :action :arrow |
| 71 | + :label :preview |
| 72 | + :label-props {:type :accounts |
| 73 | + :data selected-accounts} |
| 74 | + :description-props {:text (i18n/label :t/all-addresses)}} |
| 75 | + {:title (i18n/label :t/for-airdrops) |
| 76 | + :on-press show-airdrop-addresses |
| 77 | + :description :text |
| 78 | + :action :arrow |
| 79 | + :label :preview |
| 80 | + :label-props {:type :accounts |
| 81 | + :data [airdrop-account]} |
| 82 | + :description-props {:text (:name airdrop-account)}}]}] |
| 83 | + [quo/text |
| 84 | + {:style style/section-title |
| 85 | + :accessibility-label :community-rules-title |
| 86 | + :weight :semi-bold |
| 87 | + :size :paragraph-1} |
| 88 | + (i18n/label :t/community-rules)] |
| 89 | + [community-rules/view id]]] |
| 90 | + [rn/view {:style (style/bottom-actions)} |
| 91 | + [quo/slide-button |
| 92 | + {:size :size-48 |
| 93 | + :track-text (i18n/label :t/slide-to-request-to-join) |
| 94 | + :track-icon :i/face-id |
| 95 | + :customization-color color |
| 96 | + :on-complete join-and-go-back}]]])))) |
0 commit comments