Limit size of siblings list and some bug fixes
This commit is contained in:
@@ -79,7 +79,7 @@ const drop = (e: DragEvent, drop_idx: number) => {
|
||||
<MenuEntry id="bookmarks" collapsed={menu_collapsed}>
|
||||
{#snippet title()}
|
||||
<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}
|
||||
<i class="icon">save</i>
|
||||
{:else}
|
||||
@@ -129,7 +129,6 @@ const drop = (e: DragEvent, drop_idx: number) => {
|
||||
<style>
|
||||
.title {
|
||||
flex: 1 1 auto;
|
||||
text-align: center;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
|
||||
@@ -299,7 +299,6 @@ const set_offset = (off: number) => {
|
||||
}
|
||||
.username {
|
||||
flex: 1 1 auto;
|
||||
text-align: center;
|
||||
margin: 3px;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ const toggle = (e: MouseEvent) => {
|
||||
</script>
|
||||
|
||||
<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}
|
||||
{@render title()}
|
||||
|
||||
@@ -10,7 +10,21 @@ let siblings: FSNode[] = $state([])
|
||||
|
||||
onMount(() => {
|
||||
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>
|
||||
@@ -18,7 +32,7 @@ onMount(() => {
|
||||
<MenuEntry id="tree_parents" collapsed={menu_collapsed}>
|
||||
{#snippet title()}
|
||||
<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>
|
||||
</button>
|
||||
{/snippet}
|
||||
@@ -40,10 +54,10 @@ onMount(() => {
|
||||
<MenuEntry id="tree_siblings" collapsed={menu_collapsed}>
|
||||
{#snippet title()}
|
||||
<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>
|
||||
</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>
|
||||
</button>
|
||||
{/snippet}
|
||||
@@ -65,7 +79,6 @@ onMount(() => {
|
||||
<style>
|
||||
.title {
|
||||
flex: 1 1 auto;
|
||||
text-align: center;
|
||||
margin: 3px;
|
||||
}
|
||||
.row {
|
||||
|
||||
Reference in New Issue
Block a user