fix: [closes #59] prevent users from using empty room names

This commit is contained in:
Jeremy Kahn 2022-10-29 12:54:40 -05:00
parent 73e09041cc
commit 95d6ed6f11

View File

@ -47,6 +47,8 @@ export function Home({ userId }: HomeProps) {
navigate(`/private/${roomName}`) navigate(`/private/${roomName}`)
} }
const isRoomNameValid = roomName.length > 0
return ( return (
<Box className="Home"> <Box className="Home">
<main className="mt-6 px-4 max-w-3xl text-center mx-auto"> <main className="mt-6 px-4 max-w-3xl text-center mx-auto">
@ -83,6 +85,7 @@ export function Home({ userId }: HomeProps) {
sx={{ sx={{
marginTop: 2, marginTop: 2,
}} }}
disabled={!isRoomNameValid}
> >
Join public room Join public room
</Button> </Button>
@ -93,6 +96,7 @@ export function Home({ userId }: HomeProps) {
marginTop: 2, marginTop: 2,
marginLeft: 2, marginLeft: 2,
}} }}
disabled={!isRoomNameValid}
> >
Join private room Join private room
</Button> </Button>