Files
mock/components/CreateTaskDialog.tsx
Your Name bf1dbe39a8 Initial commit: Agile Project Manager
- Complete React + TypeScript application with Vite
- Dashboard with charts and metrics visualization
- Kanban board with drag-and-drop functionality
- Product backlog management with user stories
- Sprint planning and tracking features
- Comprehensive UI component library (shadcn/ui)
- Tailwind CSS styling with dark mode support
- Context-based state management
- Mock data for immediate testing and demonstration
2025-10-24 17:58:09 -07:00

88 lines
2.5 KiB
TypeScript

import React, { useState } from 'react';
import { Dialog, DialogContent, DialogHeader, DialogTitle } from './ui/dialog';
import { Button } from './ui/button';
import { Input } from './ui/input';
import { Textarea } from './ui/textarea';
import { Label } from './ui/label';
import { useApp } from '../contexts/AppContext';
interface CreateTaskDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
userStoryId: string;
}
export const CreateTaskDialog: React.FC<CreateTaskDialogProps> = ({
open,
onOpenChange,
userStoryId
}) => {
const { addTask } = useApp();
const [title, setTitle] = useState('');
const [description, setDescription] = useState('');
const [timeComplexity, setTimeComplexity] = useState('');
const handleCreate = () => {
if (title.trim()) {
addTask({
title,
description,
timeComplexity,
status: 'todo',
userStoryId
});
setTitle('');
setDescription('');
setTimeComplexity('');
onOpenChange(false);
}
};
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="sm:max-w-[500px]">
<DialogHeader>
<DialogTitle>Create New Task</DialogTitle>
</DialogHeader>
<div className="space-y-4 py-4">
<div className="space-y-2">
<Label htmlFor="title">Task Title</Label>
<Input
id="title"
value={title}
onChange={(e) => setTitle(e.target.value)}
placeholder="Enter task title"
/>
</div>
<div className="space-y-2">
<Label htmlFor="description">Task Description</Label>
<Textarea
id="description"
value={description}
onChange={(e) => setDescription(e.target.value)}
placeholder="Enter task description"
rows={4}
/>
</div>
<div className="space-y-2">
<Label htmlFor="complexity">Time Complexity</Label>
<Input
id="complexity"
value={timeComplexity}
onChange={(e) => setTimeComplexity(e.target.value)}
placeholder="e.g., 4 hours, 2 days"
/>
</div>
</div>
<div className="flex justify-end gap-2">
<Button variant="outline" onClick={() => onOpenChange(false)}>
Cancel
</Button>
<Button onClick={handleCreate}>Create</Button>
</div>
</DialogContent>
</Dialog>
);
};