Skip to content

Commit 8515eae

Browse files
committed
feat: guide Background Sound downloads in picker
1 parent 103e23c commit 8515eae

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

src/vue-tui/component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,16 +783,16 @@ function backgroundSoundPickerModal(
783783
});
784784
return h(Box, {
785785
flexDirection: "column", borderStyle: "round", borderColor: noColor ? undefined : "cyan",
786-
paddingX: 2, width: "50%",
786+
paddingX: 2, width: "80%",
787787
}, () => [
788-
h(Text, { bold: true }, () => "Choose Background Sound"),
788+
h(Text, { bold: true }, () => "Choose Background Sound · j/k ↑/↓ · Enter · Esc"),
789789
...rows,
790-
h(Text, { dimColor: true }, () => "j/k ↑/↓ · Enter · Esc"),
790+
h(Text, { dimColor: true }, () => "Missing sounds? macOS Settings download · Esc then u refresh"),
791791
]);
792792
}
793793

794794
function backgroundSoundPickerVisibleCount(terminalRows: number, terminalColumns: number, soundCount: number): number {
795-
const chromeRows = terminalColumns < 70 ? 9 : 8;
795+
const chromeRows = terminalColumns < 70 ? 11 : 8;
796796
return Math.max(1, Math.min(soundCount, terminalRows - chromeRows));
797797
}
798798

tests/vue-tui.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,10 @@ describe("TMU top-level surface smoke", () => {
185185
volumePercent: 45,
186186
};
187187
const writes: string[] = [];
188+
let reads = 0;
188189
const control = {
189-
probe: async () => snapshot, read: async () => snapshot,
190+
probe: async () => snapshot,
191+
read: async () => { reads += 1; return snapshot; },
190192
setEnabled: async (enabled: boolean) => (writes.push(`enabled:${enabled}`), snapshot = { ...snapshot, enabled }),
191193
setSound: async (id: string) => (writes.push(`sound:${id}`), snapshot = { ...snapshot, sound: snapshot.sounds.find((sound) => sound.id === id)! }),
192194
setVolume: async (volumePercent: number) => (writes.push(`volume:${volumePercent}`), snapshot = { ...snapshot, volumePercent }),
@@ -205,8 +207,14 @@ describe("TMU top-level surface smoke", () => {
205207
expect(writes).toEqual(["enabled:true"]);
206208
await terminal.stdin.write("\r");
207209
expect(terminal.lastFrame()).toContain("Choose Background Sound");
210+
expect(terminal.lastFrame()).toContain("Missing sounds? macOS Settings download · Esc then u refresh");
208211
expect(terminal.lastFrame()).toContain("Rain");
209212
expect(terminal.lastFrame()).toContain("Ocean");
213+
await terminal.stdin.write("\x1b");
214+
await terminal.stdin.write("u");
215+
await sleep(0);
216+
expect(reads).toBe(1);
217+
await terminal.stdin.write("\r");
210218
await terminal.stdin.write("\x1b[B");
211219
await terminal.stdin.write("\r");
212220
expect(writes).toEqual(["enabled:true", "sound:Ocean"]);

0 commit comments

Comments
 (0)