2023-01-02 15:22:33 -05:00
|
|
|
<script lang="ts">
|
2023-07-01 00:50:47 -04:00
|
|
|
import { createEventDispatcher, onMount } from 'svelte';
|
|
|
|
|
import KeyVariant from 'svelte-material-icons/KeyVariant.svelte';
|
2023-08-25 19:44:52 +02:00
|
|
|
import { copyToClipboard } from '@api';
|
2023-07-01 00:50:47 -04:00
|
|
|
import Button from '../elements/buttons/button.svelte';
|
2023-08-25 19:44:52 +02:00
|
|
|
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
2023-01-02 15:22:33 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
export let secret = '';
|
2023-01-02 15:22:33 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
|
const handleDone = () => dispatch('done');
|
|
|
|
|
let canCopyImagesToClipboard = true;
|
2023-06-27 08:49:20 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
onMount(async () => {
|
|
|
|
|
const module = await import('copy-image-clipboard');
|
|
|
|
|
canCopyImagesToClipboard = module.canCopyImagesToClipboard();
|
|
|
|
|
});
|
2023-01-02 15:22:33 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<FullScreenModal>
|
2023-07-01 00:50:47 -04:00
|
|
|
<div
|
2023-07-18 13:19:39 -05:00
|
|
|
class="w-[500px] max-w-[95vw] rounded-3xl border bg-immich-bg p-4 py-8 shadow-sm dark:border-immich-dark-gray dark:bg-immich-dark-gray dark:text-immich-dark-fg"
|
2023-07-01 00:50:47 -04:00
|
|
|
>
|
|
|
|
|
<div
|
2023-07-18 13:19:39 -05:00
|
|
|
class="flex flex-col place-content-center place-items-center gap-4 px-4 text-immich-primary dark:text-immich-dark-primary"
|
2023-07-01 00:50:47 -04:00
|
|
|
>
|
|
|
|
|
<KeyVariant size="4em" />
|
2023-07-18 13:19:39 -05:00
|
|
|
<h1 class="text-2xl font-medium text-immich-primary dark:text-immich-dark-primary">API Key</h1>
|
2023-01-02 15:22:33 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
<p class="text-sm dark:text-immich-dark-fg">
|
|
|
|
|
This value will only be shown once. Please be sure to copy it before closing the window.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2023-01-02 15:22:33 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
<div class="m-4 flex flex-col gap-2">
|
2023-08-16 20:27:57 +02:00
|
|
|
<!-- <label class="immich-form-label" for="secret">API Key</label> -->
|
2023-07-01 00:50:47 -04:00
|
|
|
<textarea class="immich-form-input" id="secret" name="secret" readonly={true} value={secret} />
|
|
|
|
|
</div>
|
2023-01-02 15:22:33 -05:00
|
|
|
|
2023-07-18 13:19:39 -05:00
|
|
|
<div class="mt-8 flex w-full gap-4 px-4">
|
2023-07-01 00:50:47 -04:00
|
|
|
{#if canCopyImagesToClipboard}
|
2023-08-25 19:44:52 +02:00
|
|
|
<Button on:click={() => copyToClipboard(secret)} fullwidth>Copy to Clipboard</Button>
|
2023-07-01 00:50:47 -04:00
|
|
|
{/if}
|
|
|
|
|
<Button on:click={() => handleDone()} fullwidth>Done</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-01-02 15:22:33 -05:00
|
|
|
</FullScreenModal>
|