b067fac875
Co-authored-by: nova28 <17953305+nova28@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
23 lines
724 B
TypeScript
23 lines
724 B
TypeScript
type Step = { id: string };
|
|
type StepTask = { workflowStepId: string | null };
|
|
|
|
export function areAllEmptyStepsAutoHidden(visibleSteps: Step[], moveTargetSteps: Step[]): boolean {
|
|
return visibleSteps.length === 0 && moveTargetSteps.length > 0;
|
|
}
|
|
|
|
export function deriveAutoHiddenStepIds(
|
|
steps: Step[],
|
|
tasks: StepTask[],
|
|
enabled: boolean,
|
|
manuallyHiddenStepIds: string[],
|
|
): Set<string> {
|
|
if (!enabled) return new Set();
|
|
const occupied = new Set(tasks.map((task) => task.workflowStepId).filter(Boolean));
|
|
const manuallyHidden = new Set(manuallyHiddenStepIds);
|
|
return new Set(
|
|
steps
|
|
.filter((step) => !occupied.has(step.id) && !manuallyHidden.has(step.id))
|
|
.map((step) => step.id),
|
|
);
|
|
}
|