-
Notifications
You must be signed in to change notification settings - Fork 1
feat(workspace): find tonight's first range on the roadmap #1147
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
Closed
seonghobae
wants to merge
5
commits into
feat/workspace-find-first-range-section
from
feat/workspace-find-first-range-roadmap
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2b8542e
feat(workspace): find tonight's first range on the roadmap
seonghobae 58cfbb8
test(workspace): reproduce repeated roadmap label rejection
seonghobae ee8e079
fix(workspace): navigate repeated form labels by owned IDs
seonghobae e3ad077
test(workspace): reproduce reused analysis identity focus leak
seonghobae 54d8ddf
fix(workspace): scope roadmap focus to local project identity
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
Some comments aren't visible on the classic Files Changed page.
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
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 |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ import { RoleSwitcher } from "./RoleSwitcher"; | |
| import { SectionRoadmap } from "./SectionRoadmap"; | ||
| import { GrooveMap } from "./GrooveMap"; | ||
| import { PracticeProgress } from "./PracticeProgress"; | ||
| import { fillRangeCopy, firstRangeSqueeze } from "./firstRangeSqueeze"; | ||
| import { fillRangeCopy, firstRangeRoadmap, firstRangeSqueeze } from "./firstRangeSqueeze"; | ||
| import { createTranslator, detectPreferredLocale } from "../../i18n"; | ||
| import { generateCueSheetCsv, generateChartSummaryJson, generateMetadataHandoffJson, sanitizeFilename } from "../../lib/export"; | ||
| import { Button } from "@/components/ui/button"; | ||
|
|
@@ -17,6 +17,14 @@ interface WorkspaceProps { | |
| onSongUpdate?: (song: RehearsalSong) => void; | ||
| } | ||
|
|
||
| /** Request identity for a user-initiated section-roadmap focus action. */ | ||
| type RoadmapFocusRequest = { | ||
| rehearsalSourceIdentity: string; | ||
| sectionId: string; | ||
| roleId: string; | ||
| requestSequence: number; | ||
| }; | ||
|
|
||
| /** Documented. */ | ||
| function formatTimelineTime(totalSeconds: number): string { | ||
| const safeSeconds = Number.isFinite(totalSeconds) && totalSeconds >= 0 ? totalSeconds : 0; | ||
|
|
@@ -121,7 +129,13 @@ const SongStructure = memo(function SongStructure({ sections, t }: { sections: R | |
| /** Documented. */ | ||
| export function Workspace({ song, sourceBootstrap = null, onSongUpdate }: WorkspaceProps) { | ||
| const [activeRole, setActiveRole] = useState<string | null>(null); | ||
| const [roadmapFocusRequest, setRoadmapFocusRequest] = useState<RoadmapFocusRequest | null>(null); | ||
| const t = useMemo(() => createTranslator(detectPreferredLocale()), []); | ||
| const parsedSourceBootstrap = useMemo( | ||
| () => safeProjectBootstrapSummary(sourceBootstrap), | ||
| [sourceBootstrap] | ||
| ); | ||
| const rehearsalSourceIdentity = parsedSourceBootstrap?.projectId ?? song.id; | ||
|
|
||
| // Extract all unique roles from the song's sections | ||
| const roleMap = useMemo(() => { | ||
|
|
@@ -163,6 +177,41 @@ export function Workspace({ song, sourceBootstrap = null, onSongUpdate }: Worksp | |
| } | ||
| ) | ||
| : t("workspaceFirstRangeMissing"); | ||
| const firstRangeBoard = firstRangeRoadmap(song, firstRange); | ||
|
Comment on lines
177
to
+180
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| const firstRangeFindCopy = firstRangeBoard | ||
| ? fillRangeCopy(t("workspaceFirstRangeFindRoadmap"), { | ||
| sectionLabel: firstRangeBoard.sectionLabel, | ||
| roleName: firstRangeBoard.roleName | ||
| }) | ||
| : null; | ||
| const focusedSectionId = | ||
| roadmapFocusRequest?.rehearsalSourceIdentity === rehearsalSourceIdentity | ||
| ? roadmapFocusRequest.sectionId | ||
| : null; | ||
| const focusedRoleId = | ||
| roadmapFocusRequest?.rehearsalSourceIdentity === rehearsalSourceIdentity | ||
| ? roadmapFocusRequest.roleId | ||
| : null; | ||
| const focusRequestSequence = | ||
| roadmapFocusRequest?.rehearsalSourceIdentity === rehearsalSourceIdentity | ||
| ? roadmapFocusRequest.requestSequence | ||
| : 0; | ||
|
|
||
| /** Request the first-range roadmap cell on every activation, even when it is already highlighted. */ | ||
| const handleFindFirstRangeRoadmap = () => { | ||
| if (!firstRangeBoard) { | ||
| return; | ||
| } | ||
| setRoadmapFocusRequest((previousFocusRequest) => ({ | ||
| rehearsalSourceIdentity, | ||
| sectionId: firstRangeBoard.sectionId, | ||
| roleId: firstRangeBoard.roleId, | ||
| requestSequence: | ||
| previousFocusRequest?.rehearsalSourceIdentity === rehearsalSourceIdentity | ||
| ? previousFocusRequest.requestSequence + 1 | ||
| : 1 | ||
| })); | ||
| }; | ||
|
|
||
| /** Handle the practice progress change internally by immutably updating the song state. */ | ||
| const handlePracticeProgressChange = (newProgress: number) => { | ||
|
|
@@ -240,7 +289,6 @@ export function Workspace({ song, sourceBootstrap = null, onSongUpdate }: Worksp | |
|
|
||
| /** Documented. */ | ||
| const handleExportHandoff = () => { | ||
| const parsedSourceBootstrap = safeProjectBootstrapSummary(sourceBootstrap); | ||
| const json = generateMetadataHandoffJson(song, { | ||
| sourceBootstrap: parsedSourceBootstrap, | ||
| workspaceId: song.id, | ||
|
|
@@ -308,6 +356,17 @@ export function Workspace({ song, sourceBootstrap = null, onSongUpdate }: Worksp | |
| > | ||
| <p className="text-xs font-black uppercase tracking-[0.24em] text-fuchsia-200">{t("workspaceFirstRangeTitle")}</p> | ||
| <p className="mt-2 text-sm leading-6 text-slate-100">{firstRangeCopy}</p> | ||
| {firstRangeBoard && firstRangeFindCopy ? ( | ||
| <Button | ||
| type="button" | ||
| variant="outline" | ||
| size="sm" | ||
| className="mt-3 min-h-10 border-fuchsia-300/30 bg-fuchsia-300/10 font-semibold text-fuchsia-50 hover:bg-fuchsia-300/20 hover:text-white" | ||
| onClick={handleFindFirstRangeRoadmap} | ||
| > | ||
| {firstRangeFindCopy} | ||
| </Button> | ||
| ) : null} | ||
| </section> | ||
|
|
||
| <div className="grid gap-4 md:grid-cols-2 xl:grid-cols-4"> | ||
|
|
@@ -506,6 +565,9 @@ export function Workspace({ song, sourceBootstrap = null, onSongUpdate }: Worksp | |
| song={song} | ||
| activeRole={activeRole} | ||
| onSongUpdate={onSongUpdate} | ||
| focusSectionId={focusedSectionId} | ||
| focusRoleId={focusedRoleId} | ||
| focusRequestSequence={focusRequestSequence} | ||
| /> | ||
| </section> | ||
| </CardContent> | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Loaded songs inherit stale roadmap focus
When a loaded song ID equals the prior project ID,
rehearsalSourceIdentitytreats both sources as identical. The new song retains the old roadmap highlight.Was this helpful? React with 👍 or 👎 to provide feedback.