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

View File

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