Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions libs/ui-components/src/components/QuickStart/QuickStart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ const CardStatusLabel = ({ status }: { status: PhaseCardStatus }) => {

const PhaseCard = ({ card, prevPhaseId }: PhaseCardProps) => {
const { t } = useTranslation();
const { startPhase } = useQuickStart();
const { activePhaseId, isGuideOpen, startPhase } = useQuickStart();
const { checkPermissions } = usePermissionsContext();
const PhaseIcon = PHASE_ICONS[card.icon];

const isLocked = card.status === 'locked';
const isContinueDisabled = card.status === 'in-progress' && activePhaseId === card.id && isGuideOpen;
const actionLabel = getActionLabel(t, card.status);
const productName = useProductName();

Expand Down Expand Up @@ -162,7 +163,7 @@ const PhaseCard = ({ card, prevPhaseId }: PhaseCardProps) => {
</Button>
</Popover>
) : (
<Button variant="primary" onClick={() => startPhase(card.id)}>
<Button variant="primary" isDisabled={isContinueDisabled} onClick={() => startPhase(card.id)}>
{actionLabel}
</Button>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type QuickStartPanelValue = {
totalMinutes: number;
completedPhases: QuickStartPhaseId[];
activePhaseId: QuickStartPhaseId | null;
isGuideOpen: boolean;
activeStepIndex: number;
toggleVisibility: VoidFunction;
toggleCollapsed: VoidFunction;
Expand Down Expand Up @@ -70,6 +71,7 @@ export const useQuickStart = (): QuickStartPanelValue => {
totalMinutes: store.totalMinutes,
completedPhases: store.completedPhases,
activePhaseId: store.activePhaseId,
isGuideOpen: store.isGuideOpen,
activeStepIndex: store.activeStepIndex,
toggleVisibility: store.toggleVisibility,
toggleCollapsed: store.toggleCollapsed,
Expand Down Expand Up @@ -193,6 +195,12 @@ export const QuickStartProvider = ({ children, username }: QuickStartProviderPro
return;
}

if (activePhaseId === phaseId && phase.status !== 'complete') {
// Re-entering the active phase resets state without rerunning its guide effects.
setIsGuideMinimized(false);
return;
}

const savedIndex = persisted.phaseProgress[phaseId]?.lastStepIndex ?? 0;
const stepIndex = isPhaseComplete(phaseId, persisted)
? 0
Expand All @@ -211,7 +219,7 @@ export const QuickStartProvider = ({ children, username }: QuickStartProviderPro
},
}));
},
[persisted, phases, resetGuidePresentation, updatePersisted],
[activePhaseId, persisted, phases, resetGuidePresentation, updatePersisted],
);

const setStepIndex = React.useCallback(
Expand Down Expand Up @@ -278,6 +286,7 @@ export const QuickStartProvider = ({ children, username }: QuickStartProviderPro
totalMinutes: totalMinutes,
completedPhases: persisted.completedPhases,
activePhaseId,
isGuideOpen: activePhaseId !== null && !isGuideMinimized,
activeStepIndex,
guidePresentation,
guideActions,
Expand Down
Loading