|
| 1 | +<script lang="ts"> |
| 2 | + import Divider from '$lib/components/Divider.svelte'; |
| 3 | + import { email } from '$data/api/settings'; |
| 4 | + import Dialog from '$layout/Dialogs/Dialog.svelte'; |
| 5 | + import Button from '$lib/components/Button.svelte'; |
| 6 | + import Input from '$lib/components/Input.svelte'; |
| 7 | +
|
| 8 | + export let showEmailDialog: boolean; |
| 9 | +
|
| 10 | + let enableInputSeconds = 15; |
| 11 | + let keyword: string = ''; |
| 12 | +
|
| 13 | + let interval: NodeJS.Timeout; |
| 14 | + function closeDialog() { |
| 15 | + showEmailDialog = false; |
| 16 | + clearInterval(interval); |
| 17 | + enableInputSeconds = 15; |
| 18 | + keyword = ''; |
| 19 | + } |
| 20 | +
|
| 21 | + $: if (showEmailDialog && !interval && enableInputSeconds != 0) { |
| 22 | + interval = setInterval(() => { |
| 23 | + if (enableInputSeconds <= 0) { |
| 24 | + clearInterval(interval); |
| 25 | + return; |
| 26 | + } |
| 27 | + enableInputSeconds -= 1; |
| 28 | + }, 1000); |
| 29 | + } |
| 30 | +</script> |
| 31 | + |
| 32 | +<Dialog bind:dialogOpen={showEmailDialog} notDismissible> |
| 33 | + <svelte:fragment slot="title">Abuse notice</svelte:fragment> |
| 34 | + <svelte:fragment slot="description"> |
| 35 | + <p> |
| 36 | + This E-Mail address is <b>not</b> for support, help, bug reports or feature requests. It must |
| 37 | + have a subject and body and have the keyword <span style="user-select: none;">'Reficio'</span> |
| 38 | + in either, otherwise your mail will be |
| 39 | + <b>ignored</b>. |
| 40 | + </p> |
| 41 | + <br /> |
| 42 | + {#if enableInputSeconds == 0} |
| 43 | + <span>Enter the keyword, then click "Send".</span> |
| 44 | + <br /> |
| 45 | + <br /> |
| 46 | + <Input placeholder="Keyword" type="text" bind:value={keyword}></Input> |
| 47 | + {:else} |
| 48 | + <span>Read above and wait <b>{enableInputSeconds}</b> seconds.</span> |
| 49 | + {/if} |
| 50 | + </svelte:fragment> |
| 51 | + <svelte:fragment slot="buttons"> |
| 52 | + {#if keyword.toLowerCase() === 'reficio'} |
| 53 | + <Button type="text"><a href="mailto:{email()}">Send</a></Button> |
| 54 | + {/if} |
| 55 | + <Button type="filled" on:click={closeDialog}>Close</Button> |
| 56 | + </svelte:fragment> |
| 57 | +</Dialog> |
| 58 | + |
| 59 | +<style> |
| 60 | + a { |
| 61 | + text-decoration: none; |
| 62 | + color: var(--text-four); |
| 63 | + font-weight: 600; |
| 64 | + } |
| 65 | +</style> |
0 commit comments