From f69b7773bcbec521883a7dbb3ba20523cd8e5fbf Mon Sep 17 00:00:00 2001 From: Vidit Kushwaha Date: Tue, 14 Jan 2025 20:04:53 +0000 Subject: [PATCH 1/3] fix(my-design): Update heading for Other Published Design to Other Public Design Signed-off-by: Vidit Kushwaha --- src/custom/CatalogDetail/RelatedDesigns.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/custom/CatalogDetail/RelatedDesigns.tsx b/src/custom/CatalogDetail/RelatedDesigns.tsx index 41f92d5e0..d436be88e 100644 --- a/src/custom/CatalogDetail/RelatedDesigns.tsx +++ b/src/custom/CatalogDetail/RelatedDesigns.tsx @@ -41,7 +41,7 @@ const RelatedDesigns: React.FC = ({

- Other published design by {formatToTitleCase(userProfile?.first_name ?? '')}{' '} + Other public design by {formatToTitleCase(userProfile?.first_name ?? '')}{' '} {fetchingOrgError ? '' : `under ${organizationName}`}

From 70bf90103d51c11b3942431354bec78f48176cb5 Mon Sep 17 00:00:00 2001 From: Vidit Kushwaha Date: Sat, 1 Feb 2025 12:13:17 +0000 Subject: [PATCH 2/3] chore: updated heading of realated designs Signed-off-by: Vidit Kushwaha --- src/custom/CatalogDetail/RelatedDesigns.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/custom/CatalogDetail/RelatedDesigns.tsx b/src/custom/CatalogDetail/RelatedDesigns.tsx index d436be88e..a3bc3ba05 100644 --- a/src/custom/CatalogDetail/RelatedDesigns.tsx +++ b/src/custom/CatalogDetail/RelatedDesigns.tsx @@ -41,7 +41,8 @@ const RelatedDesigns: React.FC = ({

- Other public design by {formatToTitleCase(userProfile?.first_name ?? '')}{' '} + Other {type.toLowerCase() == 'my-designs' ? 'public' : 'published'} design by{' '} + {formatToTitleCase(userProfile?.first_name ?? '')}{' '} {fetchingOrgError ? '' : `under ${organizationName}`}

From 02afab1a2e5c3e0f3cfd6232e5f1cbb0f97d8999 Mon Sep 17 00:00:00 2001 From: Vidit Kushwaha Date: Sun, 2 Feb 2025 05:09:52 +0000 Subject: [PATCH 3/3] chore: remove inline condition in related Designs Signed-off-by: Vidit Kushwaha --- src/custom/CatalogDetail/RelatedDesigns.tsx | 6 ++---- src/custom/CatalogDetail/helper.ts | 22 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/custom/CatalogDetail/RelatedDesigns.tsx b/src/custom/CatalogDetail/RelatedDesigns.tsx index a3bc3ba05..00396b508 100644 --- a/src/custom/CatalogDetail/RelatedDesigns.tsx +++ b/src/custom/CatalogDetail/RelatedDesigns.tsx @@ -1,6 +1,6 @@ import { CatalogCardDesignLogo } from '../CustomCatalog'; import CustomCatalogCard, { Pattern } from '../CustomCatalog/CustomCard'; -import { formatToTitleCase } from './helper'; +import { getHeadingText } from './helper'; import { AdditionalContainer, ContentHeading, DesignCardContainer } from './style'; import { UserProfile } from './types'; @@ -41,9 +41,7 @@ const RelatedDesigns: React.FC = ({

- Other {type.toLowerCase() == 'my-designs' ? 'public' : 'published'} design by{' '} - {formatToTitleCase(userProfile?.first_name ?? '')}{' '} - {fetchingOrgError ? '' : `under ${organizationName}`} + {getHeadingText({ type, userProfile, organizationName, fetchingOrgError })}

diff --git a/src/custom/CatalogDetail/helper.ts b/src/custom/CatalogDetail/helper.ts index b43477bf9..272347176 100644 --- a/src/custom/CatalogDetail/helper.ts +++ b/src/custom/CatalogDetail/helper.ts @@ -61,3 +61,25 @@ export const formatDate = (date: Date) => { const formattedDate = new Date(date).toLocaleDateString('en-US', options); return formattedDate; }; + +interface HeadingProps { + type: string; + userProfile?: { + first_name?: string; + }; + organizationName?: string; + fetchingOrgError: boolean; +} + +export const getHeadingText = ({ + type, + userProfile, + organizationName, + fetchingOrgError +}: HeadingProps): string => { + const designType = type.toLowerCase() === 'my-designs' ? 'public' : 'published'; + const firstName = formatToTitleCase(userProfile?.first_name ?? ''); + const orgText = fetchingOrgError ? '' : `under ${organizationName}`; + + return `Other ${designType} design by ${firstName} ${orgText}`; +};