fix(audit): P2 frontend any→concrete types (181→61), heroicons→lucide-react, missing type exports, toast API, Select options, TaskStatus types; P2-9 hooks.py type annotations

This commit is contained in:
Agent Zero
2026-08-17 22:24:24 +02:00
parent 40fd633917
commit 45ebbee26f
52 changed files with 404 additions and 302 deletions
+12 -10
View File
@@ -2,6 +2,7 @@
* Tasks page — list with filter, create modal, detail.
*/
import { asError } from '@/utils/errorTypes';
import React, { useState, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/Button';
@@ -20,6 +21,7 @@ import {
useUpdateTaskStatus,
type Task,
type TaskFilter,
type TaskStatus,
} from '@/api/tasks';
const STATUS_COLORS: Record<string, 'secondary' | 'info' | 'success'> = {
@@ -96,8 +98,8 @@ export function TasksPage() {
});
toast.success(t('tasks.created'));
setCreateModalOpen(false);
} catch (err: any) {
toast.error(err.message || t('common.error'));
} catch (err: unknown) { const errObj = asError(err);
toast.error(errObj.message || t('common.error'));
}
};
@@ -107,8 +109,8 @@ export function TasksPage() {
await updateMutation.mutateAsync({ id: editingTask.id, data: formData });
toast.success(t('tasks.updated'));
setEditingTask(null);
} catch (err: any) {
toast.error(err.message || t('common.error'));
} catch (err: unknown) { const errObj = asError(err);
toast.error(errObj.message || t('common.error'));
}
};
@@ -118,17 +120,17 @@ export function TasksPage() {
await deleteMutation.mutateAsync(task.id);
toast.success(t('tasks.deleted'));
setSelectedTask(null);
} catch (err: any) {
toast.error(err.message || t('common.error'));
} catch (err: unknown) { const errObj = asError(err);
toast.error(errObj.message || t('common.error'));
}
};
const handleStatusChange = async (task: Task, newStatus: string) => {
const handleStatusChange = async (task: Task, newStatus: TaskStatus) => {
try {
await statusMutation.mutateAsync({ id: task.id, status: newStatus });
toast.success(t('tasks.statusUpdated'));
} catch (err: any) {
toast.error(err.message || t('common.error'));
} catch (err: unknown) { const errObj = asError(err);
toast.error(errObj.message || t('common.error'));
}
};
@@ -163,7 +165,7 @@ export function TasksPage() {
{ value: 'done', label: t('tasks.statusDone') },
]}
value={filter.status || ''}
onChange={(e) => { setFilter(f => ({ ...f, status: e.target.value || undefined })); setPage(1); }}
onChange={(e) => { setFilter(f => ({ ...f, status: (e.target.value || undefined) as TaskStatus | undefined })); setPage(1); }}
className="w-40"
/>
<Select