diff --git a/src/quo/components/list_items/approval_info/view.cljs b/src/quo/components/list_items/approval_info/view.cljs index 9f5b084e27..990b6723d1 100644 --- a/src/quo/components/list_items/approval_info/view.cljs +++ b/src/quo/components/list_items/approval_info/view.cljs @@ -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 diff --git a/src/status_im/contexts/preview/quo/list_items/approval_info.cljs b/src/status_im/contexts/preview/quo/list_items/approval_info.cljs index cd2f31c449..a716a99388 100644 --- a/src/status_im/contexts/preview/quo/list_items/approval_info.cljs +++ b/src/status_im/contexts/preview/quo/list_items/approval_info.cljs @@ -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))