fix: workspace name validation added (#1702)

This commit is contained in:
Anmol Singh Bhatia 2023-07-31 12:03:16 +05:30 committed by GitHub
parent d9ce042dff
commit 47838a506a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 13 deletions

View File

@ -140,6 +140,10 @@ export const CreateWorkspaceForm: React.FC<Props> = ({
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}

View File

@ -224,12 +224,13 @@ const WorkspaceSettings: NextPage = () => {
<p className="text-sm text-custom-text-200">Your workspace URL.</p>
</div>
<div className="col-span-12 flex items-center gap-2 sm:col-span-6">
<div className="flex flex-col gap-1">
<Input
id="url"
name="url"
autoComplete="off"
register={register}
error={errors.name}
error={errors.url}
className="w-full"
value={`${
typeof window !== "undefined" &&
@ -237,6 +238,7 @@ const WorkspaceSettings: NextPage = () => {
}/${activeWorkspace.slug}`}
disabled
/>
</div>
<SecondaryButton
className="h-min"
onClick={() =>
@ -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",
},
}}
/>
</div>