feat(space): timer 종료 모달과 10분 연장 추가
This commit is contained in:
@@ -79,6 +79,10 @@ export interface UpdateCurrentFocusSessionIntentRequest {
|
||||
microStep?: string | null;
|
||||
}
|
||||
|
||||
export interface ExtendCurrentPhaseRequest {
|
||||
additionalMinutes: number;
|
||||
}
|
||||
|
||||
export interface AdvanceCurrentGoalRequest {
|
||||
completedGoal: string;
|
||||
nextGoal: string;
|
||||
@@ -164,6 +168,15 @@ export const focusSessionApi = {
|
||||
return normalizeFocusSession(response);
|
||||
},
|
||||
|
||||
extendCurrentPhase: async (payload: ExtendCurrentPhaseRequest): Promise<FocusSession> => {
|
||||
const response = await apiClient<RawFocusSession>('api/v1/focus-sessions/current/extend-phase', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
return normalizeFocusSession(response);
|
||||
},
|
||||
|
||||
updateCurrentSelection: async (
|
||||
payload: UpdateCurrentFocusSessionSelectionRequest,
|
||||
): Promise<FocusSession> => {
|
||||
|
||||
@@ -73,6 +73,7 @@ interface UseFocusSessionEngineResult {
|
||||
pauseSession: () => Promise<FocusSession | null>;
|
||||
resumeSession: () => Promise<FocusSession | null>;
|
||||
restartCurrentPhase: () => Promise<FocusSession | null>;
|
||||
extendCurrentPhase: (payload: { additionalMinutes: number }) => Promise<FocusSession | null>;
|
||||
updateCurrentIntent: (payload: UpdateCurrentFocusSessionIntentRequest) => Promise<FocusSession | null>;
|
||||
updateCurrentSelection: (payload: UpdateCurrentFocusSessionSelectionRequest) => Promise<FocusSession | null>;
|
||||
completeSession: (payload: CompleteFocusSessionRequest) => Promise<FocusSession | null>;
|
||||
@@ -237,6 +238,18 @@ export const useFocusSessionEngine = (): UseFocusSessionEngineResult => {
|
||||
|
||||
return applySession(session);
|
||||
},
|
||||
extendCurrentPhase: async (payload) => {
|
||||
if (!currentSession) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const session = await runMutation(
|
||||
() => focusSessionApi.extendCurrentPhase(payload),
|
||||
copy.focusSession.resumeFailed,
|
||||
);
|
||||
|
||||
return applySession(session);
|
||||
},
|
||||
updateCurrentIntent: async (payload) => {
|
||||
if (!currentSession) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user