@@ -2,6 +2,7 @@ import { CatalogCardDesignLogo } from '../CustomCatalog';
22import CustomCatalogCard , { Pattern } from '../CustomCatalog/CustomCard' ;
33import { formatToTitleCase } from './helper' ;
44import { AdditionalContainer , ContentHeading , DesignCardContainer } from './style' ;
5+ import { UserProfile } from './types' ;
56
67export interface PatternsPerUser {
78 patterns : Pattern [ ] ;
@@ -11,9 +12,17 @@ interface RelatedDesignsProps {
1112 details : Pattern ;
1213 type : string ;
1314 patternsPerUser : PatternsPerUser ;
15+ onSuggestedPatternClick : ( pattern : Pattern ) => void ;
16+ userProfile ?: UserProfile ;
1417}
1518
16- const RelatedDesigns : React . FC < RelatedDesignsProps > = ( { details, type, patternsPerUser } ) => {
19+ const RelatedDesigns : React . FC < RelatedDesignsProps > = ( {
20+ details,
21+ type,
22+ patternsPerUser,
23+ onSuggestedPatternClick,
24+ userProfile
25+ } ) => {
1726 const filteredPatternsPerUser = patternsPerUser ?. patterns ?. filter (
1827 ( pattern ) => pattern . id !== details . id
1928 ) ;
@@ -24,15 +33,26 @@ const RelatedDesigns: React.FC<RelatedDesignsProps> = ({ details, type, patterns
2433 < AdditionalContainer >
2534 < ContentHeading >
2635 < h2 style = { { margin : '0' , textTransform : 'uppercase' } } >
27- Other published design by { formatToTitleCase ( details . user . first_name ) }
36+ Other published design by
37+ { formatToTitleCase ( userProfile ?. first_name ?? '' ) }
2838 </ h2 >
2939 </ ContentHeading >
3040 < DesignCardContainer >
3141 { filteredPatternsPerUser . map ( ( pattern , index ) => (
32- < CustomCatalogCard key = { `design-${ index } ` } pattern = { pattern } patternType = { type } >
42+ < CustomCatalogCard
43+ key = { `design-${ index } ` }
44+ pattern = { pattern }
45+ patternType = { type }
46+ onCardClick = { ( ) => onSuggestedPatternClick ( pattern ) }
47+ UserName = { `${ userProfile ?. first_name ?? '' } ${ userProfile ?. last_name ?? '' } ` }
48+ avatarUrl = { userProfile ?. avatar_url }
49+ basePath = "/static/img/meshmodels"
50+ subBasePath = "color"
51+ cardTechnologies = { true }
52+ >
3353 < CatalogCardDesignLogo
3454 imgURL = { pattern ?. catalog_data ?. imageURL }
35- height = { '100% ' }
55+ height = { '7.5rem ' }
3656 width = { '100%' }
3757 zoomEffect = { false }
3858 type = { { type : type } }
0 commit comments