Skip to content

Commit 0652c49

Browse files
authored
Merge pull request #1005 from DokterKaj/patch-1
Switch to remove button for selected instances
2 parents 7bea538 + f167e6e commit 0652c49

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

src/pages/options_src/Services/Instances.svelte

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,34 @@
207207
<span style="color:{pingCache[instance].color}">{pingCache[instance].value}</span>
208208
{/if}
209209
</span>
210-
<button
211-
class="add"
212-
aria-label="Add instance"
213-
on:click={() => {
214-
if (_options[selectedFrontend]) {
215-
if (!_options[selectedFrontend].includes(instance)) {
210+
{#if !_options[selectedFrontend].includes(instance)}
211+
<button
212+
class="add"
213+
aria-label="Add instance"
214+
on:click={() => {
215+
if (_options[selectedFrontend]) {
216216
_options[selectedFrontend].push(instance)
217217
options.set(_options)
218218
}
219-
}
220-
}}
221-
>
222-
<AddIcon />
223-
</button>
219+
}}
220+
>
221+
<AddIcon />
222+
</button>
223+
{:else}
224+
<button
225+
class="add"
226+
aria-label="Remove Instance"
227+
on:click={() => {
228+
const index = _options[selectedFrontend].indexOf(instance)
229+
if (index > -1) {
230+
_options[selectedFrontend].splice(index, 1)
231+
options.set(_options)
232+
}
233+
}}
234+
>
235+
<CloseIcon />
236+
</button>
237+
{/if}
224238
</Row>
225239
<hr />
226240
{/each}

0 commit comments

Comments
 (0)