Skip to content

Commit

Permalink
Community: Request to join - Show addresses shared (#18180)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayesivan authored Dec 15, 2023
1 parent 2a5c102 commit 5507ae4
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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})
Original file line number Diff line number Diff line change
@@ -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)]]]))
7 changes: 6 additions & 1 deletion src/status_im2/navigation/screens.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -352,4 +358,3 @@

(when config/quo-preview-enabled?
status-im-preview/main-screens)))

2 changes: 2 additions & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5507ae4

Please sign in to comment.