fix(space): 종료와 목표 완료 흐름 재정렬

This commit is contained in:
2026-03-17 12:57:59 +09:00
parent 4bbee36e1e
commit 5026138ad9
3 changed files with 32 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ interface SpaceFocusHudWidgetProps {
microStep?: string | null;
}) => boolean | Promise<boolean>;
onGoalUpdate: (nextGoal: string) => boolean | Promise<boolean>;
onGoalFinish: () => boolean | Promise<boolean>;
onGoalCompleteFinish: () => boolean | Promise<boolean>;
onTimerFinish: () => boolean | Promise<boolean>;
onAddTenMinutes: () => boolean | Promise<boolean>;
onStatusMessage: (payload: HudStatusLinePayload) => void;
@@ -42,7 +42,7 @@ export const SpaceFocusHudWidget = ({
sessionPhase = "focus",
onIntentUpdate,
onGoalUpdate,
onGoalFinish,
onGoalCompleteFinish,
onTimerFinish,
onAddTenMinutes,
onStatusMessage,
@@ -103,9 +103,16 @@ export const SpaceFocusHudWidget = ({
}
timerPromptSignatureRef.current = timerCompletionSignature;
setEndSessionConfirmOpen(false);
setOverlay("timer-complete");
}, [timerCompletionSignature]);
const handleOpenGoalComplete = () => {
setEndSessionConfirmOpen(false);
setCompletePreferredView("choice");
setOverlay("complete");
};
const handleInlineMicrostepUpdate = async (nextStep: string | null) => {
if (isSavingIntent) return false;
@@ -191,13 +198,26 @@ export const SpaceFocusHudWidget = ({
{hasActiveSession &&
(sessionPhase === "focus" || sessionPhase === "break") && (
<button
type="button"
onClick={() => setEndSessionConfirmOpen(true)}
className="mt-8 text-[11px] font-bold uppercase tracking-[0.25em] text-white/30 transition hover:text-white/70"
>
{copy.space.endSession.trigger}
</button>
<div className="mt-8 flex items-center gap-4">
<button
type="button"
onClick={handleOpenGoalComplete}
className="text-[11px] font-bold uppercase tracking-[0.25em] text-white/34 transition hover:text-white/76"
>
{copy.space.focusHud.completeAction}
</button>
<span aria-hidden className="h-3 w-px bg-white/10" />
<button
type="button"
onClick={() => {
setOverlay("none");
setEndSessionConfirmOpen(true);
}}
className="text-[11px] font-bold uppercase tracking-[0.25em] text-white/30 transition hover:text-white/70"
>
{copy.space.endSession.trigger}
</button>
</div>
)}
</div>
</div>
@@ -212,7 +232,7 @@ export const SpaceFocusHudWidget = ({
onFinish={() =>
overlay === "timer-complete"
? Promise.resolve(onTimerFinish())
: Promise.resolve(onGoalFinish())
: Promise.resolve(onGoalCompleteFinish())
}
onExtendTenMinutes={() => Promise.resolve(onAddTenMinutes())}
onRest={() => {

View File

@@ -300,7 +300,7 @@ export const useSpaceWorkspaceSessionControls = ({
}
const completionResult = await completeSession({
completionType: 'manual-end',
completionType: 'goal-complete',
completedGoal: trimmedCurrentGoal || undefined,
});

View File

@@ -364,7 +364,7 @@ export const SpaceWorkspaceWidget = () => {
playbackState={resolvedPlaybackState}
sessionPhase={phase ?? 'focus'}
onIntentUpdate={controls.handleIntentUpdate}
onGoalFinish={async () => {
onGoalCompleteFinish={async () => {
const completionResult = await controls.handleGoalComplete();
if (completionResult) {