Skip to content

Commit 1967469

Browse files
authored
[#22579] Add modal with help to create a community (#22582)
* Refactor of common components * Add modal to help users to create a community
1 parent 78f9331 commit 1967469

File tree

9 files changed

+90
-58
lines changed

9 files changed

+90
-58
lines changed

src/status_im/common/home/title_column/style.cljs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
:padding-horizontal 20
99
:background-color :transparent})
1010

11+
(def title
12+
{:flex 1
13+
:align-items :center
14+
:flex-direction :row})
15+
16+
(def beta-label {:padding-top 6 :padding-bottom 2})
17+
1118
(def title-column-text
1219
{:accessibility-label :communities-screen-title
1320
:margin-right 6

src/status_im/common/home/title_column/view.cljs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,18 @@
99
(defn view
1010
[{:keys [beta? label handler accessibility-label customization-color]}]
1111
[rn/view style/title-column
12-
[rn/view
13-
{:style {:flex 1
14-
:align-items :center
15-
:flex-direction :row}}
12+
[rn/view {:style style/title}
1613
[quo/text style/title-column-text
1714
label]
1815
(when beta?
19-
[rn/view
20-
{:style {:padding-top 6
21-
:padding-bottom 2}}
16+
[rn/view {:style style/beta-label}
2217
[quo/tag
2318
{:accessibility-label :communities-chat-beta-tag
2419
:size 24
2520
:type :label
2621
:label (i18n/label :t/beta)
2722
:labelled? true
2823
:blurred? false}]])]
29-
3024
(when handler
3125
[plus-button/plus-button
3226
{:on-press handler

src/status_im/constants.cljs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,7 @@
491491

492492
(def ^:const pre-login-log-level-key "pre-login-log-level")
493493
(def ^:const report-email "[email protected]")
494+
495+
;; Community help links
496+
(def ^:const create-community-help-url
497+
"https://status.app/help/communities/create-a-status-community#create-a-status-community")

src/status_im/contexts/chat/home/view.cljs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@
133133
:title (i18n/label :t/invite-friends-to-status)
134134
:description (i18n/label :t/share-invite-link)}}))
135135

136+
(defn- on-tab-change
137+
[tab]
138+
(rf/dispatch [:messages-home/select-tab tab]))
139+
136140
(defn view
137141
[]
138142
(let [theme (quo.context/use-theme)
@@ -170,5 +174,5 @@
170174
:accessibility-label :tab-contacts
171175
:notification-dot? (pos? (count pending-contact-requests))}]
172176
:selected-tab selected-tab
173-
:on-tab-change (fn [tab] (rf/dispatch [:messages-home/select-tab tab]))
177+
:on-tab-change on-tab-change
174178
:scroll-shared-value scroll-shared-value}]]))

src/status_im/contexts/communities/actions/home_plus/view.cljs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/status_im/contexts/communities/home/view.cljs

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
[status-im.common.home.header-spacing.view :as common.header-spacing]
1111
[status-im.common.resources :as resources]
1212
[status-im.config :as config]
13+
[status-im.constants :as constants]
1314
[status-im.contexts.communities.actions.community-options.view :as options]
14-
[status-im.contexts.communities.actions.home-plus.view :as actions.home-plus]
1515
[status-im.contexts.shell.constants :as shell.constants]
1616
[utils.debounce :as debounce]
1717
[utils.i18n :as i18n]
@@ -26,9 +26,9 @@
2626
[quo/communities-membership-list-item
2727
{:customization-color customization-color
2828
:style {:padding-horizontal 20}
29-
:on-press #(debounce/throttle-and-dispatch [:communities/navigate-to-community-overview
30-
id]
31-
500)
29+
:on-press #(debounce/throttle-and-dispatch
30+
[:communities/navigate-to-community-overview id]
31+
500)
3232
:on-long-press #(rf/dispatch
3333
[:show-bottom-sheet
3434
{:content (fn []
@@ -43,6 +43,56 @@
4343
{:id :pending :label (i18n/label :t/pending) :accessibility-label :pending-tab}
4444
{:id :opened :label (i18n/label :t/opened) :accessibility-label :opened-tab}])
4545

46+
(defn- community-creation-options-testing
47+
[]
48+
[rn/view {:style {:padding-vertical 12 :row-gap 12}}
49+
[quo/divider-line]
50+
[rn/view
51+
[quo/action-drawer
52+
[[{:icon :i/communities
53+
:accessibility-label :create-closed-community
54+
:label "Create closed community (only for testing)"
55+
:on-press #(rf/dispatch [:fast-create-community/create-closed-community])}
56+
{:icon :i/communities
57+
:accessibility-label :create-open-community
58+
:label "Create open community (only for testing)"
59+
:on-press #(rf/dispatch [:fast-create-community/create-open-community])}
60+
{:icon :i/communities
61+
:accessibility-label :create-token-gated-community
62+
:label "Create token-gated community (only for testing)"
63+
:on-press #(rf/dispatch
64+
[:fast-create-community/create-token-gated-community])}]]]]])
65+
66+
(defn- open-learn-more-link
67+
[]
68+
(rf/dispatch [:hide-bottom-sheet])
69+
(rf/dispatch
70+
[:browser.ui/open-url constants/create-community-help-url]))
71+
72+
(defn- hide-bottom-sheet
73+
[]
74+
(rf/dispatch [:hide-bottom-sheet]))
75+
76+
(defn- create-community-sheet
77+
[]
78+
(let [customization-color (rf/sub [:profile/customization-color])]
79+
[:<>
80+
[quo/drawer-top {:title (i18n/label :t/want-to-create-community)}]
81+
[quo/text {:style {:padding-horizontal 20 :padding-bottom 12}}
82+
(i18n/label :t/communities-only-available-in-desktop)]
83+
[quo/bottom-actions
84+
{:actions :two-actions
85+
:button-one-label (i18n/label :t/learn-more)
86+
:button-one-props {:disabled? false
87+
:customization-color customization-color
88+
:on-press open-learn-more-link
89+
:icon-right :i/external}
90+
:button-two-label (i18n/label :t/maybe-later)
91+
:button-two-props {:type :grey
92+
:on-press hide-bottom-sheet}}]
93+
(when config/fast-create-community-enabled?
94+
[community-creation-options-testing])]))
95+
4696
(defn empty-state-content
4797
[theme]
4898
{:joined
@@ -66,8 +116,7 @@
66116
{:title-props
67117
{:beta? true
68118
:label (i18n/label :t/communities)
69-
:handler (when config/fast-create-community-enabled?
70-
#(rf/dispatch [:show-bottom-sheet {:content actions.home-plus/view}]))
119+
:handler #(rf/dispatch [:show-bottom-sheet {:content create-community-sheet}])
71120
:accessibility-label :new-communities-button}
72121
:card-props
73122
{:on-press #(rf/dispatch [:navigate-to :screen/discover-communities])

src/status_im/contexts/shell/home_stack/style.cljs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
(ns status-im.contexts.shell.home-stack.style
2-
(:require
3-
[quo.foundations.colors :as colors]
4-
[react-native.reanimated :as reanimated]))
2+
(:require [quo.foundations.colors :as colors]
3+
[react-native.core :as rn]
4+
[status-im.contexts.shell.constants :as shell.constants]))
55

66
(defn stack-view
7-
[stack-id {:keys [opacity z-index]}]
8-
(reanimated/apply-animations-to-style
9-
{:opacity opacity
10-
:z-index z-index}
11-
{:top 0
12-
:left 0
13-
:right 0
14-
:bottom 0
15-
:position :absolute
16-
:accessibility-label stack-id}))
7+
[shared-values stack-id]
8+
[{:opacity (->> stack-id
9+
(get shell.constants/stacks-opacity-keywords)
10+
(get shared-values))
11+
:z-index (->> stack-id
12+
(get shell.constants/stacks-z-index-keywords)
13+
(get shared-values))}
14+
rn/stylesheet-absolute-fill])
1715

1816
(defn home-stack
1917
[theme]

src/status_im/contexts/shell/home_stack/view.cljs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
[status-im.contexts.chat.home.view :as chat]
88
[status-im.contexts.communities.home.view :as communities]
99
[status-im.contexts.market.view :as market]
10-
[status-im.contexts.shell.constants :as shell.constants]
1110
[status-im.contexts.shell.home-stack.style :as style]
1211
[status-im.contexts.shell.state :as state]
1312
[status-im.contexts.wallet.home.view :as wallet]))
@@ -21,15 +20,11 @@
2120
:screen/wallet-stack @state/load-wallet-stack?
2221
:screen/market-stack @state/load-market-stack?))
2322

24-
(defn- f-stack-view
23+
(defn- stack-view
2524
[stack-id shared-values]
2625
[reanimated/view
27-
{:style (style/stack-view
28-
stack-id
29-
{:opacity (get shared-values
30-
(get shell.constants/stacks-opacity-keywords stack-id))
31-
:z-index (get shared-values
32-
(get shell.constants/stacks-z-index-keywords stack-id))})}
26+
{:style (style/stack-view shared-values stack-id)
27+
:accessibility-label stack-id}
3328
(case stack-id
3429
:screen/communities-stack [communities/view]
3530
:screen/chats-stack [chat/view]
@@ -42,7 +37,7 @@
4237
[stack-id shared-values theme]
4338
(when (load-stack? stack-id)
4439
[quo.context/provider {:theme theme :screen-id stack-id}
45-
[f-stack-view stack-id shared-values]]))
40+
[stack-view stack-id shared-values]]))
4641

4742
(defn view
4843
[shared-values]

translations/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@
427427
"communities": "Communities",
428428
"communities-alpha": "Communities (alpha)",
429429
"communities-enabled": "Communities enabled",
430+
"communities-only-available-in-desktop": "For now, you can only create communities on the Status desktop app.",
430431
"communities-verified": "✓ Verified Status Community",
431432
"community": "Community",
432433
"community-channel": "Community channel",
@@ -2976,6 +2977,7 @@
29762977
"wallet-total-value": "Total value",
29772978
"wallet-transaction-total-fee": "Total Fee",
29782979
"wallet-updated-at": "Updated {{at}}",
2980+
"want-to-create-community": "Want to create your own community?",
29792981
"wants-to-access-profile": "wants to access to your profile",
29802982
"wants-to-join": "wants to join",
29812983
"warning": "Warning",

0 commit comments

Comments
 (0)