format files

This commit is contained in:
maxDorninger
2025-06-30 21:32:34 +02:00
parent 40a1bbf904
commit 3799ae8712
23 changed files with 144 additions and 83 deletions

View File

@@ -6,7 +6,7 @@
import { base } from '$app/paths';
import { onMount } from 'svelte';
import { env } from '$env/dynamic/public';
import { MetaDataProviderSearchResult } from '$lib/types';
import type { MetaDataProviderSearchResult } from '$lib/types';
const apiUrl = env.PUBLIC_API_URL;

View File

@@ -9,9 +9,10 @@
import { toast } from 'svelte-sonner';
import { env } from '$env/dynamic/public';
import { Skeleton } from '$lib/components/ui/skeleton';
import type { PublicMovie } from '$lib/types';
const apiUrl = env.PUBLIC_API_URL;
let movies;
let movies: PublicMovie[] = [];
let loading = false;
onMount(async () => {
loading = true;

View File

@@ -1,8 +1,8 @@
import type { LayoutLoad } from './$types';
import type { PageLoad } from './$types';
import { env } from '$env/dynamic/public';
import { error } from '@sveltejs/kit';
export const load: LayoutLoad = async ({ params, fetch }) => {
export const load: PageLoad = async ({ params, fetch }) => {
const res = await fetch(`${env.PUBLIC_API_URL}/movies/${params.movieId}`, {
credentials: 'include'
});

View File

@@ -43,5 +43,5 @@
<h1 class="scroll-m-20 text-center text-4xl font-extrabold tracking-tight lg:text-5xl">
Movie Requests
</h1>
<RequestsTable bind:requests isShow={false} />
<RequestsTable {requests} isShow={false} />
</div>

View File

@@ -8,9 +8,10 @@
import * as Sidebar from '$lib/components/ui/sidebar/index.js';
import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
import { base } from '$app/paths';
import type { User } from '$lib/types';
let currentUser = getContext('user');
let users = page.data.users;
let currentUser: () => User = getContext('user');
let users = $state(page.data.users);
</script>
<svelte:head>
@@ -56,7 +57,7 @@
<Card.Description>Edit or delete users</Card.Description>
</Card.Header>
<Card.Content>
<UserTable bind:users />
<UserTable {users} />
</Card.Content>
</Card.Root>
{/if}

View File

@@ -6,7 +6,7 @@
const showData = $derived(data.showData);
setContext('show', () => showData);
const fetchError = $derived(data.error);
const fetchError = $derived((data as { error?: string }).error || null);
</script>
{#if fetchError}

View File

@@ -7,7 +7,7 @@
import { ImageOff } from 'lucide-svelte';
import * as Table from '$lib/components/ui/table/index.js';
import { getContext } from 'svelte';
import type { RichShowTorrent, Show, User } from '$lib/types.js';
import type { PublicShow, RichShowTorrent, Show, User } from '$lib/types.js';
import { getFullyQualifiedMediaName } from '$lib/utils';
import DownloadSeasonDialog from '$lib/components/download-season-dialog.svelte';
import CheckmarkX from '$lib/components/checkmark-x.svelte';
@@ -48,10 +48,10 @@
</script>
<svelte:head>
<title>{getFullyQualifiedMediaName(show)} - MediaManager</title>
<title>{getFullyQualifiedMediaName(show())} - MediaManager</title>
<meta
content="View details and manage downloads for {getFullyQualifiedMediaName(
show
show()
)} in MediaManager"
name="description"
/>
@@ -122,7 +122,7 @@
{/if}
<DownloadSeasonDialog show={show()} />
{/if}
<RequestSeasonDialog show={show()} />
<RequestSeasonDialog show={show() as PublicShow} />
</div>
</div>
<div class="flex-1 rounded-xl bg-muted/50 p-4">
@@ -146,7 +146,7 @@
>
<Table.Cell class="min-w-[10px] font-medium">{season.number}</Table.Cell>
<Table.Cell class="min-w-[10px] font-medium">
<CheckmarkX state={season.downloaded} />
<CheckmarkX state={false} />
</Table.Cell>
<Table.Cell class="min-w-[50px]">{season.name}</Table.Cell>
<Table.Cell class="max-w-[300px] truncate">{season.overview}</Table.Cell>
@@ -154,7 +154,7 @@
{/each}
{:else}
<Table.Row>
<Table.Cell colspan="3" class="text-center">No season data available.</Table.Cell>
<Table.Cell colspan={3} class="text-center">No season data available.</Table.Cell>
</Table.Row>
{/if}
</Table.Body>

View File

@@ -12,7 +12,7 @@
let seasonFiles: PublicSeasonFile[] = $state(page.data.files);
let season: Season = $state(page.data.season);
let show: ()=> Show = getContext('show');
let show: () => Show = getContext('show');
console.log('loaded files', seasonFiles);
</script>

View File

@@ -39,7 +39,7 @@ export const load: PageLoad = async ({ fetch, params }) => {
} catch (error) {
console.error('An error occurred while fetching TV show files:', error);
return {
error: `An unexpected error occurred: ${error.message || 'Unknown error'}`,
error: `An unexpected error occurred: ${error instanceof Error ? error.message : 'Unknown error'}`,
files: [],
season: null
};

View File

@@ -44,5 +44,5 @@
<h1 class="scroll-m-20 text-center text-4xl font-extrabold tracking-tight lg:text-5xl">
Season Requests
</h1>
<RequestsTable bind:requests isShow={true} />
<RequestsTable {requests} isShow={true} />
</div>

View File

@@ -108,7 +108,7 @@
bind:value={newPassword}
disabled={isLoading}
required
minlength="1"
minlength={1}
/>
</div>
<div class="grid gap-2">
@@ -120,7 +120,7 @@
bind:value={confirmPassword}
disabled={isLoading}
required
minlength="1"
minlength={1}
/>
</div>
<Button