This commit is contained in:
Timothy Jaeryang Baek 2025-10-07 12:08:21 -05:00
parent e000494e48
commit 7d205b1711

View file

@ -330,7 +330,7 @@
{#each Object.keys(tools) as toolId} {#each Object.keys(tools) as toolId}
<button <button
class="relative flex w-full justify-between gap-2 items-center px-3 py-1.5 text-sm cursor-pointer rounded-xl hover:bg-gray-50 dark:hover:bg-gray-800/50" class="relative flex w-full justify-between gap-2 items-center px-3 py-1.5 text-sm cursor-pointer rounded-xl hover:bg-gray-50 dark:hover:bg-gray-800/50"
on:click={(e) => { on:click={async (e) => {
if (!(tools[toolId]?.authenticated ?? true)) { if (!(tools[toolId]?.authenticated ?? true)) {
e.preventDefault(); e.preventDefault();
@ -341,6 +341,15 @@
window.open(authUrl, '_blank', 'noopener'); window.open(authUrl, '_blank', 'noopener');
} else { } else {
tools[toolId].enabled = !tools[toolId].enabled; tools[toolId].enabled = !tools[toolId].enabled;
const state = tools[toolId].enabled;
await tick();
if (state) {
selectedToolIds = [...selectedToolIds, toolId];
} else {
selectedToolIds = selectedToolIds.filter((id) => id !== toolId);
}
} }
}} }}
> >
@ -383,18 +392,7 @@
{/if} {/if}
<div class=" shrink-0"> <div class=" shrink-0">
<Switch <Switch state={tools[toolId].enabled} />
state={tools[toolId].enabled}
on:change={async (e) => {
const state = e.detail;
await tick();
if (state) {
selectedToolIds = [...selectedToolIds, toolId];
} else {
selectedToolIds = selectedToolIds.filter((id) => id !== toolId);
}
}}
/>
</div> </div>
</button> </button>
{/each} {/each}