Add project selector in task detail, archive completed tasks

This commit is contained in:
2026-01-28 18:41:11 +00:00
parent b87cb69ae0
commit 4b753cb57a
9 changed files with 177 additions and 21 deletions

View File

@@ -5,6 +5,7 @@ import { cn } from '@/lib/utils';
import { useTasksStore } from '@/stores/tasks';
import { TaskItem } from '@/components/TaskItem';
import { AddTask } from '@/components/AddTask';
import { CompletedSection } from '@/components/CompletedSection';
import { BoardView } from '@/pages/Board';
import { api } from '@/lib/api';
import type { Project as ProjectType, Section } from '@/types';
@@ -13,7 +14,7 @@ export function ProjectPage() {
const { id } = useParams<{ id: string }>();
const location = useLocation();
const navigate = useNavigate();
const { tasks, isLoading, fetchTasks, setSelectedTask } = useTasksStore();
const { tasks, completedTasks, isLoading, fetchTasks, fetchCompletedTasks, setSelectedTask } = useTasksStore();
const [project, setProject] = useState<ProjectType | null>(null);
const [sections, setSections] = useState<Section[]>([]);
@@ -22,6 +23,7 @@ export function ProjectPage() {
useEffect(() => {
if (!id) return;
fetchTasks({ projectId: id, completed: false });
fetchCompletedTasks({ projectId: id });
api.getProject(id).then((p) => {
setProject(p);
setSections(p.sections || []);
@@ -138,6 +140,9 @@ export function ProjectPage() {
<AddTask projectId={id} sectionId={section.id} />
</div>
))}
{/* Completed tasks */}
<CompletedSection tasks={completedTasks} />
</>
)}
</div>