mirror of
https://github.com/status-im/status-react.git
synced 2025-03-01 11:00:51 +00:00
parent
06c31f3a12
commit
68ad4fe086
@ -57,7 +57,7 @@
|
|||||||
{:title "Title"
|
{:title "Title"
|
||||||
:type :account
|
:type :account
|
||||||
:account-avatar-emoji "🍿"
|
:account-avatar-emoji "🍿"
|
||||||
:networks [{:name :ethereum :short :eth}]
|
:networks [{:name :ethereum :short-name "eth"}]
|
||||||
:description "0x62b...0a5"
|
:description "0x62b...0a5"
|
||||||
:customization-color :purple}])
|
:customization-color :purple}])
|
||||||
(h/is-truthy (h/get-by-text "Title"))
|
(h/is-truthy (h/get-by-text "Title"))
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
[quo.components.icon :as icons]
|
[quo.components.icon :as icons]
|
||||||
[quo.components.markdown.text :as text]
|
[quo.components.markdown.text :as text]
|
||||||
[quo.components.tags.context-tag.view :as context-tag]
|
[quo.components.tags.context-tag.view :as context-tag]
|
||||||
|
[quo.components.wallet.address-text.view :as address-text]
|
||||||
[quo.foundations.colors :as colors]
|
[quo.foundations.colors :as colors]
|
||||||
[quo.theme :as quo.theme]
|
[quo.theme :as quo.theme]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
@ -32,14 +33,6 @@
|
|||||||
:profile-picture profile-picture}]
|
:profile-picture profile-picture}]
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defn- network-view
|
|
||||||
[network]
|
|
||||||
[text/text
|
|
||||||
{:size :paragraph-2
|
|
||||||
:weight :regular
|
|
||||||
:style (style/network-text-color (:name network))}
|
|
||||||
(str (name (:short network)) ":")])
|
|
||||||
|
|
||||||
(defn- keypair-subtitle
|
(defn- keypair-subtitle
|
||||||
[{:keys [theme blur? keycard?]}]
|
[{:keys [theme blur? keycard?]}]
|
||||||
[rn/view {:style style/row}
|
[rn/view {:style style/row}
|
||||||
@ -59,15 +52,16 @@
|
|||||||
|
|
||||||
(defn- account-subtitle
|
(defn- account-subtitle
|
||||||
[{:keys [networks theme blur? description]}]
|
[{:keys [networks theme blur? description]}]
|
||||||
[rn/view {:style style/row}
|
(if networks
|
||||||
(for [network networks]
|
[address-text/view
|
||||||
^{:key (str network)}
|
{:networks networks
|
||||||
[network-view network])
|
:address description
|
||||||
|
:format :short}]
|
||||||
[text/text
|
[text/text
|
||||||
{:size :paragraph-2
|
{:size :paragraph-2
|
||||||
:weight :regular
|
:weight :regular
|
||||||
:style (style/description theme blur?)}
|
:style (style/description theme blur?)}
|
||||||
description]])
|
description]))
|
||||||
|
|
||||||
(defn- default-keypair-subtitle
|
(defn- default-keypair-subtitle
|
||||||
[{:keys [description theme blur?]}]
|
[{:keys [description theme blur?]}]
|
||||||
|
@ -4,19 +4,12 @@
|
|||||||
[quo.components.icon :as icon]
|
[quo.components.icon :as icon]
|
||||||
[quo.components.list-items.account.style :as style]
|
[quo.components.list-items.account.style :as style]
|
||||||
[quo.components.markdown.text :as text]
|
[quo.components.markdown.text :as text]
|
||||||
|
[quo.components.wallet.address-text.view :as address-text]
|
||||||
[quo.foundations.colors :as colors]
|
[quo.foundations.colors :as colors]
|
||||||
[quo.theme :as quo.theme]
|
[quo.theme :as quo.theme]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[reagent.core :as reagent]))
|
[reagent.core :as reagent]))
|
||||||
|
|
||||||
(defn- network-view
|
|
||||||
[network]
|
|
||||||
[text/text
|
|
||||||
{:size :paragraph-2
|
|
||||||
:weight :regular
|
|
||||||
:style {:color (colors/custom-color (:name network))}}
|
|
||||||
(str (name (:short network)) ":")])
|
|
||||||
|
|
||||||
(defn- account-view
|
(defn- account-view
|
||||||
[{:keys [account-props title-icon? blur? theme]
|
[{:keys [account-props title-icon? blur? theme]
|
||||||
:or {title-icon? false}}]
|
:or {title-icon? false}}]
|
||||||
@ -38,15 +31,10 @@
|
|||||||
:color (if blur?
|
:color (if blur?
|
||||||
colors/white-opa-40
|
colors/white-opa-40
|
||||||
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}]])]
|
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}]])]
|
||||||
[text/text {:size :paragraph-2}
|
[address-text/view
|
||||||
(for [network (:networks account-props)]
|
{:networks (:networks account-props)
|
||||||
^{:key (str network)}
|
:address (:address account-props)
|
||||||
[network-view network])
|
:format :short}]]])
|
||||||
[text/text
|
|
||||||
{:size :paragraph-2
|
|
||||||
:weight :monospace
|
|
||||||
:style (style/account-address blur? theme)}
|
|
||||||
(:address account-props)]]]])
|
|
||||||
|
|
||||||
(defn- balance-view
|
(defn- balance-view
|
||||||
[{:keys [balance-props type theme]}]
|
[{:keys [balance-props type theme]}]
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
[quo.components.icon :as icon]
|
[quo.components.icon :as icon]
|
||||||
[quo.components.list-items.account-list-card.style :as style]
|
[quo.components.list-items.account-list-card.style :as style]
|
||||||
[quo.components.markdown.text :as text]
|
[quo.components.markdown.text :as text]
|
||||||
|
[quo.components.wallet.address-text.view :as address-text]
|
||||||
[quo.foundations.colors :as colors]
|
[quo.foundations.colors :as colors]
|
||||||
[quo.theme :as quo.theme]
|
[quo.theme :as quo.theme]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
@ -26,20 +27,10 @@
|
|||||||
{:weight :semi-bold
|
{:weight :semi-bold
|
||||||
:size :paragraph-2}
|
:size :paragraph-2}
|
||||||
(:name account-props)]
|
(:name account-props)]
|
||||||
[text/text {:size :paragraph-2}
|
[address-text/view
|
||||||
(map (fn [network]
|
{:networks networks
|
||||||
^{:key (str network)}
|
:address (:address account-props)
|
||||||
[text/text
|
:format :short}]]]
|
||||||
{:size :paragraph-2
|
|
||||||
:style {:color (colors/resolve-color network theme)}}
|
|
||||||
(str (subs (name network) 0 3) ":")])
|
|
||||||
networks)
|
|
||||||
[text/text
|
|
||||||
{:size :paragraph-2
|
|
||||||
:style {:color (if blur?
|
|
||||||
colors/white-opa-40
|
|
||||||
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}}
|
|
||||||
(:address account-props)]]]]
|
|
||||||
(when (= action :icon)
|
(when (= action :icon)
|
||||||
[rn/pressable {:on-press on-options-press}
|
[rn/pressable {:on-press on-options-press}
|
||||||
[icon/icon :i/options
|
[icon/icon :i/options
|
||||||
|
9
src/quo/components/wallet/address_text/style.cljs
Normal file
9
src/quo/components/wallet/address_text/style.cljs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
(ns quo.components.wallet.address-text.style
|
||||||
|
(:require [quo.foundations.colors :as colors]))
|
||||||
|
|
||||||
|
(defn address-text
|
||||||
|
[format blur? theme]
|
||||||
|
(when (= format :short)
|
||||||
|
{:color (if blur?
|
||||||
|
colors/white-opa-40
|
||||||
|
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}))
|
31
src/quo/components/wallet/address_text/view.cljs
Normal file
31
src/quo/components/wallet/address_text/view.cljs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
(ns quo.components.wallet.address-text.view
|
||||||
|
(:require [quo.components.markdown.text :as text]
|
||||||
|
[quo.components.wallet.address-text.style :as style]
|
||||||
|
[quo.foundations.colors :as colors]
|
||||||
|
[quo.theme]
|
||||||
|
[utils.address :as utils]))
|
||||||
|
|
||||||
|
(defn- colored-network-text
|
||||||
|
[theme network]
|
||||||
|
(let [{:keys [name short-name]} network]
|
||||||
|
[text/text
|
||||||
|
{:size :paragraph-2
|
||||||
|
:style {:color (colors/resolve-color name theme)}}
|
||||||
|
(str short-name ":")]))
|
||||||
|
|
||||||
|
(defn- view-internal
|
||||||
|
[{:keys [networks address blur? theme format]}]
|
||||||
|
(let [network-text-xf (map #(colored-network-text theme %))
|
||||||
|
address-text [text/text
|
||||||
|
{:size :paragraph-2
|
||||||
|
;; TODO: monospace font https://github.com/status-im/status-mobile/issues/17009
|
||||||
|
:weight :monospace
|
||||||
|
:style (style/address-text format blur? theme)}
|
||||||
|
(if (= format :short)
|
||||||
|
(utils/get-short-wallet-address address)
|
||||||
|
address)]]
|
||||||
|
(as-> networks $
|
||||||
|
(into [text/text] network-text-xf $)
|
||||||
|
(conj $ address-text))))
|
||||||
|
|
||||||
|
(def view (quo.theme/with-theme view-internal))
|
@ -10,7 +10,8 @@
|
|||||||
:type :default
|
:type :default
|
||||||
:name "Trip to Vegas"
|
:name "Trip to Vegas"
|
||||||
:address "0x0ah...71a"}
|
:address "0x0ah...71a"}
|
||||||
:networks [:ethereum :optimism]
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}]
|
||||||
:state :default
|
:state :default
|
||||||
:action :none}])
|
:action :none}])
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@
|
|||||||
quo.components.wallet.account-card.view
|
quo.components.wallet.account-card.view
|
||||||
quo.components.wallet.account-origin.view
|
quo.components.wallet.account-origin.view
|
||||||
quo.components.wallet.account-overview.view
|
quo.components.wallet.account-overview.view
|
||||||
|
quo.components.wallet.address-text.view
|
||||||
quo.components.wallet.keypair.view
|
quo.components.wallet.keypair.view
|
||||||
quo.components.wallet.network-amount.view
|
quo.components.wallet.network-amount.view
|
||||||
quo.components.wallet.network-bridge.view
|
quo.components.wallet.network-bridge.view
|
||||||
@ -371,6 +372,7 @@
|
|||||||
(def account-card quo.components.wallet.account-card.view/view)
|
(def account-card quo.components.wallet.account-card.view/view)
|
||||||
(def account-origin quo.components.wallet.account-origin.view/view)
|
(def account-origin quo.components.wallet.account-origin.view/view)
|
||||||
(def account-overview quo.components.wallet.account-overview.view/view)
|
(def account-overview quo.components.wallet.account-overview.view/view)
|
||||||
|
(def address-text quo.components.wallet.address-text.view/view)
|
||||||
(def keypair quo.components.wallet.keypair.view/view)
|
(def keypair quo.components.wallet.keypair.view/view)
|
||||||
(def network-amount quo.components.wallet.network-amount.view/view)
|
(def network-amount quo.components.wallet.network-amount.view/view)
|
||||||
(def network-bridge quo.components.wallet.network-bridge.view/view)
|
(def network-bridge quo.components.wallet.network-bridge.view/view)
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
:type :default
|
:type :default
|
||||||
:label "Drawer label"
|
:label "Drawer label"
|
||||||
:keycard? true
|
:keycard? true
|
||||||
:networks [:ethereum]
|
:networks [{:name :ethereum :short-name "eth"}]
|
||||||
:description "0x62b...0a5"
|
:description "0x62b...0a5"
|
||||||
:button-icon :i/placeholder
|
:button-icon :i/placeholder
|
||||||
:community-name "Coinbase"
|
:community-name "Coinbase"
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
{:type :account
|
{:type :account
|
||||||
:blur? false
|
:blur? false
|
||||||
:title "Collectibles vault"
|
:title "Collectibles vault"
|
||||||
:networks [:ethereum :optimism]
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}]
|
||||||
:description "0x0ah...78b"
|
:description "0x0ah...78b"
|
||||||
:account-avatar-emoji "🍿"
|
:account-avatar-emoji "🍿"
|
||||||
:customization-color (or customization-color :blue)}]
|
:customization-color (or customization-color :blue)}]
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
:type :default
|
:type :default
|
||||||
:name "Trip to Vegas"
|
:name "Trip to Vegas"
|
||||||
:address "0x0ah...78b"}
|
:address "0x0ah...78b"}
|
||||||
:networks [:ethereum :optimism]
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}]
|
||||||
:action :none
|
:action :none
|
||||||
:on-press (fn [] (js/alert "Item pressed"))
|
:on-press (fn [] (js/alert "Item pressed"))
|
||||||
:on-options-press (fn [] (js/alert "Options pressed"))
|
:on-options-press (fn [] (js/alert "Options pressed"))
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
(defn view
|
(defn view
|
||||||
[]
|
[]
|
||||||
(let [state (reagent/atom {:address "0x0ah...78b"
|
(let [state (reagent/atom {:address "0x0ah...78b"
|
||||||
:networks [:ethereum :optimism]})]
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}]})]
|
||||||
(fn []
|
(fn []
|
||||||
[preview/preview-container
|
[preview/preview-container
|
||||||
{:state state
|
{:state state
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
:type :default
|
:type :default
|
||||||
:name "Trip to Vegas"
|
:name "Trip to Vegas"
|
||||||
:address "0x0ah...71a"}
|
:address "0x0ah...71a"}
|
||||||
:networks [:ethereum :optimism]
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}]
|
||||||
:state :default
|
:state :default
|
||||||
:action :none}
|
:action :none}
|
||||||
{:account-props {:customization-color :purple
|
{:account-props {:customization-color :purple
|
||||||
@ -21,7 +22,8 @@
|
|||||||
:type :default
|
:type :default
|
||||||
:name "My savings"
|
:name "My savings"
|
||||||
:address "0x0ah...72b"}
|
:address "0x0ah...72b"}
|
||||||
:networks [:ethereum :optimism]
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}]
|
||||||
:state :default
|
:state :default
|
||||||
:action :none}
|
:action :none}
|
||||||
{:account-props {:customization-color :army
|
{:account-props {:customization-color :army
|
||||||
@ -30,7 +32,8 @@
|
|||||||
:type :default
|
:type :default
|
||||||
:name "Coin vault"
|
:name "Coin vault"
|
||||||
:address "0x0ah...73c"}
|
:address "0x0ah...73c"}
|
||||||
:networks [:ethereum :optimism]
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}]
|
||||||
:state :default
|
:state :default
|
||||||
:action :none}
|
:action :none}
|
||||||
{:account-props {:customization-color :orange
|
{:account-props {:customization-color :orange
|
||||||
@ -39,7 +42,8 @@
|
|||||||
:type :default
|
:type :default
|
||||||
:name "Crypto fortress"
|
:name "Crypto fortress"
|
||||||
:address "0x0ah...74e"}
|
:address "0x0ah...74e"}
|
||||||
:networks [:ethereum :optimism]
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}]
|
||||||
:state :default
|
:state :default
|
||||||
:action :none}
|
:action :none}
|
||||||
{:account-props {:customization-color :yellow
|
{:account-props {:customization-color :yellow
|
||||||
@ -48,7 +52,8 @@
|
|||||||
:type :default
|
:type :default
|
||||||
:name "Block treasure"
|
:name "Block treasure"
|
||||||
:address "0x0ah...75f"}
|
:address "0x0ah...75f"}
|
||||||
:networks [:ethereum :optimism]
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}]
|
||||||
:state :default
|
:state :default
|
||||||
:action :none}])
|
:action :none}])
|
||||||
|
|
||||||
|
@ -52,13 +52,16 @@
|
|||||||
:label (i18n/label :t/share-address)}]]])
|
:label (i18n/label :t/share-address)}]]])
|
||||||
|
|
||||||
(defn- view-internal
|
(defn- view-internal
|
||||||
[{:keys [theme]}]
|
[]
|
||||||
[rn/view {:style style/about-tab}
|
[rn/view {:style style/about-tab}
|
||||||
[quo/data-item
|
[quo/data-item
|
||||||
(merge temp/data-item-state
|
(merge temp/data-item-state
|
||||||
{:custom-subtitle (fn [] [description
|
{:custom-subtitle (fn [] [quo/address-text
|
||||||
{:theme theme
|
{:networks [{:name :ethereum :short-name "eth"}
|
||||||
:address temp/address}])
|
{:name :optimism :short-name "opt"}
|
||||||
|
{:name :arbitrum :short-name "arb1"}]
|
||||||
|
:address temp/address
|
||||||
|
:format :long}])
|
||||||
:container-style {:margin-bottom 12}
|
:container-style {:margin-bottom 12}
|
||||||
:on-press #(rf/dispatch [:show-bottom-sheet {:content about-options}])})]
|
:on-press #(rf/dispatch [:show-bottom-sheet {:content about-options}])})]
|
||||||
[quo/account-origin temp/account-origin-state]])
|
[quo/account-origin temp/account-origin-state]])
|
||||||
|
@ -108,6 +108,11 @@
|
|||||||
:account :default
|
:account :default
|
||||||
:customization-color :blue})
|
:customization-color :blue})
|
||||||
|
|
||||||
|
(def network-names
|
||||||
|
[{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}
|
||||||
|
{:name :arbitrum :short-name "arb1"}])
|
||||||
|
|
||||||
(def address "0x39cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd4")
|
(def address "0x39cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd4")
|
||||||
|
|
||||||
(def data-item-state
|
(def data-item-state
|
||||||
@ -147,10 +152,10 @@
|
|||||||
(def account-data
|
(def account-data
|
||||||
{:title "Trip to Vegas"
|
{:title "Trip to Vegas"
|
||||||
:type :account
|
:type :account
|
||||||
:networks [{:name :ethereum :short :eth}
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
{:name :optimism :short :opt}
|
{:name :optimism :short-name "opt"}
|
||||||
{:name :arbitrum :short :arb1}]
|
{:name :arbitrum :short-name "arb1"}]
|
||||||
:description "0x62b...0a5"
|
:description "0x39cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd4"
|
||||||
:account-avatar-emoji "🍑"
|
:account-avatar-emoji "🍑"
|
||||||
:customization-color :purple})
|
:customization-color :purple})
|
||||||
|
|
||||||
@ -158,14 +163,14 @@
|
|||||||
[{:customization-color :flamingo
|
[{:customization-color :flamingo
|
||||||
:emoji "🍿"
|
:emoji "🍿"
|
||||||
:name "New House"
|
:name "New House"
|
||||||
:address "0x21a...49e"
|
:address "0x21af6E0Ba4C4530735616e1Ee7ff5FbCB726f493"
|
||||||
:networks [{:name :ethereum :short :eth}
|
:networks [{:name :ethereum :short-name "eth"}
|
||||||
{:name :optimism :short :opt}]}
|
{:name :optimism :short-name "opt"}]}
|
||||||
{:customization-color :blue
|
{:customization-color :blue
|
||||||
:emoji "🎮"
|
:emoji "🎮"
|
||||||
:name "My savings"
|
:name "My savings"
|
||||||
:address "0x43c...98d"
|
:address "0x43cf6E0Ba4C4530735616e1Ee7ff5FbCB726f98d"
|
||||||
:networks [{:name :ethereum :short :eth}]}])
|
:networks [{:name :ethereum :short-name "eth"}]}])
|
||||||
|
|
||||||
(def asset-snt
|
(def asset-snt
|
||||||
{:size 24
|
{:size 24
|
||||||
|
@ -39,7 +39,12 @@
|
|||||||
:right-icon :i/advanced
|
:right-icon :i/advanced
|
||||||
:card? true
|
:card? true
|
||||||
:title (i18n/label :t/address)
|
:title (i18n/label :t/address)
|
||||||
:subtitle account-address
|
:custom-subtitle (fn [] [quo/address-text
|
||||||
|
{:networks [{:name :ethereum :short-name "eth"}
|
||||||
|
{:name :optimism :short-name "opt"}
|
||||||
|
{:name :arbitrum :short-name "arb1"}]
|
||||||
|
:address account-address
|
||||||
|
:format :long}])
|
||||||
:on-press (fn []
|
:on-press (fn []
|
||||||
(rf/dispatch [:show-bottom-sheet
|
(rf/dispatch [:show-bottom-sheet
|
||||||
{:content (fn [] [network-preferences/view
|
{:content (fn [] [network-preferences/view
|
||||||
|
@ -72,3 +72,8 @@
|
|||||||
abbreviated-public-key (str first-part-of-public-key ellipsis last-part-of-public-key)]
|
abbreviated-public-key (str first-part-of-public-key ellipsis last-part-of-public-key)]
|
||||||
abbreviated-public-key)
|
abbreviated-public-key)
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
|
(defn get-short-wallet-address
|
||||||
|
[value]
|
||||||
|
(when value
|
||||||
|
(str (subs value 0 5) "..." (subs value (- (count value) 3) (count value)))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user