From 2c1f321627e404d41201293862565ed64219e0fa Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 28 Oct 2026 21:00:29 +0300 Subject: [PATCH] Align local web integrations with updated lint rules and Cast types --- .../components/memories/MemoriesLane.svelte | 18 ++++++++---------- .../timeline-manager/internal/utils.svelte.ts | 2 +- web/src/lib/stores/sidebar.svelte.ts | 2 +- .../lib/utils/cast/gcast-destination.svelte.ts | 1 - web/src/lib/utils/ocr-utils.ts | 2 -- web/src/lib/utils/wakelock.svelte.ts | 3 --- .../[[assetId=id]]/+page.svelte | 6 +++--- .../onboarding/OnboardingUserPrivacy.svelte | 2 +- web/tsconfig.json | 5 ++--- 9 files changed, 16 insertions(+), 25 deletions(-) diff --git a/web/src/lib/components/memories/MemoriesLane.svelte b/web/src/lib/components/memories/MemoriesLane.svelte index 04abaaebf..490f38836 100644 --- a/web/src/lib/components/memories/MemoriesLane.svelte +++ b/web/src/lib/components/memories/MemoriesLane.svelte @@ -61,16 +61,14 @@ currentMemories.flatMap((memory) => { const asset = memory.assets[frame % memory.assets.length]; return asset - ? [ - { - id: memory.id, - title: $memoryLaneTitle(memory), - href: Route.viewMemory({ id: memory.id, assetId: asset.id }), - alt: $t('memory_lane_title', { values: { title: $getAltText(toTimelineAsset(asset)) } }), - src: getAssetMediaUrl({ id: asset.id }), - type: memory.type, - }, - ] + ? { + id: memory.id, + title: $memoryLaneTitle(memory), + href: Route.viewMemory({ id: memory.id, assetId: asset.id }), + alt: $t('memory_lane_title', { values: { title: $getAltText(toTimelineAsset(asset)) } }), + src: getAssetMediaUrl({ id: asset.id }), + type: memory.type, + } : []; }), ); diff --git a/web/src/lib/managers/timeline-manager/internal/utils.svelte.ts b/web/src/lib/managers/timeline-manager/internal/utils.svelte.ts index 0dcf7346f..618e85454 100644 --- a/web/src/lib/managers/timeline-manager/internal/utils.svelte.ts +++ b/web/src/lib/managers/timeline-manager/internal/utils.svelte.ts @@ -24,5 +24,5 @@ export function updateObject(target: any, source: any): boolean { return updated; } export function isMismatched(option: T | undefined, value: T): boolean { - return option === undefined ? false : option !== value; + return option !== undefined && option !== value; } diff --git a/web/src/lib/stores/sidebar.svelte.ts b/web/src/lib/stores/sidebar.svelte.ts index 1058a44a2..ee279e1e3 100644 --- a/web/src/lib/stores/sidebar.svelte.ts +++ b/web/src/lib/stores/sidebar.svelte.ts @@ -10,7 +10,7 @@ class SidebarStore { /** Toggles the sidebar visibility, if available at the current screen width. */ toggle() { - this.isOpen = mediaQueryManager.isFullSidebar ? true : !this.isOpen; + this.isOpen = mediaQueryManager.isFullSidebar || !this.isOpen; } } diff --git a/web/src/lib/utils/cast/gcast-destination.svelte.ts b/web/src/lib/utils/cast/gcast-destination.svelte.ts index 6afdc6930..893b8b293 100644 --- a/web/src/lib/utils/cast/gcast-destination.svelte.ts +++ b/web/src/lib/utils/cast/gcast-destination.svelte.ts @@ -1,6 +1,5 @@ import { authManager } from '#lib/managers/auth-manager.svelte.ts'; import { CastDestinationType, CastState, type ICastDestination } from '#lib/managers/cast-manager.svelte.ts'; -import 'chromecast-caf-sender'; import { Duration } from 'luxon'; const FRAMEWORK_LINK = 'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1'; diff --git a/web/src/lib/utils/ocr-utils.ts b/web/src/lib/utils/ocr-utils.ts index 1270a3ea4..6a12b00d9 100644 --- a/web/src/lib/utils/ocr-utils.ts +++ b/web/src/lib/utils/ocr-utils.ts @@ -121,7 +121,6 @@ export const calculateFittedFontSize = ( return clamp(fontSize, MIN_FONT_SIZE, MAX_FONT_SIZE); } - // eslint-disable-next-line tscompat/tscompat -- This assigns the Canvas 2D font property, not a font() method. context.font = getReferenceFont(); let maxCharWidth = 0; @@ -146,7 +145,6 @@ export const calculateFittedFontSize = ( return clamp((1.4 * fitWidth) / text.length, MIN_FONT_SIZE, MAX_FONT_SIZE); } - // eslint-disable-next-line tscompat/tscompat -- This assigns the Canvas 2D font property, not a font() method. context.font = getReferenceFont(); const metrics = context.measureText(text); diff --git a/web/src/lib/utils/wakelock.svelte.ts b/web/src/lib/utils/wakelock.svelte.ts index 7e4b8073e..730e9a4b5 100644 --- a/web/src/lib/utils/wakelock.svelte.ts +++ b/web/src/lib/utils/wakelock.svelte.ts @@ -11,7 +11,6 @@ export async function acquireWakeLock() { return; } - // eslint-disable-next-line tscompat/tscompat -- The feature check above guards Wake Lock access. if (sentinel && !sentinel.released) { return; } @@ -20,7 +19,6 @@ export async function acquireWakeLock() { } acquiring = true; try { - // eslint-disable-next-line tscompat/tscompat -- Browsers without Wake Lock return before this call. sentinel = await navigator.wakeLock.request('screen'); } catch (error) { console.warn('Failed to acquire wake lock:', error); @@ -38,7 +36,6 @@ export async function releaseWakeLock() { // Unset first to avoid race condition after await sentinel = undefined; - // eslint-disable-next-line tscompat/tscompat -- A sentinel is only acquired on browsers supporting Wake Lock. await toReleaseSentinel.release(); } diff --git a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte index f8fb67347..39aa29586 100644 --- a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -226,7 +226,7 @@ return { albumId, order: album.order }; }); - const isShared = $derived(viewMode === AlbumPageViewMode.SELECT_ASSETS ? false : album.albumUsers.length > 1); + const isShared = $derived(viewMode !== AlbumPageViewMode.SELECT_ASSETS && album.albumUsers.length > 1); $effect(() => { if (assetViewerManager.isViewing || !isShared) { @@ -248,10 +248,10 @@ const isEditor = $derived(isAlbumEditor(album)); const isSelectionMode = $derived( - viewMode === AlbumPageViewMode.SELECT_ASSETS ? true : viewMode === AlbumPageViewMode.SELECT_THUMBNAIL, + viewMode === AlbumPageViewMode.SELECT_ASSETS || viewMode === AlbumPageViewMode.SELECT_THUMBNAIL, ); const singleSelect = $derived( - viewMode === AlbumPageViewMode.SELECT_ASSETS ? false : viewMode === AlbumPageViewMode.SELECT_THUMBNAIL, + viewMode !== AlbumPageViewMode.SELECT_ASSETS && viewMode === AlbumPageViewMode.SELECT_THUMBNAIL, ); const showArchiveIcon = $derived(viewMode !== AlbumPageViewMode.SELECT_ASSETS); const onSelect = ({ id }: { id: string }) => { diff --git a/web/src/routes/auth/onboarding/OnboardingUserPrivacy.svelte b/web/src/routes/auth/onboarding/OnboardingUserPrivacy.svelte index f8c26380b..784465d71 100644 --- a/web/src/routes/auth/onboarding/OnboardingUserPrivacy.svelte +++ b/web/src/routes/auth/onboarding/OnboardingUserPrivacy.svelte @@ -6,7 +6,7 @@ import { onDestroy } from 'svelte'; import { t } from 'svelte-i18n'; - let gCastEnabled = $state(authManager.authenticated ? authManager.preferences.cast.gCastEnabled : false); + let gCastEnabled = $state(authManager.authenticated && authManager.preferences.cast.gCastEnabled); onDestroy(async () => { try { diff --git a/web/tsconfig.json b/web/tsconfig.json index 269fa136a..ca3d0f00f 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -5,14 +5,13 @@ "paths": { "#i18n/*": ["../i18n/*"], "#test-data/*": ["./src/test-data/*"], - "#tests/*": ["./src/../tests/*"], - "chromecast-caf-sender": ["./node_modules/@types/chromecast-caf-sender/index.d.ts"] + "#tests/*": ["./src/../tests/*"] }, "rootDir": ".", "sourceMap": true, "strict": true, "target": "es2022", - "types": ["$app/types", "vitest/globals"] + "types": ["$app/types", "vitest/globals", "chromecast-caf-sender"] }, "exclude": ["vite.config.ts", "src/service-worker/*"], "extends": "$app/tsconfig",