Skip to content

Commit 0c1a5aa

Browse files
committed
fix: ui for /new
1 parent 698ed73 commit 0c1a5aa

File tree

6 files changed

+218
-49
lines changed

6 files changed

+218
-49
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<script lang="ts">
2+
import { twMerge } from "tailwind-merge";
3+
4+
let {
5+
disabled = $bindable(false),
6+
class: buttonClass = "",
7+
borderStyle = "",
8+
onclick = () => {},
9+
children
10+
} = $props();
11+
</script>
12+
13+
<div class={`relative h-fit w-fit`}>
14+
<button
15+
class={twMerge(
16+
'bg-white text-black px-6 py-3 font-raleway font-medium rounded-lg',
17+
buttonClass
18+
)}
19+
onclick={() => onclick()}
20+
>
21+
{@render children()}
22+
</button>
23+
24+
<div class={twMerge(
25+
`-z-10 absolute top-[6px] left-[6px] h-full w-full rounded-lg border-2 border-white`,
26+
borderStyle
27+
)}></div>
28+
</div>

frontend/src/lib/components/Modal.svelte

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
import { fade } from "svelte/transition";
44
import { twMerge } from "tailwind-merge";
55
6-
let { isOpen = $bindable(), class: modalClass = "", children} = $props();
6+
let {
7+
isOpen = $bindable(),
8+
class: modalClass = "",
9+
children
10+
} = $props();
711
const closeModal = () => isOpen = false;
812
</script>
913

@@ -12,7 +16,13 @@
1216
in:fade={{ duration: 50 }}
1317
class={`fixed top-0 left-0 z-30 h-screen w-screen grid place-items-center bg-neutral-800/60 backdrop-blur-sm`}
1418
>
15-
<div class={twMerge(`relative z-40 grid place-items-center px-8 py-4 bg-white rounded-md`, modalClass)} use:clickOutside={() => closeModal()}>
19+
<div
20+
class={twMerge(
21+
`relative z-40 grid place-items-center px-8 py-4 bg-white rounded-md`,
22+
modalClass
23+
)}
24+
use:clickOutside={() => closeModal()}
25+
>
1626
<!-- Close modal button -->
1727
<button class={`absolute top-2 right-2`} aria-label={`Close Modal`} onclick={() => closeModal()}>
1828
<svg class={`h-[24px] aspect-square fill-none stroke-current stroke-2 lucide lucide-x-icon lucide-x`} viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">

frontend/src/lib/components/SpellSymbols.svelte

Lines changed: 90 additions & 1 deletion
Large diffs are not rendered by default.

frontend/src/lib/directives/validateInput.svelte.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export enum ValidationOptions {
66
NUMERIC = '0123456789',
77
SPACE = ' ',
88
SPECIAL_CHARACTERS = ',.!?;:_<>',
9-
ALL = ' ,.!?;:_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
9+
ALL = ' ,.!?;:_<>0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
1010
}
1111

1212
export interface IValidationConfig {

frontend/src/routes/+page.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,9 @@
5757
src={`/assets/images/splash.webp`}
5858
alt={`SplashScreen`}
5959
/>
60-
{/if}
60+
{/if}
61+
62+
<svelte:head>
63+
<title>Labyrinth</title>
64+
<meta name="description" content="Dive into Labyrinth 2025 — a Scott Pilgrim-inspired treasure hunt across Shiv Nadar University. Battle riddles, defeat evil exes, and race for a ₹50,000 prize. Register now!">
65+
</svelte:head>

frontend/src/routes/new/+page.svelte

Lines changed: 81 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts">
22
import { goto } from "$app/navigation";
3+
import BorderButton from "$lib/components/BorderButton.svelte";
34
import { validateInput, ValidationOptions } from "$lib/directives/validateInput.svelte";
45
import { LoadingStore } from "$lib/stores/LoadingStore";
5-
import { UserStore } from "$lib/stores/SupabaseStore";
66
import { setTeam, type ITeamData } from "$lib/stores/TeamStore";
77
import { addToast } from "$lib/stores/ToastStore";
88
import { fetchWithAuth } from "$lib/utils/fetchWithAuth";
@@ -12,7 +12,7 @@
1212
1313
type PageState = 'create' | 'join';
1414
15-
let pageState: PageState = $state('create');
15+
let pageState: PageState = $state('join');
1616
let teamName: string = $state('');
1717
let teamId: string = $state('');
1818
@@ -133,54 +133,91 @@
133133
}
134134
</script>
135135

136-
<main class={`h-screen w-screen flex flex-col justify-center items-center py-4`}>
137-
<div class={`w-[90%] flex flex-col p-4 border-2 rounded-lg`}>
138-
<div class={`h-fit w-full gap-3 flex justify-center items-center p-4`}>
139-
<button class={`px-4 py-2 rounded-lg border-2 ${pageState === 'create' && 'border-green-500'}`} onmousedown={() => pageState = 'create'}>Create Team</button>
140-
<button class={`px-4 py-2 rounded-lg border-2 ${pageState === 'join' && 'border-green-500'}`} onmousedown={() => pageState = 'join'}>Join Team</button>
136+
<main class={`h-screen w-screen flex flex-col justify-center gap-2 pt-16 pb-8 px-4`}>
137+
<hgroup>
138+
<h1 class={`font-neue-machina font-black text-3xl`}>Registration</h1>
139+
<p class={`text-sm`}>Team up in groups of 4 and dive head first into defeating 7 evil exes!</p>
140+
</hgroup>
141+
142+
<div class={`flex flex-col justify-center items-center mt-4`}>
143+
<div class={`flex w-full justify-between items-center gap-1 p-1 bg-neutral-800 rounded-full text-lg text-black font-medium`}>
144+
<button
145+
onclick={() => pageState = 'join'}
146+
class={`w-1/2 flex justify-center items-center py-2 px-2 rounded-full transition-colors duration-300 ${pageState === 'join' ? 'text-black bg-white' : 'text-white'}`}
147+
>
148+
Join
149+
</button>
150+
151+
<button
152+
onclick={() => pageState = 'create'}
153+
class={`w-1/2 flex justify-center items-center py-2 px-2 rounded-full transition-colors duration-300 ${pageState !== 'join' ? 'text-black bg-white' : 'text-white'}`}
154+
>
155+
Create
156+
</button>
141157
</div>
158+
</div>
142159

143-
{#if pageState === 'create'}
144-
<div class={`flex flex-col gap-4`}>
145-
<label for={`team_name`}>Team Name</label>
146-
<input
147-
type={`text`}
148-
id={`team_name`}
149-
bind:value={teamName}
150-
class={`w-full border-2 p-2 rounded-lg`}
151-
/>
152-
153-
<button onclick={() => createTeam()} class={`w-full border-2 p-2 rounded-lg`}>
154-
Create Team
155-
</button>
156-
</div>
157-
{:else if pageState === 'join'}
158-
<div class={`flex flex-col gap-4`}>
159-
<label for={`team_name`}>Team Code</label>
160-
<input
161-
type={`text`}
162-
id={`team_name`}
163-
bind:value={teamId}
164-
use:validateInput={{
165-
allowed: [ValidationOptions.NUMERIC],
166-
maxLength: 6
167-
}}
168-
class={`w-full border-2 p-2 rounded-lg`}
169-
placeholder="e.g, 123456"
170-
/>
171-
172-
<button onclick={() => joinTeam()} class={`w-full border-2 p-2 rounded-lg`}>
173-
Join Team
174-
</button>
175-
</div>
160+
<div class={`flex flex-col justify-center items-center gap-2 mt-2`}>
161+
{#if pageState === 'join'}
162+
<input
163+
id={`team_id`}
164+
name={`team_id`}
165+
class={`w-[80%] py-4 px-4 text-lg bg-neutral-800 border-2 border-neutral-600 rounded-lg mb-2`}
166+
use:validateInput={{
167+
maxLength: 6,
168+
allowed: [ValidationOptions.NUMERIC]
169+
}}
170+
bind:value={teamId}
171+
placeholder={`Team Code`}
172+
/>
173+
174+
<BorderButton onclick={() => joinTeam()} class={`px-8 active:bg-neutral-400 flex justify-center items-center gap-2`}>
175+
<p class={`font-semibold`}>Join Team</p>
176+
<svg xmlns="http://www.w3.org/2000/svg" class={`h-[18px] aspect-square fill-none stroke-3 stroke-current lucide lucide-user-plus-icon lucide-user-plus`} viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round">
177+
<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/>
178+
<circle cx="9" cy="7" r="4"/>
179+
<line x1="19" x2="19" y1="8" y2="14"/>
180+
<line x1="22" x2="16" y1="11" y2="11"/>
181+
</svg>
182+
</BorderButton>
183+
{:else}
184+
<input
185+
id={`team_id`}
186+
name={`team_id`}
187+
class={`w-[80%] py-4 px-4 text-lg bg-neutral-800 border-2 border-neutral-600 rounded-lg mb-2`}
188+
use:validateInput={{
189+
maxLength: 18,
190+
allowed: [ValidationOptions.ALL]
191+
}}
192+
bind:value={teamName}
193+
placeholder={`Team Name`}
194+
/>
195+
196+
<BorderButton onclick={() => createTeam()} class={`px-8 active:bg-neutral-400 flex justify-center items-center gap-1`}>
197+
<p class={`font-semibold`}>Create Team</p>
198+
<svg xmlns="http://www.w3.org/2000/svg" class={`h-[18px] aspect-square fill-none stroke-current stroke-3 lucide lucide-plus-icon lucide-plus`} viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round">
199+
<path d="M5 12h14"/>
200+
<path d="M12 5v14"/>
201+
</svg>
202+
</BorderButton>
176203
{/if}
177204
</div>
178205

179206

180-
<div class={`flex flex-col`}>
181-
<p>{$UserStore?.email}</p>
182-
<button onclick={() => handleSignOut()} class={`border-2 px-4 py-2 rounded-lg`}>
207+
<div class={`flex flex-col justify-center items-center text-center gap-2 mt-16`}>
208+
<div class={`border-t-2 border-white/20 h-[0.5px] w-full`}></div>
209+
<div class={`mt-1`}>
210+
<p>Logged in with email</p>
211+
<p>{user!.email}</p>
212+
</div>
213+
214+
<button class={`active:bg-neutral-700 border-2 border-labyrinth-red bg-neutral-800/60 transition-colors duration-200 text-labyrinth-neutral-200 px-4 py-2 rounded-lg`}>
183215
Sign Out
184216
</button>
185217
</div>
186-
</main>
218+
</main>
219+
220+
<svelte:head>
221+
<title>Labyrinth | Team Registration</title>
222+
<meta name="description" content="Create or join a team and dive into Labyrinth 2025!">
223+
</svelte:head>

0 commit comments

Comments
 (0)