Repository navigation
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 3 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 = { | ||
| rehearsalSongId: string; | ||
| sectionId: string; | ||
| roleId: string; | ||
| requestSequence: number; | ||
| }; | ||
|
|
||
| /** Documented. */ | ||
| function formatTimelineTime(totalSeconds: number): string { | ||
| const safeSeconds = Number.isFinite(totalSeconds) && totalSeconds >= 0 ? totalSeconds : 0; | ||
|
|
@@ -121,6 +129,7 @@ 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()), []); | ||
|
|
||
| // Extract all unique roles from the song's sections | ||
|
|
@@ -163,6 +172,35 @@ export function Workspace({ song, sourceBootstrap = null, onSongUpdate }: Worksp | |
| } | ||
| ) | ||
| : t("workspaceFirstRangeMissing"); | ||
| const firstRangeBoard = firstRangeRoadmap(song, firstRange); | ||
| const firstRangeFindCopy = firstRangeBoard | ||
| ? fillRangeCopy(t("workspaceFirstRangeFindRoadmap"), { | ||
| sectionLabel: firstRangeBoard.sectionLabel, | ||
| roleName: firstRangeBoard.roleName | ||
| }) | ||
| : null; | ||
| const focusedSectionId = | ||
| roadmapFocusRequest?.rehearsalSongId === song.id ? roadmapFocusRequest.sectionId : null; | ||
| const focusedRoleId = | ||
| roadmapFocusRequest?.rehearsalSongId === song.id ? roadmapFocusRequest.roleId : null; | ||
| const focusRequestSequence = | ||
| roadmapFocusRequest?.rehearsalSongId === song.id ? roadmapFocusRequest.requestSequence : 0; | ||
|
seonghobae marked this conversation as resolved.
Outdated
|
||
|
|
||
| /** Request the first-range roadmap cell on every activation, even when it is already highlighted. */ | ||
| const handleFindFirstRangeRoadmap = () => { | ||
| if (!firstRangeBoard) { | ||
| return; | ||
| } | ||
| setRoadmapFocusRequest((previousFocusRequest) => ({ | ||
| rehearsalSongId: song.id, | ||
| sectionId: firstRangeBoard.sectionId, | ||
| roleId: firstRangeBoard.roleId, | ||
| requestSequence: | ||
| previousFocusRequest?.rehearsalSongId === song.id | ||
| ? previousFocusRequest.requestSequence + 1 | ||
| : 1 | ||
| })); | ||
| }; | ||
|
Comment on lines
+200
to
+214
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. |
||
|
|
||
| /** Handle the practice progress change internally by immutably updating the song state. */ | ||
| const handlePracticeProgressChange = (newProgress: number) => { | ||
|
|
@@ -308,6 +346,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 +555,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.
Uh oh!
There was an error while loading. Please reload this page.
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.
📝 Info: Focused roles remain visible
firstRangeSqueezefollows the active role filter. The resulting focused role remains rendered when Find runs.Was this helpful? React with 👍 or 👎 to provide feedback.