Reanimate RPC stats screen

This commit is contained in:
Roman Volosovskyi 2024-01-04 16:46:40 +01:00
parent 4eff9cc39c
commit 09408e7811
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 48 additions and 48 deletions

View File

@ -6,7 +6,6 @@
[legacy.status-im.ui.components.typography :as typography] [legacy.status-im.ui.components.typography :as typography]
[legacy.status-im.utils.utils :as utils] [legacy.status-im.utils.utils :as utils]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[react-native.core :as rn]
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im.common.json-rpc.events :as json-rpc] [status-im.common.json-rpc.events :as json-rpc]
[taoensso.timbre :as log] [taoensso.timbre :as log]
@ -86,29 +85,28 @@
(defn stats-table (defn stats-table
[{:keys [total filtered-total stats]}] [{:keys [total filtered-total stats]}]
rn/scroll-view [react/scroll-view
{:style {:padding-horizontal 8}} {:style {:padding-horizontal 8}}
rn/view [react/view
[react/view
{:style {:flex-direction :row {:style {:flex-direction :row
:justify-content :space-between :justify-content :space-between
:margin-bottom 2}} :margin-bottom 2}}
[legacy.status-im.ui.components.core/text {:style typography/font-semi-bold} [legacy.status-im.ui.components.core/text {:style typography/font-semi-bold}
(i18n/label :t/rpc-usage-total)] (i18n/label :t/rpc-usage-total)]
[legacy.status-im.ui.components.core/text {:style typography/font-semi-bold} [legacy.status-im.ui.components.core/text {:style typography/font-semi-bold}
(i18n/label :t/rpc-usage-filtered-total {:filtered-total filtered-total :total total})] (i18n/label :t/rpc-usage-filtered-total {:filtered-total filtered-total :total total})]]
[react/view
{:style {:flex-direction :column
:flex 1}}
(when (seq stats) (when (seq stats)
(for [[k v] stats] (for [[k v] stats]
^{:key (str k v)} ^{:key (str k v)}
[:<> [react/view
rn/view
{:style {:flex-direction :row {:style {:flex-direction :row
:align-items :center :align-items :stretch}}
:margin-vertical 10}} [legacy.status-im.ui.components.core/text {:style {:flex 7}} k]
[legacy.status-im.ui.components.core/text {:style {:flex 1}} [legacy.status-im.ui.components.core/text {:style {:flex 1}} v]]))]]])
k]
[legacy.status-im.ui.components.core/text {:style {:margin-left 16}}
v]
[legacy.status-im.ui.components.core/separator]])))
(defn prepare-stats (defn prepare-stats
[{:keys [stats]}] [{:keys [stats]}]
@ -125,9 +123,11 @@
[react/view [react/view
{:flex 1 {:flex 1
:margin-horizontal 8} :margin-horizontal 8}
rn/view [react/view
{:style {:flex-direction :column
:justify-content :space-between}}
[react/view
{:style {:flex-direction :row {:style {:flex-direction :row
:margin-vertical 8
:justify-content :space-between}} :justify-content :space-between}}
[legacy.status-im.ui.components.core/button [legacy.status-im.ui.components.core/button
{:on-press #(re-frame/dispatch [::reset]) {:on-press #(re-frame/dispatch [::reset])
@ -137,7 +137,7 @@
{:on-press {:on-press
#(react/copy-to-clipboard (prepare-stats stats)) #(react/copy-to-clipboard (prepare-stats stats))
:accessibility-label :rpc-usage-copy} :accessibility-label :rpc-usage-copy}
(i18n/label :t/rpc-usage-copy)] (i18n/label :t/rpc-usage-copy)]]
[legacy.status-im.ui.components.core/text-input [legacy.status-im.ui.components.core/text-input
{:on-change-text #(re-frame/dispatch [::set-filter %]) {:on-change-text #(re-frame/dispatch [::set-filter %])
:label (i18n/label :t/rpc-usage-filter-methods) :label (i18n/label :t/rpc-usage-filter-methods)
@ -148,7 +148,7 @@
:default-value methods-filter :default-value methods-filter
:auto-capitalize :none :auto-capitalize :none
:show-cancel false :show-cancel false
:auto-focus false}] :auto-focus false}]]
[stats-table stats]])) [stats-table stats]]))
(defn usage-info (defn usage-info