Skip to content

Commit 749006e

Browse files
2 parents 3b5a9cf + 0c1a5aa commit 749006e

File tree

13 files changed

+363
-63
lines changed

13 files changed

+363
-63
lines changed

frontend/src/app.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@theme {
44
--font-raleway: 'Raleway', sans-serif;
5+
--font-philosopher: 'Philosopher', sans-serif;
56
--font-neue-machina: 'NeueMachina', sans-serif;
67

78
--font-weight-thin: 100;

frontend/src/app.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<!-- Google Fonts -->
1010
<link rel="preconnect" href="https://fonts.googleapis.com">
1111
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
12-
<link href="https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
12+
<link href="https://fonts.googleapis.com/css2?family=Philosopher:ital,wght@0,400;0,700;1,400;1,700&family=Raleway:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
1313
</head>
14-
<body data-sveltekit-preload-data="hover" class="font-raleway bg-neutral-900">
14+
<body data-sveltekit-preload-data="hover" class="font-raleway bg-neutral-900 text-neutral-200">
1515
<div style="display: contents">%sveltekit.body%</div>
1616
</body>
1717
</html>
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>
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
<main class={`h-screen w-screen overflow-hidden flex flex-col justify-center items-center`}>
2-
<p>Only Mobile :P</p>
2+
<p class={`text-3xl font-philosopher font-bold`}>
3+
Please use a mobile device for
4+
<span class={`text-labyrinth-purple`}>optimal</span>
5+
experience!
6+
</p>
37
</main>

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: 177 additions & 0 deletions
Large diffs are not rendered by default.

frontend/src/lib/components/StreamListener.svelte

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
<!-- TODO: Edit component to not try on TeamStore update but poll for connection -->
2-
31
<script lang="ts">
42
import { PUBLIC_BACKEND_URL } from "$env/static/public";
53
import { TeamStore } from "$lib/stores/TeamStore";
64
import { onMount } from "svelte";
75
86
let eventSource: EventSource | null = $state(null);
7+
let isConnected: boolean = $state(false);
98
109
const cleanup = () => {
1110
if (eventSource) {
1211
alert('closing event source');
12+
isConnected = false;
1313
eventSource.close();
1414
eventSource = null;
1515
}
1616
}
1717
1818
const connect = () => {
19+
if (isConnected) return;
20+
1921
console.log('Attempting Connection');
2022
const cleanedUrl = PUBLIC_BACKEND_URL.replace(/\/+$/, '');
2123
const params = new URLSearchParams({ team_id: $TeamStore!.id })
2224
eventSource = new EventSource(`${cleanedUrl}/api/eventlistener?${params.toString()}`);
2325
24-
eventSource.onopen = (event) => {
25-
alert('Connection Established')
26+
eventSource.onopen = () => {
27+
isConnected = true;
2628
}
2729
2830
eventSource.onmessage = (event) => {

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/lib/stores/DeviceStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { browser } from "$app/environment";
22
import { writable } from "svelte/store";
33

44
const TOKEN_NAME = 'labyrinth-gdsc-device'
5-
const initialValue = browser ? window.localStorage.getItem(TOKEN_NAME) ?? 'desktop' : 'desktop';
5+
const initialValue = browser ? window.localStorage.getItem(TOKEN_NAME) ?? 'mobile' : 'mobile';
66
const device = writable<Device>(initialValue as Device);
77
const setDevice = (value: Device) => {
88
if (!browser) return;

frontend/src/routes/+layout.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import Toast from "$lib/components/Toast.svelte";
1212
import { LoadingStore } from "$lib/stores/LoadingStore";
1313
import Loading from "$lib/components/Loading.svelte";
14-
import StreamListener from "$lib/components/StreamListener.svelte";
14+
import SpellSymbols from "$lib/components/SpellSymbols.svelte";
1515
1616
let { data, children } = $props();
1717
let { supabase, session, user } = $derived(data);
@@ -57,8 +57,9 @@
5757
)}
5858
/>
5959

60-
{#if $device === "mobile" || PUBLIC_ENVIRONMENT === "development"}
60+
{#if $device === "mobile" || PUBLIC_ENVIRONMENT !== "development"}
6161
{@render children()}
62+
<SpellSymbols />
6263
{:else}
6364
<MobileOnly />
6465
{/if}

0 commit comments

Comments
 (0)