aboutsummaryrefslogtreecommitdiff
path: root/src_frontend/Components/Settings/InstanceName.svelte
blob: 6d1892ace33ae749968574211e458bb794e88a6f (plain) (blame)
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
<script>
    import { onMount } from "svelte";
    import { openSocket, authorizedSocket } from "../../stores/socketStore.js";

    let name = "-";

    openSocket.on("name", (_name) => name = _name);

    function saveName() {
        authorizedSocket.emit("name:set", name, (res) => {});
    }

    onMount(async() => {
        openSocket.emit("name:get");
    });
</script>

<style>
    div {
        margin-bottom: 15px;
    }
    h1 { margin-bottom: 0; }
    input {
        background-color: var(--grey-200);
        border-radius: 15px;
        width: 100%;
        padding: 15px;
        box-sizing: border-box;
        border: none;
    }
</style>

<div>
    <h1>Name</h1>
    <input type="text" bind:value={name} on:change={saveName} />
</div>