Skip to content

Commit

Permalink
Remove join room button (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
takumihara authored Feb 21, 2024
1 parent 70ac8a9 commit 3cfc4e2
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions frontend/app/pong/JoinRoomForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,20 @@ import {
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Separator } from "@/components/ui/separator";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { v4 } from "uuid";
import MatchButton from "./MatchButton";

export default function JoinRoomForm({}) {
return (
<Card className="basis-1/3">
<CardHeader>
<CardTitle>Join room</CardTitle>
<CardDescription>
Join a room to play pong with your friend
</CardDescription>
<CardTitle>Play Pong</CardTitle>
<CardDescription>Lets play pong with your friend</CardDescription>
</CardHeader>
<CardContent>
<div className="flex flex-col gap-4">
<Form />
<OrSeparator />
<CreateRoomButton />
<OrSeparator />
<MatchButton />
Expand Down Expand Up @@ -57,27 +49,3 @@ function CreateRoomButton() {
</Button>
);
}

function Form() {
const router = useRouter();
const [inputValue, setInputValue] = useState("");
const handleSubmit = (event: React.SyntheticEvent) => {
event.preventDefault();
router.push(`/pong/${inputValue}?mode=player`);
};
return (
<form onSubmit={handleSubmit}>
<div className="grid w-full items-center gap-4">
<div className="flex flex-col space-y-1.5">
<Label htmlFor="id">ID</Label>
<Input
id="id"
placeholder="ID of pong room you friend told you"
onChange={(e) => setInputValue(e.target.value)}
/>
</div>
<Button>Join</Button>
</div>
</form>
);
}

0 comments on commit 3cfc4e2

Please sign in to comment.