cryptgeon/packages/frontend/src/lib/ui/NoteResult.svelte

51 lines
870 B
Svelte
Raw Normal View History

<script lang="ts" context="module">
export type NoteResult = {
id: string
2023-05-23 09:39:19 +02:00
password?: string
}
</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'
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
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}
copy
data-testid="share-link"
/>
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>
<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;
}
</style>