Wallet: Activity Tab (#17643)

* Wallet: activity tab
This commit is contained in:
Omar Basem 2023-10-17 08:00:22 +04:00 committed by GitHub
parent 7ae96e86f1
commit be6b02304b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 122 additions and 32 deletions

View File

@ -4,6 +4,8 @@
[react-native.core :as rn]
[status-im2.contexts.wallet.account.tabs.about.view :as about]
[status-im2.contexts.wallet.account.tabs.dapps.view :as dapps]
[status-im2.contexts.wallet.common.activity-tab.view :as activity]
[status-im2.contexts.wallet.common.collectibles-tab.view :as collectibles]
[status-im2.contexts.wallet.common.empty-tab.view :as empty-tab]
[status-im2.contexts.wallet.common.temp :as temp]
[utils.i18n :as i18n]))
@ -15,19 +17,11 @@
{:render-fn quo/token-value
:data temp/tokens
:content-container-style {:padding-horizontal 8}}]
:collectibles [empty-tab/view
{:title (i18n/label :t/no-collectibles)
:description (i18n/label :t/no-collectibles-description)
:placeholder? true}]
:activity [empty-tab/view
{:title (i18n/label :t/no-activity)
:description (i18n/label :t/empty-tab-description)
:placeholder? true}]
:collectibles [collectibles/view]
:activity [activity/view]
:permissions [empty-tab/view
{:title (i18n/label :t/no-permissions)
:description (i18n/label :t/no-collectibles-description)
:placeholder? true}]
:dapps [dapps/view]
[about/view]))

View File

@ -0,0 +1,28 @@
(ns status-im2.contexts.wallet.common.activity-tab.view
(:require
[quo2.core :as quo]
[react-native.core :as rn]
[status-im2.contexts.wallet.common.empty-tab.view :as empty-tab]
[status-im2.contexts.wallet.common.temp :as temp]
[utils.i18n :as i18n]))
(defn activity-item
[item]
[:<>
[quo/divider-date (:date item)]
[quo/wallet-activity
(merge {:on-press #(js/alert "Item pressed")}
item)]])
(defn view
[]
(let [activity-list temp/activity-list]
(if (empty? activity-list)
[empty-tab/view
{:title (i18n/label :t/no-activity)
:description (i18n/label :t/empty-tab-description)
:placeholder? true}]
[rn/flat-list
{:data activity-list
:style {:flex 1}
:render-fn activity-item}])))

View File

@ -0,0 +1,27 @@
(ns status-im2.contexts.wallet.common.collectibles-tab.view
(:require
[quo2.core :as quo]
[react-native.core :as rn]
[status-im2.contexts.wallet.common.empty-tab.view :as empty-tab]
[status-im2.contexts.wallet.common.temp :as temp]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn view
[]
(let [collectible-list temp/collectible-list]
(if (empty? collectible-list)
[empty-tab/view
{:title (i18n/label :t/no-collectibles)
:description (i18n/label :t/no-collectibles-description)
:placeholder? true}]
[rn/flat-list
{:data collectible-list
:style {:flex 1}
:content-container-style {:align-items :center}
:num-columns 2
:render-fn (fn [item] [quo/collectible
{:images (repeat 1 item)
:on-press #(rf/dispatch [:navigate-to
:wallet-collectible])}])}])))

View File

@ -201,3 +201,62 @@
:name "My savings"
:address "0x43c...98d"
:networks [{:name :ethereum :short :eth}]}])
(def asset-snt
{:size 24
:type :token
:token-name "SNT"
:amount 1500
:token-logo (quo.resources/get-token :snt)})
(def piggy-bank
{:size 24
:type :account
:account-name "Piggy bank"
:emoji "🐷"})
(def aretha-gosling
{:size 24
:type :default
:full-name "Aretha Gosling"
:profile-picture (status.resources/mock-images :user-picture-female2)})
(def mainnet
{:size 24
:type :network
:network-logo (quo.resources/get-network :ethereum)
:network-name "Mainnet"})
(def activity-list
[{:date "Today"
:transaction :send
:timestamp "Today 22:20"
:status :pending
:counter 1
:first-tag asset-snt
:second-tag-prefix :t/from
:second-tag piggy-bank
:third-tag-prefix :t/to
:third-tag aretha-gosling
:fourth-tag-prefix :t/via
:fourth-tag mainnet
:blur? false}
{:date "Yesterday"
:transaction :receive
:timestamp "Yesterday 22:20"
:status :pending
:counter 1
:first-tag asset-snt
:second-tag-prefix :t/from
:second-tag piggy-bank
:third-tag-prefix :t/to
:third-tag aretha-gosling
:fourth-tag-prefix :t/via
:fourth-tag mainnet
:blur? false}])
(def collectible-list
[(status.resources/get-mock-image :collectible1)
(status.resources/get-mock-image :collectible2)
(status.resources/get-mock-image :collectible3)
(status.resources/get-mock-image :collectible4)])

View File

@ -5,6 +5,8 @@
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im2.common.home.top-nav.view :as common.top-nav]
[status-im2.contexts.wallet.common.activity-tab.view :as activity]
[status-im2.contexts.wallet.common.collectibles-tab.view :as collectibles]
[status-im2.contexts.wallet.common.temp :as temp]
[status-im2.contexts.wallet.home.style :as style]
[utils.i18n :as i18n]
@ -76,25 +78,5 @@
:data temp/tokens
:key :assets-list
:content-container-style {:padding-horizontal 8}}]
:collectibles (if temp/collectible-details
[rn/flat-list
{:render-fn (fn [item]
[quo/collectible
{:images [(:image item)]
:on-press #(rf/dispatch [:navigate-to
:wallet-collectible])}])
:data temp/collectibles
:key :collectibles-list
:key-fn :id
:num-columns 2
:content-container-style {:padding-horizontal 8}}]
[quo/empty-state
{:title (i18n/label :t/no-collectibles)
:description (i18n/label :t/no-collectibles-description)
:placeholder? true
:container-style style/empty-container-style}])
[quo/empty-state
{:title (i18n/label :t/no-activity)
:description (i18n/label :t/empty-tab-description)
:placeholder? true
:container-style style/empty-container-style}])])))
:collectibles [collectibles/view]
[activity/view])])))