Skip to content

Commit

Permalink
Merge branch 'develop' into 19232-fix-derivation-path-creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ulisesmac committed May 24, 2024
2 parents 7a35b18 + e30ca97 commit cc1a9ad
Show file tree
Hide file tree
Showing 25 changed files with 585 additions and 279 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(ns quo.components.avatars.community-avatar.component-spec
(:require [quo.components.avatars.community-avatar.view :as community-avatar]
[test-helpers.component :as h]))

(h/describe "Avatars: Community Avatar"
(h/test "should render correctly"
(h/render-with-theme-provider
[community-avatar/view {:image "mock-image"}])
(h/is-truthy (h/get-by-label-text :community-avatar))))
12 changes: 12 additions & 0 deletions src/quo/components/avatars/community_avatar/style.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(ns quo.components.avatars.community-avatar.style)

(def ^:private sizes
{:size-32 32
:size-24 24})

(defn image
[size]
(let [size-val (sizes size)]
{:border-radius (/ size-val 2)
:width size-val
:height size-val}))
23 changes: 23 additions & 0 deletions src/quo/components/avatars/community_avatar/view.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(ns quo.components.avatars.community-avatar.view
(:require [quo.components.avatars.community-avatar.style :as style]
[react-native.core :as rn]
[schema.core :as schema]))

(def ?schema
[:=>
[:catn
[:props
[:map {:closed true}
[:size {:optional true} [:maybe [:enum :size-32 :size-24]]]
[:image :schema.common/image-source]
[:container-style {:optional true} [:maybe :map]]]]]
:any])

(defn- view-internal
[{:keys [size image container-style]}]
[rn/image
{:source image
:accessibility-label :community-avatar
:style (merge (style/image size) container-style)}])

(def view (schema/instrument #'view-internal ?schema))
14 changes: 14 additions & 0 deletions src/quo/components/avatars/dapp_avatar/component_spec.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(ns quo.components.avatars.dapp-avatar.component-spec
(:require [quo.components.avatars.dapp-avatar.view :as dapp-avatar]
[test-helpers.component :as h]))

(h/describe "Avatars: dApp Avatar"
(h/test "should render correctly without context"
(h/render-with-theme-provider
[dapp-avatar/view {:image "mock-image"}])
(h/is-truthy (h/get-by-label-text :dapp-avatar)))

(h/test "should render correctly with context"
(h/render-with-theme-provider
[dapp-avatar/view {:image "mock-image" :network-image "mock-image" :context? true}])
(h/is-truthy (h/get-by-label-text :dapp-avatar))))
23 changes: 23 additions & 0 deletions src/quo/components/avatars/dapp_avatar/style.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(ns quo.components.avatars.dapp-avatar.style)

(def ^:const size 32)

(def container
{:height size
:width size})

(def hole-view
{:width size
:height size})

(def context
{:width 16
:height 16
:border-radius 8
:position :absolute
:right -4
:bottom -4})

(def image
{:width size
:height size})
42 changes: 42 additions & 0 deletions src/quo/components/avatars/dapp_avatar/view.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
(ns quo.components.avatars.dapp-avatar.view
(:require [quo.components.avatars.dapp-avatar.style :as style]
[react-native.core :as rn]
[react-native.hole-view :as hole-view]
[react-native.platform :as platform]
[schema.core :as schema]))

(def ?schema
[:=>
[:catn
[:props
[:map {:closed true}
[:context? {:optional true} [:maybe :boolean]]
[:image :schema.common/image-source]
[:network-image {:optional true} [:maybe :schema.common/image-source]]
[:container-style {:optional true} [:maybe :map]]]]]
:any])

(defn- view-internal
[{:keys [context? image network-image container-style]}]
[rn/view
{:style (merge style/container container-style)
:accessibility-label :dapp-avatar}
[hole-view/hole-view
(cond-> {:holes (if context?
[{:x 19
:y 19
:width 18
:height 18
:borderRadius 9}]
[])
:style style/hole-view}
platform/android? (assoc :key context?))
[rn/image
{:source image
:style style/image}]]
(when context?
[rn/image
{:source network-image
:style style/context}])])

(def view (schema/instrument #'view-internal ?schema))
14 changes: 14 additions & 0 deletions src/quo/components/avatars/token_avatar/component_spec.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(ns quo.components.avatars.token-avatar.component-spec
(:require [quo.components.avatars.token-avatar.view :as token-avatar]
[test-helpers.component :as h]))

(h/describe "Avatars: Token Avatar"
(h/test "should render correctly without context"
(h/render-with-theme-provider
[token-avatar/view {:image "mock-image"}])
(h/is-truthy (h/get-by-label-text :token-avatar)))

(h/test "should render correctly with context"
(h/render-with-theme-provider
[token-avatar/view {:image "mock-image" :network-image "mock-image" :context? true}])
(h/is-truthy (h/get-by-label-text :token-avatar))))
25 changes: 25 additions & 0 deletions src/quo/components/avatars/token_avatar/style.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(ns quo.components.avatars.token-avatar.style)

(def ^:const size 32)

(def container
{:height size
:width size})

(def hole-view
{:width size
:height size})

(def context
{:width 16
:height 16
:border-radius 8
:position :absolute
:right -4
:bottom -4})

(defn image
[type]
{:width size
:border-radius (if (= type :collectible) 8 0)
:height size})
43 changes: 43 additions & 0 deletions src/quo/components/avatars/token_avatar/view.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
(ns quo.components.avatars.token-avatar.view
(:require [quo.components.avatars.token-avatar.style :as style]
[react-native.core :as rn]
[react-native.hole-view :as hole-view]
[react-native.platform :as platform]
[schema.core :as schema]))

(def ?schema
[:=>
[:catn
[:props
[:map {:closed true}
[:type {:optional true} [:enum :asset :collectible]]
[:context? {:optional true} [:maybe :boolean]]
[:image :schema.common/image-source]
[:network-image {:optional true} [:maybe :schema.common/image-source]]
[:container-style {:optional true} [:maybe :map]]]]]
:any])

(defn- view-internal
[{:keys [type context? image network-image container-style]}]
[rn/view
{:style (merge style/container container-style)
:accessibility-label :token-avatar}
[hole-view/hole-view
(cond-> {:holes (if context?
[{:x 19
:y 19
:width 18
:height 18
:borderRadius 9}]
[])
:style style/hole-view}
platform/android? (assoc :key context?))
[rn/image
{:source image
:style (style/image type)}]]
(when context?
[rn/image
{:source network-image
:style style/context}])])

(def view (schema/instrument #'view-internal ?schema))
2 changes: 1 addition & 1 deletion src/quo/components/buttons/swap_order_button/schema.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
[:map {:closed true}
[:disabled? {:optional true} [:maybe :boolean]]
[:on-press fn?]
[:container-style {:optional true} [:maybe :any]]]]]
[:container-style {:optional true} [:maybe :map]]]]]
:any])
2 changes: 1 addition & 1 deletion src/quo/components/buttons/swap_order_button/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[react-native.core :as rn]
[schema.core :as schema]))

(defn view-internal
(defn- view-internal
[{:keys [disabled? on-press container-style]}]
(let [theme (quo.theme/use-theme)
[pressed? set-pressed] (rn/use-state false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
(h/render-with-theme-provider component :light))

(def props
{:theme :light
:state :default
{:state :default
:label "Mainnet"
:network-image 873
:customization-color :blue
Expand Down
1 change: 0 additions & 1 deletion src/quo/components/list_items/network_list/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
[:catn
[:props
[:map {:closed true}
[:theme :schema.common/theme]
[:network-image :int]
[:label :string]
[:fiat-value :string]
Expand Down
6 changes: 6 additions & 0 deletions src/quo/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
quo.components.avatars.account-avatar.view
quo.components.avatars.channel-avatar.view
quo.components.avatars.collection-avatar.view
quo.components.avatars.community-avatar.view
quo.components.avatars.dapp-avatar.view
quo.components.avatars.group-avatar.view
quo.components.avatars.icon-avatar
quo.components.avatars.token-avatar.view
quo.components.avatars.user-avatar.view
quo.components.avatars.wallet-user-avatar.view
quo.components.banners.banner.view
Expand Down Expand Up @@ -190,8 +193,11 @@
(def account-avatar quo.components.avatars.account-avatar.view/view)
(def channel-avatar quo.components.avatars.channel-avatar.view/view)
(def collection-avatar quo.components.avatars.collection-avatar.view/view)
(def community-avatar quo.components.avatars.community-avatar.view/view)
(def dapp-avatar quo.components.avatars.dapp-avatar.view/view)
(def group-avatar quo.components.avatars.group-avatar.view/view)
(def icon-avatar quo.components.avatars.icon-avatar/icon-avatar)
(def token-avatar quo.components.avatars.token-avatar.view/view)
(def user-avatar quo.components.avatars.user-avatar.view/user-avatar)
(def wallet-user-avatar quo.components.avatars.wallet-user-avatar.view/wallet-user-avatar)

Expand Down
3 changes: 3 additions & 0 deletions src/quo/core_spec.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
(ns quo.core-spec
(:require
quo.components.avatars.account-avatar.component-spec
quo.components.avatars.community-avatar.component-spec
quo.components.avatars.dapp-avatar.component-spec
quo.components.avatars.token-avatar.component-spec
quo.components.avatars.user-avatar.component-spec
quo.components.banners.banner.component-spec
quo.components.browser.browser-input.component-spec
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/config.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
(goog-define ALCHEMY_OPTIMISM_SEPOLIA_TOKEN "")
(goog-define WALLET_CONNECT_PROJECT_ID "")

(def mainnet-rpc-url (str "https://eth-archival.gateway.pokt.network/v1/lb/" POKT_TOKEN))
(def mainnet-rpc-url (str "https://eth-archival.rpc.grove.city/v1/" POKT_TOKEN))
(def goerli-rpc-url (str "https://goerli-archival.gateway.pokt.network/v1/lb/" POKT_TOKEN))
(def mainnet-chain-explorer-link "https://etherscan.io/address/")
(def optimism-mainnet-chain-explorer-link "https://optimistic.etherscan.io/address/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
(h/is-truthy (h/get-by-translation-text :t/mark-as-read))
(h/is-truthy (h/get-by-translation-text :t/mute-community))
(h/is-truthy (h/get-by-translation-text :t/notification-settings))
;(h/is-truthy (h/get-by-translation-text :t/notification-settings))
(h/is-truthy (h/get-by-translation-text :t/invite-people-from-contacts))
(h/is-truthy (h/get-by-translation-text :t/show-qr))
(h/is-truthy (h/get-by-translation-text :t/share-community))
Expand All @@ -30,7 +30,7 @@
(h/is-truthy (h/get-by-translation-text :t/view-token-gating))
(h/is-truthy (h/get-by-translation-text :t/mark-as-read))
(h/is-truthy (h/get-by-translation-text :t/mute-community))
(h/is-truthy (h/get-by-translation-text :t/notification-settings))
;(h/is-truthy (h/get-by-translation-text :t/notification-settings))
(h/is-truthy (h/get-by-translation-text :t/invite-people-from-contacts))
(h/is-truthy (h/get-by-translation-text :t/show-qr))
(h/is-truthy (h/get-by-translation-text :t/share-community))
Expand All @@ -44,7 +44,7 @@
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
(h/is-truthy (h/get-by-translation-text :t/mark-as-read))
(h/is-truthy (h/get-by-translation-text :t/mute-community))
(h/is-truthy (h/get-by-translation-text :t/notification-settings))
;(h/is-truthy (h/get-by-translation-text :t/notification-settings))
(h/is-truthy (h/get-by-translation-text :t/invite-people-from-contacts))
(h/is-truthy (h/get-by-translation-text :t/show-qr))
(h/is-truthy (h/get-by-translation-text :t/share-community)))
Expand All @@ -58,7 +58,7 @@
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
(h/is-truthy (h/get-by-translation-text :t/mark-as-read))
(h/is-truthy (h/get-by-translation-text :t/mute-community))
(h/is-truthy (h/get-by-translation-text :t/notification-settings))
;(h/is-truthy (h/get-by-translation-text :t/notification-settings))
(h/is-truthy (h/get-by-translation-text :t/invite-people-from-contacts))
(h/is-truthy (h/get-by-translation-text :t/show-qr))
(h/is-truthy (h/get-by-translation-text :t/share-community)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[quo.core :as quo]
[status-im.common.mute-drawer.view :as mute-options]
[status-im.common.muting.helpers :refer [format-mute-till]]
[status-im.config :as config]
[status-im.constants :as constants]
[status-im.contexts.communities.actions.leave.view :as leave-menu]
[status-im.contexts.communities.actions.permissions-sheet.view :as permissions-sheet]
Expand Down Expand Up @@ -83,11 +84,12 @@

(defn community-notification-settings
[id]
{:icon :i/notifications
:accessibility-label :community-notification-settings
:label (i18n/label :t/notification-settings)
:on-press #(js/alert (str "implement action" id))
:right-icon :i/chevron-right})
(when config/show-not-implemented-features?
{:icon :i/notifications
:accessibility-label :community-notification-settings
:label (i18n/label :t/notification-settings)
:on-press #(js/alert (str "implement action" id))
:right-icon :i/chevron-right}))

(defn invite-contacts
[id]
Expand Down
24 changes: 24 additions & 0 deletions src/status_im/contexts/preview/quo/avatars/community_avatar.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(ns status-im.contexts.preview.quo.avatars.community-avatar
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im.common.resources :as resources]
[status-im.contexts.preview.quo.preview :as preview]))

(def descriptor
[{:type :select
:key :size
:options [{:key :size-32}
{:key :size-24}]}])

(defn view
[]
(let [[state set-state] (rn/use-state {:size :size-32})]
[preview/preview-container
{:state state
:set-state set-state
:descriptor descriptor}
[quo/community-avatar
(assoc state
:image
(resources/get-mock-image :community-logo))]]))
Loading

0 comments on commit cc1a9ad

Please sign in to comment.