Communities - Display community rules at request to join (#18082)

This update introduces a feature that displays community rules to users as they join.
This commit is contained in:
Flavio Fraschetti 2023-12-06 13:21:17 -03:00 committed by GitHub
parent 4376ee8908
commit 2bc7b62324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 0 deletions

View File

@ -74,6 +74,7 @@
:adminSettings :admin-settings
:tokenPermissions :token-permissions
:communityTokensMetadata :tokens-metadata
:introMessage :intro-message
:muteTill :muted-till})
(update :admin-settings
set/rename-keys

View File

@ -4,6 +4,7 @@
[react-native.core :as rn]
[react-native.gesture :as gesture]
[status-im2.common.password-authentication.view :as password-authentication]
[status-im2.contexts.communities.actions.community-rules.view :as community-rules]
[status-im2.contexts.communities.actions.request-to-join.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@ -26,6 +27,13 @@
[rn/view {:flex 1}
[gesture/scroll-view {:style {:flex 1}}
[rn/view style/page-container
[quo/text
{:style {:margin-top 24}
:accessibility-label :community-rules-title
:weight :semi-bold
:size :paragraph-1}
(i18n/label :t/community-rules)]
[community-rules/view id]
[rn/view {:style (style/bottom-container)}
[quo/button
{:accessibility-label :cancel

View File

@ -0,0 +1,10 @@
(ns status-im2.contexts.communities.actions.community-rules.style)
(def community-rule
{:flex 1
:align-items :flex-start
:margin-top 16})
(def community-rule-text
{:margin-left 6
:flex 1})

View File

@ -0,0 +1,16 @@
(ns status-im2.contexts.communities.actions.community-rules.view
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im2.contexts.communities.actions.community-rules.style :as style]
[utils.re-frame :as rf]))
(defn view
[id]
(let [rules (rf/sub [:communities/rules id])]
[rn/view {:style style/community-rule}
[quo/text
{:style style/community-rule-text
:weight :regular
:size :paragraph-2}
rules]]))

View File

@ -329,3 +329,9 @@
:<- [:communities]
(fn [communities [_ id]]
(get-in communities [id :images])))
(re-frame/reg-sub
:communities/rules
:<- [:communities]
(fn [communities [_ community-id]]
(get-in communities [community-id :intro-message])))