-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
airdop-addresses refactor and code review
- Loading branch information
Showing
7 changed files
with
62 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/status_im/contexts/communities/actions/airdrop_addresses/style.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}) |
47 changes: 47 additions & 0 deletions
47
src/status_im/contexts/communities/actions/airdrop_addresses/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
(ns status-im.contexts.communities.actions.airdrop-addresses.view | ||
(:require | ||
[quo.components.list-items.account.view :as account-view] | ||
[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] | ||
[account-view/view | ||
{: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}]])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
src/status_im2/contexts/communities/actions/airdrop_addresses/style.cljs
This file was deleted.
Oops, something went wrong.
55 changes: 0 additions & 55 deletions
55
src/status_im2/contexts/communities/actions/airdrop_addresses/view.cljs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters