Add routine management features for child and parent views
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m8s

- Implemented routine child-mode flow tests to ensure proper functionality of routine assignment and task completion.
- Created notification tests for parent view to verify routine completion notifications for children.
- Developed ChildRoutineOverlay component for displaying routine tasks and handling user interactions.
- Added RoutineApproveDialog component for approving or rejecting completed routines.
- Created unit tests for ChildRoutineOverlay and RoutineEditView components to ensure correct behavior and rendering.
- Enhanced RoutineEditView with proper handling of task addition and form submission.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-17 23:47:12 -04:00
parent eb775ba7d8
commit 5392e5af70
31 changed files with 3859 additions and 265 deletions

View File

@@ -390,3 +390,77 @@ export async function cancelRoutineConfirmation(
body: JSON.stringify({ routine_id: routineId }),
})
}
/**
* Parent approves a pending routine confirmation (awards points).
*/
export async function approveRoutine(childId: string, confirmationId: string): Promise<Response> {
return fetch(`/api/child/${childId}/approve-routine/${confirmationId}`, {
method: 'POST',
})
}
/**
* Parent rejects a pending routine confirmation (no points, resets to available).
*/
export async function rejectRoutine(childId: string, confirmationId: string): Promise<Response> {
return fetch(`/api/child/${childId}/reject-routine/${confirmationId}`, {
method: 'POST',
})
}
/**
* Parent resets an approved routine (routine can be confirmed again).
*/
export async function resetRoutine(childId: string, confirmationId: string): Promise<Response> {
return fetch(`/api/child/${childId}/reset-routine/${confirmationId}`, {
method: 'POST',
})
}
/**
* Parent triggers a routine directly (awards points immediately).
*/
export async function triggerRoutineAsParent(
childId: string,
routineId: string,
): Promise<Response> {
return fetch(`/api/child/${childId}/trigger-routine`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ routine_id: routineId }),
})
}
/**
* Assign a single routine to a child.
*/
export async function assignRoutine(childId: string, routineId: string): Promise<Response> {
return fetch(`/api/child/${childId}/assign-routine`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ routine_id: routineId }),
})
}
/**
* Remove a single routine assignment from a child.
*/
export async function removeRoutine(childId: string, routineId: string): Promise<Response> {
return fetch(`/api/child/${childId}/remove-routine`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ routine_id: routineId }),
})
}
/**
* Replace all routine assignments for a child.
*/
export async function setChildRoutines(childId: string, routineIds: string[]): Promise<Response> {
return fetch(`/api/child/${childId}/set-routines`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ routine_ids: routineIds }),
})
}