Skip to content

Commit

Permalink
Fix: cljs.core/name shouldn't be called on nullable value
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmotta authored and siddarthkay committed Dec 26, 2023
1 parent c80f5b2 commit fee498e
Showing 1 changed file with 38 additions and 34 deletions.
72 changes: 38 additions & 34 deletions src/quo/components/wallet/network_bridge/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,52 @@
[quo.theme :as quo.theme]
[react-native.core :as rn]))


(defn network-bridge-add
[{:keys [network state theme]}]
[rn/view {:style (merge (style/container network state theme) (style/add-container theme))}
[icon/icon :i/add-circle {:size 12 :no-color true}]])

(defn- network->text
[network]
(cond (not network) ""
(= network :ethereum) "Mainnet"
:else (string/capitalize (name network))))

(defn view-internal
[{:keys [theme network status amount container-style] :as args}]
(let [network-text (if (= network :ethereum) "Mainnet" (string/capitalize (name network)))]
(if (= status :add)
[network-bridge-add args]
[rn/view
{:style (merge (style/container network status theme) container-style)
:accessible true
:accessibility-label :container}
(if (= status :loading)
[rn/view
{:style (style/loading-skeleton theme)
:accessible true
:accessibility-label :loading}]
[rn/view
{:style {:flex-direction :row
:justify-content :space-between}}
[text/text
{:size :paragraph-2
:weight :medium} amount]
(when (= status :locked)
[icon/icon :i/locked
{:size 12
:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:accessible true
:accessibility-label :lock}])])
(if (= status :add)
[network-bridge-add args]
[rn/view
{:style (merge (style/container network status theme) container-style)
:accessible true
:accessibility-label :container}
(if (= status :loading)
[rn/view
{:style (style/loading-skeleton theme)
:accessible true
:accessibility-label :loading}]
[rn/view
{:style {:flex-direction :row
:align-items :center}}
[rn/image
{:source (resources/get-network network)
:style style/network-icon}]
{:style {:flex-direction :row
:justify-content :space-between}}
[text/text
{:size :label
:weight :medium
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}}
network-text]]])))
{:size :paragraph-2
:weight :medium} amount]
(when (= status :locked)
[icon/icon :i/locked
{:size 12
:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:accessible true
:accessibility-label :lock}])])
[rn/view
{:style {:flex-direction :row
:align-items :center}}
[rn/image
{:source (resources/get-network network)
:style style/network-icon}]
[text/text
{:size :label
:weight :medium
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}}
(network->text network)]]]))

(def view (quo.theme/with-theme view-internal))

0 comments on commit fee498e

Please sign in to comment.