Remove dApps tab from Wallet (#20818)

This commit is contained in:
Alexander 2024-07-23 17:57:27 +02:00 committed by GitHub
parent a5c8182461
commit 8597b899bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 65 deletions

View File

@ -1,18 +0,0 @@
(ns status-im.contexts.wallet.account.tabs.dapps.style
(:require
[quo.foundations.colors :as colors]))
(def dapps-container
{:padding-horizontal 20
:padding-vertical 8})
(defn dapps-list
[theme]
{:border-radius 16
:border-width 1
:border-color (colors/theme-colors colors/neutral-10 colors/neutral-80 theme)})
(defn separator
[theme]
{:height 1
:background-color (colors/theme-colors colors/neutral-10 colors/neutral-80 theme)})

View File

@ -1,37 +0,0 @@
(ns status-im.contexts.wallet.account.tabs.dapps.view
(:require
[quo.core :as quo]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[status-im.common.resources :as resources]
[status-im.contexts.wallet.account.tabs.dapps.style :as style]
[status-im.contexts.wallet.common.empty-tab.view :as empty-tab]
[utils.i18n :as i18n]))
(defn dapp-options
[]
[quo/action-drawer
[[{:icon :i/browser
:accessibility-label :visit-dapp
:label (i18n/label :t/visit-dapp)}
{:icon :i/disconnect
:accessibility-label :disconnect-dapp
:label (i18n/label :t/disconnect-dapp)
:add-divider? true
:danger? true}]]])
(defn view
[]
(let [theme (quo.theme/use-theme)
dapps-list []]
(if (empty? dapps-list)
[empty-tab/view
{:title (i18n/label :t/no-dapps)
:description (i18n/label :t/no-dapps-description)
:image (resources/get-themed-image :no-dapps theme)}]
[rn/view {:style style/dapps-container}
[rn/flat-list
{:data dapps-list
:style (style/dapps-list theme)
:render-fn (fn [item] [quo/dapp item])
:separator [rn/view {:style (style/separator theme)}]}]])))

View File

@ -3,7 +3,6 @@
[react-native.core :as rn]
[status-im.contexts.wallet.account.tabs.about.view :as about]
[status-im.contexts.wallet.account.tabs.assets.view :as assets]
[status-im.contexts.wallet.account.tabs.dapps.view :as dapps]
[status-im.contexts.wallet.collectible.options.view :as options-drawer]
[status-im.contexts.wallet.common.activity-tab.view :as activity]
[status-im.contexts.wallet.common.collectibles-tab.view :as collectibles]
@ -45,5 +44,4 @@
{:title (i18n/label :t/no-permissions)
:description (i18n/label :t/no-collectibles-description)
:placeholder? true}]
:dapps [dapps/view]
[about/view])]))

View File

@ -13,13 +13,11 @@
(def first-tab-id :assets)
(defn tabs-data
[watch-only?]
(cond-> [{:id :assets :label (i18n/label :t/assets) :accessibility-label :assets-tab}
{:id :collectibles :label (i18n/label :t/collectibles) :accessibility-label :collectibles-tab}
{:id :activity :label (i18n/label :t/activity) :accessibility-label :activity-tab}]
(not watch-only?) (conj {:id :dapps :label (i18n/label :t/dapps) :accessibility-label :dapps})
:always (conj {:id :about :label (i18n/label :t/about) :accessibility-label :about})))
(def tabs-data
[{:id :assets :label (i18n/label :t/assets) :accessibility-label :assets-tab}
{:id :collectibles :label (i18n/label :t/collectibles) :accessibility-label :collectibles-tab}
{:id :activity :label (i18n/label :t/activity) :accessibility-label :activity-tab}
{:id :about :label (i18n/label :t/about) :accessibility-label :about}])
(defn- change-tab [id] (rf/dispatch [:wallet/select-account-tab id]))
@ -69,7 +67,7 @@
{:style style/tabs
:size 32
:active-tab-id selected-tab
:data (tabs-data watch-only?)
:data tabs-data
:on-change change-tab
:scrollable? true
:scroll-on-press? true}]