mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: workspace url error message (#809)
This commit is contained in:
parent
3457411c6a
commit
dc9ce5101c
@ -42,6 +42,7 @@ export const CreateWorkspaceForm: React.FC<Props> = ({
|
|||||||
setDefaultValues,
|
setDefaultValues,
|
||||||
}) => {
|
}) => {
|
||||||
const [slugError, setSlugError] = useState(false);
|
const [slugError, setSlugError] = useState(false);
|
||||||
|
const [invalidSlug, setInvalidSlug] = useState(false);
|
||||||
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
@ -130,11 +131,20 @@ export const CreateWorkspaceForm: React.FC<Props> = ({
|
|||||||
name="slug"
|
name="slug"
|
||||||
register={register}
|
register={register}
|
||||||
className="block w-full rounded-md bg-transparent py-2 px-0 text-sm"
|
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>
|
</div>
|
||||||
{slugError && (
|
{slugError && (
|
||||||
<span className="-mt-3 text-sm text-red-500">Workspace URL is already taken!</span>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user