Merge pull request #168 from maxdorninger/enhance-frontend

Miscellaneous frontend enhancements
This commit is contained in:
Maximilian Dorninger
2025-10-28 09:00:18 +01:00
committed by GitHub
7 changed files with 19 additions and 16 deletions

View File

@@ -2,7 +2,6 @@
import * as Collapsible from '$lib/components/ui/collapsible/index.js';
import * as Sidebar from '$lib/components/ui/sidebar/index.js';
import ChevronRight from '@lucide/svelte/icons/chevron-right';
import { resolve } from '$app/paths';
let {
items
@@ -34,10 +33,12 @@
{mainItem.title}
{/snippet}
{#snippet child({ props })}
<a href={resolve(mainItem.url, {})} {...props}>
<!-- eslint-disable svelte/no-navigation-without-resolve -->
<a href={mainItem.url} {...props}>
<mainItem.icon />
<span>{mainItem.title}</span>
</a>
<!-- eslint-enable svelte/no-navigation-without-resolve -->
{/snippet}
</Sidebar.MenuButton>
{#if mainItem.items?.length}

View File

@@ -3,7 +3,6 @@
import type { ComponentProps } from 'svelte';
import Sun from '@lucide/svelte/icons/sun';
import Moon from '@lucide/svelte/icons/moon';
import { resolve } from '$app/paths';
import { toggleMode } from 'mode-watcher';
let {
@@ -41,10 +40,12 @@
<Sidebar.MenuItem>
<Sidebar.MenuButton size="sm">
{#snippet child({ props })}
<a href={resolve(item.url, {})} {...props}>
<!-- eslint-disable svelte/no-navigation-without-resolve -->
<a href={item.url} {...props}>
<item.icon />
<span>{item.title}</span>
</a>
<!-- eslint-enable svelte/no-navigation-without-resolve -->
{/snippet}
</Sidebar.MenuButton>
</Sidebar.MenuItem>

View File

@@ -25,7 +25,7 @@
</Table.Row>
</Table.Header>
<Table.Body>
{#each torrents as torrent (torrent.id)}
{#each torrents as torrent (torrent.torrent_id)}
<Table.Row>
<Table.Cell class="font-medium">
{torrent.torrent_title}

View File

@@ -99,3 +99,9 @@ export function formatSecondsToOptimalUnit(seconds: number): string {
return '0s';
}
export function handleQueryNotificationToast(count: number = 0, query: string = '') {
if (count > 0 && query.length > 0)
toast.success(`Found ${count} ${count > 1 ? 'result' : 'results'} for search term "${query}".`);
else if (count == 0) toast.info(`No results found for "${query}".`);
}

View File

@@ -9,11 +9,11 @@
import * as Collapsible from '$lib/components/ui/collapsible/index.js';
import * as RadioGroup from '$lib/components/ui/radio-group/index.js';
import AddMediaCard from '$lib/components/add-media-card.svelte';
import { toast } from 'svelte-sonner';
import { onMount } from 'svelte';
import { base } from '$app/paths';
import client from '$lib/api';
import type { components } from '$lib/api/api';
import { handleQueryNotificationToast } from '$lib/utils.ts';
let searchTerm: string = $state('');
let metadataProvider: 'tmdb' | 'tvdb' = $state('tmdb');
@@ -36,12 +36,11 @@
})
: await client.GET('/api/v1/movies/recommended');
if (data && data.length > 0) {
toast.success(`Found ${data.length} result(s) for "${query}".`);
results = data as components['schemas']['MetaDataProviderSearchResult'][];
} else {
toast.info(`No results found for "${query}".`);
results = null;
}
handleQueryNotificationToast(data?.length ?? 0, query);
}
</script>

View File

@@ -9,7 +9,6 @@
import * as Collapsible from '$lib/components/ui/collapsible/index.js';
import * as RadioGroup from '$lib/components/ui/radio-group/index.js';
import AddMediaCard from '$lib/components/add-media-card.svelte';
import { toast } from 'svelte-sonner';
import { onMount } from 'svelte';
let searchTerm: string = $state('');
@@ -18,6 +17,7 @@
import { resolve } from '$app/paths';
import client from '$lib/api';
import type { components } from '$lib/api/api';
import { handleQueryNotificationToast } from '$lib/utils.ts';
onMount(() => {
search('');
@@ -36,10 +36,10 @@
})
: await client.GET('/api/v1/tv/recommended');
if (results.data && results.data.length > 0) {
toast.success(`Found ${results.data.length} result(s) for "${query}".`);
handleQueryNotificationToast(results.data.length, query);
data = results.data as components['schemas']['MetaDataProviderSearchResult'][];
} else {
toast.info(`No results found for "${query}".`);
handleQueryNotificationToast(0, query);
data = null;
}
}

View File

@@ -2,7 +2,6 @@
import { UserCheck } from 'lucide-svelte';
import { Button } from '$lib/components/ui/button/index.js';
import { handleLogout } from '$lib/utils.ts';
import { resolve } from '$app/paths';
</script>
<svelte:head>
@@ -24,11 +23,8 @@
Your account has been successfully created, but activation by an administrator is required.
</p>
<div class="mt-8">
<Button href={resolve('/dashboard', {})}>Go to Dashboard</Button>
<Button onclick={() => handleLogout()}>Logout</Button>
</div>
<p class="text-muted-foreground mt-10 text-sm">
The above button will only work once your account is verified.
</p>
<p class="end text-muted-foreground mt-10 text-sm">
If you have any questions, please contact an administrator.
</p>