mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 23:21:08 +02:00
fix(manacore): fix white screen when toggling todo completion in dashboard
Task links pointed to non-existent /task/{id} route in Todo app, causing
navigation to a 404 page. Replace passive checkbox div with interactive
button that toggles completion via API, and fix links to open Todo app root.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7da67febd1
commit
73d5529495
3 changed files with 30 additions and 2 deletions
|
|
@ -160,6 +160,32 @@ export const todoService = {
|
|||
return { data: result.data.projects || [], error: null };
|
||||
},
|
||||
|
||||
/**
|
||||
* Mark a task as complete
|
||||
*/
|
||||
async completeTask(id: string): Promise<ApiResult<Task>> {
|
||||
const result = await getClient().post<{ task: Task }>(`/tasks/${id}/complete`);
|
||||
|
||||
if (result.error || !result.data) {
|
||||
return { data: null, error: result.error };
|
||||
}
|
||||
|
||||
return { data: result.data.task, error: null };
|
||||
},
|
||||
|
||||
/**
|
||||
* Mark a task as incomplete
|
||||
*/
|
||||
async uncompleteTask(id: string): Promise<ApiResult<Task>> {
|
||||
const result = await getClient().post<{ task: Task }>(`/tasks/${id}/uncomplete`);
|
||||
|
||||
if (result.error || !result.data) {
|
||||
return { data: null, error: result.error };
|
||||
}
|
||||
|
||||
return { data: result.data.task, error: null };
|
||||
},
|
||||
|
||||
/**
|
||||
* Get task count summary
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
const totalCount = $derived((data || []).length);
|
||||
|
||||
// Track tasks being toggled (for optimistic UI)
|
||||
let togglingIds = $state<Set<string>>(new Set());
|
||||
let togglingIds: Set<string> = $state(new Set());
|
||||
|
||||
async function handleToggleComplete(e: MouseEvent, task: Task) {
|
||||
e.preventDefault();
|
||||
|
|
|
|||
|
|
@ -108,7 +108,9 @@
|
|||
<div class="space-y-1">
|
||||
{#each displayedTasks as task}
|
||||
<a
|
||||
href="{todoUrl}/task/{task.id}"
|
||||
href={todoUrl}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="flex items-center gap-2.5 rounded-lg px-2 py-1.5 transition-colors hover:bg-surface-hover"
|
||||
>
|
||||
<!-- Priority dot -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue