fix: 7 UX bugs across dashboard, tasks, projects, calendar, settings
- Dashboard: fetch project progress from /api/projects/[id]/progress - Tasks List: add DropdownMenuTrigger to More options button - Projects: add New project button with CreateItemDialog integration - Settings: use color picker value when creating domains - Calendar: use dynamic domain options instead of hardcoded list - Dashboard: make View all button navigate to /tasks - Dashboard: domain names already resolved via domainMap (verified working)
This commit is contained in:
@@ -26,7 +26,21 @@ export function ProjectProgressWidget() {
|
||||
);
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
setProjects(data.items || []);
|
||||
const items = data.items || [];
|
||||
// Fetch progress for each project since the list API doesn't include it
|
||||
const withProgress = await Promise.all(
|
||||
items.map(async (p: { id: string; name: string }) => {
|
||||
try {
|
||||
const progRes = await fetch(`/api/projects/${p.id}/progress`);
|
||||
if (progRes.ok) {
|
||||
const progData = await progRes.json();
|
||||
return { ...p, progress: progData.progress ?? 0 };
|
||||
}
|
||||
} catch {}
|
||||
return { ...p, progress: 0 };
|
||||
})
|
||||
);
|
||||
setProjects(withProgress);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch projects:', error);
|
||||
|
||||
@@ -5,6 +5,7 @@ import { CheckCircle2, Circle, ListTodo } from 'lucide-react';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
interface Task {
|
||||
id: string;
|
||||
@@ -20,11 +21,25 @@ export function TodayTasksWidget() {
|
||||
const [tasks, setTasks] = useState<Task[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [domainMap, setDomainMap] = useState<Map<string, string>>(new Map());
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
fetchTasks();
|
||||
fetchDomains();
|
||||
}, []);
|
||||
|
||||
async function fetchDomains() {
|
||||
try {
|
||||
const res = await fetch("/api/domains?sort=sort_order");
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
const map = new Map<string, string>();
|
||||
for (const d of data.items || []) map.set(d.id, d.name);
|
||||
setDomainMap(map);
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
async function fetchTasks() {
|
||||
try {
|
||||
const response = await fetch(
|
||||
@@ -63,7 +78,7 @@ export function TodayTasksWidget() {
|
||||
<ListTodo className="h-4 w-4" aria-hidden="true" />
|
||||
Today's Tasks
|
||||
</CardTitle>
|
||||
<Button variant="ghost" size="sm" className="h-7 text-xs">
|
||||
<Button variant="ghost" size="sm" className="h-7 text-xs" onClick={() => router.push('/tasks')}>
|
||||
View all
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user