🐛 Fix relative path in app

This commit is contained in:
Rune Harlyk
2025-10-20 20:34:33 +02:00
parent b14f005b22
commit 64ef3d31eb
7 changed files with 18 additions and 8 deletions
@@ -1,11 +1,15 @@
<script> <script>
import logo from '$lib/assets/logo512.png' import logo from '$lib/assets/logo512.png'
import { resolve } from '$app/paths'
/** @type {{appName: any}} */ /** @type {{appName: any}} */
let { appName } = $props() let { appName } = $props()
</script> </script>
<a href="/" class="rounded-box mb-4 flex items-center hover:scale-[1.02] active:scale-[0.98]"> <a
href={resolve('/')}
class="rounded-box mb-4 flex items-center hover:scale-[1.02] active:scale-[0.98]"
>
<img src={logo} alt="Logo" class="h-12 w-12" /> <img src={logo} alt="Logo" class="h-12 w-12" />
<h1 class="px-4 text-2xl font-bold">{appName}</h1> <h1 class="px-4 text-2xl font-bold">{appName}</h1>
</a> </a>
@@ -1,10 +1,11 @@
<script lang="ts"> <script lang="ts">
import { Hamburger } from '../icons' import { Hamburger } from '../icons'
import { resolve } from '$app/paths'
</script> </script>
<div class="topbar absolute left-0 top-0 w-full z-20 flex justify-between bg-zinc-800"> <div class="topbar absolute left-0 top-0 w-full z-20 flex justify-between bg-zinc-800">
<div class="flex gap-2 p-2"> <div class="flex gap-2 p-2">
<a href="/"> <a href={resolve('/')}>
<Hamburger class="h-8 w-8" /> <Hamburger class="h-8 w-8" />
</a> </a>
</div> </div>
+2 -1
View File
@@ -1,8 +1,9 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state' import { page } from '$app/state'
import { resolve } from '$app/paths'
</script> </script>
<div class="flex justify-center items-center w-full h-full"> <div class="flex justify-center items-center w-full h-full">
<h1>{page.status} {page.error?.message}</h1> <h1>{page.status} {page.error?.message}</h1>
<span>Go to <a class="btn btn-primary" href="/">Home page</a></span> <span>Go to <a class="btn btn-primary" href={resolve('/')}>Home page</a></span>
</div> </div>
+3 -2
View File
@@ -3,11 +3,12 @@
import Visualization from '$lib/components/Visualization.svelte' import Visualization from '$lib/components/Visualization.svelte'
import { socket } from '$lib/stores' import { socket } from '$lib/stores'
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { resolve } from '$app/paths'
onMount(() => { onMount(() => {
socket.subscribe(isConnected => { socket.subscribe(isConnected => {
if (isConnected) { if (isConnected) {
goto('/controller') goto(resolve('/controller'))
} }
}) })
}) })
@@ -21,7 +22,7 @@
<div class="card-body w-80"> <div class="card-body w-80">
<h2 class="card-title text-center text-2xl">Begin you journey</h2> <h2 class="card-title text-center text-2xl">Begin you journey</h2>
<p class="py-6 text-center"></p> <p class="py-6 text-center"></p>
<a class="btn btn-primary" href={$socket ? '/controller' : '/connection'}> <a class="btn btn-primary" href={resolve($socket ? '/controller' : '/connection')}>
Add Robot Dog Add Robot Dog
</a> </a>
</div> </div>
+2 -1
View File
@@ -1,7 +1,8 @@
import type { PageLoad } from './$types' import type { PageLoad } from './$types'
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { resolve } from '$app/paths'
export const load = (async () => { export const load = (async () => {
goto('/') goto(resolve('/'))
return return
}) satisfies PageLoad }) satisfies PageLoad
+2 -1
View File
@@ -1,7 +1,8 @@
import type { PageLoad } from './$types' import type { PageLoad } from './$types'
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { resolve } from '$app/paths'
export const load = (async () => { export const load = (async () => {
goto('/') goto(resolve('/'))
return return
}) satisfies PageLoad }) satisfies PageLoad
+2 -1
View File
@@ -1,7 +1,8 @@
import type { PageLoad } from './$types' import type { PageLoad } from './$types'
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { resolve } from '$app/paths'
export const load = (async () => { export const load = (async () => {
goto('/') goto(resolve('/'))
return return
}) satisfies PageLoad }) satisfies PageLoad