Skip to content

connected the backend to the frontend - #21

Merged
Bishopukpai merged 2 commits into
mainfrom
features/production-tasks-backend
Aug 28, 2026
Merged

Bishopukpai merged 2 commits into
mainfrom
features/production-tasks-backend

Conversation

@Bishopukpai

Copy link
Copy Markdown
Owner

Task Frontend UI & API Integration

🚀 Summary

Connects the frontend production task UI to the backend API endpoints, introducing state management, real-time board interactivity, task modal creation, detail slide-overs, and type-safe member extraction.

This PR links the frontend Kanban interfaces directly to backend API routes (/api/projects/[projectId]/tasks and /api/tasks/[taskId]). Project teams can now create, inspect, update, and comment on tasks within the UI while maintaining dynamic local state and strict TypeScript compliance across varied user/membership data shapes.

The implementation establishes a clear operational workflow for:

  • Fetching project-scoped tasks with full population of assignees, authors, and actors.
  • Client-side state orchestration and error handling via a reusable hook.
  • Rendering production tasks visually across status columns and priority badges.
  • Dynamically updating task status, assignee allocation, and comment threads directly from the slide-over drawer.
  • Safe type-casting and member detail extraction without triggering @typescript-eslint/no-explicit-any ESLint errors.

Authenticated project members can now:

  • View task boards organized by status (Backlog, To Do, In Production, In Review, Done).
  • Spot priority levels using visual badges (LOW, MEDIUM, HIGH, URGENT).
  • Create tasks via a modal form and assign them to project members.
  • Open a detail drawer to adjust statuses and assignees on the fly.
  • Submit comments and instantly refresh the comment feed.
  • Review task audit logs showing system and member actions.

📦 Changes Made

🎨 Task Kanban Board Component

Updated ProductionTasksBoard (components/ProductionTasksBoard.tsx):

  • Integrated useProjectTasks to fetch initial task lists and bind mutation functions (createTask, updateTask).
  • Rendered tasks into multi-column Kanban layouts grouped by TaskStatus.
  • Added priority indicator badges using TaskPriority.
  • Provided a task creation modal with form controls for title, description, priority, status, assignee, and due date.
  • Added a slide-over details drawer providing real-time controls for changing task status, updating assignees, submitting comments, and reading activity logs.
  • Implemented strict, type-safe member parsing in getMemberDetails using unknown and property type checks to replace explicit any casts.

🎣 Custom Task Hook

Integrated useProjectTasks (hooks/useProjectTasks.ts):

  • Manages client-side fetch, loading, and error states for project tasks.
  • Encapsulates createTask API calls to handle payload formatting and local state prepend.
  • Encapsulates updateTask API calls for status changes, assignee updates, and comment additions with optimism/resynchronization.

🌐 API Integration Points

Connected client actions to backend routes:

  • GET /api/projects/[projectId]/tasks: Consumed by useProjectTasks on component mount to retrieve populated tasks.
  • POST /api/projects/[projectId]/tasks: Triggered by the task creation modal.
  • PATCH /api/tasks/[taskId]: Triggered via drawer selectors (status/assignee) and comment submission inputs.

💡 Why It Changed

Eliminating ESLint Violations

The helper function getMemberDetails previously relied on const m = member as Record<string, any>;, which triggered @typescript-eslint/no-explicit-any lint errors. Transitioning to unknown with runtime type narrowing resolves lint errors while strictly preserving robust support for both raw user objects and nested membership structures.

Connecting Visual Interfaces to Persistent Data

The visual board needed direct binding to asynchronous API operations so state modifications (such as updating task status or appending comments) reflect immediately in the UI without full page reloads.


🧪 How to Test

TypeScript & ESLint Validation

Run:

npx tsc --noEmit
npm run lint

Expected result: 0 errors, 0 warnings (no @typescript-eslint/no-explicit-any flags).

Create Task via UI Modal

  1. Navigate to a project page containing ProductionTasksBoard.
  2. Click Create Task.
  3. Fill out the form fields (Title, Description, Priority, Assignee, Due Date) and submit.

Expected behavior: The modal closes, and the newly created task card appears in the target status column.

Interacting with the Task Drawer

  1. Click on any task card on the board to open the slide-over drawer.
  2. Change the Status or Assignee dropdowns.
  3. Type a comment into the input field and click Send.

Expected behavior: Dropdown updates trigger background PATCH requests; the comment feed updates immediately; activity log reflects recent changes upon refresh.


📋 Pre-Merge Checklist

  • Replaced any types with unknown and runtime type guards in getMemberDetails
  • Bound ProductionTasksBoard UI to useProjectTasks hook
  • Verified task creation form submission and modal state resetting
  • Verified task detail drawer slide-over rendering and closing
  • Tested status transition dropdowns and assignee updates
  • Tested comment submission input and feed rendering
  • npx tsc --noEmit passes
  • npm run lint passes
  • No secrets or untracked local environment variables committed

🔐 Security & Safety Notes

  • Client-side state mutations rely strictly on API responses returned from session-validated endpoints.
  • Safe object extraction prevents runtime TypeError crashes when rendering dynamic or incomplete ProjectMember records.

🔄 Next Steps

  1. Drag-and-Drop Column Reordering: Integrate @hello-pangea/dnd into ProductionTasksBoard for intuitive drag-and-drop status changes.
  2. Real-time Task WebSockets/SSE: Push status updates and comment additions live to other active session users on the board.

@netlify

netlify Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for scenepilot ready!

Name Link
🔨 Latest commit 16fd2d9
🔍 Latest deploy log https://app.netlify.com/projects/scenepilot/deploys/6a915814bf5b1e00083d7ad5
😎 Deploy Preview https://deploy-preview-21--scenepilot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bd978182-24e0-4f3c-9381-74bf1c540e04


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Bishopukpai
Bishopukpai merged commit aa35f11 into main Aug 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant