mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-21 00:05:13 +02:00
refactor: TmdbIntegration
This commit is contained in:
@@ -2,15 +2,10 @@
|
||||
import { tmdbApi } from '../../apis/tmdb/tmdb-api';
|
||||
import { user } from '../../stores/user.store';
|
||||
import SelectField from '../SelectField.svelte';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import Button from '../Button.svelte';
|
||||
import { ArrowRight, Trash } from 'radix-icons-svelte';
|
||||
import { Trash } from 'radix-icons-svelte';
|
||||
import { derived } from 'svelte/store';
|
||||
import classNames from 'classnames';
|
||||
|
||||
export let handleConnectTmdb: () => void;
|
||||
|
||||
const dispatch = createEventDispatcher<{ 'click-user': null }>();
|
||||
const userId = derived(user, (user) => user?.settings.tmdb.userId);
|
||||
|
||||
$: connectedTmdbAccount = !!$userId && tmdbApi.getAccountDetails();
|
||||
@@ -32,17 +27,10 @@
|
||||
|
||||
{#await connectedTmdbAccount then tmdbAccount}
|
||||
{#if tmdbAccount}
|
||||
<SelectField value={tmdbAccount.username || ''} action={handleDisconnectTmdb} class="mb-4">
|
||||
<SelectField value={tmdbAccount.username || ''} action={handleDisconnectTmdb}>
|
||||
Connected to
|
||||
<Trash slot="icon" let:size let:iconClass {size} class={classNames(iconClass, '')} />
|
||||
</SelectField>
|
||||
{:else}
|
||||
<slot>
|
||||
<div class="flex space-x-4">
|
||||
<Button type="primary-dark" iconAfter={ArrowRight} on:clickOrSelect={handleConnectTmdb}>
|
||||
Connect
|
||||
</Button>
|
||||
</div>
|
||||
</slot>
|
||||
{/if}
|
||||
<slot connected={!!tmdbAccount} />
|
||||
{/await}
|
||||
|
||||
Reference in New Issue
Block a user