From 2c41cbbd3c36d16bafe8d7e8f619025db7c3bbf0 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Thu, 25 Jul 2024 14:43:38 +0200 Subject: [PATCH] fix: validate project names on blur (#7668) This fix validates the project name when you blur the field in the new project form. The only instances where it'll be wrong is if you have just whitespace or an empty string, but you'll be notified immediately. Also removes some unused variables and parameters that I found. --- .../NewCreateProjectForm/CreateProjectDialog.tsx | 2 +- .../src/component/project/ProjectList/ProjectList.tsx | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/frontend/src/component/project/Project/CreateProject/NewCreateProjectForm/CreateProjectDialog.tsx b/frontend/src/component/project/Project/CreateProject/NewCreateProjectForm/CreateProjectDialog.tsx index 08f5bb389a..aa2dc4e748 100644 --- a/frontend/src/component/project/Project/CreateProject/NewCreateProjectForm/CreateProjectDialog.tsx +++ b/frontend/src/component/project/Project/CreateProject/NewCreateProjectForm/CreateProjectDialog.tsx @@ -128,7 +128,6 @@ export const CreateProjectDialog = ({ const navigate = useNavigate(); const { trackEvent } = usePlausibleTracker(); const { - projectId, projectName, projectDesc, projectMode, @@ -276,6 +275,7 @@ export const CreateProjectDialog = ({ errors={errors} icon={StyledProjectIcon} onClose={onClose} + validateName={validateName} configButtons={ <> = ({ - projectCount, -}) => { +const ProjectCreationButton: FC = () => { const [searchParams] = useSearchParams(); const showCreateDialog = Boolean(searchParams.get('create')); const [openCreateDialog, setOpenCreateDialog] = useState(showCreateDialog); const { hasAccess } = useContext(AccessContext); - const { isOss, uiConfig, loading } = useUiConfig(); + const { isOss, loading } = useUiConfig(); const createButtonData = resolveCreateButtonData( isOss(), @@ -203,9 +201,7 @@ export const ProjectListNew = () => { } /> - + } >