-
Notifications
You must be signed in to change notification settings - Fork 0
feat(workspace): guide tonight's first verse on map and player #947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
seonghobae
wants to merge
11
commits into
develop
Choose a base branch
from
feat/workspace-first-verse-line
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
62b1bbe
feat(workspace): guide tonight's first verse on map and player
seonghobae 6125221
test(workspace): reject stale verse completion across songs
seonghobae a1f2c73
fix(workspace): bind verse completion to current song
seonghobae d779248
style(workspace): restore verse callout newline
seonghobae 6f71d87
docs(workspace): record verse completion reset
seonghobae 56e5b81
fix(changelog): preserve release history for verse repair
seonghobae 315e563
test(workspace): lock particle-safe Korean verse copy
seonghobae 1e19369
fix(ci): use particle-safe Korean verse body copy for vowel-ending ro…
seonghobae 884b6fc
Merge remote-tracking branch 'origin/develop' into HEAD
seonghobae 9cf1142
Merge remote-tracking branch 'origin/develop' into HEAD
seonghobae 38ed1c8
fix(changelog): preserve heading spacing
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| import { fireEvent, render, screen } from "@testing-library/react"; | ||
| import { createDemoRehearsalSong } from "@bandscope/shared-types"; | ||
| import { describe, expect, it, vi } from "vitest"; | ||
| import { PlayerFeature } from "./index"; | ||
|
|
||
| function songWithVerse() { | ||
| const song = createDemoRehearsalSong(); | ||
| const seed = song.sections[0]!; | ||
| const verse = structuredClone(seed); | ||
| verse.id = "verse-1"; | ||
| verse.label = "verse"; | ||
| verse.timeRange = { start: 10, end: 30 }; | ||
| verse.roles = [ | ||
| { | ||
| ...seed.roles[2]!, | ||
| id: "lead-vocal", | ||
| name: "Lead Vocal", | ||
| rehearsalPriority: "high" | ||
| } | ||
| ]; | ||
| verse.partGraph = [ | ||
| { | ||
| role_id: "lead-vocal", | ||
| is_active: true, | ||
| handoff_to: [], | ||
| handoff_from: [] | ||
| } | ||
| ]; | ||
| song.sections = [verse]; | ||
| return song; | ||
| } | ||
|
|
||
| describe("PlayerFeature", () => { | ||
| it("asks the room to analyze first when no song is loaded", () => { | ||
| render(<PlayerFeature title="Player" />); | ||
| expect( | ||
| screen.getByText("Analyze tonight's song first, then hear the first verse from this player.") | ||
| ).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("keeps the verse hear action unavailable without a player playback callback", () => { | ||
| render(<PlayerFeature title="Player" song={songWithVerse()} />); | ||
|
|
||
| expect(screen.queryByRole("button", { name: "Hear Lead Vocal verse at 0:10" })).toBeNull(); | ||
| expect(screen.getByText("Lead Vocal carries the verse at 0:10.")).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("delegates the verse hear action to the owning player callback", () => { | ||
| const onPlayFromSeconds = vi.fn(); | ||
| render(<PlayerFeature title="Player" song={songWithVerse()} onPlayFromSeconds={onPlayFromSeconds} />); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: "Hear Lead Vocal verse at 0:10" })); | ||
|
|
||
| expect(onPlayFromSeconds).toHaveBeenCalledTimes(1); | ||
| expect(onPlayFromSeconds).toHaveBeenCalledWith(10); | ||
| }); | ||
|
|
||
| it("renders a safe empty summary when the runtime section collection is not an array", () => { | ||
| const song = songWithVerse(); | ||
| (song as unknown as { sections: unknown }).sections = null; | ||
|
|
||
| render(<PlayerFeature title="Player" song={song} />); | ||
|
|
||
| expect(screen.getByText("No verse yet. Stay on tonight's map until the first verse is labeled.")).toBeTruthy(); | ||
| expect(screen.getByText("0 sections")).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("renders a safe empty summary when the runtime section collection is sparse", () => { | ||
| const song = songWithVerse(); | ||
| const sparseSections: typeof song.sections = new Array(2); | ||
| sparseSections[1] = song.sections[0]!; | ||
| song.sections = sparseSections; | ||
|
|
||
| render(<PlayerFeature title="Player" song={song} />); | ||
|
|
||
| expect(screen.getByText("No verse yet. Stay on tonight's map until the first verse is labeled.")).toBeTruthy(); | ||
| expect(screen.getByText("0 sections")).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("omits malformed runtime section elements without crashing the player summary", () => { | ||
| const song = songWithVerse(); | ||
| song.sections = [null, song.sections[0]!] as unknown as typeof song.sections; | ||
|
|
||
| render(<PlayerFeature title="Player" song={song} />); | ||
|
|
||
| expect(screen.getByText("1 section")).toBeTruthy(); | ||
| expect(screen.getByText("verse")).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("does not pass an object-valued runtime song title into React copy", () => { | ||
| const song = songWithVerse(); | ||
| (song as unknown as { title: unknown }).title = { unsafe: "not-copy" }; | ||
|
|
||
| expect(() => render(<PlayerFeature title="Player" song={song} />)).not.toThrow(); | ||
| expect(screen.queryByText("not-copy")).toBeNull(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
apps/desktop/src/features/workspace/FirstVerseCallout.particle.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { render, screen } from "@testing-library/react"; | ||
| import { createDemoRehearsalSong } from "@bandscope/shared-types"; | ||
| import { afterEach, describe, expect, it, vi } from "vitest"; | ||
| import { FirstVerseCallout } from "./FirstVerseCallout"; | ||
|
|
||
| describe("FirstVerseCallout Korean role copy", () => { | ||
| afterEach(() => { | ||
| vi.unstubAllGlobals(); | ||
| }); | ||
|
|
||
| it("keeps vowel-ending dynamic role names particle-safe", () => { | ||
| vi.stubGlobal("navigator", { language: "ko-KR" }); | ||
| const song = createDemoRehearsalSong(); | ||
| const seed = song.sections[0]!; | ||
| const verse = structuredClone(seed); | ||
| verse.id = "verse-particle"; | ||
| verse.label = "verse"; | ||
| verse.timeRange = { start: 10, end: 30 }; | ||
| verse.roles = [{ ...seed.roles[0]!, id: "piano", name: "피아노", rehearsalPriority: "high" }]; | ||
| verse.partGraph = [ | ||
| { role_id: "piano", is_active: true, handoff_to: [], handoff_from: [] } | ||
| ]; | ||
| song.sections = [verse]; | ||
|
|
||
| render(<FirstVerseCallout song={song} />); | ||
|
|
||
| expect(screen.getByText("0:10 벌스에서 피아노 파트가 첫 소절을 잡습니다.")).toBeTruthy(); | ||
| expect(screen.queryByText("피아노이 0:10 벌스에서 첫 소절을 잡습니다.")).toBeNull(); | ||
| }); | ||
| }); |
67 changes: 67 additions & 0 deletions
67
apps/desktop/src/features/workspace/FirstVerseCallout.reduced-motion.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import { fireEvent, render, screen } from "@testing-library/react"; | ||
| import { createDemoRehearsalSong } from "@bandscope/shared-types"; | ||
| import { afterEach, describe, expect, it, vi } from "vitest"; | ||
| import { FirstVerseCallout } from "./FirstVerseCallout"; | ||
|
|
||
| function songWithVerse() { | ||
| const song = createDemoRehearsalSong(); | ||
| const seed = song.sections[0]!; | ||
| const verse = structuredClone(seed); | ||
| verse.id = "verse-1"; | ||
| verse.label = "verse"; | ||
| verse.timeRange = { start: 10, end: 30 }; | ||
| verse.roles = [ | ||
| { | ||
| ...seed.roles[2]!, | ||
| id: "lead-vocal", | ||
| name: "Lead Vocal", | ||
| rehearsalPriority: "high" | ||
| } | ||
| ]; | ||
| verse.partGraph = [ | ||
| { | ||
| role_id: "lead-vocal", | ||
| is_active: true, | ||
| handoff_to: [], | ||
| handoff_from: [] | ||
| } | ||
| ]; | ||
| song.sections = [verse]; | ||
| return song; | ||
| } | ||
|
|
||
| describe("FirstVerseCallout reduced motion", () => { | ||
| afterEach(() => { | ||
| vi.unstubAllGlobals(); | ||
| }); | ||
|
|
||
| it("scrolls immediately when the operating system requests reduced motion", () => { | ||
| vi.stubGlobal("matchMedia", (query: string) => ({ | ||
| matches: query === "(prefers-reduced-motion: reduce)", | ||
| media: query, | ||
| onchange: null, | ||
| addListener: vi.fn(), | ||
| removeListener: vi.fn(), | ||
| addEventListener: vi.fn(), | ||
| removeEventListener: vi.fn(), | ||
| dispatchEvent: vi.fn() | ||
| })); | ||
|
|
||
| const grid = document.createElement("div"); | ||
| grid.dataset.testid = "song-structure-grid"; | ||
| const target = document.createElement("div"); | ||
| const scrollIntoView = vi.fn(); | ||
| Object.defineProperty(target, "scrollIntoView", { | ||
| configurable: true, | ||
| value: scrollIntoView | ||
| }); | ||
| grid.appendChild(target); | ||
| document.body.appendChild(grid); | ||
|
|
||
| render(<FirstVerseCallout song={songWithVerse()} />); | ||
| fireEvent.click(screen.getByRole("button", { name: "Open Lead Vocal verse at 0:10" })); | ||
| expect(scrollIntoView).toHaveBeenCalledWith({ block: "nearest", behavior: "auto" }); | ||
|
|
||
| grid.remove(); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.