Restore the invitations tab, render library tracks on first paint and re-measure the tab indicator
This commit is contained in:
@@ -57,6 +57,8 @@
|
|||||||
(track) => track.id
|
(track) => track.id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
untrack(() => list.reset(tracks));
|
||||||
|
|
||||||
let search = $state('');
|
let search = $state('');
|
||||||
let selectedIds = $state<string[]>([]);
|
let selectedIds = $state<string[]>([]);
|
||||||
let pendingDelete = $state<LibraryTrack[]>([]);
|
let pendingDelete = $state<LibraryTrack[]>([]);
|
||||||
|
|||||||
@@ -21,16 +21,29 @@
|
|||||||
|
|
||||||
const activeHref = $derived(tabs.find((tab) => tab.active)?.href);
|
const activeHref = $derived(tabs.find((tab) => tab.active)?.href);
|
||||||
|
|
||||||
$effect(() => {
|
let nav = $state<HTMLElement>();
|
||||||
|
|
||||||
|
function measure() {
|
||||||
const link = activeHref ? links[activeHref] : undefined;
|
const link = activeHref ? links[activeHref] : undefined;
|
||||||
if (!link) return;
|
if (!link || link.offsetWidth === 0) return;
|
||||||
indicator = { x: link.offsetLeft, width: link.offsetWidth };
|
indicator = { x: link.offsetLeft, width: link.offsetWidth };
|
||||||
measured = true;
|
measured = true;
|
||||||
if (!animated) requestAnimationFrame(() => (animated = true));
|
if (!animated) requestAnimationFrame(() => (animated = true));
|
||||||
|
}
|
||||||
|
|
||||||
|
$effect(measure);
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (!nav) return;
|
||||||
|
const observer = new ResizeObserver(() => measure());
|
||||||
|
observer.observe(nav);
|
||||||
|
for (const link of Object.values(links)) if (link) observer.observe(link);
|
||||||
|
return () => observer.disconnect();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav
|
<nav
|
||||||
|
bind:this={nav}
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
class="relative inline-flex max-w-full rounded-full bg-surface-2 p-1 {klass}"
|
class="relative inline-flex max-w-full rounded-full bg-surface-2 p-1 {klass}"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -14,6 +14,11 @@
|
|||||||
href: '/library/uploads',
|
href: '/library/uploads',
|
||||||
label: 'Subidas',
|
label: 'Subidas',
|
||||||
description: 'Sube varias canciones a la vez y añádelas a tu biblioteca.'
|
description: 'Sube varias canciones a la vez y añádelas a tu biblioteca.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: '/library/invitations',
|
||||||
|
label: 'Invitaciones',
|
||||||
|
description: 'Responde a las invitaciones para figurar como coautor de una canción.'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user