From 47838a506a29487920d2075228e79907a5b40ef7 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Mon, 31 Jul 2023 12:03:16 +0530 Subject: [PATCH] fix: workspace name validation added (#1702) --- .../workspace/create-workspace-form.tsx | 4 +++ .../pages/[workspaceSlug]/settings/index.tsx | 32 +++++++++++-------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/apps/app/components/workspace/create-workspace-form.tsx b/apps/app/components/workspace/create-workspace-form.tsx index a5b27e9f8..2e1128bba 100644 --- a/apps/app/components/workspace/create-workspace-form.tsx +++ b/apps/app/components/workspace/create-workspace-form.tsx @@ -140,6 +140,10 @@ export const CreateWorkspaceForm: React.FC = ({ validate: (value) => /^[\w\s-]*$/.test(value) || `Name can only contain (" "), ( - ), ( _ ) & alphanumeric characters.`, + maxLength: { + value: 80, + message: "Workspace name should not exceed 80 characters", + }, }} placeholder="Enter workspace name..." error={errors.name} diff --git a/apps/app/pages/[workspaceSlug]/settings/index.tsx b/apps/app/pages/[workspaceSlug]/settings/index.tsx index 6306605ed..66284382a 100644 --- a/apps/app/pages/[workspaceSlug]/settings/index.tsx +++ b/apps/app/pages/[workspaceSlug]/settings/index.tsx @@ -224,19 +224,21 @@ const WorkspaceSettings: NextPage = () => {

Your workspace URL.

- +
+ +
@@ -273,6 +275,10 @@ const WorkspaceSettings: NextPage = () => { error={errors.name} validations={{ required: "Name is required", + maxLength: { + value: 80, + message: "Workspace name should not exceed 80 characters", + }, }} />