Skip to content

Commit 2bc7b62

Browse files
author
Flavio Fraschetti
authored
Communities - Display community rules at request to join (#18082)
This update introduces a feature that displays community rules to users as they join.
1 parent 4376ee8 commit 2bc7b62

File tree

5 files changed

+41
-0
lines changed

5 files changed

+41
-0
lines changed

src/status_im/communities/core.cljs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
:adminSettings :admin-settings
7575
:tokenPermissions :token-permissions
7676
:communityTokensMetadata :tokens-metadata
77+
:introMessage :intro-message
7778
:muteTill :muted-till})
7879
(update :admin-settings
7980
set/rename-keys

src/status_im2/contexts/communities/actions/accounts_selection/view.cljs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[react-native.core :as rn]
55
[react-native.gesture :as gesture]
66
[status-im2.common.password-authentication.view :as password-authentication]
7+
[status-im2.contexts.communities.actions.community-rules.view :as community-rules]
78
[status-im2.contexts.communities.actions.request-to-join.style :as style]
89
[utils.i18n :as i18n]
910
[utils.re-frame :as rf]))
@@ -26,6 +27,13 @@
2627
[rn/view {:flex 1}
2728
[gesture/scroll-view {:style {:flex 1}}
2829
[rn/view style/page-container
30+
[quo/text
31+
{:style {:margin-top 24}
32+
:accessibility-label :community-rules-title
33+
:weight :semi-bold
34+
:size :paragraph-1}
35+
(i18n/label :t/community-rules)]
36+
[community-rules/view id]
2937
[rn/view {:style (style/bottom-container)}
3038
[quo/button
3139
{:accessibility-label :cancel
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(ns status-im2.contexts.communities.actions.community-rules.style)
2+
3+
(def community-rule
4+
{:flex 1
5+
:align-items :flex-start
6+
:margin-top 16})
7+
8+
(def community-rule-text
9+
{:margin-left 6
10+
:flex 1})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(ns status-im2.contexts.communities.actions.community-rules.view
2+
(:require
3+
[quo.core :as quo]
4+
[react-native.core :as rn]
5+
[status-im2.contexts.communities.actions.community-rules.style :as style]
6+
[utils.re-frame :as rf]))
7+
8+
(defn view
9+
[id]
10+
(let [rules (rf/sub [:communities/rules id])]
11+
[rn/view {:style style/community-rule}
12+
[quo/text
13+
{:style style/community-rule-text
14+
:weight :regular
15+
:size :paragraph-2}
16+
rules]]))

src/status_im2/subs/communities.cljs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,3 +329,9 @@
329329
:<- [:communities]
330330
(fn [communities [_ id]]
331331
(get-in communities [id :images])))
332+
333+
(re-frame/reg-sub
334+
:communities/rules
335+
:<- [:communities]
336+
(fn [communities [_ community-id]]
337+
(get-in communities [community-id :intro-message])))

0 commit comments

Comments
 (0)