Fix double navigation bug in breadcrumbs

This commit is contained in:
2026-01-27 15:33:25 +01:00
parent 70a22d4a06
commit 0723cb5331
9 changed files with 40 additions and 45 deletions

View File

@@ -1,9 +1,9 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
import { onMount } from 'svelte'
import { fs_path_url, fs_encode_path, fs_node_icon } from "lib/FilesystemAPI.svelte"
import { fs_path_url, fs_encode_path, fs_node_icon, FSNode } from "lib/FilesystemAPI.svelte"
import TextBlock from "layout/TextBlock.svelte"
import type { FSNavigator } from 'filesystem/FSNavigator';
import { branding_from_props } from 'filesystem/edit_window/Branding';
let { nav, children }: {
nav: FSNavigator;
@@ -13,7 +13,7 @@ let { nav, children }: {
let player: HTMLAudioElement = $state()
let playing = $state(false)
let media_session = false
let siblings = $state([])
let siblings: FSNode[] = $state([])
export const toggle_playback = () => playing ? player.pause() : player.play()
export const toggle_mute = () => player.muted = !player.muted
@@ -38,6 +38,18 @@ export const update = async () => {
}
siblings = await nav.get_siblings()
for(const sib of siblings) {
if (sib.name === "cover.jpg") {
console.log("found sibling", sib)
if (sib.properties === undefined) {
sib.properties = {}
}
sib.properties.brand_background_image = sib.path
document.documentElement.style = branding_from_props(sib.properties)
break
}
}
}
onMount(() => {
@@ -82,11 +94,7 @@ onMount(() => {
<h2>Tracklist</h2>
{#each siblings as sibling (sibling.path)}
<a
href={"/d"+fs_encode_path(sibling.path)}
onclick={preventDefault(() => nav.navigate(sibling.path, true))}
class="node"
>
<a href={"/d"+fs_encode_path(sibling.path)} class="node">
{#if sibling.path === $nav.base.path}
<i class="play_arrow icon">play_arrow</i>
{:else}