πŸ‘¨β€πŸ’Ό Welcome to the Epic Task Manager! This is a real-world React application where you'll practice all the TypeScript skills you've learned in this workshop. You'll implement utility functions that power a task management dashboard.

What You'll Build

This app helps teams manage projects and tasks. You'll implement:
  • Type definitions for projects, tasks, and users
  • Discriminated unions for project status tracking
  • Generic functions for filtering and updating tasks
  • Type narrowing for handling user roles and assignments
  • Union types for priorities and user roles

Getting Started

🐨 Open
src/utils.ts
and implement all the type definitions and utility functions. Each function has 🐨 instructions explaining what to do.
🐨 Then open
src/app.tsx
and use your utility functions to make the app fully functional. Look for 🐨 comments indicating where to use your functions.

Running the App

npm run dev
The app will start on http://localhost:5173 (or another port if 5173 is busy).

What to Implement

In utils.ts:

  1. Type Definitions - ProjectStatus, Priority, Task, UserRole, User (replace the any placeholders)
  2. formatProjectStatus - exact strings:
    • planning β†’ Project is in planning phase
    • active β†’ Project started on {startDate}
    • completed β†’ Project completed on {endDate} (started {startDate})
  3. filterByPriority - return items whose priority matches the given value
  4. getUserDisplayName - null β†’ Unassigned; otherwise {name} ({role})
  5. canManageTasks - true for 'admin' / 'manager', otherwise false
  6. updateTaskProperty - return a new task with one property updated
  7. getTasksByAssignee - filter by assigneeId, including the null (unassigned) case
  8. createProjectUpdate - takes current status plus 'start' | 'complete' and returns the next ProjectStatus. On 'start', move planning β†’ active and set startDate. On 'complete', move active β†’ completed, keep startDate, and set endDate. Choose ISO date strings inside this helper (the function signature does not take a date argument).

In app.tsx:

  1. Use filterByPriority when a priority other than 'all' is selected
  2. Use getTasksByAssignee with selectedUserId
  3. Use formatProjectStatus for statusDisplay
  4. Use updateTaskProperty to toggle completed in handleTaskToggle
  5. Call createProjectUpdate from the start/complete handlers and store the returned status (dates are produced by the helper, not passed from the UI)

What success looks like

With npm run dev open:
  • Priority and assignee filters change which tasks appear
  • Project status text matches formatProjectStatus for planning / active / completed
  • Start / Complete project buttons transition status and update the status text
  • Toggling a task updates its completed state through updateTaskProperty
  • Assignee labels use getUserDisplayName (including Unassigned)
  • Manage-task UI respects canManageTasks for the current user's role

Tips

πŸ’° Start with the type definitions - they'll help TypeScript guide you as you implement the functions.
πŸ’° Use type narrowing (typeof, instanceof, or discriminated unions) to handle different cases safely.
πŸ’° Generic constraints ensure your functions work with any type that has the required properties.
πŸ’° Discriminated unions make it easy to handle different variants of a type safely.

No Tests, No Solutions

πŸ“ This is practice time! There are no tests or solutions. Experiment, make mistakes, and learn. The goal is to build confidence by applying what you've learned.

Please set the playground first

Loading "Epic Task Manager"
Login to get access to the exclusive discord channel.
Loading Discord Posts