about summary refs log tree commit diff
path: root/assets/src/components/share/ShareStatus.svelte
blob: da8531ef367f9e45d2d323d12985cec9fad40e6f (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
<script lang="ts">
    import { getShareState, ShareStateType, Sharing } from "../../state/share";
    import DataSelector from "./selector/DataSelector.svelte";
    import DataView from "../DataView.svelte";

    const state = getShareState().type;

    function token() {
        const sharing = getShareState().state as Sharing;
        return sharing.getToken();
    }
</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}
        <p>
            Your share is available under: <br />
            rook.to/<span>{token()}</span>
        </p>
        <DataView />
    {/if}
{/if}

<style>
    h1 {
        margin-top: 0;
    }

    span {
        color: white;
    }
</style>