|
| 1 | +(ns status-im2.contexts.wallet.send.transaction-confirmation.view |
| 2 | + (:require |
| 3 | + [quo.core :as quo] |
| 4 | + [quo.foundations.resources :as quo.resources] |
| 5 | + [quo.theme :as quo.theme] |
| 6 | + [react-native.core :as rn] |
| 7 | + [react-native.safe-area :as safe-area] |
| 8 | + [reagent.core :as reagent] |
| 9 | + [status-im2.common.resources :as resources] |
| 10 | + [status-im2.contexts.wallet.send.transaction-confirmation.style :as style] |
| 11 | + [utils.i18n :as i18n] |
| 12 | + [utils.re-frame :as rf])) |
| 13 | + |
| 14 | +(defn- transaction-title |
| 15 | + [] |
| 16 | + [rn/view {:style style/content-container} |
| 17 | + [rn/view {:style {:flex-direction :row}} |
| 18 | + [quo/text |
| 19 | + {:size :heading-1 |
| 20 | + :weight :semi-bold |
| 21 | + :style style/title-container |
| 22 | + :accessibility-label :send-label} |
| 23 | + (i18n/label :t/send)] |
| 24 | + [quo/summary-tag |
| 25 | + {:label "150 ETH" |
| 26 | + :type :token |
| 27 | + :image-source (quo.resources/get-token :eth)}]] |
| 28 | + [rn/view |
| 29 | + {:style {:flex-direction :row |
| 30 | + :margin-top 4}} |
| 31 | + [quo/text |
| 32 | + {:size :heading-1 |
| 33 | + :weight :semi-bold |
| 34 | + :style style/title-container |
| 35 | + :accessibility-label :send-label} |
| 36 | + (i18n/label :t/from)] |
| 37 | + [quo/summary-tag |
| 38 | + {:label "Collectibles vault" |
| 39 | + :type :account |
| 40 | + :emoji "🍑" |
| 41 | + :customization-color :purple}]] |
| 42 | + [rn/view |
| 43 | + {:style {:flex-direction :row |
| 44 | + :margin-top 4}} |
| 45 | + [quo/text |
| 46 | + {:size :heading-1 |
| 47 | + :weight :semi-bold |
| 48 | + :style style/title-container |
| 49 | + :accessibility-label :send-label} |
| 50 | + (i18n/label :t/to)] |
| 51 | + [quo/summary-tag |
| 52 | + {:label "Mark Libot" |
| 53 | + :type :user |
| 54 | + :image-source (resources/get-mock-image :user-picture-male4) |
| 55 | + :customization-color :magenta}]]]) |
| 56 | + |
| 57 | +(defn- transaction-from |
| 58 | + [status-account-props theme] |
| 59 | + [rn/view |
| 60 | + {:style {:padding-horizontal 20 |
| 61 | + :padding-bottom 16}} |
| 62 | + [quo/text |
| 63 | + {:size :paragraph-2 |
| 64 | + :weight :medium |
| 65 | + :style (style/section-label theme) |
| 66 | + :accessibility-label :summary-from-label} |
| 67 | + (i18n/label :t/from-capitalized)] |
| 68 | + [quo/summary-info |
| 69 | + {:type :status-account |
| 70 | + :networks? true |
| 71 | + :values {:ethereum 150 |
| 72 | + :optimism 50 |
| 73 | + :arbitrum 25} |
| 74 | + :account-props status-account-props}]]) |
| 75 | + |
| 76 | +(defn- transaction-to |
| 77 | + [user-props theme] |
| 78 | + [rn/view |
| 79 | + {:style {:padding-horizontal 20 |
| 80 | + :padding-bottom 16}} |
| 81 | + [quo/text |
| 82 | + {:size :paragraph-2 |
| 83 | + :weight :medium |
| 84 | + :style (style/section-label theme) |
| 85 | + :accessibility-label :summary-from-label} |
| 86 | + (i18n/label :t/to-capitalized)] |
| 87 | + [quo/summary-info |
| 88 | + {:type :user |
| 89 | + :networks? true |
| 90 | + :values {:ethereum 150 |
| 91 | + :optimism 50 |
| 92 | + :arbitrum 25} |
| 93 | + :account-props user-props}]]) |
| 94 | + |
| 95 | +(defn- transaction-details |
| 96 | + [theme] |
| 97 | + [rn/view |
| 98 | + {:style {:padding-horizontal 20 |
| 99 | + :padding-bottom 16}} |
| 100 | + [quo/text |
| 101 | + {:size :paragraph-2 |
| 102 | + :weight :medium |
| 103 | + :style (style/section-label theme) |
| 104 | + :accessibility-label :summary-from-label} |
| 105 | + (i18n/label :t/details)] |
| 106 | + [rn/view |
| 107 | + {:style (style/details-container theme)} |
| 108 | + [quo/data-item |
| 109 | + {:container-style {:flex 1 |
| 110 | + :height 36} |
| 111 | + :blur? false |
| 112 | + :description :default |
| 113 | + :icon-right? false |
| 114 | + :card? false |
| 115 | + :label :none |
| 116 | + :status :default |
| 117 | + :size :small |
| 118 | + :title (i18n/label :t/est-time) |
| 119 | + :subtitle "3-5 min"}] |
| 120 | + [quo/data-item |
| 121 | + {:container-style {:flex 1 |
| 122 | + :height 36} |
| 123 | + :blur? false |
| 124 | + :description :default |
| 125 | + :icon-right? false |
| 126 | + :card? false |
| 127 | + :label :none |
| 128 | + :status :default |
| 129 | + :size :small |
| 130 | + :title (i18n/label :t/max-fees) |
| 131 | + :subtitle "€188,70"}] |
| 132 | + [quo/data-item |
| 133 | + {:container-style {:flex 1 |
| 134 | + :height 36} |
| 135 | + :blur? false |
| 136 | + :description :default |
| 137 | + :icon-right? false |
| 138 | + :card? false |
| 139 | + :label :none |
| 140 | + :status :default |
| 141 | + :size :small |
| 142 | + :title (i18n/label :t/user-gets {:name "Mark"}) |
| 143 | + :subtitle "149.99 ETH"}]]]) |
| 144 | + |
| 145 | +(defn- f-view-internal |
| 146 | + [_] |
| 147 | + (let [reset-slider? (reagent/atom false) |
| 148 | + margin-top (safe-area/get-top) |
| 149 | + biometric-auth? true |
| 150 | + on-close #(rf/dispatch [:navigate-back-within-stack :wallet-select-asset]) |
| 151 | + status-account-props {:customization-color :purple |
| 152 | + :size 32 |
| 153 | + :emoji "🍑" |
| 154 | + :type :default |
| 155 | + :name "Collectibles vault" |
| 156 | + :address "0x0ah...78b"} |
| 157 | + user-props {:full-name "M L" |
| 158 | + :status-indicator? false |
| 159 | + :size :small |
| 160 | + :ring-background (resources/get-mock-image :ring) |
| 161 | + :customization-color :blue |
| 162 | + :name "Mark Libot" |
| 163 | + :address "0x0ah...78b" |
| 164 | + :status-account (merge status-account-props |
| 165 | + {:size 16 |
| 166 | + :name "New house" |
| 167 | + :emoji "🍔"})}] |
| 168 | + (fn [{:keys [theme]}] |
| 169 | + [rn/view {:style {:flex 1}} |
| 170 | + [quo/gradient-cover {:customization-color :purple}] |
| 171 | + [rn/view {:style (style/container margin-top)} |
| 172 | + [quo/page-nav |
| 173 | + {:icon-name :i/arrow-left |
| 174 | + :on-press on-close |
| 175 | + :accessibility-label :top-bar |
| 176 | + :right-side [{:icon-name :i/advanced |
| 177 | + :on-press (fn callback [] nil) |
| 178 | + :accessibility-label "Advanced"}]}] |
| 179 | + [transaction-title] |
| 180 | + [transaction-from status-account-props theme] |
| 181 | + [transaction-to user-props theme] |
| 182 | + [transaction-details theme] |
| 183 | + [rn/view {:style style/slide-button-container} |
| 184 | + [quo/slide-button |
| 185 | + {:size :size/s-48 |
| 186 | + :customization-color :purple |
| 187 | + :on-reset (when @reset-slider? #(reset! reset-slider? false)) |
| 188 | + :on-complete #(js/alert "Not implemented yet") |
| 189 | + :track-icon (if biometric-auth? :i/face-id :password) |
| 190 | + :track-text (i18n/label :t/slide-to-send)}]]]]))) |
| 191 | + |
| 192 | +(defn view-internal |
| 193 | + [props] |
| 194 | + [:f> f-view-internal props]) |
| 195 | + |
| 196 | +(def view (quo.theme/with-theme view-internal)) |
0 commit comments