Skip to content

Commit 1b90070

Browse files
committed
feat: add swap button to reverse write/read engine selection
1 parent fa59448 commit 1b90070

3 files changed

Lines changed: 45 additions & 1 deletion

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Swap Button Design
2+
3+
**Date:** 2026-04-27
4+
**Status:** Approved
5+
6+
## What
7+
8+
Add a `` button at the end of the `write → read` header in the results panel. Clicking it swaps the two selected engines.
9+
10+
## UI
11+
12+
```
13+
databricks → bigquery ⇄
14+
```
15+
16+
Button shows only when `write` is set. Muted (`#888`), brightens on hover, monospace, no border.
17+
18+
## Changes
19+
20+
- `src/lib/CatalogResults.svelte` — add `createEventDispatcher`, dispatch `swap` on click, render button in `.results-header`
21+
- `src/App.svelte` — handle `swap` event: `[selectedWrite, selectedRead] = [selectedRead, selectedWrite]`

src/App.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
66
let selectedWrite: EngineId | null = null;
77
let selectedRead: EngineId | null = null;
8+
9+
function swapEngines() {
10+
[selectedWrite, selectedRead] = [selectedRead, selectedWrite];
11+
}
812
</script>
913

1014
<div class="app">
@@ -22,7 +26,7 @@
2226
<div class="divider" aria-hidden="true"></div>
2327

2428
<section class="results">
25-
<CatalogResults write={selectedWrite} read={selectedRead} />
29+
<CatalogResults write={selectedWrite} read={selectedRead} on:swap={swapEngines} />
2630
</section>
2731
</main>
2832

src/lib/CatalogResults.svelte

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<script lang="ts">
2+
import { createEventDispatcher } from 'svelte';
23
import { engineCatalogRules, engineReadRules, pairOverrides, CATALOGS } from '../data/compatibility';
34
import type { EngineId, CatalogId, Support, CatalogSupport, EngineRule } from '../data/compatibility';
45
6+
const dispatch = createEventDispatcher();
7+
58
export let write: EngineId | null;
69
export let read: EngineId | null;
710
@@ -67,6 +70,7 @@
6770
<span class="engine-tag write">{write}</span>
6871
<span class="arrow">→</span>
6972
<span class="engine-tag read">{read ?? '?'}</span>
73+
<button class="swap-btn" on:click={() => dispatch('swap')} title="Swap write and read engines">⇄</button>
7074
</div>
7175
{#if !read}
7276
<p class="read-hint">Pick a read engine above to refine results</p>
@@ -200,6 +204,21 @@
200204
201205
.arrow { color: #888; }
202206
207+
.swap-btn {
208+
background: none;
209+
border: none;
210+
color: #555;
211+
font-family: monospace;
212+
font-size: 16px;
213+
cursor: pointer;
214+
padding: 2px 6px;
215+
border-radius: 4px;
216+
line-height: 1;
217+
transition: color 0.15s;
218+
margin-left: 4px;
219+
}
220+
.swap-btn:hover { color: #ccc; }
221+
203222
.read-hint {
204223
font-family: monospace;
205224
font-size: 11px;

0 commit comments

Comments
 (0)