fix: resolve vite-plugin-svelte warnings

- image-viewer: replace backdrop div with button for a11y
- file-drop-zone: wrap prop check in \$effect to avoid state_referenced_locally
- about: use \$derived for stats array
- magazine: use \$derived for featuredArticle
- play: add role/keyboard support to seek bar slider; fix \$state on SvelteMap in device-mapping-dialog
- admin/videos/[id]: add <track kind="captions"> to video element

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 11:41:58 +01:00
parent edee98b552
commit 422f97417e
7 changed files with 27 additions and 12 deletions

View File

@@ -145,7 +145,7 @@
{#if isViewerOpen} {#if isViewerOpen}
<div class="fixed inset-0 z-50 flex items-center justify-center animate-fade-in"> <div class="fixed inset-0 z-50 flex items-center justify-center animate-fade-in">
<!-- Backdrop --> <!-- Backdrop -->
<div class="absolute inset-0 bg-black/95 backdrop-blur-xl" onclick={closeViewer}></div> <button type="button" class="absolute inset-0 bg-black/95 backdrop-blur-xl cursor-default" onclick={closeViewer} aria-label="Close viewer"></button>
<!-- Viewer Content --> <!-- Viewer Content -->
<div class="relative w-[90vw] h-[90vh] flex flex-col animate-slide-up"> <div class="relative w-[90vw] h-[90vh] flex flex-col animate-slide-up">

View File

@@ -23,11 +23,13 @@
...rest ...rest
}: FileDropZoneProps = $props(); }: FileDropZoneProps = $props();
$effect(() => {
if (maxFiles !== undefined && fileCount === undefined) { if (maxFiles !== undefined && fileCount === undefined) {
console.warn( console.warn(
"Make sure to provide FileDropZone with `fileCount` when using the `maxFiles` prompt", "Make sure to provide FileDropZone with `fileCount` when using the `maxFiles` prompt",
); );
} }
});
let uploading = $state(false); let uploading = $state(false);

View File

@@ -7,7 +7,7 @@
const { data } = $props(); const { data } = $props();
const stats = [ const stats = $derived([
{ {
icon: "icon-[ri--user-heart-line]", icon: "icon-[ri--user-heart-line]",
value: data.stats.viewers_count, value: data.stats.viewers_count,
@@ -28,7 +28,7 @@
value: $_("about.stats.yearsFormatted", { values: { years: 5 } }), value: $_("about.stats.yearsFormatted", { values: { years: 5 } }),
label: $_("about.stats.experience"), label: $_("about.stats.experience"),
}, },
]; ]);
const team = [ const team = [
{ {

View File

@@ -154,7 +154,9 @@
poster={imageId ? (getAssetUrl(imageId, "preview") ?? undefined) : undefined} poster={imageId ? (getAssetUrl(imageId, "preview") ?? undefined) : undefined}
controls controls
class="w-full rounded-lg bg-black max-h-72 mb-2" class="w-full rounded-lg bg-black max-h-72 mb-2"
></video> >
<track kind="captions" />
</video>
{/if} {/if}
<FileDropZone accept="video/*" maxFileSize={2000 * MEGABYTE} onUpload={handleVideoUpload} /> <FileDropZone accept="video/*" maxFileSize={2000 * MEGABYTE} onUpload={handleVideoUpload} />
</div> </div>

View File

@@ -22,8 +22,9 @@
$effect(() => { searchValue = data.search ?? ""; }); $effect(() => { searchValue = data.search ?? ""; });
let searchTimeout: ReturnType<typeof setTimeout>; let searchTimeout: ReturnType<typeof setTimeout>;
const featuredArticle = const featuredArticle = $derived(
data.page === 1 && !data.search && !data.category ? data.items.find((a) => a.featured) : null; data.page === 1 && !data.search && !data.category ? data.items.find((a) => a.featured) : null,
);
function debounceSearch(value: string) { function debounceSearch(value: string) {
clearTimeout(searchTimeout); clearTimeout(searchTimeout);

View File

@@ -480,12 +480,22 @@
.padStart(2, "0")} .padStart(2, "0")}
</span> </span>
<div <div
role="slider"
tabindex="0"
aria-label="Seek"
aria-valuemin={0}
aria-valuemax={data.recording.duration}
aria-valuenow={playbackProgress}
class="flex-1 h-2 bg-muted rounded-full overflow-hidden cursor-pointer relative" class="flex-1 h-2 bg-muted rounded-full overflow-hidden cursor-pointer relative"
onclick={(e) => { onclick={(e) => {
const rect = e.currentTarget.getBoundingClientRect(); const rect = e.currentTarget.getBoundingClientRect();
const percentage = ((e.clientX - rect.left) / rect.width) * 100; const percentage = ((e.clientX - rect.left) / rect.width) * 100;
seek(percentage); seek(percentage);
}} }}
onkeydown={(e) => {
if (e.key === "ArrowRight") seek(((playbackProgress + 1) / data.recording.duration) * 100);
else if (e.key === "ArrowLeft") seek(((playbackProgress - 1) / data.recording.duration) * 100);
}}
> >
<div <div
class="absolute inset-0 bg-gradient-to-r from-primary to-accent transition-all duration-150" class="absolute inset-0 bg-gradient-to-r from-primary to-accent transition-all duration-150"

View File

@@ -16,7 +16,7 @@
let { open, recordedDevices, connectedDevices, onConfirm, onCancel }: Props = $props(); let { open, recordedDevices, connectedDevices, onConfirm, onCancel }: Props = $props();
// Device mappings: recorded device name -> connected device // Device mappings: recorded device name -> connected device
let mappings = new SvelteMap<string, BluetoothDevice>(); let mappings = $state(new SvelteMap<string, BluetoothDevice>());
// Check if a connected device is compatible with a recorded device // Check if a connected device is compatible with a recorded device
function isCompatible(recordedDevice: DeviceInfo, connectedDevice: BluetoothDevice): boolean { function isCompatible(recordedDevice: DeviceInfo, connectedDevice: BluetoothDevice): boolean {