From 6b2fed4b46cabf68b06ead8864ea4989aae6f36d Mon Sep 17 00:00:00 2001 From: Shivek Khurana Date: Fri, 16 Feb 2024 11:30:05 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=A7=AA=20Extract=20schema=20to=20dedi?= =?UTF-8?q?cated=20namespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wallet/network_amount/schema.cljs | 11 +++++++++++ .../components/wallet/network_amount/view.cljs | 11 +---------- .../wallet/network_bridge/schema.cljs | 17 +++++++++++++++++ .../components/wallet/network_bridge/view.cljs | 17 +---------------- .../wallet/network_routing/schema.cljs | 17 +++++++++++++++++ .../components/wallet/network_routing/view.cljs | 17 +---------------- .../components/wallet/progress_bar/schema.cljs | 12 ++++++++++++ .../components/wallet/progress_bar/view.cljs | 12 +----------- .../wallet/required_tokens/schema.cljs | 17 +++++++++++++++++ .../components/wallet/required_tokens/view.cljs | 17 +---------------- .../components/wallet/summary_info/schema.cljs | 13 +++++++++++++ .../components/wallet/summary_info/view.cljs | 13 +------------ 12 files changed, 93 insertions(+), 81 deletions(-) create mode 100644 src/quo/components/wallet/network_amount/schema.cljs create mode 100644 src/quo/components/wallet/network_bridge/schema.cljs create mode 100644 src/quo/components/wallet/network_routing/schema.cljs create mode 100644 src/quo/components/wallet/progress_bar/schema.cljs create mode 100644 src/quo/components/wallet/required_tokens/schema.cljs create mode 100644 src/quo/components/wallet/summary_info/schema.cljs diff --git a/src/quo/components/wallet/network_amount/schema.cljs b/src/quo/components/wallet/network_amount/schema.cljs new file mode 100644 index 00000000000..a7baa54e5f7 --- /dev/null +++ b/src/quo/components/wallet/network_amount/schema.cljs @@ -0,0 +1,11 @@ +(ns quo.components.wallet.network-amount.schema) + +(def ?schema + [:=> + [:catn + [:props + [:map {:closed true} + [:amount {:optional true} [:maybe :string]] + [:token {:optional true} [:or :keyword :string]] + [:theme :schema.common/theme]]]] + :any]) diff --git a/src/quo/components/wallet/network_amount/view.cljs b/src/quo/components/wallet/network_amount/view.cljs index bd6cccc802b..d7ed6b37f64 100644 --- a/src/quo/components/wallet/network_amount/view.cljs +++ b/src/quo/components/wallet/network_amount/view.cljs @@ -3,21 +3,12 @@ [clojure.string :as string] [quo.components.markdown.text :as text] [quo.components.utilities.token.view :as token] + [quo.components.wallet.network-amount.schema :refer [?schema]] [quo.components.wallet.network-amount.style :as style] [quo.theme :as quo.theme] [react-native.core :as rn] [schema.core :as schema])) -(def ?schema - [:=> - [:catn - [:props - [:map {:closed true} - [:amount {:optional true} [:maybe :string]] - [:token {:optional true} [:or :keyword :string]] - [:theme :schema.common/theme]]]] - :any]) - (defn- view-internal [{:keys [amount token theme]}] [rn/view {:style style/container} diff --git a/src/quo/components/wallet/network_bridge/schema.cljs b/src/quo/components/wallet/network_bridge/schema.cljs new file mode 100644 index 00000000000..c070baabb2d --- /dev/null +++ b/src/quo/components/wallet/network_bridge/schema.cljs @@ -0,0 +1,17 @@ +(ns quo.components.wallet.network-bridge.schema) + +(def ^:private ?network-bridge-status + [:enum :add :loading :locked :disabled :default]) + +(def ?schema + [:=> + [:catn + [:props + [:map + [:theme :schema.common/theme] + [:network {:optional true} [:maybe :keyword]] + [:status {:optional true} [:maybe ?network-bridge-status]] + [:amount {:optional true} [:maybe :string]] + [:container-style {:optional true} [:maybe :map]] + [:on-press {:optional true} [:maybe fn?]]]]] + :any]) diff --git a/src/quo/components/wallet/network_bridge/view.cljs b/src/quo/components/wallet/network_bridge/view.cljs index e8c934515a5..c45780dba6e 100644 --- a/src/quo/components/wallet/network_bridge/view.cljs +++ b/src/quo/components/wallet/network_bridge/view.cljs @@ -3,6 +3,7 @@ [clojure.string :as string] [quo.components.icon :as icon] [quo.components.markdown.text :as text] + [quo.components.wallet.network-bridge.schema:refer [?schema]] [quo.components.wallet.network-bridge.style :as style] [quo.foundations.colors :as colors] [quo.foundations.resources :as resources] @@ -25,22 +26,6 @@ (= network :ethereum) "Mainnet" :else (string/capitalize (name network)))) -(def ^:private ?network-bridge-status - [:enum :add :loading :locked :disabled :default]) - -(def ?schema - [:=> - [:catn - [:props - [:map - [:theme :schema.common/theme] - [:network {:optional true} [:maybe :keyword]] - [:status {:optional true} [:maybe ?network-bridge-status]] - [:amount {:optional true} [:maybe :string]] - [:container-style {:optional true} [:maybe :map]] - [:on-press {:optional true} [:maybe fn?]]]]] - :any]) - (defn view-internal [{:keys [theme network status amount container-style on-press] :as args}] (if (= status :add) diff --git a/src/quo/components/wallet/network_routing/schema.cljs b/src/quo/components/wallet/network_routing/schema.cljs new file mode 100644 index 00000000000..fec6a7a3d9d --- /dev/null +++ b/src/quo/components/wallet/network_routing/schema.cljs @@ -0,0 +1,17 @@ +(ns quo.components.wallet.network-routing.schema) + +(def ?schema + [:=> + [:catn + [:props + [:map + [:networks {:optional true} + [:maybe + [:sequential + [:map + [:amount :int] + [:max-amount :int] + [:network-name [:or :string :keyword]]]]]] + [:container-style {:optional true} [:maybe :map]] + [:theme :schema.common/theme]]]] + :any]) diff --git a/src/quo/components/wallet/network_routing/view.cljs b/src/quo/components/wallet/network_routing/view.cljs index 001e7de64f3..23d06bca154 100644 --- a/src/quo/components/wallet/network_routing/view.cljs +++ b/src/quo/components/wallet/network_routing/view.cljs @@ -2,6 +2,7 @@ (:require [oops.core :as oops] [quo.components.wallet.network-routing.animation :as animation] + [quo.components.wallet.network-routing.schema :refer [?schema]] [quo.components.wallet.network-routing.style :as style] [quo.theme :as quo.theme] [react-native.core :as rn] @@ -173,22 +174,6 @@ [rn/view {:style (style/max-limit-bar-background network-name)}] [dashed-line network-name]])])))) -(def ?schema - [:=> - [:catn - [:props - [:map - [:networks {:optional true} - [:maybe - [:sequential - [:map - [:amount :int] - [:max-amount :int] - [:network-name [:or :string :keyword]]]]]] - [:container-style {:optional true} [:maybe :map]] - [:theme :schema.common/theme]]]] - :any]) - (defn view-internal [{:keys [networks container-style theme] :as params}] (reagent/with-let [total-width (reagent/atom nil)] diff --git a/src/quo/components/wallet/progress_bar/schema.cljs b/src/quo/components/wallet/progress_bar/schema.cljs new file mode 100644 index 00000000000..6ef509a6acf --- /dev/null +++ b/src/quo/components/wallet/progress_bar/schema.cljs @@ -0,0 +1,12 @@ +(ns quo.components.wallet.progress-bar.schema) + +(def ?schema + [:=> + [:catn + [:props + [:map + [:customization-color {:optional true} [:maybe :schema.common/customization-color]] + [:theme :schema.common/theme] + [:progressed-value {:optional true} [:maybe [:or :string :int]]] + [:full-width? {:optional true} [:maybe :boolean]]]]] + :any]) diff --git a/src/quo/components/wallet/progress_bar/view.cljs b/src/quo/components/wallet/progress_bar/view.cljs index 9c5f1ed734d..755fc96ca3e 100644 --- a/src/quo/components/wallet/progress_bar/view.cljs +++ b/src/quo/components/wallet/progress_bar/view.cljs @@ -1,21 +1,11 @@ (ns quo.components.wallet.progress-bar.view (:require + [quo.components.wallet.progress-bar.schema :refer [?schema]] [quo.components.wallet.progress-bar.style :as style] [quo.theme :as quo.theme] [react-native.core :as rn] [schema.core :as schema])) -(def ?schema - [:=> - [:catn - [:props - [:map - [:customization-color {:optional true} [:maybe :schema.common/customization-color]] - [:theme :schema.common/theme] - [:progressed-value {:optional true} [:maybe [:or :string :int]]] - [:full-width? {:optional true} [:maybe :boolean]]]]] - :any]) - (defn- view-internal [{:keys [full-width?] :as props}] [rn/view diff --git a/src/quo/components/wallet/required_tokens/schema.cljs b/src/quo/components/wallet/required_tokens/schema.cljs new file mode 100644 index 00000000000..8bf19f6864e --- /dev/null +++ b/src/quo/components/wallet/required_tokens/schema.cljs @@ -0,0 +1,17 @@ +(ns quo.components.wallet.required-tokens.schema) + +(def ?schema + [:=> + [:catn + [:props + [:map {:closed true} + [:type [:enum :token :collectible]] + [:amount {:optional true} [:maybe [:or :string :int]]] + [:token {:optional true} [:maybe :string]] + [:token-img-src {:optional true} [:maybe :schema.common/image-source]] + [:collectible-img-src {:optional true} [:maybe :schema.common/image-source]] + [:collectible-name {:optional true} [:maybe :string]] + [:divider? {:optional true} [:maybe :boolean]] + [:theme :schema.common/theme] + [:container-style {:optional true} [:maybe :map]]]]] + :any]) diff --git a/src/quo/components/wallet/required_tokens/view.cljs b/src/quo/components/wallet/required_tokens/view.cljs index d3a7754e281..bcbde20301b 100644 --- a/src/quo/components/wallet/required_tokens/view.cljs +++ b/src/quo/components/wallet/required_tokens/view.cljs @@ -1,27 +1,12 @@ (ns quo.components.wallet.required-tokens.view (:require [quo.components.markdown.text :as text] [quo.components.utilities.token.view :as token] + [quo.components.wallet.required-tokens.schema :refer [?schema]] [quo.components.wallet.required-tokens.style :as style] quo.theme [react-native.core :as rn] [schema.core :as schema])) -(def ?schema - [:=> - [:catn - [:props - [:map {:closed true} - [:type [:enum :token :collectible]] - [:amount {:optional true} [:maybe [:or :string :int]]] - [:token {:optional true} [:maybe :string]] - [:token-img-src {:optional true} [:maybe :schema.common/image-source]] - [:collectible-img-src {:optional true} [:maybe :schema.common/image-source]] - [:collectible-name {:optional true} [:maybe :string]] - [:divider? {:optional true} [:maybe :boolean]] - [:theme :schema.common/theme] - [:container-style {:optional true} [:maybe :map]]]]] - :any]) - (defn- view-internal [{:keys [type amount token token-img-src collectible-img-src collectible-name divider? theme container-style]}] diff --git a/src/quo/components/wallet/summary_info/schema.cljs b/src/quo/components/wallet/summary_info/schema.cljs new file mode 100644 index 00000000000..3d604830b52 --- /dev/null +++ b/src/quo/components/wallet/summary_info/schema.cljs @@ -0,0 +1,13 @@ +(ns quo.components.wallet.summary-info.schema) + +(def ?schema + [:=> + [:catn + [:props + [:map + [:theme :schema.common/theme] + [:type [:enum :status-account :saved-account :account :user]] + [:account-props {:optional true} [:maybe :map]] + [:networks? {:optional true} [:maybe :boolean]] + [:values {:optional true} [:maybe :map]]]]] + :any]) diff --git a/src/quo/components/wallet/summary_info/view.cljs b/src/quo/components/wallet/summary_info/view.cljs index 697b99718db..cdab276e6ff 100644 --- a/src/quo/components/wallet/summary_info/view.cljs +++ b/src/quo/components/wallet/summary_info/view.cljs @@ -4,6 +4,7 @@ [quo.components.avatars.user-avatar.view :as user-avatar] [quo.components.avatars.wallet-user-avatar.view :as wallet-user-avatar] [quo.components.markdown.text :as text] + [quo.components.wallet.summary-info.schema :refer [?schema]] [quo.components.wallet.summary-info.style :as style] [quo.foundations.colors :as colors] [quo.foundations.resources :as resources] @@ -52,18 +53,6 @@ :amount (str (:amount arbitrum) " " (or (:token-symbol arbitrum) "ARB")) :theme theme}])])) -(def ?schema - [:=> - [:catn - [:props - [:map - [:theme :schema.common/theme] - [:type [:enum :status-account :saved-account :account :user]] - [:account-props {:optional true} [:maybe :map]] - [:networks? {:optional true} [:maybe :boolean]] - [:values {:optional true} [:maybe :map]]]]] - :any]) - (defn- view-internal [{:keys [theme type account-props networks? values]}] [rn/view From 20b8f9e837a0ceeab40cf6e163e888738aa847d8 Mon Sep 17 00:00:00 2001 From: Shivek Khurana Date: Mon, 19 Feb 2024 11:59:37 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20syntax=20errors?= =?UTF-8?q?=20and=20dep=20issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/quo/components/wallet/account_permissions/schema.cljs | 4 ++-- src/quo/components/wallet/network_bridge/view.cljs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/quo/components/wallet/account_permissions/schema.cljs b/src/quo/components/wallet/account_permissions/schema.cljs index a0dd1d95b86..8893b6b52a2 100644 --- a/src/quo/components/wallet/account_permissions/schema.cljs +++ b/src/quo/components/wallet/account_permissions/schema.cljs @@ -1,5 +1,5 @@ (ns quo.components.wallet.account-permissions.schema - (:require [quo.components.wallet.required-tokens.view :as required-tokens])) + (:require [quo.components.wallet.required-tokens.schema :as required-tokens-schema])) (def ?schema [:=> @@ -12,7 +12,7 @@ [:address [:maybe :string]] [:emoji [:maybe :string]] [:customization-color {:optional true} [:maybe :schema.common/customization-color]]]] - [:token-details {:optional true} [:maybe [:sequential required-tokens/?schema]]] + [:token-details {:optional true} [:maybe [:sequential required-tokens-schema/?schema]]] [:keycard? {:optional true} [:maybe :boolean]] [:checked? {:optional true} [:maybe :boolean]] [:disabled? {:optional true} [:maybe :boolean]] diff --git a/src/quo/components/wallet/network_bridge/view.cljs b/src/quo/components/wallet/network_bridge/view.cljs index c45780dba6e..f53dc56e678 100644 --- a/src/quo/components/wallet/network_bridge/view.cljs +++ b/src/quo/components/wallet/network_bridge/view.cljs @@ -3,7 +3,7 @@ [clojure.string :as string] [quo.components.icon :as icon] [quo.components.markdown.text :as text] - [quo.components.wallet.network-bridge.schema:refer [?schema]] + [quo.components.wallet.network-bridge.schema :refer [?schema]] [quo.components.wallet.network-bridge.style :as style] [quo.foundations.colors :as colors] [quo.foundations.resources :as resources] From 824ee93b68b1401e9b04009e0ad65bfce770a98d Mon Sep 17 00:00:00 2001 From: Shivek Khurana Date: Mon, 19 Feb 2024 13:04:46 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A6=9E=20Follow=20guidelines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/quo/components/wallet/network_amount/view.cljs | 4 ++-- src/quo/components/wallet/network_bridge/view.cljs | 4 ++-- src/quo/components/wallet/network_routing/view.cljs | 4 ++-- src/quo/components/wallet/progress_bar/view.cljs | 4 ++-- src/quo/components/wallet/required_tokens/view.cljs | 4 ++-- src/quo/components/wallet/summary_info/view.cljs | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/quo/components/wallet/network_amount/view.cljs b/src/quo/components/wallet/network_amount/view.cljs index d7ed6b37f64..2e92a8c6de2 100644 --- a/src/quo/components/wallet/network_amount/view.cljs +++ b/src/quo/components/wallet/network_amount/view.cljs @@ -3,7 +3,7 @@ [clojure.string :as string] [quo.components.markdown.text :as text] [quo.components.utilities.token.view :as token] - [quo.components.wallet.network-amount.schema :refer [?schema]] + [quo.components.wallet.network-amount.schema :as network-amount-schema] [quo.components.wallet.network-amount.style :as style] [quo.theme :as quo.theme] [react-native.core :as rn] @@ -21,4 +21,4 @@ [rn/view {:style (style/divider theme)}]]) -(def view (quo.theme/with-theme (schema/instrument #'view-internal ?schema))) +(def view (quo.theme/with-theme (schema/instrument #'view-internal network-amount-schema/?schema))) diff --git a/src/quo/components/wallet/network_bridge/view.cljs b/src/quo/components/wallet/network_bridge/view.cljs index f53dc56e678..c033ee953a7 100644 --- a/src/quo/components/wallet/network_bridge/view.cljs +++ b/src/quo/components/wallet/network_bridge/view.cljs @@ -3,7 +3,7 @@ [clojure.string :as string] [quo.components.icon :as icon] [quo.components.markdown.text :as text] - [quo.components.wallet.network-bridge.schema :refer [?schema]] + [quo.components.wallet.network-bridge.schema :as network-bridge-schema] [quo.components.wallet.network-bridge.style :as style] [quo.foundations.colors :as colors] [quo.foundations.resources :as resources] @@ -66,4 +66,4 @@ (def view (quo.theme/with-theme - (schema/instrument #'view-internal ?schema))) + (schema/instrument #'view-internal network-bridge-schema/?schema))) diff --git a/src/quo/components/wallet/network_routing/view.cljs b/src/quo/components/wallet/network_routing/view.cljs index 23d06bca154..a9d1d085289 100644 --- a/src/quo/components/wallet/network_routing/view.cljs +++ b/src/quo/components/wallet/network_routing/view.cljs @@ -2,7 +2,7 @@ (:require [oops.core :as oops] [quo.components.wallet.network-routing.animation :as animation] - [quo.components.wallet.network-routing.schema :refer [?schema]] + [quo.components.wallet.network-routing.schema :as network-routing-schema] [quo.components.wallet.network-routing.style :as style] [quo.theme :as quo.theme] [react-native.core :as rn] @@ -190,4 +190,4 @@ (def view (quo.theme/with-theme - (schema/instrument #'view-internal ?schema))) + (schema/instrument #'view-internal network-routing-schema/?schema))) diff --git a/src/quo/components/wallet/progress_bar/view.cljs b/src/quo/components/wallet/progress_bar/view.cljs index 755fc96ca3e..f7c7e9e8f79 100644 --- a/src/quo/components/wallet/progress_bar/view.cljs +++ b/src/quo/components/wallet/progress_bar/view.cljs @@ -1,6 +1,6 @@ (ns quo.components.wallet.progress-bar.view (:require - [quo.components.wallet.progress-bar.schema :refer [?schema]] + [quo.components.wallet.progress-bar.schema :as progress-bar-schema] [quo.components.wallet.progress-bar.style :as style] [quo.theme :as quo.theme] [react-native.core :as rn] @@ -16,4 +16,4 @@ (def view (quo.theme/with-theme - (schema/instrument #'view-internal ?schema))) + (schema/instrument #'view-internal progress-bar-schema/?schema))) diff --git a/src/quo/components/wallet/required_tokens/view.cljs b/src/quo/components/wallet/required_tokens/view.cljs index bcbde20301b..e8bfb2c181c 100644 --- a/src/quo/components/wallet/required_tokens/view.cljs +++ b/src/quo/components/wallet/required_tokens/view.cljs @@ -1,7 +1,7 @@ (ns quo.components.wallet.required-tokens.view (:require [quo.components.markdown.text :as text] [quo.components.utilities.token.view :as token] - [quo.components.wallet.required-tokens.schema :refer [?schema]] + [quo.components.wallet.required-tokens.schema :as required-tokens-schema] [quo.components.wallet.required-tokens.style :as style] quo.theme [react-native.core :as rn] @@ -38,4 +38,4 @@ (def view (quo.theme/with-theme - (schema/instrument #'view-internal ?schema))) + (schema/instrument #'view-internal required-tokens-schema/?schema))) diff --git a/src/quo/components/wallet/summary_info/view.cljs b/src/quo/components/wallet/summary_info/view.cljs index cdab276e6ff..375321770db 100644 --- a/src/quo/components/wallet/summary_info/view.cljs +++ b/src/quo/components/wallet/summary_info/view.cljs @@ -4,7 +4,7 @@ [quo.components.avatars.user-avatar.view :as user-avatar] [quo.components.avatars.wallet-user-avatar.view :as wallet-user-avatar] [quo.components.markdown.text :as text] - [quo.components.wallet.summary-info.schema :refer [?schema]] + [quo.components.wallet.summary-info.schema :as summary-info-schema] [quo.components.wallet.summary-info.style :as style] [quo.foundations.colors :as colors] [quo.foundations.resources :as resources] @@ -95,4 +95,4 @@ (def view (quo.theme/with-theme - (schema/instrument #'view-internal ?schema))) + (schema/instrument #'view-internal summary-info-schema/?schema)))