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" ;
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
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 x 1=" 19" x 2=" 19" y 1=" 8" y 2=" 14" />
180+ <line x 1=" 22" x 2=" 16" y 1=" 11" y 2=" 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