Skip to content

Commit bf068f7

Browse files
janherichjeluard
authored andcommitted
View & preview implemented
Signed-off-by: Julien Eluard <[email protected]>
1 parent 3570b78 commit bf068f7

File tree

4 files changed

+31
-19
lines changed

4 files changed

+31
-19
lines changed

src/status_im/chat/commands/impl/transactions.cljs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
[status-im.ui.screens.wallet.choose-recipient.events :as choose-recipient.events]
2424
[status-im.ui.screens.currency-settings.subs :as currency-settings.subs]
2525
[status-im.models.transactions :as wallet.transactions]
26-
[status-im.ui.screens.navigation :as navigation]))
26+
[status-im.ui.screens.navigation :as navigation]
27+
status-im.chat.commands.impl.transactions.subs))
2728

2829
;; common `send/request` functionality
2930

@@ -51,7 +52,10 @@
5152
[react/image {:source (-> asset :icon :source)
5253
:style transactions-styles/asset-icon}]
5354
[react/text {:style transactions-styles/asset-symbol} name]]
54-
[react/text {:style transactions-styles/nft-asset-amount} (money/to-fixed amount)]]]))
55+
[react/text {:style {:font-size 16
56+
:color colors/gray
57+
:padding-right 14}}
58+
(money/to-fixed amount)]]]))
5559

5660
(def assets-separator [react/view transactions-styles/asset-separator])
5761

@@ -116,14 +120,25 @@
116120
:border-radius 2
117121
:border-width 1
118122
:border-color colors/gray}
119-
[svgimage/svgimage {:style transactions-styles/nft-token-icon
120-
:source {:uri image_url}}]
123+
[svgimage/svgimage {:style {:width 100
124+
:height 100
125+
:margin-left 20
126+
:margin-right 20}
127+
:source {:uri image_url}}]
121128
[react/text {} name]]])
122129
collectible-tokens)])))
123130

124131
(defn choose-nft-token-suggestion [selected-event-creator]
125132
[choose-nft-token selected-event-creator])
126133

134+
(defview nft-token [{:keys [name image_url] :as token}]
135+
[react/view {:flex-direction :column
136+
:align-items :center}
137+
[svgimage/svgimage {:style {:width 100
138+
:height 100}
139+
:source {:uri image_url}}]
140+
[react/text {} name]])
141+
127142
;;TODO(goranjovic): currently we only allow tokens which are enabled in Manage assets here
128143
;; because balances are only fetched for them. Revisit this decision with regard to battery/network consequences
129144
;; if we were to update all balances.

src/status_im/chat/commands/impl/transactions/styles.cljs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@
2323
(def asset-symbol
2424
{:color colors/black})
2525

26-
(def nft-asset-amount
27-
{:font-size 16
28-
:color colors/gray
29-
:padding-right 14})
30-
31-
(def nft-token-icon
32-
{:width 100
33-
:height 100
34-
:margin-left 20
35-
:margin-right 20})
36-
3726
(def asset-name
3827
{:color colors/gray
3928
:padding-left 4})
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
(ns status-im.chat.commands.impl.transactions.subs
2+
(:require [re-frame.core :as re-frame]))
3+
4+
(re-frame/reg-sub
5+
:get-collectible-token
6+
:<- [:collectibles]
7+
(fn [collectibles [_ nft-symbol token-id]]
8+
(get-in collectibles [(keyword nft-symbol) (js/parseInt token-id)])))

src/status_im/extensions/registry.cljs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
(def components
1313
{'view react/view
1414
'text react/text
15+
'nft-token transactions/nft-token
16+
'send-status transactions/send-status
1517
'asset-selector transactions/choose-nft-asset-suggestion
1618
'token-selector transactions/choose-nft-token-suggestion})
1719

@@ -21,11 +23,9 @@
2123
(reduce (fn [capacities hook]
2224
(assoc-in capacities [:hooks (host/id hook)] hook))
2325
{:components components
24-
:queries #{:get-in}
26+
:queries #{:get-in :get-collectible-token}
2527
:events #{:set-in}
26-
:permissions {:read {:include-paths #{[:network]
27-
[:current-chat-id]
28-
[:chats #".*"]}}
28+
:permissions {:read {:include-paths #{[:chats #".*"]}}
2929
:write {:include-paths #{}}}}
3030
app-hooks))
3131

0 commit comments

Comments
 (0)