Community: Request to join - Show addresses shared (#18180)

This commit is contained in:
Ajay Sivan 2023-12-15 22:43:32 +05:30 committed by GitHub
parent 2a5c102b1c
commit 5507ae4fa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 90 additions and 2 deletions

View File

@ -62,7 +62,8 @@
[quo/category
{:list-type :settings
:data [{:title (i18n/label :t/join-as-a-member)
:on-press not-implemented/alert
:on-press #(rf/dispatch [:open-modal :addresses-for-permissions
{:community-id id}])
:description :text
:action :arrow
:label :preview

View File

@ -0,0 +1,22 @@
(ns status-im2.contexts.communities.actions.addresses-for-permissions.style
(:require [quo.foundations.colors :as colors]))
(def container {:flex 1})
(def account-item-container
{:font-size 30
:border-radius 16
:flex-direction :row
:border-width 1
:height 56
:padding-horizontal 12
:align-items :center
:margin-bottom 8
:gap 8
:border-color colors/neutral-90})
(def buttons
{:flex-direction :row
:gap 12
:padding-horizontal 20
:padding-vertical 12})

View File

@ -0,0 +1,58 @@
(ns status-im2.contexts.communities.actions.addresses-for-permissions.view
(:require [quo.core :as quo]
[react-native.core :as rn]
[status-im2.common.not-implemented :as not-implemented]
[status-im2.contexts.communities.actions.addresses-for-permissions.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- account-item
[item]
[rn/view
{:style style/account-item-container}
[quo/account-avatar (assoc item :size 32)]
[rn/view
[quo/text
{:size :paragraph-1
:weight :semi-bold}
(:name item)]
[quo/address-text
{:address (:address item)
:format :short}]]])
(defn view
[]
(let [{id :community-id} (rf/sub [:get-screen-params])
{:keys [name color images]} (rf/sub [:communities/community id])
accounts (->> (rf/sub [:wallet])
:accounts
vals
(map #(assoc % :customization-color (:color %))))]
[rn/safe-area-view {:style style/container}
[quo/drawer-top
{:type :context-tag
:title (i18n/label :t/addresses-for-permissions)
:community-name name
:button-icon :i/info
:on-button-press not-implemented/alert
:community-logo (get-in images [:thumbnail :uri])
:customization-color color}]
[rn/flat-list
{:render-fn account-item
:content-container-style {:padding 20}
:key-fn :key-uid
:data accounts}]
[rn/view {:style style/buttons}
[quo/button
{:type :grey
:container-style {:flex 1}
:on-press #(rf/dispatch [:navigate-back])}
(i18n/label :t/cancel)]
[quo/button
{:container-style {:flex 1}
:customization-color color
:on-press #(rf/dispatch [:navigate-back])}
(i18n/label :t/confirm-changes)]]]))

View File

@ -11,6 +11,8 @@
[status-im2.contexts.chat.new-chat.view :as new-chat]
[status-im2.contexts.chat.photo-selector.view :as photo-selector]
[status-im2.contexts.communities.actions.accounts-selection.view :as communities.accounts-selection]
[status-im2.contexts.communities.actions.addresses-for-permissions.view :as
addresses-for-permissions]
[status-im2.contexts.communities.actions.request-to-join.view :as join-menu]
[status-im2.contexts.communities.discover.view :as communities.discover]
[status-im2.contexts.communities.overview.view :as communities.overview]
@ -98,6 +100,10 @@
:options {:sheet? true}
:component communities.accounts-selection/view}
{:name :addresses-for-permissions
:options {:sheet? true}
:component addresses-for-permissions/view}
{:name :lightbox
:options options/lightbox
:component lightbox/lightbox}
@ -352,4 +358,3 @@
(when config/quo-preview-enabled?
status-im-preview/main-screens)))

View File

@ -178,6 +178,8 @@
},
"community-rules": "Community rules",
"address-to-share": "Addresses to share",
"addresses-for-permissions": "Addresses for permissions",
"confirm-changes": "Confirm changes",
"join-as-a-member": "Join as a Member",
"all-addresses": "All addresses",
"for-airdrops": "For airdrops",