|
1 | 1 | <script lang="ts">
|
2 |
| - import { getContext } from 'svelte'; |
3 | 2 | import QRCode from 'qrcode';
|
| 3 | + import { getContext } from 'svelte'; |
4 | 4 | import { Button } from 'sveltestrap';
|
5 | 5 |
|
6 |
| -
|
| 6 | + import type { Writable } from 'svelte/store'; |
7 | 7 | import type { SHLAdminParams, SHLClient } from './managementClient';
|
| 8 | +
|
8 | 9 | export let shl: SHLAdminParams;
|
| 10 | + let shlStore: Writable<SHLAdminParams[]> = getContext('shlStore'); |
| 11 | + let selectedShl: Writable<number | undefined> = getContext('selectedShl'); |
9 | 12 | let shlClient: SHLClient = getContext('shlClient');
|
| 13 | +
|
10 | 14 | let copyNotice = '';
|
11 | 15 |
|
12 | 16 | let href: Promise<string>;
|
|
30 | 34 | copyNotice = copyNoticePrev;
|
31 | 35 | }, 1000);
|
32 | 36 | }
|
| 37 | +
|
| 38 | + async function deleteShl() { |
| 39 | + const newStore = [...$shlStore]; |
| 40 | + newStore.splice($selectedShl!, 1); |
| 41 | + $shlStore = newStore; |
| 42 | + if ($shlStore.length == 0) { |
| 43 | + $selectedShl = undefined; |
| 44 | + } else { |
| 45 | + $selectedShl = $selectedShl! - 1; |
| 46 | + } |
| 47 | + } |
33 | 48 | </script>
|
34 | 49 |
|
35 | 50 | <div>
|
|
55 | 70 | {#if copyNotice}
|
56 | 71 | {copyNotice}
|
57 | 72 | {:else}
|
58 |
| - Copy SMART Health Link |
| 73 | + Copy SMART Health Link to Clipboard |
59 | 74 | {/if}
|
60 | 75 | </Button>
|
61 | 76 | </li>
|
|
65 | 80 | </li>
|
66 | 81 | {/await}
|
67 | 82 | {#await qrCode then dataUrl}
|
68 |
| - <li class="logo"> <span class="show">Show SMART Health Link</span> |
| 83 | + <li class="logo"> |
| 84 | + <span class="show">Present SMART Health Link as QR</span> |
69 | 85 | <img class="qr" alt="QR Code for SHL" src={dataUrl} />
|
70 |
| - <img class="logo" alt="SMART Logo" src={"./smart-logo.svg"} /> |
| 86 | + <img class="logo" alt="SMART Logo" src={'./smart-logo.svg'} /> |
71 | 87 | </li>
|
72 | 88 | {/await}
|
| 89 | + <li> |
| 90 | + <Button size="sm" on:click={deleteShl} color="danger">Delete SMART Health Link</Button> |
| 91 | + </li> |
73 | 92 | </ul>
|
74 | 93 | </div>
|
75 | 94 |
|
|
82 | 101 | top: 1.5em;
|
83 | 102 | }
|
84 | 103 | li.logo {
|
85 |
| - position:relative; |
| 104 | + position: relative; |
86 | 105 | width: 250px;
|
87 | 106 | height: 250px;
|
88 | 107 | margin-bottom: 2em;
|
|
92 | 111 | background: white;
|
93 | 112 | width: 100px;
|
94 | 113 | left: calc(50% - 1em - 50px);
|
95 |
| - top: calc(50% + .7em); |
| 114 | + top: calc(50% + 0.7em); |
96 | 115 | border: 2px solid white;
|
97 | 116 | box-sizing: border-box;
|
98 | 117 | }
|
|
0 commit comments