chore(control): added upload finished animation

This commit is contained in:
E44
2026-01-05 19:09:53 +01:00
parent a8a59bd543
commit 6f0b05ca67
@@ -55,6 +55,20 @@
loading_data = liveQuery(() => get_loading_data(get_file_primary_key(file), d)); loading_data = liveQuery(() => get_loading_data(get_file_primary_key(file), d));
}); });
let loading_finished = $state(false);
$effect(() => {
if (!loading_data) return;
let prev: boolean | undefined;
const sub = loading_data.subscribe((v) => {
if (prev === true && v.is_loading === false) {
loading_finished = true;
setTimeout(() => (loading_finished = false), 200);
}
prev = v.is_loading;
});
return () => sub.unsubscribe();
});
let thumbnail_url = liveQuery(() => get_thumbnail_url(get_file_primary_key(file))); let thumbnail_url = liveQuery(() => get_thumbnail_url(get_file_primary_key(file)));
let date_mapping: Observable<Record<string, Date>> = liveQuery(() => let date_mapping: Observable<Record<string, Date>> = liveQuery(() =>
get_date_mapping(get_file_primary_key(file)) get_date_mapping(get_file_primary_key(file))
@@ -151,7 +165,9 @@
function get_main_classes(): string { function get_main_classes(): string {
let out = ''; let out = '';
if ($loading_data?.is_loading) { if (loading_finished) {
out += 'bg-stone-500 text-white/30';
} else if ($loading_data?.is_loading) {
out += 'bg-stone-700 text-white/30'; out += 'bg-stone-700 text-white/30';
} else { } else {
out += get_selectable_color_classes( out += get_selectable_color_classes(
@@ -216,7 +232,7 @@
} }
</script> </script>
<div data-testid="inode" class="flex flex-row h-{$current_height.file} w-full"> <div data-testid="inode" class="flex flex-row h-{$current_height.file} w-full {loading_finished ? 'scale-105' : ''} transition-[scale] duration-300">
{#if !not_interactable} {#if !not_interactable}
<div class="h-{$current_height.file} aspect-square max-w-15 flex"> <div class="h-{$current_height.file} aspect-square max-w-15 flex">
<Button <Button