Communities: Present the list of airdrop addresses (#18189)

Co-authored-by: Flavio Fraschetti <frasqueti@gmail.com>
Co-authored-by: Ajay Sivan <ajayesivan@gmail.com>
This commit is contained in:
Flavio Fraschetti 2023-12-21 06:27:59 -03:00 committed by GitHub
parent 60dfd6ce78
commit e59e34d0da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 5 deletions

View File

@ -3,7 +3,6 @@
[quo.core :as quo]
[react-native.core :as rn]
[react-native.gesture :as gesture]
[status-im.common.not-implemented :as not-implemented]
[status-im.common.password-authentication.view :as password-authentication]
[status-im.contexts.communities.actions.accounts-selection.style :as style]
[status-im.contexts.communities.actions.community-rules.view :as community-rules]
@ -58,7 +57,6 @@
:weight :semi-bold
:size :paragraph-1}
(i18n/label :t/address-to-share)]
[quo/category
{:list-type :settings
:data [{:title (i18n/label :t/join-as-a-member)
@ -71,14 +69,14 @@
:data accounts}
:description-props {:text (i18n/label :t/all-addresses)}}
{:title (i18n/label :t/for-airdrops)
:on-press not-implemented/alert
:on-press #(rf/dispatch [:open-modal :airdrop-addresses
{:community-id id}])
:description :text
:action :arrow
:label :preview
:label-props {:type :accounts
:data (take 1 accounts)}
:data [(first accounts)]}
:description-props {:text (-> accounts first :name)}}]}]
[quo/text
{:style style/section-title
:accessibility-label :community-rules-title

View File

@ -0,0 +1,6 @@
(ns status-im.contexts.communities.actions.airdrop-addresses.style)
(def account-list-container
{:flex 1
:padding-top 12
:padding-bottom 8})

View File

@ -0,0 +1,46 @@
(ns status-im.contexts.communities.actions.airdrop-addresses.view
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im.common.not-implemented :as not-implemented]
[status-im.contexts.communities.actions.airdrop-addresses.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- render-item
[item]
[quo/account-item
{:account-props item
:emoji (:emoji item)}])
(defn- accounts-list
[{:keys [accounts]}]
[rn/view {:style style/account-list-container}
(when (seq accounts)
[rn/flat-list
{:data accounts
:render-fn render-item
:key-fn :address}])])
(defn view
[]
(let [{id :community-id} (rf/sub [:get-screen-params])
{:keys [name images color]} (rf/sub [:communities/community id])
logo-uri (get-in images [:thumbnail :uri])
accounts (->> (rf/sub [:wallet])
:accounts
vals
(map #(assoc % :customization-color (:color %))))]
[:<>
[quo/drawer-top
{:type :context-tag
:title (i18n/label :t/airdrop-addresses)
:community-name name
:button-icon :i/info
:on-button-press not-implemented/alert
:community-logo (get-in images [:thumbnail :uri])
:customization-color color}]
[accounts-list
{:accounts accounts
:logo-uri logo-uri
:community-name name}]]))

View File

@ -13,6 +13,7 @@
[status-im.contexts.communities.actions.accounts-selection.view :as communities.accounts-selection]
[status-im.contexts.communities.actions.addresses-for-permissions.view :as
addresses-for-permissions]
[status-im.contexts.communities.actions.airdrop-addresses.view :as airdrop-addresses]
[status-im.contexts.communities.actions.request-to-join.view :as join-menu]
[status-im.contexts.communities.discover.view :as communities.discover]
[status-im.contexts.communities.overview.view :as communities.overview]
@ -104,6 +105,10 @@
:options {:sheet? true}
:component addresses-for-permissions/view}
{:name :airdrop-addresses
:options {:sheet? true}
:component airdrop-addresses/view}
{:name :lightbox
:options options/lightbox
:component lightbox/lightbox}

View File

@ -180,6 +180,7 @@
"address-to-share": "Addresses to share",
"addresses-for-permissions": "Addresses for permissions",
"confirm-changes": "Confirm changes",
"airdrop-addresses": "Address for airdrops",
"join-as-a-member": "Join as a Member",
"all-addresses": "All addresses",
"for-airdrops": "For airdrops",