Skip to content

Commit

Permalink
chore(wallet): feature flag graph and hide about action button
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Son89 committed Apr 30, 2024
1 parent 2ec6a3e commit ad88004
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 76 deletions.
12 changes: 4 additions & 8 deletions src/quo/components/buttons/wallet_ctas/style.cljs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
(ns quo.components.buttons.wallet-ctas.style)

(def container
{:padding-top 24
:padding-bottom 12
:padding-horizontal 20
:flex-direction :row
:justify-content :center
:flex 1
:max-height 106})
(def inner-container
{:flex-direction :row
:justify-content :center
:flex 1})

(def button-container
{:padding-vertical 8
Expand Down
53 changes: 27 additions & 26 deletions src/quo/components/buttons/wallet_ctas/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,31 @@
:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}} text]])

(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)]
[rn/view {:style style/container}
[action-button
{:icon :i/add
:text (i18n/label :t/buy)
:on-press buy-action
:theme theme
:accessibility-label :buy}]
[action-button
{:icon :i/send
:text (i18n/label :t/send)
:on-press send-action
:theme theme
:accessibility-label :send}]
[action-button
{:icon :i/receive
:text (i18n/label :t/receive)
:on-press receive-action
:theme theme
:accessibility-label :receive}]
[action-button
{:icon :i/bridge
:text (i18n/label :t/bridge)
:on-press bridge-action
:theme theme
:accessibility-label :bridge}]]))
[rn/view {:style container-style}
[rn/view {:style style/inner-container}
[action-button
{:icon :i/add
:text (i18n/label :t/buy)
:on-press buy-action
:theme theme
:accessibility-label :buy}]
[action-button
{:icon :i/send
:text (i18n/label :t/send)
:on-press send-action
:theme theme
:accessibility-label :send}]
[action-button
{:icon :i/receive
:text (i18n/label :t/receive)
:on-press receive-action
:theme theme
:accessibility-label :receive}]
[action-button
{:icon :i/bridge
:text (i18n/label :t/bridge)
:on-press bridge-action
:theme theme
:accessibility-label :bridge}]]]))
2 changes: 1 addition & 1 deletion src/quo/components/wallet/account_origin/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
[icons/icon
:i/keycard-card
{:color secondary-color}])]]
(when (= :derivation-path type)
(when (and on-press (= :derivation-path type))
[rn/pressable
{:accessibility-label :derivation-path-button
:on-press on-press
Expand Down
9 changes: 3 additions & 6 deletions src/quo/components/wallet/account_overview/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
[quo.foundations.colors :as colors]))

(def account-overview-wrapper
{:padding-top 24
:padding-horizontal 20
:padding-bottom 20
:height 130
:align-items :center
:justify-content :center})
{:height 110
:align-items :center
:justify-content :center})

(defn account-name
[color]
Expand Down
4 changes: 2 additions & 2 deletions src/quo/components/wallet/account_overview/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@

(defn- view-internal
[{: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}}]
(let [theme (quo.theme/use-theme)
time-frame-string (time-string time-frame time-frame-string)
up? (= metrics :positive)]
[rn/view {:style style/account-overview-wrapper}
[rn/view {:style (merge container-style style/account-overview-wrapper)}
(if (= :loading state)
[loading-state (colors/theme-colors colors/neutral-5 colors/neutral-90 theme)]
[rn/view
Expand Down
12 changes: 8 additions & 4 deletions src/status_im/contexts/preview/quo/buttons/wallet_ctas.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
[]
[preview/preview-container {}
[quo/wallet-ctas
{: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")}]])
{:container-style {:padding-top 24
:padding-bottom 12
:padding-horizontal 20
: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")}]])
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@
:time-frame-string "16 May"
:time-frame-to-string "25 May"
:account :default
:customization-color :blue})]
:customization-color :blue
:container-style {:padding-top 24
:padding-horizontal 20
:padding-bottom 20}})]
(fn []
[preview/preview-container
{:state state
Expand Down
10 changes: 10 additions & 0 deletions src/status_im/contexts/wallet/account/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@
(def tabs
{:padding-left 20
: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})
3 changes: 1 addition & 2 deletions src/status_im/contexts/wallet/account/tabs/about/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,4 @@
:profile-picture (profile.utils/photo profile)
:customization-color customization-color
:derivation-path path
:keypair-name keypair-name
:on-press #(js/alert "To be implemented")}])]))
:keypair-name keypair-name}])]))
26 changes: 15 additions & 11 deletions src/status_im/contexts/wallet/account/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[status-im.contexts.wallet.account.tabs.view :as tabs]
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
[status-im.contexts.wallet.sheets.buy-token.view :as buy-token]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

Expand All @@ -31,22 +32,25 @@
{:type :wallet-networks
:on-press #(rf/dispatch [:wallet/close-account-page])}]
[quo/account-overview
{:current-value formatted-balance
{:container-style style/account-overview
:current-value formatted-balance
:account-name name
:account (if watch-only? :watched-address :default)
: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?)
[quo/wallet-ctas
{:send-action (fn []
(rf/dispatch [:wallet/clean-send-data])
(rf/dispatch [:wallet/wizard-navigate-forward
{:start-flow? true
:flow-id :wallet-flow}]))
:receive-action #(rf/dispatch [:open-modal :screen/wallet.share-address {:status :receive}])
:buy-action #(rf/dispatch [:show-bottom-sheet
{:content buy-token/view}])
:bridge-action #(rf/dispatch [:wallet/start-bridge])}])
{:container-style style/cta-buttons
:send-action (fn []
(rf/dispatch [:wallet/clean-send-data])
(rf/dispatch [:wallet/wizard-navigate-forward
{:start-flow? true
:flow-id :wallet-flow}]))
:receive-action #(rf/dispatch [:open-modal :screen/wallet.share-address
{:status :receive}])
:buy-action #(rf/dispatch [:show-bottom-sheet
{:content buy-token/view}])
:bridge-action #(rf/dispatch [:wallet/start-bridge])}])
[quo/tabs
{:style style/tabs
:size 32
Expand Down
9 changes: 3 additions & 6 deletions src/status_im/contexts/wallet/home/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
:padding-top 8
:padding-bottom 12})

(def overview-container
{:height 86})

(def accounts-list
{:padding-top 32
:padding-bottom 12
:max-height 112})
{:padding-top 8
:padding-bottom 16
:flex-grow 0})

(def accounts-list-container
{:padding-horizontal 20})
Expand Down
8 changes: 5 additions & 3 deletions src/status_im/contexts/wallet/home/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[status-im.contexts.wallet.home.style :as style]
[status-im.contexts.wallet.home.tabs.view :as tabs]
[status-im.contexts.wallet.sheets.network-filter.view :as network-filter]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

Expand Down Expand Up @@ -33,7 +34,8 @@
(def tabs-data
[{:id :assets :label (i18n/label :t/assets) :accessibility-label :assets-tab}
{:id :collectibles :label (i18n/label :t/collectibles) :accessibility-label :collectibles-tab}
{:id :activity :label (i18n/label :t/activity) :accessibility-label :activity-tab}])
(when (ff/enabled? ::ff/wallet.home-activity)
{:id :activity :label (i18n/label :t/activity) :accessibility-label :activity-tab})])

(defn view
[]
Expand All @@ -53,15 +55,15 @@
[(count cards)])
[rn/view {:style (style/home-container)}
[common.top-nav/view]
[rn/view {:style style/overview-container}
[rn/view
[quo/wallet-overview
{:state (if tokens-loading? :loading :default)
:time-frame :none
:metrics :none
:balance formatted-balance
:networks networks
: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
{:ref #(reset! account-list-ref %)
:style style/accounts-list
Expand Down
13 changes: 7 additions & 6 deletions src/status_im/feature_flags.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@

(defonce ^:private feature-flags-config
(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.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.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.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.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.remove-account (enabled-in-env? :FLAG_REMOVE_ACCOUNT_ENABLED)}))

(defn feature-flags [] @feature-flags-config)

Expand Down

0 comments on commit ad88004

Please sign in to comment.