Address PR feedback

This commit is contained in:
Ajay Sivan 2024-06-11 00:15:04 +07:00
parent 9be0cd3738
commit ce6b8c9bed
No known key found for this signature in database
GPG Key ID: 5F9AC120AE59597A
2 changed files with 49 additions and 45 deletions

View File

@ -24,7 +24,7 @@
[:map {:closed true}
[:type
[:enum :spending-cap :token-contract :account :spending-contract :network :date-signed
:collectible :address :community]]
:collectible :address :community :collectible-contract]]
[:avatar-props :map]
[:label :string]
[:description {:optional true} [:maybe :string]]
@ -43,31 +43,29 @@
(defn- avatar
[{:keys [type avatar-props blur? theme on-press]}]
[rn/pressable {:on-press on-press}
(cond
(#{:spending-cap :token-contract :network
:collectible}
type) [token-avatar/view
(assoc avatar-props
:type
(if (= type :collectible) :collectible :asset))]
(= type :account) [account-avatar/view (assoc avatar-props :size 32)]
(= type :collectible-contract) [collection-avatar/view (assoc avatar-props :size :size-32)]
(= type :spending-contract) [dapp-avatar/view avatar-props]
(= type :date-signed) [icon-avatar/icon-avatar
(assoc avatar-props
:size :size-32
:color (if blur?
colors/white
(colors/theme-colors colors/neutral-50
colors/neutral-40
theme)))]
(= type :address) [wallet-user-avatar/wallet-user-avatar
(assoc avatar-props
:size :size-32
:monospace? true
:lowercase? true
:neutral? true)]
(= type :community) [community-avatar/view avatar-props])])
(case type
:account [account-avatar/view (assoc avatar-props :size 32)]
:collectible-contract [collection-avatar/view (assoc avatar-props :size :size-32)]
:spending-contract [dapp-avatar/view avatar-props]
:date-signed [icon-avatar/icon-avatar
(assoc avatar-props
:size :size-32
:color (if blur?
colors/white
(colors/theme-colors colors/neutral-50
colors/neutral-40
theme)))]
:address [wallet-user-avatar/wallet-user-avatar
(assoc avatar-props
:size :size-32
:monospace? true
:lowercase? true
:neutral? true)]
:community [community-avatar/view avatar-props]
[token-avatar/view
(assoc avatar-props
:type
(if (= type :collectible) :collectible :asset))])])
(defn- view-internal
[{:keys [type avatar-props label description blur? unlimited-icon? container-style
@ -91,7 +89,8 @@
[text/text
{:size :paragraph-1
:weight :semi-bold
:style (style/label blur? theme)} label]
:style (style/label blur? theme)}
label]
(when unlimited-icon?
[icon/icon :i/alert
{:container-style {:margin-left 4}
@ -100,7 +99,8 @@
(when description?
[text/text
{:size :paragraph-2
:style (style/description blur? theme)} description])]
:style (style/description blur? theme)}
description])]
(when (= type :account) [tiny-tag/view {:label tag-label}])
(when (= type :spending-cap)
[button/button
@ -108,7 +108,8 @@
:size 24
:blur? blur?
:icon-left button-icon
:on-press on-button-press} button-label])
:on-press on-button-press}
button-label])
(when option-icon
[rn/pressable {:on-press on-option-press}
[icon/icon option-icon

View File

@ -27,6 +27,10 @@
:key :blur?}
{:type :boolean
:key :unlimited-icon?}
{:type :text
:key :button-label}
{:type :text
:key :tag-label}
{:type :select
:key :option-icon
:options [{:key nil
@ -36,20 +40,19 @@
(defn- get-avatar-props
[type]
(cond
(#{:spending-cap :token-contract :network}
type) {:image (common.resources/get-mock-image :status-logo)}
(= type :collectible) {:image (common.resources/get-mock-image :collectible2)}
(= type :account) {:customization-color :orange
:emoji "😇"}
(= type :collectible-contract) {:image (common.resources/get-mock-image :bored-ape)}
(= type :spending-contract) {:network-image (resources/get-network :ethereum)
:image (resources/get-dapp :coingecko)}
(= type :date-signed) {:icon :i/signature}
(= type :address) {:customization-color :blue
:full-name "0 x"}
(= type :community) {:image (common.resources/get-mock-image :status-logo)
:size :size-32}))
(case type
:collectible {:image (common.resources/get-mock-image :collectible2)}
:account {:customization-color :orange
:emoji "😇"}
:collectible-contract {:image (common.resources/get-mock-image :bored-ape)}
:spending-contract {:network-image (resources/get-network :ethereum)
:image (resources/get-dapp :coingecko)}
:date-signed {:icon :i/signature}
:address {:customization-color :blue
:full-name "0 x"}
:community {:image (common.resources/get-mock-image :status-logo)
:size :size-32}
{:image (common.resources/get-mock-image :status-logo)}))
(defn view
[]
@ -58,6 +61,8 @@
:description "Description"
:blur? false
:unlimited-icon? false
:button-label "Edit"
:tag-label "31,283.77 EUR"
:option-icon :i/options})]
[preview/preview-container
{:state state
@ -68,9 +73,7 @@
:descriptor descriptor}
[quo/approval-info
(assoc state
:button-label "Edit"
:button-icon :i/edit
:tag-label "31,283.77 EUR"
:on-button-press #(js/alert "Button Pressed")
:on-avatar-press #(js/alert "Token Pressed")
:avatar-props (get-avatar-props (:type state))