|
|
@@ -11,6 +11,8 @@
|
|
|
onMount(refresh);
|
|
|
|
|
|
const st = $derived(app.state);
|
|
|
+ // The bindings type Go slices as `T[] | null`; Go always sends arrays.
|
|
|
+ const pads = $derived(st?.pads ?? []);
|
|
|
|
|
|
// Sequences by slot, for the grid and the panel.
|
|
|
const seqBySlot = $derived(new Map((st?.sequences ?? []).map((q) => [q.slot, q])));
|
|
|
@@ -23,13 +25,13 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- const padCounts = $derived(perBank((s) => (st?.pads[s]?.file ?? "") !== ""));
|
|
|
+ const padCounts = $derived(perBank((s) => (pads[s]?.file ?? "") !== ""));
|
|
|
const seqCounts = $derived(perBank((s) => seqBySlot.has(s)));
|
|
|
|
|
|
const padCells: Cell[] = $derived(
|
|
|
st
|
|
|
? gridSlots(ui.padBank).map((slot) => {
|
|
|
- const p = st.pads[slot];
|
|
|
+ const p = pads[slot];
|
|
|
const badges = [tuneText(p.coarse, p.fine), p.muteGroup ? "M" + p.muteGroup : ""].filter(Boolean);
|
|
|
return {
|
|
|
slot,
|
|
|
@@ -46,7 +48,7 @@
|
|
|
st
|
|
|
? gridSlots(ui.seqBank).map((slot) => {
|
|
|
const q = seqBySlot.get(slot);
|
|
|
- const label = st.pads[slot].label; // pad and sequence slots share labels
|
|
|
+ const label = pads[slot].label; // pad and sequence slots share labels
|
|
|
return {
|
|
|
slot,
|
|
|
label,
|
|
|
@@ -98,7 +100,7 @@
|
|
|
|
|
|
{#if st}
|
|
|
{#if ui.tab === "pads"}
|
|
|
- <main id="view-pads" class="panels" role="tabpanel" aria-labelledby="tab-pads">
|
|
|
+ <div id="view-pads" class="panels" role="tabpanel" aria-labelledby="tab-pads">
|
|
|
<section class="panel grid-panel" aria-label="Pads">
|
|
|
<div class="grid-head">
|
|
|
<h2 class="eyebrow">Pad bank</h2>
|
|
|
@@ -116,10 +118,10 @@
|
|
|
<SlotGrid cells={padCells} selected={ui.padSlot} onpick={(s) => (ui.padSlot = s)} />
|
|
|
<p class="hint grid-hint">Click a pad to select and hear it. Drag a pad to move it, drag onto a filled pad to swap, hold Alt while dragging to copy. Drop a WAV file on any pad to assign it.</p>
|
|
|
</section>
|
|
|
- <PadPanel pad={st.pads[ui.padSlot]} limits={st.limits} />
|
|
|
- </main>
|
|
|
+ <PadPanel pad={pads[ui.padSlot]} limits={st.limits} />
|
|
|
+ </div>
|
|
|
{:else}
|
|
|
- <main id="view-sequences" class="panels" role="tabpanel" aria-labelledby="tab-sequences">
|
|
|
+ <div id="view-sequences" class="panels" role="tabpanel" aria-labelledby="tab-sequences">
|
|
|
<section class="panel grid-panel" aria-label="Sequence slots">
|
|
|
<div class="grid-head">
|
|
|
<h2 class="eyebrow">Sequence bank</h2>
|
|
|
@@ -138,7 +140,7 @@
|
|
|
<p class="hint grid-hint">Each pad is one sequence slot, {st.limits.maxSequences} in total. Click an empty slot to add a sequence there.</p>
|
|
|
</section>
|
|
|
<SequencePanel slot={ui.seqSlot} seq={seqBySlot.get(ui.seqSlot)} limits={st.limits} />
|
|
|
- </main>
|
|
|
+ </div>
|
|
|
{/if}
|
|
|
|
|
|
<footer class="mono">
|