Limit size of siblings list and some bug fixes

This commit is contained in:
2026-04-01 15:30:11 +02:00
parent 8a2cdb4acd
commit dbfe9ff383
7 changed files with 29 additions and 13 deletions

View File

@@ -56,8 +56,10 @@ const keydown = (e: KeyboardEvent) => {
return // prevent custom shortcuts from interfering with system shortcuts return // prevent custom shortcuts from interfering with system shortcuts
} else if ( } else if (
(document.activeElement as any).type !== undefined && (document.activeElement as any).type !== undefined &&
(document.activeElement as any).type === "text" && (
(document.activeElement as any).type === "textarea" (document.activeElement as any).type === "text" ||
(document.activeElement as any).type === "textarea"
)
) { ) {
return // Prevent shortcuts from interfering with input fields return // Prevent shortcuts from interfering with input fields
} }

View File

@@ -34,7 +34,7 @@ let {
</button> </button>
</IconBlock> </IconBlock>
{#if node.name === ".search_index.gz"} {#if node.name === ".search_index.zstd"}
<TextBlock> <TextBlock>
<p> <p>
Congratulations! You have found the search index. One of the Congratulations! You have found the search index. One of the
@@ -50,7 +50,7 @@ let {
have a lot of repetitive elements it compresses incredibly well. have a lot of repetitive elements it compresses incredibly well.
You'd be hard-pressed to grow this index over even 1 MB. Honestly, You'd be hard-pressed to grow this index over even 1 MB. Honestly,
this search system is incredibly efficient, I'd be surprised if this search system is incredibly efficient, I'd be surprised if
EleasticSearch could even match it. ElasticSearch could even match it.
</p> </p>
<p> <p>
This file is updated 10 minutes after the last time you modify a This file is updated 10 minutes after the last time you modify a

View File

@@ -7,6 +7,7 @@ let {
group_middle = false, group_middle = false,
group_last = false, group_last = false,
highlight = true, highlight = true,
flat = false,
action, action,
children, children,
}: { }: {
@@ -17,6 +18,7 @@ let {
group_middle?: boolean; group_middle?: boolean;
group_last?: boolean; group_last?: boolean;
highlight?: boolean; highlight?: boolean;
flat?: boolean;
action?: (e: MouseEvent) => void; action?: (e: MouseEvent) => void;
children?: import('svelte').Snippet; children?: import('svelte').Snippet;
} = $props(); } = $props();
@@ -37,6 +39,7 @@ const click = (e: MouseEvent) => {
class:group_first class:group_first
class:group_middle class:group_middle
class:group_last class:group_last
class:flat
> >
{#if on} {#if on}
<i class="icon">{icon_on}</i> <i class="icon">{icon_on}</i>

View File

@@ -79,7 +79,7 @@ const drop = (e: DragEvent, drop_idx: number) => {
<MenuEntry id="bookmarks" collapsed={menu_collapsed}> <MenuEntry id="bookmarks" collapsed={menu_collapsed}>
{#snippet title()} {#snippet title()}
<div class="title">Bookmarks</div> <div class="title">Bookmarks</div>
<button onclick={toggle_edit} class:button_highlight={editing}> <button onclick={toggle_edit} class:button_highlight={editing} class="button flat">
{#if editing} {#if editing}
<i class="icon">save</i> <i class="icon">save</i>
{:else} {:else}
@@ -129,7 +129,6 @@ const drop = (e: DragEvent, drop_idx: number) => {
<style> <style>
.title { .title {
flex: 1 1 auto; flex: 1 1 auto;
text-align: center;
} }
.row { .row {
display: flex; display: flex;

View File

@@ -299,7 +299,6 @@ const set_offset = (off: number) => {
} }
.username { .username {
flex: 1 1 auto; flex: 1 1 auto;
text-align: center;
margin: 3px; margin: 3px;
} }

View File

@@ -44,7 +44,7 @@ const toggle = (e: MouseEvent) => {
</script> </script>
<div class="title"> <div class="title">
<ToggleButton bind:on={expanded} action={toggle} icon_on="arrow_drop_down" icon_off="arrow_drop_up" highlight={false}/> <ToggleButton bind:on={expanded} action={toggle} icon_on="arrow_drop_down" icon_off="arrow_drop_up" highlight={false} flat/>
{#if !collapsed} {#if !collapsed}
{@render title()} {@render title()}

View File

@@ -10,7 +10,21 @@ let siblings: FSNode[] = $state([])
onMount(() => { onMount(() => {
return global_navigator.subscribe(async () => { return global_navigator.subscribe(async () => {
siblings = await global_navigator.get_siblings() const all_siblings = await global_navigator.get_siblings()
// Find the base
let base_idx = 0
for (let i = 0; i < all_siblings.length; i++) {
if (global_navigator.base.id === all_siblings[i].id) {
base_idx = i
break
}
}
siblings = all_siblings.slice(
Math.max(base_idx-50,0),
Math.min(base_idx+50, all_siblings.length),
)
}) })
}) })
</script> </script>
@@ -18,7 +32,7 @@ onMount(() => {
<MenuEntry id="tree_parents" collapsed={menu_collapsed}> <MenuEntry id="tree_parents" collapsed={menu_collapsed}>
{#snippet title()} {#snippet title()}
<div class="title">Parent directories</div> <div class="title">Parent directories</div>
<button title="Navigate up" onclick={() => global_navigator.navigate_up()}> <button title="Navigate up" onclick={() => global_navigator.navigate_up()} class="button flat">
<i class="icon">north</i> <i class="icon">north</i>
</button> </button>
{/snippet} {/snippet}
@@ -40,10 +54,10 @@ onMount(() => {
<MenuEntry id="tree_siblings" collapsed={menu_collapsed}> <MenuEntry id="tree_siblings" collapsed={menu_collapsed}>
{#snippet title()} {#snippet title()}
<div class="title">Siblings</div> <div class="title">Siblings</div>
<button title="Open previous sibling" onclick={() => global_navigator.open_sibling(-1)}> <button title="Open previous sibling" onclick={() => global_navigator.open_sibling(-1)} class="button flat">
<i class="icon">west</i> <i class="icon">west</i>
</button> </button>
<button title="Open next sibling" onclick={() => global_navigator.open_sibling(1)}> <button title="Open next sibling" onclick={() => global_navigator.open_sibling(1)} class="button flat">
<i class="icon">east</i> <i class="icon">east</i>
</button> </button>
{/snippet} {/snippet}
@@ -65,7 +79,6 @@ onMount(() => {
<style> <style>
.title { .title {
flex: 1 1 auto; flex: 1 1 auto;
text-align: center;
margin: 3px; margin: 3px;
} }
.row { .row {