2022-07-19 10:27:23 +02:00
|
|
|
<script lang="ts" context="module">
|
|
|
|
export type NoteResult = {
|
|
|
|
id: string
|
2023-05-23 09:39:19 +02:00
|
|
|
password?: string
|
2022-07-19 10:27:23 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { t } from 'svelte-intl-precompile'
|
|
|
|
|
|
|
|
import Button from '$lib/ui/Button.svelte'
|
|
|
|
import TextInput from '$lib/ui/TextInput.svelte'
|
2023-01-04 19:40:37 +01:00
|
|
|
import Canvas from './Canvas.svelte'
|
2022-07-19 10:27:23 +02:00
|
|
|
|
|
|
|
export let result: NoteResult
|
|
|
|
|
2023-05-23 09:39:19 +02:00
|
|
|
let url = `${window.location.origin}/note/${result.id}`
|
|
|
|
if (result.password) url += `#${result.password}`
|
2023-01-04 19:40:37 +01:00
|
|
|
|
2022-07-19 10:27:23 +02:00
|
|
|
function reset() {
|
|
|
|
window.location.reload()
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<TextInput
|
|
|
|
type="text"
|
|
|
|
readonly
|
|
|
|
label={$t('common.share_link')}
|
2023-01-04 19:40:37 +01:00
|
|
|
value={url}
|
2022-07-19 10:27:23 +02:00
|
|
|
copy
|
2022-07-19 14:12:51 +02:00
|
|
|
data-testid="share-link"
|
2022-07-19 10:27:23 +02:00
|
|
|
/>
|
2023-01-04 19:40:37 +01:00
|
|
|
|
|
|
|
<div>
|
2023-01-04 19:45:25 +01:00
|
|
|
<Canvas value={url} />
|
2023-01-04 19:40:37 +01:00
|
|
|
</div>
|
|
|
|
|
2022-07-19 10:27:23 +02:00
|
|
|
<p>
|
|
|
|
{@html $t('home.new_note_notice')}
|
|
|
|
</p>
|
|
|
|
<br />
|
|
|
|
<Button on:click={reset}>{$t('home.new_note')}</Button>
|
|
|
|
|
|
|
|
<style>
|
2023-01-04 19:40:37 +01:00
|
|
|
div {
|
|
|
|
width: min(12rem, 100%);
|
|
|
|
margin-top: 1rem;
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
}
|
2022-07-19 10:27:23 +02:00
|
|
|
</style>
|