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