mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-22 00:35:12 +02:00
refactor: Rewrote selectable component tree composition algorithm and fixed focus issues
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
{/each}
|
||||
{:then downloads}
|
||||
{#each downloads as download, index}
|
||||
<Button on:click={() => cancelDownload(download.id || -1)} let:hasFocus>
|
||||
<Button on:clickOrSelect={() => cancelDownload(download.id || -1)} let:hasFocus>
|
||||
<div class="flex w-full">
|
||||
<h1 class="flex-1 line-clamp-1">
|
||||
{download.title}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
<Container>
|
||||
<div class="-my-1">
|
||||
<Button focusOnMount on:click={() => file.id && handleDeleteFile(file.id)}>
|
||||
<Button focusOnMount on:clickOrSelect={() => file.id && handleDeleteFile(file.id)}>
|
||||
Delete File
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<script lang="ts">
|
||||
import Container from '../../../Container.svelte';
|
||||
|
||||
export let focusOnMount = false;
|
||||
</script>
|
||||
|
||||
<Container class="flex flex-col my-16" canFocusEmpty={false}>
|
||||
<Container class="flex flex-col my-16" canFocusEmpty={false} {focusOnMount}>
|
||||
<h1 class="tracking-wide text-2xl font-semibold mb-4">
|
||||
<slot name="header">Header is missing</slot>
|
||||
</h1>
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
import { derived, type Readable } from 'svelte/store';
|
||||
import ReleaseActionsModal from './Releases/ReleaseActionsModal.svelte';
|
||||
import type { SonarrRelease } from '../../apis/sonarr/sonarr-api';
|
||||
import Button from '../Button.svelte';
|
||||
import type { FileResource } from '../../apis/combined-types';
|
||||
|
||||
export let modalId: symbol;
|
||||
export let hidden: boolean;
|
||||
@@ -63,7 +65,7 @@
|
||||
);
|
||||
}
|
||||
|
||||
function handleSelectFile(file: MovieFileResource) {
|
||||
function handleSelectFile(file: FileResource) {
|
||||
modalStack.create(
|
||||
FileActionsModal,
|
||||
{
|
||||
@@ -76,7 +78,7 @@
|
||||
</script>
|
||||
|
||||
<FullScreenModal {modalId} {hidden}>
|
||||
<ManageMediaMenuLayout>
|
||||
<ManageMediaMenuLayout focusOnMount>
|
||||
<h1 slot="header">Download</h1>
|
||||
<ReleaseList
|
||||
getReleases={() => radarrApi.getReleases(id)}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="-my-1">
|
||||
<Button
|
||||
focusOnMount
|
||||
on:click={() => handleGrabRelease(release.guid || '', release.indexerId || -1)}
|
||||
on:clickOrSelect={() => handleGrabRelease(release.guid || '', release.indexerId || -1)}
|
||||
inactive={!!($data || $isFetching || status)}
|
||||
>
|
||||
{#if $data || status === 'downloading'}
|
||||
|
||||
@@ -108,11 +108,13 @@
|
||||
{/each}
|
||||
{#if !showAll && $releases?.length}
|
||||
<div class="my-1 w-full">
|
||||
<Button on:click={() => (showAll = true)}>Show all {$releases?.length} releases</Button>
|
||||
<Button on:clickOrSelect={() => (showAll = true)}
|
||||
>Show all {$releases?.length} releases</Button
|
||||
>
|
||||
</div>
|
||||
{:else if showAll}
|
||||
<div class="my-1 w-full">
|
||||
<Button on:click={() => (showAll = false)}>Show less</Button>
|
||||
<Button on:clickOrSelect={() => (showAll = false)}>Show less</Button>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
</script>
|
||||
|
||||
<FullScreenModal {modalId} {hidden}>
|
||||
<ManageMediaMenuLayout>
|
||||
<ManageMediaMenuLayout focusOnMount>
|
||||
<h1 slot="header">Download</h1>
|
||||
<SeasonList {id} selectSeason={handleSelectSeason} />
|
||||
</ManageMediaMenuLayout>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
class="h-screen flex flex-col py-12 px-20 relative"
|
||||
on:enter={scrollIntoView({ top: 0 })}
|
||||
handleNavigateOut={{
|
||||
down: () => episodesSelectable?.focusChildren(1)
|
||||
down: () => episodesSelectable?.focusChild(1)
|
||||
}}
|
||||
>
|
||||
<HeroCarousel
|
||||
|
||||
Reference in New Issue
Block a user