diff options
author | ManeraKai <manerakai@protonmail.com> | 2024-09-26 13:07:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-26 13:07:50 +0300 |
commit | 0652c496232d969a8722a553c8da7268e511ca20 (patch) | |
tree | a56dc039e72d48b7a6de0e8f5f443b45a357120b /src/pages | |
parent | 3.0.1 => 3.0.2 (diff) | |
parent | Switch to remove button for selected instances (diff) | |
download | libredirect-0652c496232d969a8722a553c8da7268e511ca20.zip |
Merge pull request #1005 from DokterKaj/patch-1
Switch to remove button for selected instances
Diffstat (limited to 'src/pages')
-rw-r--r-- | src/pages/options_src/Services/Instances.svelte | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/pages/options_src/Services/Instances.svelte b/src/pages/options_src/Services/Instances.svelte index 7a04b04e..b37c3904 100644 --- a/src/pages/options_src/Services/Instances.svelte +++ b/src/pages/options_src/Services/Instances.svelte @@ -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} |