# TaskFlow - Project Management App

A modern, feature-rich project management application built with Next.js 14, TypeScript, Tailwind CSS, and Firebase.

![TaskFlow Dashboard](https://via.placeholder.com/800x400?text=TaskFlow+Dashboard)

## 🚀 Features

### Project Management
- ✅ Create, edit, and delete projects
- ✅ Project status tracking (Planned, Active, Completed)
- ✅ Project progress visualization
- ✅ Custom project colors

### Task Management
- ✅ Create, edit, and delete tasks
- ✅ Task status (To Do, In Progress, Review, Done)
- ✅ Priority levels (Low, Medium, High)
- ✅ Due dates and assignees
- ✅ Subtasks support

### Kanban Board
- ✅ Drag-and-drop task management
- ✅ Visual status columns
- ✅ Real-time updates
- ✅ Task reordering

### Collaboration
- ✅ Task comments
- ✅ File attachments (Firebase Storage)
- ✅ Activity log per project
- ✅ Real-time updates

### Dashboard
- ✅ Project overview statistics
- ✅ Task distribution charts
- ✅ Overdue task tracking
- ✅ Recent activity feed

### UI/UX
- ✅ Dark/Light mode toggle
- ✅ Fully responsive design
- ✅ Beautiful animations
- ✅ Accessible components (ARIA)

## 🛠️ Tech Stack

- **Framework**: Next.js 14 (App Router)
- **Language**: TypeScript
- **Styling**: Tailwind CSS
- **UI Components**: ShadCN/UI + Radix UI
- **State Management**: Zustand
- **Backend**: Firebase (Firestore + Storage)
- **Drag & Drop**: dnd-kit
- **Icons**: Lucide React
- **Date Handling**: date-fns

## 📦 Installation

### Prerequisites
- Node.js 18+ installed
- Firebase project created
- npm or yarn package manager

### 1. Clone the repository

```bash
git clone https://github.com/yourusername/project-manager.git
cd project-manager
```

### 2. Install dependencies

```bash
npm install
```

### 3. Configure Firebase

1. Go to [Firebase Console](https://console.firebase.google.com/)
2. Create a new project or use existing one
3. Enable **Firestore Database**
4. Enable **Firebase Storage**
5. Go to Project Settings > General > Your apps
6. Create a Web app and copy the config

### 4. Set up environment variables

Create a `.env.local` file in the root directory:

```env
# Firebase Configuration
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key_here
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project_id.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id_here
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project_id.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id_here
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id_here
```

### 5. Set up Firestore Security Rules

In Firebase Console > Firestore > Rules, add:

```javascript
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    // Allow read/write access to all documents (for demo purposes)
    // For production, implement proper authentication rules
    match /{document=**} {
      allow read, write: if true;
    }
  }
}
```

### 6. Set up Storage Security Rules

In Firebase Console > Storage > Rules, add:

```javascript
rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if true;
    }
  }
}
```

> ⚠️ **Note**: These rules allow open access for demo purposes. For production, implement proper authentication and security rules.

### 7. (Optional) Seed demo data

```bash
npm run seed
```

### 8. Run the development server

```bash
npm run dev
```

Open [http://localhost:3000](http://localhost:3000) in your browser.

## 📁 Project Structure

```
project-manager/
├── app/                    # Next.js App Router pages
│   ├── layout.tsx          # Root layout with providers
│   ├── page.tsx            # Dashboard page
│   ├── projects/
│   │   ├── page.tsx        # Projects list page
│   │   └── [id]/
│   │       └── page.tsx    # Project detail page
│   ├── loading.tsx         # Loading UI
│   ├── error.tsx           # Error UI
│   └── not-found.tsx       # 404 page
├── components/
│   ├── ui/                 # ShadCN UI components
│   ├── layout/             # Layout components
│   ├── dashboard/          # Dashboard components
│   ├── projects/           # Project components
│   ├── tasks/              # Task components
│   ├── comments/           # Comment components
│   ├── files/              # File upload components
│   └── activity/           # Activity feed components
├── lib/
│   ├── firebase.ts         # Firebase config
│   ├── firebase/           # Firebase operations
│   ├── store/              # Zustand stores
│   ├── types.ts            # TypeScript types
│   └── utils.ts            # Utility functions
├── scripts/
│   └── seed.ts             # Database seed script
└── public/                 # Static assets
```

## 🗄️ Firebase Data Models

### Projects Collection
```typescript
{
  id: string;
  name: string;
  description: string;
  status: 'planned' | 'active' | 'completed';
  startDate: Timestamp;
  endDate: Timestamp;
  color?: string;
  taskCount?: number;
  completedTaskCount?: number;
  createdAt: Timestamp;
  updatedAt: Timestamp;
}
```

### Tasks Collection
```typescript
{
  id: string;
  projectId: string;
  title: string;
  description: string;
  status: 'todo' | 'inprogress' | 'review' | 'done';
  priority: 'low' | 'medium' | 'high';
  dueDate: Timestamp;
  assignedTo: string;
  subtasks: Subtask[];
  attachments: FileAttachment[];
  order: number;
  createdAt: Timestamp;
  updatedAt: Timestamp;
}
```

### Comments Collection
```typescript
{
  id: string;
  taskId: string;
  projectId: string;
  authorName: string;
  content: string;
  createdAt: Timestamp;
  updatedAt: Timestamp;
}
```

### Activity Logs Collection
```typescript
{
  id: string;
  projectId: string;
  taskId?: string;
  action: ActivityAction;
  actorName: string;
  description: string;
  metadata?: Record<string, unknown>;
  createdAt: Timestamp;
  updatedAt: Timestamp;
}
```

## 🚀 Deployment

### Deploy to Vercel

1. Push your code to GitHub
2. Import the project in [Vercel](https://vercel.com)
3. Add environment variables in Vercel project settings
4. Deploy!

```bash
# Or deploy via CLI
npm i -g vercel
vercel
```

### Environment Variables for Production

Add these environment variables in your Vercel project settings:

- `NEXT_PUBLIC_FIREBASE_API_KEY`
- `NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN`
- `NEXT_PUBLIC_FIREBASE_PROJECT_ID`
- `NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET`
- `NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID`
- `NEXT_PUBLIC_FIREBASE_APP_ID`

## 📝 Available Scripts

```bash
npm run dev       # Start development server
npm run build     # Build for production
npm run start     # Start production server
npm run lint      # Run ESLint
npm run seed      # Seed demo data to Firebase
```

## 🎨 Customization

### Theme Colors
Edit `app/globals.css` to customize the color scheme:

```css
:root {
  --primary: 262 83% 58%;
  --primary-foreground: 210 20% 98%;
  /* ... other CSS variables */
}
```

### Project Colors
Edit `lib/types.ts` to add/modify project colors:

```typescript
export const PROJECT_COLORS = [
  '#8B5CF6', // Purple
  '#3B82F6', // Blue
  // ... add more colors
] as const;
```

## 🤝 Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🙏 Acknowledgments

- [Next.js](https://nextjs.org/)
- [Tailwind CSS](https://tailwindcss.com/)
- [ShadCN/UI](https://ui.shadcn.com/)
- [Firebase](https://firebase.google.com/)
- [dnd-kit](https://dndkit.com/)
- [Lucide Icons](https://lucide.dev/)

---

Made with ❤️ by TaskFlow Team

