Merge pull request #1005 from DokterKaj/patch-1

Switch to remove button for selected instances
This commit is contained in:
ManeraKai 2024-09-26 13:07:50 +03:00 committed by GitHub
commit 0652c49623
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 25 additions and 11 deletions

View File

@ -207,20 +207,34 @@
<span style="color:{pingCache[instance].color}">{pingCache[instance].value}</span>
{/if}
</span>
{#if !_options[selectedFrontend].includes(instance)}
<button
class="add"
aria-label="Add instance"
on:click={() => {
if (_options[selectedFrontend]) {
if (!_options[selectedFrontend].includes(instance)) {
_options[selectedFrontend].push(instance)
options.set(_options)
}
}
}}
>
<AddIcon />
</button>
{:else}
<button
class="add"
aria-label="Remove Instance"
on:click={() => {
const index = _options[selectedFrontend].indexOf(instance)
if (index > -1) {
_options[selectedFrontend].splice(index, 1)
options.set(_options)
}
}}
>
<CloseIcon />
</button>
{/if}
</Row>
<hr />
{/each}