ericchang00's picture
add screenshot42-taskmanager-projectdetail task (build 2ecba08)
160f5ce verified
|
Raw History Blame Contribute Delete
4.62 kB
# Implement the missing Project detail (Kanban) page
The TaskFlow React + Flask app at `/app/` is missing the `/projects/:id` route. A reference screenshot of the desired page (rendered for project 1 "Apollo" with 4 tasks across 3 columns) is at **`/app/reference.png`** (1280×900).
## Your task
1. Create `/app/frontend/src/components/ProjectDetail.jsx` implementing the page shown.
2. Edit `/app/frontend/src/App.jsx` — add `import ProjectDetail from './components/ProjectDetail';` near the other component imports, and add `<Route path="/projects/:id" element={<ProjectDetail />} />` inside the `<Routes>` block.
## Context
- The route uses `useParams()` to read `id` from the URL.
- API helpers in `/app/frontend/src/api.js`:
- `getProjectDetail(id)` → `{id, name, description, archived, members: [{id, name, role}]}`
- `getProjectStats(id)` → `{total_tasks, completion_rate, by_status: {todo, in_progress, done}, overdue_count}`
- `getProjectActivities(id)` → `[{id, action, user_name, task_title, field, old_value, new_value, created_at}, ...]`
- `getProjectTasks(id, filters = {})` → array of task objects; filters object is passed as query params (status, priority, assigned_to, tag)
- `updateTask(taskId, data)` → PUT `/api/tasks/<id>`
- `deleteTask(taskId)` → DELETE `/api/tasks/<id>` (uses `confirm()` to gate)
- `updateProject(id, data)` → PUT `/api/projects/<id>` (used by Archive button)
- `getTags()` → tag list for the filter
- Sibling components for styling: `Dashboard.jsx`, `AddTask.jsx`, `TaskDetail.jsx`. CSS in `App.css` — use only existing classes (sample relevant ones): `back-link`, `error-msg`, `project-header`, `project-header-actions`, `archived-badge`, `btn`, `btn-primary`, `btn-secondary`, `btn-danger`, `btn-sm`, `stats-bar`, `stat-item`, `stat-value`, `stat-label`, `stat-overdue`, `members-bar`, `member-chip`, `user-avatar`, `role-badge`, `filter-bar`, `filter-select`, `card`, `card-header`, `activity-feed`, `activity-item`, `activity-dot`, `activity-content`, `activity-text`, `activity-time`, `kanban-board`, `kanban-column`, `kanban-column-title`, `kanban-column-count`, `kanban-card`, `kanban-card-title`, `kanban-card-tags`, `tag-badge-sm`, `kanban-card-meta`, `priority-badge`, `status-select`, `loading`.
## Layout
- **Back link** at top: `<Link to="/" className="back-link">← Back to Dashboard</Link>`.
- **Header row** (`project-header`): `<h1>{project.name}</h1>` (with optional `archived-badge`) + optional description; on the right (`project-header-actions`): `+ Add Task` link to `/projects/<id>/add-task`, `Archive`/`Unarchive` button (toggles via `updateProject`), `Activity`/`Hide Activity` button (toggles `showActivity`).
- **Stats bar** (`stats-bar`): 4 `stat-item` cards — Total Tasks, Complete (formatted as `<n>%`), In Progress (from `by_status.in_progress`), Overdue (with `stat-overdue` value class).
- **Members bar** (`members-bar`): one `member-chip` per project member; chip shows `user-avatar` (uppercase first letter) + name + optional `role-badge` "admin" if role='admin'.
- **Filter bar** (`filter-bar`): four `filter-select`s — Status (All Statuses / To Do / In Progress / Done), Priority (All Priorities / High / Medium / Low), Members (All Members / one per project member), Tags (All Tags / one per tag from `getTags`). When any filter is non-empty, show a Clear Filters button. Changing any filter calls `getProjectTasks(id, filters)` and replaces the visible task list (filter is server-side, not client-side filter on a cached list).
- **Activity sidebar** (only when `showActivity` true): a card showing activity feed entries with relative timestamps (just now / Nm ago / Nh ago / Nd ago).
- **Kanban board** (`kanban-board`): three columns — `To Do`, `In Progress`, `Done`. Each column header has the column name + a `kanban-column-count` showing the number of tasks in that column. Tasks are bucketed by their `status` field.
- Each task card (`kanban-card`) contains: title (linked to `/tasks/<id>`), optional tags (`tag-badge-sm` styled with backgroundColor `t.color + '22'`, color `t.color`), priority badge (`priority-badge <task.priority>`), assignee or "Unassigned", optional due date, optional comment count, and bottom row with a status `<select className="status-select">` (To Do / In Progress / Done) + a Delete button. Changing the status-select calls `updateTask(taskId, {status: newValue})` then reloads data; clicking Delete uses `confirm()` then `deleteTask(taskId)` then reloads.
Dependencies are pre-installed. Do not start any servers — the verifier handles that.