From 4532a962d898adfeae521a62925419ce8a9878d3 Mon Sep 17 00:00:00 2001 From: Vivian Phung Date: Wed, 28 Feb 2024 23:44:10 -0700 Subject: [PATCH 1/3] fix navigate --- packages/frontend/src/assets/templates.ts | 4 ++-- .../projects/create/TemplateCard/TemplateCard.tsx | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/frontend/src/assets/templates.ts b/packages/frontend/src/assets/templates.ts index 84c60bb5..2d12165a 100644 --- a/packages/frontend/src/assets/templates.ts +++ b/packages/frontend/src/assets/templates.ts @@ -18,14 +18,14 @@ export default [ name: 'Kotlin', icon: 'kotlin', repoFullName: '', - isComingSoon: false, + isComingSoon: true, }, { id: '4', name: 'React Native', icon: 'react-native', repoFullName: '', - isComingSoon: false, + isComingSoon: true, }, { id: '5', diff --git a/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx b/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx index b7c549fd..450760ba 100644 --- a/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx +++ b/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx @@ -1,3 +1,4 @@ +import React, { ComponentPropsWithoutRef, useCallback } from 'react'; import { Button } from 'components/shared/Button'; import { ArrowRightCircleIcon, @@ -6,7 +7,6 @@ import { TemplateIconType, } from 'components/shared/CustomIcon'; import { Tag } from 'components/shared/Tag'; -import React, { ComponentPropsWithoutRef, useCallback } from 'react'; import { useNavigate } from 'react-router-dom'; import { useToast } from 'components/shared/Toast'; import { cn } from 'utils/classnames'; @@ -24,7 +24,10 @@ export interface TemplateCardProps extends ComponentPropsWithoutRef<'div'> { isGitAuth: boolean; } -export const TemplateCard = ({ template, isGitAuth }: TemplateCardProps) => { +export const TemplateCard: React.FC = ({ + template, + isGitAuth, +}: TemplateCardProps) => { const { toast, dismiss } = useToast(); const navigate = useNavigate(); @@ -38,7 +41,7 @@ export const TemplateCard = ({ template, isGitAuth }: TemplateCardProps) => { }); } if (isGitAuth) { - return navigate(`/template?templateId=${template.id}`); + return navigate(`template?templateId=${template.id}`); } return toast({ id: 'connect-git-account', From 59467557498a5ae893a31f2b4f2d46edd20c3ba1 Mon Sep 17 00:00:00 2001 From: Vivian Phung Date: Wed, 28 Feb 2024 23:52:37 -0700 Subject: [PATCH 2/3] fix navigate --- .../projects/create/TemplateCard/TemplateCard.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx b/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx index 450760ba..dce0e20b 100644 --- a/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx +++ b/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx @@ -7,7 +7,7 @@ import { TemplateIconType, } from 'components/shared/CustomIcon'; import { Tag } from 'components/shared/Tag'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useParams } from 'react-router-dom'; import { useToast } from 'components/shared/Toast'; import { cn } from 'utils/classnames'; @@ -30,6 +30,7 @@ export const TemplateCard: React.FC = ({ }: TemplateCardProps) => { const { toast, dismiss } = useToast(); const navigate = useNavigate(); + const { orgSlug } = useParams(); const handleClick = useCallback(() => { if (template?.isComingSoon) { @@ -41,7 +42,9 @@ export const TemplateCard: React.FC = ({ }); } if (isGitAuth) { - return navigate(`template?templateId=${template.id}`); + return navigate( + `/${orgSlug}/projects/create/template?templateId=${template.id}`, + ); } return toast({ id: 'connect-git-account', From dd5f93050d7282cb507cd4ad117b7fc9719fb0b7 Mon Sep 17 00:00:00 2001 From: Vivian Phung Date: Thu, 29 Feb 2024 00:01:56 -0700 Subject: [PATCH 3/3] fix navigate --- .../components/projects/create/TemplateCard/TemplateCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx b/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx index dce0e20b..ad073c2e 100644 --- a/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx +++ b/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx @@ -52,7 +52,7 @@ export const TemplateCard: React.FC = ({ variant: 'error', onDismiss: dismiss, }); - }, [isGitAuth, navigate, template, toast]); + }, [orgSlug, dismiss, isGitAuth, navigate, template, toast]); return (