Skip to content

Commit 6b3b2ed

Browse files
committed
fix ui bug
1 parent 53bd563 commit 6b3b2ed

File tree

3 files changed

+43
-24
lines changed

3 files changed

+43
-24
lines changed

src/app/register/team/(pending)/existing/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Underline } from "@/utils/text-utils";
33

44
export default function page() {
55
const instructions = [
6-
"Obtain the unique 6-digit Team ID from your team member who registered your group.",
6+
"Obtain the unique 4-digit Team ID from your team member who registered your group.",
77
"Enter the Team ID below.",
88
"Click on “Join.”",
99
"Its official! You joined the team!",

src/app/register/team/page.tsx

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
import Link from "next/link";
22

33
import PurpleButton from "@/components/PurpleButton";
4+
import RegistrationLayout from "@/components/layouts/RegistrationLayout";
45
import JoinTeamInstructions from "@/components/teamRegistration/JoinTeamInstructions";
56
import { Underline } from "@/utils/text-utils";
67

78
export default function page() {
89
return (
9-
<div className="flex w-full flex-col justify-center gap-6 rounded-3xl bg-white p-4 text-3xl md:p-8">
10-
<div className="flex flex-col items-center justify-center font-semibold md:items-start">
11-
<h1>Next steps...</h1>
12-
<Underline noTick>Create your team!</Underline>
10+
<RegistrationLayout>
11+
<div className="flex w-full flex-col justify-center gap-6 rounded-3xl bg-white p-4 text-3xl md:p-8">
12+
<div className="flex flex-col items-center justify-center font-semibold md:items-start">
13+
<h1>Next steps...</h1>
14+
<Underline noTick>Create your team!</Underline>
15+
</div>
16+
<div className="flex flex-col gap-4 px-4">
17+
<h1 className="text-2xl font-semibold">Looking for a team?</h1>
18+
<JoinTeamInstructions />
19+
</div>
20+
<div className=" flex items-center justify-center">
21+
<h2 className="max-w-lg text-center font-bold">
22+
Ready to Register a new team or Join an existing team?
23+
</h2>
24+
</div>
25+
<div className="flex flex-col items-center justify-between text-white lg:flex-row">
26+
<Link href={"/register/team/remind"}>
27+
<PurpleButton>Remind me later</PurpleButton>
28+
</Link>
29+
<Link href={"/register/team/ready"}>
30+
<PurpleButton>Yes!</PurpleButton>
31+
</Link>
32+
</div>
1333
</div>
14-
<div className="flex flex-col gap-4 px-4">
15-
<h1 className="text-2xl font-semibold">Looking for a team?</h1>
16-
<JoinTeamInstructions />
17-
</div>
18-
<div className=" flex items-center justify-center">
19-
<h2 className="max-w-lg text-center font-bold">
20-
Ready to Register a new team or Join an existing team?
21-
</h2>
22-
</div>
23-
<div className="flex flex-col items-center justify-between text-white lg:flex-row">
24-
<Link href={"/register/team/remind"}>
25-
<PurpleButton>Remind me later</PurpleButton>
26-
</Link>
27-
<Link href={"/register/team/ready"}>
28-
<PurpleButton>Yes!</PurpleButton>
29-
</Link>
30-
</div>
31-
</div>
34+
</RegistrationLayout>
3235
);
3336
}

src/components/teamRegistration/JoinTeamCode.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Link from "next/link";
44
import { useRouter } from "next/navigation";
5-
import { type ChangeEvent, useRef, useState } from "react";
5+
import { type ChangeEvent, useEffect, useRef, useState } from "react";
66
import type { Id } from "react-toastify";
77
import { toast } from "react-toastify";
88

@@ -13,6 +13,22 @@ import PurpleButton from "../PurpleButton";
1313
import { useUser } from "../contexts/UserContext";
1414

1515
export default function JoinTeamCode() {
16+
useEffect(() => {
17+
const handlePasteEvent = (e: ClipboardEvent) => {
18+
const clipboardContentsText = e.clipboardData?.getData("text");
19+
if (clipboardContentsText?.length === 4) {
20+
e.preventDefault();
21+
setTeamIDInput(clipboardContentsText.split(""));
22+
const teamID = teamIDInput.join("");
23+
toastRef.current = toast.loading("Joining team...");
24+
joinTeamMutation.mutate(teamID);
25+
}
26+
};
27+
window.addEventListener("paste", handlePasteEvent);
28+
return () => {
29+
window.removeEventListener("paste", handlePasteEvent);
30+
};
31+
}, []);
1632
const [teamIDInput, setTeamIDInput] = useState(Array(4).fill(""));
1733
const inputRefs = useRef<(HTMLInputElement | null)[]>([]);
1834
const toastRef = useRef<Id>("");

0 commit comments

Comments
 (0)