blob: 91bb82597b6e867cd0b30fe41e92b4658d495669 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
<script lang="ts">
import { getShareState, ShareStateType, Sharing } from "../../state/share";
import DataSelector from "./selector/DataSelector.svelte";
import DataView from "../DataView.svelte";
import ClipboardIcon from "../icons/ClipboardIcon.svelte";
import copy from "../../utils/copy";
import { toast, ToastType } from "../../state/toast";
const state = getShareState().type;
function token() {
const sharing = getShareState().state as Sharing;
return sharing.getToken();
}
function copyUrl() {
const url = `https://rook.to/${token()}`;
copy(url).then(() => {
toast({
title: "Copied to clipboard!",
message: url,
type: ToastType.INFO,
});
});
}
</script>
{#if $state == ShareStateType.CHOOSING_DATA}
<h1>What do you want to share?</h1>
<DataSelector />
{:else}
<h1>
You are <br />
sharing <b>a text.</b>
</h1>
{#if $state === ShareStateType.CONNECTING}
<p>Connecting to signaling server...</p>
{:else}
<div>
Your share is available under:
<div class="url-view">
<span>rook.to/<span class="highlight">{token()}</span></span>
<button class="copy-button" on:click={copyUrl}>
<ClipboardIcon color="white" />
</button>
</div>
</div>
<DataView />
{/if}
{/if}
<style>
h1 {
margin-top: 0;
}
div {
color: #626262;
}
.highlight {
color: white;
}
.url-view {
color: #626262;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 30px;
}
.copy-button {
background: none;
border: none;
padding: 0;
margin: 0;
cursor: pointer;
padding-right: 9px;
}
</style>
|