Spaces:
Runtime error
Runtime error
no need for + route
Browse files- frontend/src/app.html +2 -0
- frontend/src/lib/App.svelte +1 -1
- frontend/src/routes/+/+page.svelte +0 -77
- frontend/src/routes/+/+page.ts +0 -1
frontend/src/app.html
CHANGED
|
@@ -5,6 +5,8 @@
|
|
| 5 |
<meta charset="utf-8" />
|
| 6 |
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
| 7 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
|
|
|
|
|
|
| 8 |
%sveltekit.head%
|
| 9 |
</head>
|
| 10 |
<!-- <body class="dark:bg-[rgb(11,15,25)] bg-white dark:text-white text-black"> -->
|
|
|
|
| 5 |
<meta charset="utf-8" />
|
| 6 |
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
| 7 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
| 8 |
+
<script
|
| 9 |
+
src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script>
|
| 10 |
%sveltekit.head%
|
| 11 |
</head>
|
| 12 |
<!-- <body class="dark:bg-[rgb(11,15,25)] bg-white dark:text-white text-black"> -->
|
frontend/src/lib/App.svelte
CHANGED
|
@@ -159,7 +159,7 @@
|
|
| 159 |
{#if showModal}
|
| 160 |
<PromptModal on:paint={onPaint} on:close={onClose} initPrompt={$myPresence?.currentPrompt} />
|
| 161 |
{/if}
|
| 162 |
-
<div class="fixed top-0 left-0 z-0 w-screen h-screen">
|
| 163 |
<PaintCanvas />
|
| 164 |
|
| 165 |
<main class="z-10 relative">
|
|
|
|
| 159 |
{#if showModal}
|
| 160 |
<PromptModal on:paint={onPaint} on:close={onClose} initPrompt={$myPresence?.currentPrompt} />
|
| 161 |
{/if}
|
| 162 |
+
<div class="fixed top-0 left-0 z-0 w-screen h-screen min-h-[600px]">
|
| 163 |
<PaintCanvas />
|
| 164 |
|
| 165 |
<main class="z-10 relative">
|
frontend/src/routes/+/+page.svelte
DELETED
|
@@ -1,77 +0,0 @@
|
|
| 1 |
-
<script lang="ts">
|
| 2 |
-
import { onMount } from 'svelte';
|
| 3 |
-
import { createClient } from '@liveblocks/client';
|
| 4 |
-
import type { Client } from '@liveblocks/client';
|
| 5 |
-
import LiveblocksProvider from '$lib/liveblocks/LiveblocksProvider.svelte';
|
| 6 |
-
import RoomProvider from '$lib/liveblocks/RoomProvider.svelte';
|
| 7 |
-
import App from '$lib/App.svelte';
|
| 8 |
-
import About from '$lib/About.svelte';
|
| 9 |
-
import { PUBLIC_API_BASE } from '$env/static/public';
|
| 10 |
-
import { selectedRoomID, toggleAbout } from '$lib/store';
|
| 11 |
-
import type { RoomResponse } from '$lib/types';
|
| 12 |
-
import { MAX_CAPACITY, CANVAS_SIZE, FRAME_SIZE } from '$lib/constants';
|
| 13 |
-
import { Status } from '$lib/types';
|
| 14 |
-
|
| 15 |
-
let loading = true;
|
| 16 |
-
let client: Client;
|
| 17 |
-
|
| 18 |
-
$: roomId = $selectedRoomID;
|
| 19 |
-
|
| 20 |
-
onMount(() => {
|
| 21 |
-
// document.addEventListener('wheel', (e) => e.preventDefault(), { passive: false });
|
| 22 |
-
client = createClient({
|
| 23 |
-
authEndpoint: PUBLIC_API_BASE + '/auth'
|
| 24 |
-
});
|
| 25 |
-
|
| 26 |
-
updateRooms();
|
| 27 |
-
});
|
| 28 |
-
|
| 29 |
-
async function updateRooms() {
|
| 30 |
-
loading = true;
|
| 31 |
-
const roomidParam = new URLSearchParams(window.location.search).get('roomid');
|
| 32 |
-
const res = await fetch(PUBLIC_API_BASE + '/rooms');
|
| 33 |
-
const rooms: RoomResponse[] = await res.json();
|
| 34 |
-
|
| 35 |
-
if (roomidParam) {
|
| 36 |
-
const room = rooms.find((room) => room.room_id === roomidParam);
|
| 37 |
-
if (room) {
|
| 38 |
-
selectedRoomID.set(roomidParam);
|
| 39 |
-
}
|
| 40 |
-
} else {
|
| 41 |
-
const room = rooms.find((room) => room.users_count < MAX_CAPACITY) || null;
|
| 42 |
-
selectedRoomID.set(room ? room.room_id : null);
|
| 43 |
-
}
|
| 44 |
-
loading = false;
|
| 45 |
-
return { rooms };
|
| 46 |
-
}
|
| 47 |
-
const initialPresence = {
|
| 48 |
-
cursor: null,
|
| 49 |
-
frame: {
|
| 50 |
-
x: CANVAS_SIZE.width / 2 - FRAME_SIZE / 2,
|
| 51 |
-
y: CANVAS_SIZE.height / 2 - FRAME_SIZE / 2
|
| 52 |
-
},
|
| 53 |
-
status: Status.dragging,
|
| 54 |
-
currentPrompt: ''
|
| 55 |
-
};
|
| 56 |
-
</script>
|
| 57 |
-
|
| 58 |
-
<About
|
| 59 |
-
classList={$toggleAbout ? 'flex' : 'hidden'}
|
| 60 |
-
on:click={() => ($toggleAbout = false)}
|
| 61 |
-
{loading}
|
| 62 |
-
/>
|
| 63 |
-
|
| 64 |
-
{#if !loading}
|
| 65 |
-
<LiveblocksProvider {client}>
|
| 66 |
-
{#if roomId}
|
| 67 |
-
<RoomProvider id={roomId} {initialPresence}>
|
| 68 |
-
<App />
|
| 69 |
-
</RoomProvider>
|
| 70 |
-
{:else}
|
| 71 |
-
<div class="flex flex-col items-center justify-center h-full">
|
| 72 |
-
<h1 class="text-2xl font-bold">No room selected</h1>
|
| 73 |
-
<p class="text-gray-500">Please select a room in the URL</p>
|
| 74 |
-
</div>
|
| 75 |
-
{/if}
|
| 76 |
-
</LiveblocksProvider>
|
| 77 |
-
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frontend/src/routes/+/+page.ts
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
export const prerender = true;
|
|
|
|
|
|