From 4a6eb8a4bce61e307814364bcff91b71b58f6dcb Mon Sep 17 00:00:00 2001 From: Lautaro Petaccio Date: Thu, 18 May 2023 17:01:47 -0300 Subject: [PATCH 1/2] feat: Add recommendations to item detail --- .../ItemDetail/ItemDetail.module.css | 8 +++ .../AssetPage/ItemDetail/ItemDetail.tsx | 12 +++- .../HomePage/Slideshow/ItemsSection.tsx | 10 +-- .../HomePage/Slideshow/Slideshow.tsx | 17 +++-- .../HomePage/Slideshow/Slideshow.types.ts | 1 + .../Recommendation/Recommendation.tsx | 71 +++++++++++++++++++ .../Recommendation/Recommendation.types.ts | 4 ++ webapp/src/components/Recommendation/index.ts | 2 + 8 files changed, 113 insertions(+), 12 deletions(-) create mode 100644 webapp/src/components/Recommendation/Recommendation.tsx create mode 100644 webapp/src/components/Recommendation/Recommendation.types.ts create mode 100644 webapp/src/components/Recommendation/index.ts diff --git a/webapp/src/components/AssetPage/ItemDetail/ItemDetail.module.css b/webapp/src/components/AssetPage/ItemDetail/ItemDetail.module.css index c2d6c0c652..ed51db0f63 100644 --- a/webapp/src/components/AssetPage/ItemDetail/ItemDetail.module.css +++ b/webapp/src/components/AssetPage/ItemDetail/ItemDetail.module.css @@ -7,3 +7,11 @@ flex-direction: column; gap: 8px; } + +.recommendations > div { + margin-top: 30px; +} + +.recommendations > :global(.Slideshow) { + margin-bottom: 0px !important; +} \ No newline at end of file diff --git a/webapp/src/components/AssetPage/ItemDetail/ItemDetail.tsx b/webapp/src/components/AssetPage/ItemDetail/ItemDetail.tsx index 9edf7d89a9..2e703d6b1d 100644 --- a/webapp/src/components/AssetPage/ItemDetail/ItemDetail.tsx +++ b/webapp/src/components/AssetPage/ItemDetail/ItemDetail.tsx @@ -8,6 +8,7 @@ import { AssetType } from '../../../modules/asset/types' import GenderBadge from '../../GenderBadge' import { AssetImage } from '../../AssetImage' import CampaignBadge from '../../Campaign/CampaignBadge' +import { Recommendation, RECO_TYPE } from '../../Recommendation' import CategoryBadge from '../CategoryBadge' import SmartBadge from '../SmartBadge' import { Description } from '../Description' @@ -18,6 +19,7 @@ import IconBadge from '../IconBadge' import { TransactionHistory } from '../TransactionHistory' import { SaleActionBox } from '../SaleActionBox' import { Props } from './ItemDetail.types' +import styles from './ItemDetail.module.css' const ItemDetail = ({ item }: Props) => { let description = '' @@ -109,7 +111,15 @@ const ItemDetail = ({ item }: Props) => { box={null} showDetails actions={} - below={} + below={ +
+ +
+ + +
+
+ } /> ) } diff --git a/webapp/src/components/HomePage/Slideshow/ItemsSection.tsx b/webapp/src/components/HomePage/Slideshow/ItemsSection.tsx index 83bc828657..48ca846619 100644 --- a/webapp/src/components/HomePage/Slideshow/ItemsSection.tsx +++ b/webapp/src/components/HomePage/Slideshow/ItemsSection.tsx @@ -14,7 +14,7 @@ import { Section } from '../../../modules/vendor/decentraland/routing/types' const ItemsSection = (props: { view: HomepageView - viewAllButton: React.ReactNode + viewAllButton?: React.ReactNode onChangeItemSection: (view: HomepageView, section: Section) => void }) => { const { view, viewAllButton, onChangeItemSection } = props @@ -47,9 +47,11 @@ const ItemsSection = (props: { {t(`menu.${Section.EMOTES}`)} -
- {viewAllButton} -
+ {viewAllButton ? ( +
+ {viewAllButton} +
+ ) : null} ) diff --git a/webapp/src/components/HomePage/Slideshow/Slideshow.tsx b/webapp/src/components/HomePage/Slideshow/Slideshow.tsx index 89c3e382c1..2c9aff3557 100644 --- a/webapp/src/components/HomePage/Slideshow/Slideshow.tsx +++ b/webapp/src/components/HomePage/Slideshow/Slideshow.tsx @@ -27,6 +27,7 @@ const Slideshow = (props: Props) => { title, subtitle, viewAllTitle, + showViewAll, emptyMessage, assets, isSubHeader, @@ -125,24 +126,26 @@ const Slideshow = (props: Props) => {
{title}
-
{subtitle}
+ {subtitle ?
{subtitle}
: null} {hasItemsSection ? ( ) : null}
- {!hasItemsSection ? ( + {!hasItemsSection && showViewAll ? ( {viewAllButton()} ) : null}
-
+
{isLoading ? ( assets.length === 0 ? ( @@ -159,7 +162,7 @@ const Slideshow = (props: Props) => { className="arrow-container arrow-container-left" {...showArrowsHandlers} > - {showArrows && totalPages > 1 && ( + {showArrows && totalPages > 1 && (