Skip to content

Commit

Permalink
fix: workspace url error message (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolsinghbhatia authored Apr 13, 2023
1 parent 3457411 commit dc9ce51
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/app/components/workspace/create-workspace-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const CreateWorkspaceForm: React.FC<Props> = ({
setDefaultValues,
}) => {
const [slugError, setSlugError] = useState(false);
const [invalidSlug, setInvalidSlug] = useState(false);

const { setToastAlert } = useToast();

Expand Down Expand Up @@ -130,11 +131,20 @@ export const CreateWorkspaceForm: React.FC<Props> = ({
name="slug"
register={register}
className="block w-full rounded-md bg-transparent py-2 px-0 text-sm"
validations={{
required: "Workspace URL is required",
}}
onChange={(e) =>
/^[a-zA-Z0-9_-]+$/.test(e.target.value) ? setInvalidSlug(false) : setInvalidSlug(true)
}
/>
</div>
{slugError && (
<span className="-mt-3 text-sm text-red-500">Workspace URL is already taken!</span>
)}
{invalidSlug && (
<span className="text-sm text-red-500">{`URL can only contain ( - ), ( _ ) & Alphanumeric characters.`}</span>
)}
</div>
</div>

Expand Down

1 comment on commit dc9ce51

@vercel
Copy link

@vercel vercel bot commented on dc9ce51 Apr 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./apps/app

plane-dev-git-develop-caravel.vercel.app
plane-dev-caravel.vercel.app
plane-dev.vercel.app

Please sign in to comment.