From 240567aa5985c57531ae2862648435831ea5d4b2 Mon Sep 17 00:00:00 2001 From: Amit Amrutiya Date: Thu, 31 Oct 2024 19:26:15 +0530 Subject: [PATCH] feat: pass props for visible of open in playground button Signed-off-by: Amit Amrutiya --- src/custom/CatalogDetail/ActionButton.tsx | 48 +++++++++++---------- src/custom/CatalogDetail/LeftPanel.tsx | 5 ++- src/custom/CatalogDetail/RelatedDesigns.tsx | 10 +++-- src/custom/CatalogDetail/RightPanel.tsx | 8 +++- src/custom/CatalogDetail/UserInfo.tsx | 2 +- 5 files changed, 45 insertions(+), 28 deletions(-) diff --git a/src/custom/CatalogDetail/ActionButton.tsx b/src/custom/CatalogDetail/ActionButton.tsx index e7a9806d7..ed7ce790f 100644 --- a/src/custom/CatalogDetail/ActionButton.tsx +++ b/src/custom/CatalogDetail/ActionButton.tsx @@ -18,6 +18,7 @@ interface ActionButtonsProps { handleClone: (name: string, id: string) => void; mode: string; isCloneDisabled: boolean; + showOpenPlaygroundButton: boolean; } const ActionButtons: React.FC = ({ @@ -28,7 +29,8 @@ const ActionButtons: React.FC = ({ isCloneLoading, handleClone, mode, - isCloneDisabled + isCloneDisabled, + showOpenPlaygroundButton }) => { const cleanedType = type.replace('my-', '').replace(/s$/, ''); const resourcePlaygroundType = Object.values({ @@ -51,7 +53,7 @@ const ActionButtons: React.FC = ({ = ({ )} )} - - - - Open in Playground - - + + + Open in Playground + + + )} ); }; diff --git a/src/custom/CatalogDetail/LeftPanel.tsx b/src/custom/CatalogDetail/LeftPanel.tsx index 2bb7fbb37..30d006072 100644 --- a/src/custom/CatalogDetail/LeftPanel.tsx +++ b/src/custom/CatalogDetail/LeftPanel.tsx @@ -21,6 +21,7 @@ interface LeftPanelProps { technologySVGPath: string; technologySVGSubpath: string; fontFamily?: string; + showOpenPlaygroundButton?: boolean; } const LeftPanel: React.FC = ({ @@ -36,7 +37,8 @@ const LeftPanel: React.FC = ({ isCloneDisabled, technologySVGPath, technologySVGSubpath, - fontFamily + fontFamily, + showOpenPlaygroundButton = true }) => { const theme = useTheme(); @@ -77,6 +79,7 @@ const LeftPanel: React.FC = ({ handleClone={handleClone} mode={mode} isCloneDisabled={isCloneDisabled} + showOpenPlaygroundButton={showOpenPlaygroundButton} /> {showTechnologies && ( void; userProfile?: UserProfile; + technologySVGPath: string; + technologySVGSubpath: string; } const RelatedDesigns: React.FC = ({ @@ -21,7 +23,9 @@ const RelatedDesigns: React.FC = ({ type, patternsPerUser, onSuggestedPatternClick, - userProfile + userProfile, + technologySVGPath, + technologySVGSubpath }) => { const filteredPatternsPerUser = patternsPerUser?.patterns?.filter( (pattern) => pattern.id !== details.id @@ -45,8 +49,8 @@ const RelatedDesigns: React.FC = ({ onCardClick={() => onSuggestedPatternClick(pattern)} UserName={`${userProfile?.first_name ?? ''} ${userProfile?.last_name ?? ''}`} avatarUrl={userProfile?.avatar_url} - basePath="/static/img/meshmodels" - subBasePath="color" + basePath={technologySVGPath} + subBasePath={technologySVGSubpath} cardTechnologies={true} > = ({ @@ -39,7 +41,9 @@ const RightPanel: React.FC = ({ onSuggestedPatternClick, handleCopyUrl, fontFamily, - useGetUserProfileByIdQuery + useGetUserProfileByIdQuery, + technologySVGPath, + technologySVGSubpath }) => { const cleanedType = type.replace('my-', '').replace(/s$/, ''); const { data: userProfile } = useGetUserProfileByIdQuery({ @@ -69,6 +73,8 @@ const RightPanel: React.FC = ({ patternsPerUser={patternsPerUser} onSuggestedPatternClick={onSuggestedPatternClick} userProfile={userProfile} + technologySVGPath={technologySVGPath} + technologySVGSubpath={technologySVGSubpath} /> ); diff --git a/src/custom/CatalogDetail/UserInfo.tsx b/src/custom/CatalogDetail/UserInfo.tsx index 86029f960..602433086 100644 --- a/src/custom/CatalogDetail/UserInfo.tsx +++ b/src/custom/CatalogDetail/UserInfo.tsx @@ -21,7 +21,7 @@ const UserInfo: React.FC = ({ details, showVersion = true, userPr target="_blank" rel="noopener noreferrer" > - + {userProfile?.first_name} {userProfile?.last_name}