Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement about tab on collectible page #18269

Merged
merged 39 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c0a93d4
add basics
mmilad75 Dec 5, 2023
d9cfd7c
finalize component
mmilad75 Dec 5, 2023
64e2cd4
fix lint issues
mmilad75 Dec 5, 2023
ee684cc
move color to props
mmilad75 Dec 6, 2023
d3548e5
move variants to props
mmilad75 Dec 11, 2023
8aa659f
change file structure
mmilad75 Dec 12, 2023
babcd37
working
J-Son89 Dec 13, 2023
1bc8af8
finalize loader
mmilad75 Dec 13, 2023
c5c9ecf
fix lint issues
mmilad75 Dec 13, 2023
d74fb18
fix style issues
mmilad75 Dec 14, 2023
6a87eb4
add tabs structure
mmilad75 Nov 30, 2023
a74e391
add basics
mmilad75 Dec 1, 2023
3f2aa72
draft codes
mmilad75 Dec 14, 2023
bcea0db
draft
mmilad75 Dec 18, 2023
5ab6f05
make codes work after rebase
mmilad75 Dec 20, 2023
7364478
fix lint issues
mmilad75 Dec 20, 2023
20d32f1
remove Permissions tab
mmilad75 Dec 20, 2023
56ea01e
revert codes
mmilad75 Dec 21, 2023
945cd9c
finalize code
mmilad75 Dec 21, 2023
442e8cc
fix lint issues
mmilad75 Dec 21, 2023
516058e
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Dec 21, 2023
b3a0b83
revert podfile.lock
mmilad75 Dec 21, 2023
0e69118
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Dec 21, 2023
3a89747
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Dec 22, 2023
e1ea5e6
create new reg-sub for traits and chain-id
mmilad75 Dec 22, 2023
4b0be06
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Jan 8, 2024
cbc9efa
add real title and description for about tab
mmilad75 Dec 22, 2023
a2df1dd
resolve comments
mmilad75 Jan 8, 2024
2853e16
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Jan 8, 2024
5ed397e
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Jan 8, 2024
e21eb87
fix overview tab
mmilad75 Jan 8, 2024
ebde44b
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Jan 8, 2024
511e473
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Jan 9, 2024
58e087b
add tests
mmilad75 Jan 9, 2024
d2be520
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Jan 9, 2024
477fa88
resolve comments
mmilad75 Jan 9, 2024
5a2bb35
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Jan 10, 2024
9d7a4ed
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Jan 10, 2024
01ce7b1
Merge branch 'develop' into milad/17321-about-tab-collectible-page
mmilad75 Jan 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/quo/components/profile/link_card/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[react-native.linear-gradient :as linear-gradient]))

(defn- view-internal
[{:keys [address theme on-press icon title customization-color]}]
[{:keys [address theme on-press icon title customization-color container-style]}]
[rn/pressable
{:accessibility-label :link-card
:on-press on-press}
Expand All @@ -17,7 +17,7 @@
(properties/gradient-end-color theme customization-color)]
:start {:x 0 :y 1}
:end {:x 1 :y 1}
:style (style/container theme)}
:style (merge (style/container theme) container-style)}
[rn/view {:style style/icon-container}
[social/view
{:accessibility-label :social-icon
Expand Down
26 changes: 0 additions & 26 deletions src/status_im/contexts/wallet/collectible/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,3 @@
(def opensea-button
{:flex 1
:margin-left 6})

(def info-container
{:flex-direction :row
:margin-horizontal 20
:margin-top 8
:margin-bottom 12})

(def account
{:margin-right 6
:flex 1})

(def network
{:margin-left 6
:flex 1})

(def traits-title-container
{:margin-left 20
:margin-top 8})

(def traits-item
{:margin 6
:flex 1})

(def traits-container
{:margin-horizontal 14
:margin-vertical 12})
27 changes: 27 additions & 0 deletions src/status_im/contexts/wallet/collectible/tabs/about/style.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(ns status-im.contexts.wallet.collectible.tabs.about.style)

(def title
{:padding-horizontal 20
:padding-top 8
:padding-bottom 4})

(def description
{:padding-horizontal 20
:padding-top 4
:padding-bottom 12})

(def section-label
{:margin-horizontal 20
:margin-top 12})

(def link-cards-container
{:margin-horizontal 20
:margin-top 12
:flex-direction :row
:justify-content :space-between
:flex-wrap :wrap})

(defn link-card
[item-width]
{:margin-bottom 16
:width item-width})
36 changes: 36 additions & 0 deletions src/status_im/contexts/wallet/collectible/tabs/about/view.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
(ns status-im.contexts.wallet.collectible.tabs.about.view
(:require [quo.core :as quo]
[quo.theme]
[react-native.core :as rn]
[status-im.contexts.wallet.collectible.tabs.about.style :as style]
[status-im.contexts.wallet.temp :as temp]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(def ^:private link-card-space 28)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌


(defn- view-internal
[]
(let [window-width (rf/sub [:dimensions/window-width])
item-width (- (/ window-width 2) link-card-space)
{:keys [collectible-data]} (rf/sub [:wallet/last-collectible-details])
link-card-container-style (style/link-card item-width)]
[:<>
[rn/view {:style style/title}
[quo/text
{:size :heading-2
:weight :semi-bold}
(:name collectible-data)]]
[rn/view {:style style/description}
[quo/text
{:size :paragraph-2}
(:description collectible-data)]]
[quo/section-label
{:container-style style/section-label
:section (i18n/label :t/on-the-web)}]
[rn/view {:style style/link-cards-container}
(for [item (:cards temp/collectible-about)]
^{:key (:title item)}
[quo/link-card (assoc item :container-style link-card-container-style)])]]))

(def view (quo.theme/with-theme view-internal))
17 changes: 17 additions & 0 deletions src/status_im/contexts/wallet/collectible/tabs/activity/view.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(ns status-im.contexts.wallet.collectible.tabs.activity.view
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the structure to the tabs!

(:require [quo.core :as quo]
[react-native.core :as rn]
[status-im.contexts.wallet.temp :as temp]))

(defn activity-item
[item]
[:<>
[quo/divider-date (:timestamp item)]
[quo/wallet-activity item]])

(defn view
[]
[rn/flat-list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question, do we really need this to be a flatlist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was more that one item before, so it needed to be scrolled. I believe it's better to use flatlist in case of small devices

{:data temp/collectible-activities
:style {:flex 1}
:render-fn activity-item}])
27 changes: 27 additions & 0 deletions src/status_im/contexts/wallet/collectible/tabs/overview/style.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(ns status-im.contexts.wallet.collectible.tabs.overview.style)

(def info-container
{:flex-direction :row
:margin-horizontal 20
:margin-top 8
:margin-bottom 12})

(def account
{:margin-right 6
:flex 1})

(def network
{:margin-left 6
:flex 1})

(def traits-title-container
{:margin-left 20
:margin-top 8})

(def traits-item
{:margin 6
:flex 1})

(def traits-container
{:margin-horizontal 14
:margin-vertical 12})
72 changes: 72 additions & 0 deletions src/status_im/contexts/wallet/collectible/tabs/overview/view.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
(ns status-im.contexts.wallet.collectible.tabs.overview.view
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.foundations.resources :as quo.resources]
[quo.theme]
[react-native.core :as rn]
[status-im.contexts.wallet.collectible.tabs.overview.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defn- trait-item
[{:keys [trait-type value]}]
[quo/data-item
{:description :default
:card? true
:status :default
:size :default
:title trait-type
:subtitle value
:container-style style/traits-item}])

(defn- traits-section
[]
(let [traits (rf/sub [:wallet/last-collectible-details-traits])]
(when (pos? (count traits))
[rn/view
[quo/section-label
{:section (i18n/label :t/traits)
:container-style style/traits-title-container}]
[rn/flat-list
{:render-fn trait-item
:data traits
:key :collectibles-list
:key-fn :id
:num-columns 2
:content-container-style style/traits-container}]])))

(defn- info
[]
(let [chain-id (rf/sub [:wallet/last-collectible-details-chain-id])
{:keys [network-name]} (rf/sub [:wallet/network-details-by-chain-id chain-id])
subtitle (string/capitalize (name (or network-name "")))
{:keys [name emoji color]} (rf/sub [:wallet/last-collectible-details-owner])]
[rn/view {:style style/info-container}
[rn/view {:style style/account}
[quo/data-item
{:card? true
:status :default
:size :default
:title (i18n/label :t/account-title)
:subtitle name
:emoji emoji
:subtitle-type :account
:customization-color color}]]
[rn/view {:style style/network}
[quo/data-item
{:subtitle-type :network
:card? true
:status :default
:size :default
:title (i18n/label :t/network)
:network-image (quo.resources/get-network network-name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I put the image in the sub for network details. can you check the value of (rf/sub [:wallet/network-details-by-chain-id chain-id])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't exist there. This is the response of the reffered sub:

{:source 870, :short-name eth, :network-name :ethereum, :chain-id 1, :related-chain-id 5, :layer 1}

:subtitle subtitle}]]]))

(defn- view-internal
[]
[:<>
[info]
[traits-section]])

(def view (quo.theme/with-theme view-internal))
15 changes: 15 additions & 0 deletions src/status_im/contexts/wallet/collectible/tabs/view.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(ns status-im.contexts.wallet.collectible.tabs.view
(:require [quo.theme]
[status-im.contexts.wallet.collectible.tabs.about.view :as about]
[status-im.contexts.wallet.collectible.tabs.activity.view :as activity]
[status-im.contexts.wallet.collectible.tabs.overview.view :as overview]))

(defn- view-internal
[{:keys [selected-tab]}]
(case selected-tab
:overview [overview/view]
:about [about/view]
:activity [activity/view]
nil))

(def view (quo.theme/with-theme view-internal))
Loading