Skip to content

Commit

Permalink
Merge pull request #1005 from DokterKaj/patch-1
Browse files Browse the repository at this point in the history
Switch to remove button for selected instances
  • Loading branch information
ManeraKai authored Sep 26, 2024
2 parents 7bea538 + f167e6e commit 0652c49
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions src/pages/options_src/Services/Instances.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,34 @@
<span style="color:{pingCache[instance].color}">{pingCache[instance].value}</span>
{/if}
</span>
<button
class="add"
aria-label="Add instance"
on:click={() => {
if (_options[selectedFrontend]) {
if (!_options[selectedFrontend].includes(instance)) {
{#if !_options[selectedFrontend].includes(instance)}
<button
class="add"
aria-label="Add instance"
on:click={() => {
if (_options[selectedFrontend]) {
_options[selectedFrontend].push(instance)
options.set(_options)
}
}
}}
>
<AddIcon />
</button>
}}
>
<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}
Expand Down

0 comments on commit 0652c49

Please sign in to comment.