From 9be8a5b961d9e09e90e3c36dd9f6bf85dda8538a Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 8 Dec 2022 11:08:16 +0100 Subject: [PATCH] Add peers stats screen --- .../ui/screens/advanced_settings/views.cljs | 7 +++++++ src/status_im/ui/screens/peers_stats.cljs | 14 ++++++++++++++ src/status_im/ui/screens/screens.cljs | 4 ++++ translations/en.json | 2 ++ 4 files changed, 27 insertions(+) create mode 100644 src/status_im/ui/screens/peers_stats.cljs diff --git a/src/status_im/ui/screens/advanced_settings/views.cljs b/src/status_im/ui/screens/advanced_settings/views.cljs index 92473c5acd..c595ad2ec9 100644 --- a/src/status_im/ui/screens/advanced_settings/views.cljs +++ b/src/status_im/ui/screens/advanced_settings/views.cljs @@ -69,6 +69,13 @@ :on-press #(re-frame/dispatch [:navigate-to :rpc-usage-info]) :chevron true} + {:size :small + :title (i18n/label :t/peers-stats) + :accessibility-label :peers-stats + :container-margin-top 8 + :on-press + #(re-frame/dispatch [:navigate-to :peers-stats]) + :chevron true} ;; If it's enabled in the config, we don't show the option (when (not config/communities-enabled?) {:size :small diff --git a/src/status_im/ui/screens/peers_stats.cljs b/src/status_im/ui/screens/peers_stats.cljs new file mode 100644 index 0000000000..09087ddf7e --- /dev/null +++ b/src/status_im/ui/screens/peers_stats.cljs @@ -0,0 +1,14 @@ +(ns status-im.ui.screens.peers-stats + (:require [react-native.core :as react-native.core] + [status-im.i18n.i18n :as i18n] + [utils.re-frame :as re-frame])) + +(defn peers-stats [] + (let [peers-count (re-frame/sub [:peers-count])] + [react-native.core/view {:flex 1 + :margin-horizontal 8} + [react-native.core/view + {:style {:flex-direction :row + :margin-vertical 8 + :justify-content :space-between}} + [react-native.core/text (str (i18n/label :t/peers-count) ": " peers-count)]]])) diff --git a/src/status_im/ui/screens/screens.cljs b/src/status_im/ui/screens/screens.cljs index dcb81a6f69..86622c8fd2 100644 --- a/src/status_im/ui/screens/screens.cljs +++ b/src/status_im/ui/screens/screens.cljs @@ -102,6 +102,7 @@ [status-im.ui.screens.backup-settings.view :as backup-settings] [status-im.ui.screens.reset-password.views :as reset-password] [status-im.ui.screens.rpc-usage-info :as rpc-usage-info] + [status-im.ui.screens.peers-stats :as peers-stats] [status-im.ui.screens.status.new.views :as status.new] [status-im.ui.screens.stickers.views :as stickers] [status-im.ui.screens.sync-settings.views :as sync-settings] @@ -541,6 +542,9 @@ {:name :rpc-usage-info :options {:topBar {:title {:text (i18n/label :t/rpc-usage-info)}}} :component rpc-usage-info/usage-info} + {:name :peers-stats + :options {:topBar {:title {:text (i18n/label :t/peers-stats)}}} + :component peers-stats/peers-stats} {:name :edit-network :options {:topBar {:title {:text (i18n/label :t/add-network)}}} :component edit-network/edit-network} diff --git a/translations/en.json b/translations/en.json index ac90816e5f..51d83bd886 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1049,6 +1049,8 @@ "paste-json": "Paste JSON", "pay-to-chat": "Pay to chat", "peers": "Peers", + "peers-count": "Peers count", + "peers-stats": "Peers stats", "pending": "Pending", "pending-confirmation": "Pending confirmation...", "permissions": "Permissions",