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:
parent
60dfd6ce78
commit
e59e34d0da
|
@ -3,7 +3,6 @@
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[react-native.gesture :as gesture]
|
[react-native.gesture :as gesture]
|
||||||
[status-im.common.not-implemented :as not-implemented]
|
|
||||||
[status-im.common.password-authentication.view :as password-authentication]
|
[status-im.common.password-authentication.view :as password-authentication]
|
||||||
[status-im.contexts.communities.actions.accounts-selection.style :as style]
|
[status-im.contexts.communities.actions.accounts-selection.style :as style]
|
||||||
[status-im.contexts.communities.actions.community-rules.view :as community-rules]
|
[status-im.contexts.communities.actions.community-rules.view :as community-rules]
|
||||||
|
@ -58,7 +57,6 @@
|
||||||
:weight :semi-bold
|
:weight :semi-bold
|
||||||
:size :paragraph-1}
|
:size :paragraph-1}
|
||||||
(i18n/label :t/address-to-share)]
|
(i18n/label :t/address-to-share)]
|
||||||
|
|
||||||
[quo/category
|
[quo/category
|
||||||
{:list-type :settings
|
{:list-type :settings
|
||||||
:data [{:title (i18n/label :t/join-as-a-member)
|
:data [{:title (i18n/label :t/join-as-a-member)
|
||||||
|
@ -71,14 +69,14 @@
|
||||||
:data accounts}
|
:data accounts}
|
||||||
:description-props {:text (i18n/label :t/all-addresses)}}
|
:description-props {:text (i18n/label :t/all-addresses)}}
|
||||||
{:title (i18n/label :t/for-airdrops)
|
{:title (i18n/label :t/for-airdrops)
|
||||||
:on-press not-implemented/alert
|
:on-press #(rf/dispatch [:open-modal :airdrop-addresses
|
||||||
|
{:community-id id}])
|
||||||
:description :text
|
:description :text
|
||||||
:action :arrow
|
:action :arrow
|
||||||
:label :preview
|
:label :preview
|
||||||
:label-props {:type :accounts
|
:label-props {:type :accounts
|
||||||
:data (take 1 accounts)}
|
:data [(first accounts)]}
|
||||||
:description-props {:text (-> accounts first :name)}}]}]
|
:description-props {:text (-> accounts first :name)}}]}]
|
||||||
|
|
||||||
[quo/text
|
[quo/text
|
||||||
{:style style/section-title
|
{:style style/section-title
|
||||||
:accessibility-label :community-rules-title
|
:accessibility-label :community-rules-title
|
||||||
|
|
|
@ -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})
|
|
@ -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}]]))
|
|
@ -13,6 +13,7 @@
|
||||||
[status-im.contexts.communities.actions.accounts-selection.view :as communities.accounts-selection]
|
[status-im.contexts.communities.actions.accounts-selection.view :as communities.accounts-selection]
|
||||||
[status-im.contexts.communities.actions.addresses-for-permissions.view :as
|
[status-im.contexts.communities.actions.addresses-for-permissions.view :as
|
||||||
addresses-for-permissions]
|
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.actions.request-to-join.view :as join-menu]
|
||||||
[status-im.contexts.communities.discover.view :as communities.discover]
|
[status-im.contexts.communities.discover.view :as communities.discover]
|
||||||
[status-im.contexts.communities.overview.view :as communities.overview]
|
[status-im.contexts.communities.overview.view :as communities.overview]
|
||||||
|
@ -104,6 +105,10 @@
|
||||||
:options {:sheet? true}
|
:options {:sheet? true}
|
||||||
:component addresses-for-permissions/view}
|
:component addresses-for-permissions/view}
|
||||||
|
|
||||||
|
{:name :airdrop-addresses
|
||||||
|
:options {:sheet? true}
|
||||||
|
:component airdrop-addresses/view}
|
||||||
|
|
||||||
{:name :lightbox
|
{:name :lightbox
|
||||||
:options options/lightbox
|
:options options/lightbox
|
||||||
:component lightbox/lightbox}
|
:component lightbox/lightbox}
|
||||||
|
|
|
@ -180,6 +180,7 @@
|
||||||
"address-to-share": "Addresses to share",
|
"address-to-share": "Addresses to share",
|
||||||
"addresses-for-permissions": "Addresses for permissions",
|
"addresses-for-permissions": "Addresses for permissions",
|
||||||
"confirm-changes": "Confirm changes",
|
"confirm-changes": "Confirm changes",
|
||||||
|
"airdrop-addresses": "Address for airdrops",
|
||||||
"join-as-a-member": "Join as a Member",
|
"join-as-a-member": "Join as a Member",
|
||||||
"all-addresses": "All addresses",
|
"all-addresses": "All addresses",
|
||||||
"for-airdrops": "For airdrops",
|
"for-airdrops": "For airdrops",
|
||||||
|
|
Loading…
Reference in New Issue