Skip to content

Commit

Permalink
some refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
briansztamfater committed May 1, 2024
1 parent d7f4a3e commit 76cb329
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
15 changes: 10 additions & 5 deletions src/quo/components/wallet/network_link/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
:strokeWidth "1"}]])

(defn- line
[stroke source destination width theme]
[{:keys [stroke-color source-color destination-color width theme]}]
[svg/svg
{:height "10"
:width "100%"
:view-box (str "0 0 " width " 10")}
[svg/path
{:d (str "M0,5 L" width ",5")
:stroke stroke
:stroke stroke-color
:stroke-width "1"}]
[svg/defs
[svg/linear-gradient
Expand All @@ -41,8 +41,8 @@
:y1 "0%"
:y2 "0%"
:gradient-units "objectBoundingBox"}
[svg/stop {:offset "0%" :stop-color (colors/resolve-color source theme)}]
[svg/stop {:offset "100%" :stop-color (colors/resolve-color destination theme)}]]]])
[svg/stop {:offset "0%" :stop-color (colors/resolve-color source-color theme)}]
[svg/stop {:offset "100%" :stop-color (colors/resolve-color destination-color theme)}]]]])

(defn link-linear
[{:keys [source destination]}]
Expand All @@ -58,7 +58,12 @@
[rn/view
{:style style/link-linear-container
:on-layout on-layout}
[line stroke-color source-color destination-color container-width theme]
[line
{:stroke-color stroke-color
:source-color source-color
:destination-color destination-color
:width container-width
:theme theme}]
[rn/view {:style style/left-circle-container}
[circle fill-color source-color]]
[rn/view {:style style/right-circle-container}
Expand Down
11 changes: 10 additions & 1 deletion src/status_im/contexts/wallet/common/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
[status-im.common.qr-codes.view :as qr-codes]
[status-im.constants :as constants]
[utils.money :as money]
[utils.number]))
[utils.number]
[status-im.contexts.preview.quo.profile.collectible :as collectible]))

(defn get-first-name
[full-name]
Expand Down Expand Up @@ -263,3 +264,11 @@
{}
tokens)
(update-vals #(prettify-balance currency-symbol %))))

(defn format-token-id
[token collectible]
(if token
(:symbol token)
(str (get-in collectible [:id :contract-id :address])
":"
(get-in collectible [:id :token-id]))))
6 changes: 1 addition & 5 deletions src/status_im/contexts/wallet/send/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,7 @@
network-chain-ids (map :chain-id networks)
bridge-to-chain-id (get-in db [:wallet :ui :send :bridge-to-chain-id])
token-decimal (when token (:decimals token))
token-id (if token
(:symbol token)
(str (get-in collectible [:id :contract-id :address])
":"
(get-in collectible [:id :token-id])))
token-id (utils/format-token-id token collectible)
to-token-id ""
network-preferences (if token [] [(get-in collectible [:id :contract-id :chain-id])])
gas-rates constants/gas-rate-medium
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/contexts/wallet/send/routes/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
(def network-links-container
{:margin-horizontal -1.5
:margin-top 7.5
:z-index 10
:z-index 3
:flex 1})

(defn network-link-container
Expand Down

0 comments on commit 76cb329

Please sign in to comment.