chore(wallet): feature flag graph and hide about action button (#19832)

This commit is contained in:
Jamie Caprani 2024-05-06 15:14:26 +02:00 committed by GitHub
parent 5fc9722992
commit 5802097f5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 91 additions and 78 deletions

View File

@ -1,13 +1,9 @@
(ns quo.components.buttons.wallet-ctas.style) (ns quo.components.buttons.wallet-ctas.style)
(def container (def inner-container
{:padding-top 24 {:flex-direction :row
:padding-bottom 12 :justify-content :center
:padding-horizontal 20 :flex 1})
:flex-direction :row
:justify-content :center
:flex 1
:max-height 106})
(def button-container (def button-container
{:padding-vertical 8 {:padding-vertical 8

View File

@ -24,30 +24,31 @@
:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}} text]]) :color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}} text]])
(defn view (defn view
[{:keys [buy-action send-action receive-action bridge-action]}] [{:keys [buy-action send-action receive-action bridge-action container-style]}]
(let [theme (quo.theme/use-theme)] (let [theme (quo.theme/use-theme)]
[rn/view {:style style/container} [rn/view {:style container-style}
[action-button [rn/view {:style style/inner-container}
{:icon :i/add [action-button
:text (i18n/label :t/buy) {:icon :i/add
:on-press buy-action :text (i18n/label :t/buy)
:theme theme :on-press buy-action
:accessibility-label :buy}] :theme theme
[action-button :accessibility-label :buy}]
{:icon :i/send [action-button
:text (i18n/label :t/send) {:icon :i/send
:on-press send-action :text (i18n/label :t/send)
:theme theme :on-press send-action
:accessibility-label :send}] :theme theme
[action-button :accessibility-label :send}]
{:icon :i/receive [action-button
:text (i18n/label :t/receive) {:icon :i/receive
:on-press receive-action :text (i18n/label :t/receive)
:theme theme :on-press receive-action
:accessibility-label :receive}] :theme theme
[action-button :accessibility-label :receive}]
{:icon :i/bridge [action-button
:text (i18n/label :t/bridge) {:icon :i/bridge
:on-press bridge-action :text (i18n/label :t/bridge)
:theme theme :on-press bridge-action
:accessibility-label :bridge}]])) :theme theme
:accessibility-label :bridge}]]]))

View File

@ -62,7 +62,7 @@
[icons/icon [icons/icon
:i/keycard-card :i/keycard-card
{:color secondary-color}])]] {:color secondary-color}])]]
(when (= :derivation-path type) (when (and on-press (= :derivation-path type))
[rn/pressable [rn/pressable
{:accessibility-label :derivation-path-button {:accessibility-label :derivation-path-button
:on-press on-press :on-press on-press

View File

@ -3,12 +3,9 @@
[quo.foundations.colors :as colors])) [quo.foundations.colors :as colors]))
(def account-overview-wrapper (def account-overview-wrapper
{:padding-top 24 {:height 110
:padding-horizontal 20 :align-items :center
:padding-bottom 20 :justify-content :center})
:height 130
:align-items :center
:justify-content :center})
(defn account-name (defn account-name
[color] [color]

View File

@ -96,12 +96,12 @@
(defn- view-internal (defn- view-internal
[{:keys [state account time-frame time-frame-string time-frame-to-string account-name current-value [{:keys [state account time-frame time-frame-string time-frame-to-string account-name current-value
percentage-change currency-change metrics customization-color] percentage-change currency-change metrics customization-color container-style]
:or {customization-color :blue}}] :or {customization-color :blue}}]
(let [theme (quo.theme/use-theme) (let [theme (quo.theme/use-theme)
time-frame-string (time-string time-frame time-frame-string) time-frame-string (time-string time-frame time-frame-string)
up? (= metrics :positive)] up? (= metrics :positive)]
[rn/view {:style style/account-overview-wrapper} [rn/view {:style (merge container-style style/account-overview-wrapper)}
(if (= :loading state) (if (= :loading state)
[loading-state (colors/theme-colors colors/neutral-5 colors/neutral-90 theme)] [loading-state (colors/theme-colors colors/neutral-5 colors/neutral-90 theme)]
[rn/view [rn/view

View File

@ -7,7 +7,11 @@
[] []
[preview/preview-container {} [preview/preview-container {}
[quo/wallet-ctas [quo/wallet-ctas
{:buy-action #(js/alert "Buy button pressed") {:container-style {:padding-top 24
:send-action #(js/alert "Send button pressed") :padding-bottom 12
:receive-action #(js/alert "Receive button pressed") :padding-horizontal 20
:bridge-action #(js/alert "Bridge button pressed")}]]) :flex-direction :row}
:buy-action #(js/alert "Buy button pressed")
:send-action #(js/alert "Send button pressed")
:receive-action #(js/alert "Receive button pressed")
:bridge-action #(js/alert "Bridge button pressed")}]])

View File

@ -50,7 +50,10 @@
:time-frame-string "16 May" :time-frame-string "16 May"
:time-frame-to-string "25 May" :time-frame-to-string "25 May"
:account :default :account :default
:customization-color :blue})] :customization-color :blue
:container-style {:padding-top 24
:padding-horizontal 20
:padding-bottom 20}})]
(fn [] (fn []
[preview/preview-container [preview/preview-container
{:state state {:state state

View File

@ -3,3 +3,13 @@
(def tabs (def tabs
{:padding-left 20 {:padding-left 20
:padding-vertical 12}) :padding-vertical 12})
(def cta-buttons
{:padding-horizontal 20
:padding-bottom 13
:flex-direction :row})
(def account-overview
{:padding-top 60
:margin-bottom 12
:padding-horizontal 20})

View File

@ -96,5 +96,4 @@
:profile-picture (profile.utils/photo profile) :profile-picture (profile.utils/photo profile)
:customization-color customization-color :customization-color customization-color
:derivation-path path :derivation-path path
:keypair-name keypair-name :keypair-name keypair-name}])]))
:on-press #(js/alert "To be implemented")}])]))

View File

@ -33,22 +33,25 @@
{:type :wallet-networks {:type :wallet-networks
:on-press #(rf/dispatch [:wallet/close-account-page])}] :on-press #(rf/dispatch [:wallet/close-account-page])}]
[quo/account-overview [quo/account-overview
{:current-value formatted-balance {:container-style style/account-overview
:current-value formatted-balance
:account-name name :account-name name
:account (if watch-only? :watched-address :default) :account (if watch-only? :watched-address :default)
:customization-color color}] :customization-color color}]
[quo/wallet-graph {:time-frame :empty}] (when (ff/enabled? ::ff/wallet.graph) [quo/wallet-graph {:time-frame :empty}])
(when (not watch-only?) (when (not watch-only?)
[quo/wallet-ctas [quo/wallet-ctas
{:send-action (fn [] {:container-style style/cta-buttons
(rf/dispatch [:wallet/clean-send-data]) :send-action (fn []
(rf/dispatch [:wallet/wizard-navigate-forward (rf/dispatch [:wallet/clean-send-data])
{:start-flow? true (rf/dispatch [:wallet/wizard-navigate-forward
:flow-id :wallet-flow}])) {:start-flow? true
:receive-action #(rf/dispatch [:open-modal :screen/wallet.share-address {:status :receive}]) :flow-id :wallet-flow}]))
:buy-action #(rf/dispatch [:show-bottom-sheet :receive-action #(rf/dispatch [:open-modal :screen/wallet.share-address
{:content buy-token/view}]) {:status :receive}])
:bridge-action #(rf/dispatch [:wallet/start-bridge])}]) :buy-action #(rf/dispatch [:show-bottom-sheet
{:content buy-token/view}])
:bridge-action #(rf/dispatch [:wallet/start-bridge])}])
[quo/tabs [quo/tabs
{:style style/tabs {:style style/tabs
:size 32 :size 32

View File

@ -7,13 +7,10 @@
:padding-top 8 :padding-top 8
:padding-bottom 12}) :padding-bottom 12})
(def overview-container
{:height 86})
(def accounts-list (def accounts-list
{:padding-top 32 {:padding-top 8
:padding-bottom 12 :padding-bottom 16
:max-height 112}) :flex-grow 0})
(def accounts-list-container (def accounts-list-container
{:padding-horizontal 20}) {:padding-horizontal 20})

View File

@ -6,6 +6,7 @@
[status-im.contexts.wallet.home.style :as style] [status-im.contexts.wallet.home.style :as style]
[status-im.contexts.wallet.home.tabs.view :as tabs] [status-im.contexts.wallet.home.tabs.view :as tabs]
[status-im.contexts.wallet.sheets.network-filter.view :as network-filter] [status-im.contexts.wallet.sheets.network-filter.view :as network-filter]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
@ -32,7 +33,9 @@
(def tabs-data (def tabs-data
[{:id :assets :label (i18n/label :t/assets) :accessibility-label :assets-tab} [{:id :assets :label (i18n/label :t/assets) :accessibility-label :assets-tab}
{:id :collectibles :label (i18n/label :t/collectibles) :accessibility-label :collectibles-tab}]) {:id :collectibles :label (i18n/label :t/collectibles) :accessibility-label :collectibles-tab}
(when (ff/enabled? ::ff/wallet.home-activity)
{:id :activity :label (i18n/label :t/activity) :accessibility-label :activity-tab})])
(defn view (defn view
[] []
@ -52,7 +55,7 @@
[(count cards)]) [(count cards)])
[rn/view {:style (style/home-container)} [rn/view {:style (style/home-container)}
[common.top-nav/view] [common.top-nav/view]
[rn/view {:style style/overview-container} [rn/view
[quo/wallet-overview [quo/wallet-overview
{:state (if tokens-loading? :loading :default) {:state (if tokens-loading? :loading :default)
:time-frame :none :time-frame :none
@ -60,7 +63,7 @@
:balance formatted-balance :balance formatted-balance
:networks networks :networks networks
:dropdown-on-press #(rf/dispatch [:show-bottom-sheet {:content network-filter/view}])}]] :dropdown-on-press #(rf/dispatch [:show-bottom-sheet {:content network-filter/view}])}]]
[quo/wallet-graph {:time-frame :empty}] (when (ff/enabled? ::ff/wallet.graph) [quo/wallet-graph {:time-frame :empty}])
[rn/flat-list [rn/flat-list
{:ref #(reset! account-list-ref %) {:ref #(reset! account-list-ref %)
:style style/accounts-list :style style/accounts-list

View File

@ -10,17 +10,17 @@
(defonce ^:private feature-flags-config (defonce ^:private feature-flags-config
(reagent/atom (reagent/atom
{::wallet.bridge-token (enabled-in-env? :FLAG_BRIDGE_TOKEN_ENABLED) {::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED)
::wallet.activities (enabled-in-env? :FLAG_WALLET_ACTIVITY_ENABLED)
::wallet.assets-modal-hide (enabled-in-env? :FLAG_ASSETS_MODAL_HIDE)
::wallet.assets-modal-manage-tokens (enabled-in-env? :FLAG_ASSETS_MODAL_MANAGE_TOKENS)
::wallet.bridge-token (enabled-in-env? :FLAG_BRIDGE_TOKEN_ENABLED)
::wallet.contacts (enabled-in-env? :FLAG_CONTACTS_ENABLED)
::wallet.edit-derivation-path (enabled-in-env? :FLAG_EDIT_DERIVATION_PATH) ::wallet.edit-derivation-path (enabled-in-env? :FLAG_EDIT_DERIVATION_PATH)
::wallet.remove-account (enabled-in-env? :FLAG_REMOVE_ACCOUNT_ENABLED) ::wallet.graph (enabled-in-env? :FLAG_GRAPH_ENABLED)
::wallet.import-private-key (enabled-in-env? :FLAG_IMPORT_PRIVATE_KEY_ENABLED) ::wallet.import-private-key (enabled-in-env? :FLAG_IMPORT_PRIVATE_KEY_ENABLED)
::wallet.long-press-watch-only-asset (enabled-in-env? :FLAG_LONG_PRESS_WATCH_ONLY_ASSET_ENABLED) ::wallet.long-press-watch-only-asset (enabled-in-env? :FLAG_LONG_PRESS_WATCH_ONLY_ASSET_ENABLED)
::wallet.assets-modal-manage-tokens (enabled-in-env? :FLAG_ASSETS_MODAL_MANAGE_TOKENS) ::wallet.wallet-connect (enabled-in-env? :FLAG_WALLET_CONNECT_ENABLED)}))
::wallet.assets-modal-hide (enabled-in-env? :FLAG_ASSETS_MODAL_HIDE)
::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED)
::wallet.contacts (enabled-in-env? :FLAG_CONTACTS_ENABLED)
::wallet.wallet-connect (enabled-in-env? :FLAG_WALLET_CONNECT_ENABLED)
::wallet.activities (enabled-in-env? :FLAG_WALLET_ACTIVITY_ENABLED)}))
(defn feature-flags [] @feature-flags-config) (defn feature-flags [] @feature-flags-config)