-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE #2883] Migrate wallet/request to latest mockups
Signed-off-by: Goran Jovic <goranjovic@gmail.com>
- Loading branch information
1 parent
96f08ab
commit 748b0fc
Showing
39 changed files
with
467 additions
and
695 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,29 @@ | ||
(ns status-im.ui.components.qr-code-viewer.views | ||
(:require [re-frame.core :as re-frame] | ||
[status-im.ui.components.react :as react] | ||
[status-im.ui.components.icons.vector-icons :as vector-icons] | ||
[status-im.ui.components.status-bar.view :as status-bar] | ||
[status-im.ui.components.list-selection :as list-selection] | ||
[status-im.ui.components.qr-code-viewer.styles :as styles] | ||
[status-im.ui.components.common.common :as common] | ||
[status-im.ui.components.common.styles :as common.styles] | ||
[status-im.utils.platform :as platform] | ||
[status-im.i18n :as i18n] | ||
(:require [reagent.core :as reagent] | ||
[status-im.react-native.js-dependencies :as rn-dependencies] | ||
[reagent.core :as r]) | ||
(:require-macros [status-im.utils.views :refer [defview letsubs]])) | ||
[status-im.ui.components.qr-code-viewer.styles :as styles] | ||
[status-im.ui.components.react :as react])) | ||
|
||
(defn qr-code [props] | ||
(r/create-element | ||
(reagent/create-element | ||
rn-dependencies/qr-code | ||
(clj->js (merge {:inverted true} props)))) | ||
|
||
(defn qr-viewer-toolbar [name qr-value] | ||
[react/view styles/account-toolbar | ||
[react/view styles/toolbar-contents | ||
[react/view styles/toolbar-action-container | ||
[common/icon-or-label {:on-press #(re-frame/dispatch [:navigate-back])} | ||
:t/done styles/toolbar-done-text-ios :icons/close {:color :black}]] | ||
[react/view styles/name-container | ||
[react/text {:style styles/name-text | ||
:number-of-lines 1} name]] | ||
[react/view styles/toolbar-action-container | ||
[react/touchable-highlight {:on-press #(list-selection/open-share {:message qr-value})} | ||
[react/view styles/toolbar-action-icon-container | ||
[vector-icons/icon :icons/share {:color :black}]]]]]]) | ||
|
||
(defn qr-viewer-body [qr-value dimensions] | ||
[react/view {:style styles/qr-code | ||
:on-layout #(let [layout (.. % -nativeEvent -layout)] | ||
(re-frame/dispatch [:set-in [:qr-modal :dimensions] {:width (* 0.7 (.-width layout)) | ||
:height (.-height layout)}]))} | ||
[react/text {:style styles/qr-code-hint} (i18n/label :t/qr-code-public-key-hint)] | ||
(when (:width dimensions) | ||
[react/view {:style (styles/qr-code-container dimensions)} | ||
[qr-code {:value qr-value | ||
:size (- (min (:width dimensions) | ||
(:height dimensions)) | ||
(* 2 styles/qr-code-padding))}]])]) | ||
|
||
(defn qr-viewer-footer [qr-value] | ||
(defn- footer [style value] | ||
[react/view styles/footer | ||
[react/view styles/wallet-info | ||
[react/text {:style styles/hash-value-text} qr-value]]]) | ||
[react/text {:style (merge styles/hash-value-text style)} | ||
value]]]) | ||
|
||
(defview qr-viewer [] | ||
(letsubs [{:keys [qr-value dimensions contact]} [:get :qr-modal]] | ||
[react/view styles/wallet-qr-code | ||
[status-bar/status-bar {:type :modal}] | ||
[qr-viewer-toolbar (:name contact) qr-value] | ||
[qr-viewer-body qr-value dimensions] | ||
[qr-viewer-footer qr-value]])) | ||
(defn qr-code-viewer [{:keys [hint-style footer-style]} value hint legend] | ||
{:pre [(not (nil? value))]} | ||
(let [{:keys [width height]} (react/get-dimensions "window")] | ||
[react/view {:style styles/qr-code} | ||
[react/text {:style (merge styles/qr-code-hint hint-style)} | ||
hint] | ||
(when width | ||
(let [size (int (* 0.7 (min width height)))] | ||
[react/view {:style (styles/qr-code-container size)} | ||
[qr-code {:value value | ||
:size (- size (* 2 styles/qr-code-padding))}]])) | ||
[footer footer-style legend]])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.