Compare commits

..
Author SHA1 Message Date
Omar Basem cc176bf04c update 2023-08-24 12:13:03 +04:00
Omar Basem 54c16d813c updates 2023-08-24 12:11:40 +04:00
Omar Basem 42cc5a86ea fix composer 2023-08-23 21:42:04 +04:00
Omar Basem 3223c71526 Feat: wallet empty account UI (#17077)
* feat: wallet account empty
2023-08-23 21:10:46 +04:00
Omar Basem 914604bbe4 UI Fix: wallet graph gradient (#17093)
* fix: wallet graph gradient
2023-08-23 20:19:19 +04:00
18 changed files with 212 additions and 114 deletions
@@ -4,7 +4,10 @@
{:padding-top 24
:padding-bottom 12
:padding-horizontal 20
:flex-direction :row})
:flex-direction :row
:justify-content :center
:flex 1
:max-height 106})
(def button-container
{:padding-vertical 8
@@ -24,3 +24,8 @@
{:color colors/white}))
(def button-container {:margin-top 20})
(def image-placeholder
{:width 80
:height 80
:background-color colors/danger})
@@ -7,14 +7,16 @@
[quo2.theme :as theme]))
(defn- empty-state-internal
[{:keys [customization-color image title description blur?]
[{:keys [customization-color image title description blur? placeholder? container-style]
upper-button :upper-button
lower-button :lower-button
:or {customization-color :blue}}]
[rn/view {:style styles/container}
[fast-image/fast-image
{:style styles/image
:source image}]
[rn/view {:style (merge styles/container container-style)}
(if placeholder?
[rn/view {:style styles/image-placeholder}]
[fast-image/fast-image
{:style styles/image
:source image}])
[rn/view {:style styles/text-container}
[text/text
{:style (styles/title blur?)
@@ -2,8 +2,11 @@
(:require [quo2.foundations.colors :as colors]))
(def gradient-background
{:height 294
:justify-content :flex-end})
{:height 294
:position :absolute
:left 0
:right 0
:bottom 0})
(def x-axis-label-text-style ; We need this to remove unnecessary bottom spacing from graph
{:margin-bottom -3
@@ -37,11 +37,12 @@
:style style/illustration}
[text/text {:style {:color colors/white}}
"Illustration here"]]
[linear-gradient/linear-gradient
{:colors gradient-colors
:start {:x 0 :y 1}
:end {:x 0 :y 0}
:style style/gradient-background}
[rn/view
[linear-gradient/linear-gradient
{:colors gradient-colors
:start {:x 0 :y 1}
:end {:x 0 :y 0}
:style style/gradient-background}]
[rn/view {:accessibility-label :line-chart}
[charts/line-chart
{:height 96
@@ -47,7 +47,7 @@
(defn- user-account
[{:keys [state name balance percentage-value loading? amount customization-color type emoji metrics?
theme]}]
theme on-press]}]
(let [watch-only? (= :watch-only type)
empty? (= :empty type)
account-amount (if (= :empty state) "€0.00" amount)
@@ -59,44 +59,45 @@
:type type
:theme theme
:metrics? metrics?}]
[:<>
[rn/view {:style (style/card customization-color watch-only? metrics? theme)}
[rn/view {:style style/profile-container}
[rn/view {:style {:padding-bottom 2 :margin-right 2}}
[text/text {:style style/emoji} emoji]]
[rn/view {:style style/watch-only-container}
[rn/pressable
{:style (style/card customization-color watch-only? metrics? theme)
:on-press on-press}
[rn/view {:style style/profile-container}
[rn/view {:style {:padding-bottom 2 :margin-right 2}}
[text/text {:style style/emoji} emoji]]
[rn/view {:style style/watch-only-container}
[text/text
{:size :paragraph-2
:weight :medium
:style (style/account-name watch-only? theme)}
account-name]
(when watch-only? [icon/icon :reveal {:color colors/neutral-50 :size 12}])]]
[text/text
{:size :heading-2
:weight :semi-bold
:style (style/account-value watch-only? theme)}
balance]
(when metrics?
[rn/view {:style style/metrics-container}
[text/text
{:size :paragraph-2
:weight :medium
:style (style/account-name watch-only? theme)}
account-name]
(when watch-only? [icon/icon :reveal {:color colors/neutral-50 :size 12}])]]
[text/text
{:size :heading-2
:weight :semi-bold
:style (style/account-value watch-only? theme)}
balance]
(when metrics?
[rn/view {:style style/metrics-container}
[text/text
{:weight :semi-bold
:size :paragraph-2
:accessibility-label :metrics
:style (style/metrics watch-only? theme)}
account-percentage]
(when (not empty?)
[:<>
[rn/view (style/separator watch-only? theme)]
[text/text
{:weight :semi-bold
:size :paragraph-2
:style (style/metrics watch-only? theme)} account-amount]
[rn/view {:style {:margin-left 4}}
[icon/icon :positive
{:color (if (and watch-only? (not (colors/dark?)))
colors/neutral-50
colors/white-opa-70)
:size 16}]]])])]])))
{:weight :semi-bold
:size :paragraph-2
:accessibility-label :metrics
:style (style/metrics watch-only? theme)}
account-percentage]
(when (not empty?)
[:<>
[rn/view (style/separator watch-only? theme)]
[text/text
{:weight :semi-bold
:size :paragraph-2
:style (style/metrics watch-only? theme)} account-amount]
[rn/view {:style {:margin-left 4}}
[icon/icon :positive
{:color (colors/theme-colors (if watch-only? colors/neutral-50 colors/white-opa-70)
colors/white-opa-70
theme)
:size 16}]]])])])))
(defn- add-account-view
[{:keys [on-press customization-color theme metrics?]}]
@@ -5,7 +5,7 @@
{:padding-top 24
:padding-horizontal 20
:padding-bottom 20
:height 78
:height 130
:align-items :center
:justify-content :center})
@@ -9,7 +9,9 @@
(defn- loading-state
[color]
[:<>
[rn/view
{:style {:height 130
:align-items :center}}
[rn/view
(style/loading-bar-margin-bottom {:color color
:width 104
@@ -99,7 +101,9 @@
{:style style/account-overview-wrapper}
(if (= :loading state)
[loading-state (colors/theme-colors colors/neutral-5 colors/neutral-90 theme)]
[:<>
[rn/view
{:style {:height 130
:align-items :center}}
[account-details account-name account theme]
[text/text
{:weight :semi-bold
+6 -10
View File
@@ -243,19 +243,15 @@
(rf/merge
cofx
{:json-rpc/call [{:method "wakuext_editMessage"
:params [{:id message-id
:text text
:content-type (if (message-content/emoji-only-content?
{:text text
:response-to quoted-message})
constants/content-type-emoji
constants/content-type-text)
:link-previews (map #(select-keys % [:url :title :description :thumbnail])
(get-in db [:chat/link-previews :unfurled]))}]
:params [{:id message-id
:text text
:content-type (if (message-content/emoji-only-content?
{:text text :response-to quoted-message})
constants/content-type-emoji
constants/content-type-text)}]
:js-response true
:on-error #(log/error "failed to edit message " %)
:on-success (fn [result]
(prn result "awpdkoawpodkawd")
(re-frame/dispatch [:sanitize-messages-and-process-response
result]))}]}
(link-preview/reset-unfurled)
@@ -11,7 +11,8 @@
(def ^:const composer-default-height (+ bar-container-height input-height actions-container-height))
(def ^:const line-height (:line-height typography/paragraph-1))
;(def ^:const line-height (:line-height typography/paragraph-1))
(def ^:const line-height 20.5)
(def ^:const multiline-minimized-height (+ input-height (if platform/ios? 18 line-height)))
@@ -69,10 +69,11 @@
[rn/touchable-without-feedback {:on-press rn/dismiss-keyboard!}
[rn/view {:padding-bottom 150}
[preview/customizer state descriptor]
[quo/wallet-graph
{:data (generate-data (:time-frame @state))
:state (:state @state)
:time-frame (:time-frame @state)}]]])))
[rn/view {:margin-top 300}
[quo/wallet-graph
{:data (generate-data (:time-frame @state))
:state (:state @state)
:time-frame (:time-frame @state)}]]]])))
(defn preview-wallet-graph
[]
@@ -0,0 +1,15 @@
(ns status-im2.contexts.wallet.account.style)
(def tabs
{:padding-left 20
:padding-vertical 12})
(def wip
{:justify-content :center
:align-items :center
:flex 1})
(def empty-container-style
{:justify-content :center
:flex 1
:margin-bottom 44})
@@ -0,0 +1,37 @@
(ns status-im2.contexts.wallet.account.tabs.view
(:require
[quo2.core :as quo]
[react-native.core :as rn]
[status-im2.contexts.wallet.account.style :as style]
[status-im2.contexts.wallet.common.temp :as temp]
[utils.i18n :as i18n]))
(defn view
[selected-tab]
(case selected-tab
:assets [rn/flat-list
{:render-fn quo/token-value
:data temp/tokens
:content-container-style {:padding-horizontal 8}}]
:collectibles [quo/empty-state
{:title (i18n/label :t/no-collectibles)
:description (i18n/label :t/no-collectibles-description)
:placeholder? true
:container-style style/empty-container-style}]
:activity [quo/empty-state
{:title (i18n/label :t/no-activity)
:description (i18n/label :t/empty-tab-description)
:placeholder? true
:container-style style/empty-container-style}]
:permissions [quo/empty-state
{:title (i18n/label :t/no-permissions)
:description (i18n/label :t/no-collectibles-description)
:placeholder? true
:container-style style/empty-container-style}]
:dapps [quo/empty-state
{:title (i18n/label :t/no-dapps)
:description (i18n/label :t/no-collectibles-description)
:placeholder? true
:container-style style/empty-container-style}]
[rn/view {:style style/wip}
[quo/text "[WIP]"]]))
@@ -1,15 +1,47 @@
(ns status-im2.contexts.wallet.account.view
(:require [react-native.core :as rn]
[quo2.core :as quo]
[utils.re-frame :as rf]))
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im2.contexts.wallet.common.temp :as temp]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[status-im2.contexts.wallet.account.style :as style]
[status-im2.contexts.wallet.account.tabs.view :as tabs]))
(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}
{:id :permissions :label (i18n/label :t/permissions) :accessibility-label :permissions}
{:id :dapps :label (i18n/label :t/dapps) :accessibility-label :dapps}
{:id :about :label (i18n/label :t/about) :accessibility-label :about}])
(defn view
[]
[rn/view
{:style {:flex 1
:align-items :center
:justify-content :center}}
[quo/text {} "ACCOUNTS PAGE"]
[quo/divider-label]
[quo/button {:on-press #(rf/dispatch [:navigate-back])}
"NAVIGATE BACK"]])
(let [top (safe-area/get-top)
selected-tab (reagent/atom (:id (first tabs-data)))]
(fn []
[rn/view
{:style {:flex 1
:margin-top top}}
[quo/page-nav
{:align-mid? true
:mid-section {:type :text-only :main-text ""}
:left-section {:type :grey
:icon :i/close
:on-press #(rf/dispatch [:navigate-back])}
:right-section-buttons [{:type :grey
:label "[WIP]"
:on-press #(rf/dispatch [:open-modal :how-to-pair])}]}]
[quo/account-overview temp/account-overview-state]
[quo/wallet-graph {:time-frame :empty}]
[quo/wallet-ctas]
[quo/tabs
{:style style/tabs
:size 32
:default-active @selected-tab
:data tabs-data
:on-change #(reset! selected-tab %)
:scrollable? true}]
[tabs/view @selected-tab]])))
@@ -1,4 +1,4 @@
(ns status-im2.contexts.wallet.home.temp
(ns status-im2.contexts.wallet.common.temp
(:require [quo2.core :as quo]
[react-native.core :as rn]
[utils.re-frame :as rf]))
@@ -36,7 +36,8 @@
:percentage-value "€0.00"
:customization-color :blue
:type :empty
:emoji "🍑"}
:emoji "🍑"
:on-press #(rf/dispatch [:navigate-to :wallet-accounts])}
{:customization-color :blue
:on-press #(js/alert "Button pressed")
:type :add-account}])
@@ -66,3 +67,9 @@
:fiat-value "€0.00"
:percentage-change "0.00"
:fiat-change "€0.00"}}])
(def account-overview-state
{:current-value "€0.00"
:account-name "Account 1"
:account :default
:customization-color :blue})
+6 -13
View File
@@ -1,24 +1,17 @@
(ns status-im2.contexts.wallet.home.style
(:require [quo2.foundations.colors :as colors]))
(ns status-im2.contexts.wallet.home.style)
(def tabs
{:padding-horizontal 20
:padding-top 8
:padding-bottom 12})
(def empty-container
{:justify-content :center
:align-items :center
:margin-bottom 44
:flex 1})
(def image-placeholder
{:width 80
:height 80
:background-color colors/danger})
(def accounts-list
{:padding-horizontal 20
:padding-top 32
:padding-bottom 12
:max-height 112})
(def empty-container-style
{:justify-content :center
:flex 1
:margin-bottom 44})
+11 -17
View File
@@ -8,27 +8,13 @@
[status-im2.contexts.wallet.home.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[status-im2.contexts.wallet.home.temp :as temp]))
[status-im2.contexts.wallet.common.temp :as temp]))
(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}])
(defn collectibles
[]
[rn/view {:style style/empty-container}
[rn/view {:style style/image-placeholder}]
[quo/text {:weight :semi-bold :style {:margin-top 12}} (i18n/label :t/no-collectibles)]
[quo/text {:size :paragraph-2 :style {:margin-top 2}} (i18n/label :t/no-collectibles-description)]])
(defn activity
[]
[rn/view {:style style/empty-container}
[rn/view {:style style/image-placeholder}]
[quo/text {:weight :semi-bold :style {:margin-top 12}} (i18n/label :t/no-activity)]
[quo/text {:size :paragraph-2 :style {:margin-top 2}} (i18n/label :t/no-activity-description)]])
(defn view
[]
(let [top (safe-area/get-top)
@@ -59,5 +45,13 @@
{:render-fn quo/token-value
:data temp/tokens
:content-container-style {:padding-horizontal 8}}]
:collectibles [collectibles]
[activity])])))
:collectibles [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}])])))
+7 -4
View File
@@ -391,7 +391,7 @@
"custom-networks": "Custom networks",
"dapp": "ÐApp",
"dapp-would-like-to-connect-wallet": "would like to connect to",
"dapps": "ÐApps",
"dapps": "dApps",
"dapps-permissions": "DApp permissions",
"data": "Data",
"datetime-ago": "ago",
@@ -2001,7 +2001,7 @@
"no-pinned-messages-desc": "This chat doesn't have any pinned messages.",
"no-pinned-messages-community-desc": "This channel doesn't have any pinned messages.",
"shell-placeholder-subtitle": "Open tabs of your communities, messages,\nwallet account and browser windows",
"invite-friends-to-status": "Invite friends to status",
"invite-friends-to-status": "Invite friends to Status",
"share-invite-link": "Share an invite link",
"pending-requests": "Pending requests",
"received": "Received",
@@ -2280,10 +2280,13 @@
"collectibles": "Collectibles",
"no-collectibles-description": "Don't be a bored ape",
"no-activity": "No activity",
"no-activity-description": "C'mon do something...",
"empty-tab-description": "C'mon do something...",
"buy": "Buy",
"bridge": "Bridge",
"on-device": "On device",
"on-keycard": "On Keycard",
"keypair-title": "{{name}}'s default keypair"
"keypair-title": "{{name}}'s default keypair",
"about": "About",
"no-permissions": "No permissions",
"no-dapps": "No connected dApps"
}