From 7875e11ea06644f68e5232daf0b7aa967371f0c2 Mon Sep 17 00:00:00 2001 From: alwx Date: Thu, 7 Sep 2017 18:32:49 +0300 Subject: [PATCH] 1628: Add Testnet warning, so no real ether or SNT is sent to the app --- src/status_im/translations/en.cljs | 2 ++ src/status_im/ui/screens/profile/styles.cljs | 24 ++++++++++++++++++++ src/status_im/ui/screens/profile/views.cljs | 19 ++++++++++++++-- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index b88790f8df..ed95316754 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -97,6 +97,8 @@ :share-qr "Share QR" :error-incorrect-name "Please select another name" :error-incorrect-email "Incorrect e-mail" + :profile-testnet-icon "Testnet" + :profile-testnet-text "Ropsten Testnet Only. Please do not send real ETH or SNT to your address" ;;make_photo :image-source-title "Profile image" diff --git a/src/status_im/ui/screens/profile/styles.cljs b/src/status_im/ui/screens/profile/styles.cljs index 15086f5859..e90f9f13f5 100644 --- a/src/status_im/ui/screens/profile/styles.cljs +++ b/src/status_im/ui/screens/profile/styles.cljs @@ -1,5 +1,6 @@ (ns status-im.ui.screens.profile.styles (:require [status-im.components.styles + :as styles :refer [color-black color-gray4 @@ -190,3 +191,26 @@ (def add-a-status (merge profile-status-text {:color color-gray4})) + +(def testnet-only-container + {:background-color styles/color-dark + :flex-direction :row + :padding 14}) + +(def testnet-only-text + {:flex 1 + :color color-white + :margin-left 12}) + +(def testnet-icon + {:border-radius 15 + :border-width 1 + :border-color styles/color-gray + :height 27 + :width 65 + :flex-direction :row + :align-items :center + :justify-content :center}) + +(def testnet-icon-text + {:color color-white}) diff --git a/src/status_im/ui/screens/profile/views.cljs b/src/status_im/ui/screens/profile/views.cljs index 5ff903807b..aab3c7fedf 100644 --- a/src/status_im/ui/screens/profile/views.cljs +++ b/src/status_im/ui/screens/profile/views.cljs @@ -182,11 +182,23 @@ [react/text {:style styles/profile-status-text} (colorize-status-hashtags status)]]]])]) + +(defn testnet-only [] + [react/view styles/testnet-only-container + [react/view styles/testnet-icon + [react/text {:style styles/testnet-icon-text} + (label :t/profile-testnet-icon)]] + [react/text {:style styles/testnet-only-text} + (label :t/profile-testnet-text)]]) + (defview my-profile [] - (letsubs [{:keys [status] :as current-account} [:get-current-account]] + (letsubs [{:keys [status] :as current-account} [:get-current-account] + network [:get :network]] [react/view styles/profile [status-bar] [my-profile-toolbar] + (when (= network "testnet") + [testnet-only]) [react/scroll-view [react/view styles/profile-form [profile-badge current-account] @@ -207,10 +219,13 @@ status whisper-identity] :as contact} [:contact] - chat-id [:get :current-chat-id]] + chat-id [:get :current-chat-id] + network [:get :network]] [react/view styles/profile [status-bar] [profile-toolbar contact] + (when (= network "testnet") + [testnet-only]) [react/scroll-view [react/view styles/profile-form [profile-badge contact]