Add ability to manually adjust the running timer's start time
Allows users to retroactively correct the start time of an ongoing timer without stopping it. A pencil icon in the timer widget opens an inline time input pre-filled with the current start time; confirming sends the new time to the backend which validates it is in the past before persisting.
This commit is contained in:
@@ -17,6 +17,7 @@ interface TimerContextType {
|
||||
elapsedSeconds: number;
|
||||
startTimer: (projectId?: string) => Promise<void>;
|
||||
updateTimerProject: (projectId?: string | null) => Promise<void>;
|
||||
updateTimerStartTime: (startTime: string) => Promise<void>;
|
||||
stopTimer: (projectId?: string) => Promise<TimeEntry | null>;
|
||||
}
|
||||
|
||||
@@ -102,7 +103,14 @@ export function TimerProvider({ children }: { children: ReactNode }) {
|
||||
|
||||
const updateTimerProject = useCallback(
|
||||
async (projectId?: string | null) => {
|
||||
await updateMutation.mutateAsync(projectId);
|
||||
await updateMutation.mutateAsync({ projectId });
|
||||
},
|
||||
[updateMutation],
|
||||
);
|
||||
|
||||
const updateTimerStartTime = useCallback(
|
||||
async (startTime: string) => {
|
||||
await updateMutation.mutateAsync({ startTime });
|
||||
},
|
||||
[updateMutation],
|
||||
);
|
||||
@@ -127,6 +135,7 @@ export function TimerProvider({ children }: { children: ReactNode }) {
|
||||
elapsedSeconds,
|
||||
startTimer,
|
||||
updateTimerProject,
|
||||
updateTimerStartTime,
|
||||
stopTimer,
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user