Timeline: place dots by co-op stage at the event date
Each date-field event is now plotted on the lane corresponding to the Framework Stage the co-op was in on the field's stored date, resolved from the activity stream's stage transitions. Date_Opened is pinned to Stage 5 as the journey anchor. Events that pre-date any known transition fall back to the field's section rank so they still surface somewhere. Extracts the STAGE_RANK map (previously inline in ReportView) into lib/stageRank.ts alongside the new buildStageRankAtDate resolver factory.
This commit is contained in:
@@ -10,6 +10,7 @@ import type {
|
||||
StageSectionConfig,
|
||||
} from "@/types/form";
|
||||
import { STAGE_OPTION_GROUP_ID } from "@/config/form";
|
||||
import { STAGE_RANK, buildStageRankAtDate } from "@/lib/stageRank";
|
||||
import { StageIcon } from "./StageIcon";
|
||||
import {
|
||||
FieldHistoryGroup,
|
||||
@@ -39,15 +40,6 @@ type LoadState =
|
||||
|
||||
type PathwayState = "past" | "current" | "future";
|
||||
|
||||
const STAGE_RANK: Record<string, number> = {
|
||||
Inquiry: 0,
|
||||
Organizing: 1,
|
||||
Feasibility: 2,
|
||||
"Business feasibility": 3,
|
||||
"Store Implementation": 4,
|
||||
"Stabilize newly opened co-op": 5,
|
||||
};
|
||||
|
||||
export function ReportView({ config, cid, cs }: ReportViewProps) {
|
||||
const [load, setLoad] = useState<LoadState>({ kind: "loading" });
|
||||
|
||||
@@ -126,7 +118,11 @@ export function ReportView({ config, cid, cs }: ReportViewProps) {
|
||||
dateRange={dateRange}
|
||||
/>
|
||||
|
||||
<DateTimeline sections={config.sections} fieldHistory={data.fieldHistory} />
|
||||
<DateTimeline
|
||||
sections={config.sections}
|
||||
fieldHistory={data.fieldHistory}
|
||||
stageRankAtDate={buildStageRankAtDate(data.activities)}
|
||||
/>
|
||||
|
||||
{sectionsToRender.length === 0 ? (
|
||||
<EmptyState />
|
||||
|
||||
Reference in New Issue
Block a user