Wallet: Buy Tokens drawer (#17654)

* Wallet: buy tokens drawer
This commit is contained in:
Omar Basem 2023-10-18 15:24:25 +04:00 committed by GitHub
parent 7da899e29f
commit f19ec2a93f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 92 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -22,6 +22,7 @@
(let [{component-size :component icon-size :icon} (get sizes size) (let [{component-size :component icon-size :icon} (get sizes size)
circle-color (colors/resolve-color color theme opacity) circle-color (colors/resolve-color color theme opacity)
icon-color (colors/resolve-color color theme)] icon-color (colors/resolve-color color theme)]
(if (keyword? icon)
[rn/view [rn/view
{:style {:width component-size {:style {:width component-size
:height component-size :height component-size
@ -33,6 +34,9 @@
:align-items :center}} :align-items :center}}
[icons/icon icon [icons/icon icon
{:size icon-size {:size icon-size
:color icon-color}]])) :color icon-color}]]
[rn/image
{:source icon
:style {:width 32 :height 32}}])))
(def icon-avatar (quo.theme/with-theme icon-avatar-internal)) (def icon-avatar (quo.theme/with-theme icon-avatar-internal))

View File

@ -12,6 +12,8 @@
(defn left-sub-container (defn left-sub-container
[{:keys [tag description]}] [{:keys [tag description]}]
{:flex-direction :row {:flex-direction :row
:flex 1
:margin-right 12
:align-items (if (or tag description) :flex-start :center)}) :align-items (if (or tag description) :flex-start :center)})
(defn sub-container (defn sub-container
@ -20,7 +22,8 @@
:align-items (or align-action :center)}) :align-items (or align-action :center)})
(def left-container (def left-container
{:margin-left 12 {:margin-horizontal 12
:flex 1
:height "100%" :height "100%"
:justify-content :flex-start}) :justify-content :flex-start})

View File

@ -91,7 +91,7 @@
[{:keys [action action-props blur? theme]}] [{:keys [action action-props blur? theme]}]
[rn/view {:style {:margin-left 12}} [rn/view {:style {:margin-left 12}}
(case action (case action
:arrow [icon/icon :i/chevron-right (style/color blur? theme)] :arrow [icon/icon (or (:icon action-props) :i/chevron-right) (style/color blur? theme)]
:button [button/button :button [button/button
(merge action-props (merge action-props
{:type :outline {:type :outline

View File

@ -158,3 +158,7 @@
(reagent/adapt-react-class (reagent/adapt-react-class
(.requireNativeComponent ^js react-native "RNSelectableTextInput")) (.requireNativeComponent ^js react-native "RNSelectableTextInput"))
view)) view))
(def linking (.-Linking react-native))
(defn open-url [link] (.openURL ^js linking link))

View File

@ -127,6 +127,15 @@
(js/require "../resources/videos2/generating_keys_02.mp4") (js/require "../resources/videos2/generating_keys_02.mp4")
(js/require "../resources/videos2/generating_keys_03.mp4")]}) (js/require "../resources/videos2/generating_keys_03.mp4")]})
(def services
{:latamex (js/require "../resources/images/services/Latamex.png")
:moonpay (js/require "../resources/images/services/Moonpay.png")
:ramp (js/require "../resources/images/services/Ramp.png")})
(defn get-service-image
[k]
(get services k))
(defn get-mock-image (defn get-mock-image
[k] [k]
(get mock-images k)) (get mock-images k))

View File

@ -40,6 +40,16 @@
:render-fn (fn [account] [quo/account-item {:account-props account}]) :render-fn (fn [account] [quo/account-item {:account-props account}])
:style {:margin-horizontal 8}}]]) :style {:margin-horizontal 8}}]])
(defn buy-drawer
[]
[:<>
[quo/drawer-top {:title (i18n/label :t/buy-tokens)}]
[rn/flat-list
{:data temp/buy-tokens-list
:style {:padding-horizontal 8
:padding-bottom 8}
:render-fn quo/settings-item}]])
(def ^:private networks-list (def ^:private networks-list
[{:source (quo.resources/get-network :ethereum)} [{:source (quo.resources/get-network :ethereum)}
{:source (quo.resources/get-network :optimism)} {:source (quo.resources/get-network :optimism)}
@ -76,7 +86,9 @@
[quo/account-overview temp/account-overview-state] [quo/account-overview temp/account-overview-state]
[quo/wallet-graph {:time-frame :empty}] [quo/wallet-graph {:time-frame :empty}]
[quo/wallet-ctas [quo/wallet-ctas
{:send-action #(rf/dispatch [:open-modal :wallet-select-address])}] {:send-action #(rf/dispatch [:open-modal :wallet-select-address])
:buy-action #(rf/dispatch [:show-bottom-sheet
{:content buy-drawer}])}]
[quo/tabs [quo/tabs
{:style style/tabs {:style style/tabs
:size 32 :size 32

View File

@ -260,3 +260,41 @@
(status.resources/get-mock-image :collectible2) (status.resources/get-mock-image :collectible2)
(status.resources/get-mock-image :collectible3) (status.resources/get-mock-image :collectible3)
(status.resources/get-mock-image :collectible4)]) (status.resources/get-mock-image :collectible4)])
(def buy-tokens-list
[{:title "Ramp"
:description :text
:description-props {:text (i18n/label :t/ramp-description)}
:tag :context
:tag-props {:icon :i/fees
:context "0.49% - 2.9%"}
:action :arrow
:action-props {:alignment :flex-start
:icon :i/external}
:image :icon-avatar
:image-props {:icon (status.resources/get-service-image :ramp)}
:on-press #(rn/open-url "https://ramp.com")}
{:title "MoonPay"
:description :text
:description-props {:text (i18n/label :t/moonpay-description)}
:tag :context
:tag-props {:icon :i/fees
:context "1% - 4.5%"}
:action :arrow
:action-props {:alignment :flex-start
:icon :i/external}
:image :icon-avatar
:image-props {:icon (status.resources/get-service-image :moonpay)}
:on-press #(rn/open-url "https://moonpay.com")}
{:title "Latamex"
:description :text
:description-props {:text (i18n/label :t/latamex-description)}
:tag :context
:tag-props {:icon :i/fees
:context "1% - 1.7%"}
:action :arrow
:action-props {:alignment :flex-start
:icon :i/external}
:image :icon-avatar
:image-props {:icon (status.resources/get-service-image :latamex)}
:on-press #(rn/open-url "https://latamex.com")}])

View File

@ -2350,5 +2350,9 @@
"remove-account": "Remove account", "remove-account": "Remove account",
"select-another-account": "Select another account", "select-another-account": "Select another account",
"oops-this-qr-does-not-contain-an-address": "Oops! This QR does not contain an address", "oops-this-qr-does-not-contain-an-address": "Oops! This QR does not contain an address",
"scan-an-account-qr-code": "Scan an account QR code" "scan-an-account-qr-code": "Scan an account QR code",
"buy-tokens": "Buy Tokens",
"ramp-description": "Global crypto to fiat flow.",
"moonpay-description": "The new standard for fiat to crypto, supports Apple Pay.",
"latamex-description": "Easily buy crypto in Argentina, Mexico and Brazil."
} }