- Created TaskList component with WeeklyTaskItem - Created WeeklyCalendarView component with drag-and-drop functionality - Created main tasks page with integration - Added TaskForm component for creating new tasks - Implemented navigation controls for week switching - Added responsive styling for all components Files created: - src/components/TaskList.tsx - src/components/WeeklyCalendarView.tsx - src/app/tasks/page.tsx - src/components/TaskForm.tsx - src/components/WeeklyTaskItem.tsx - src/app/globals.css
41 lines
890 B
TypeScript
41 lines
890 B
TypeScript
import React from 'react';
|
|
|
|
interface Task {
|
|
id: string;
|
|
title: string;
|
|
description?: string;
|
|
completed: boolean;
|
|
startTime?: string;
|
|
endTime?: string;
|
|
dayOfWeek?: number; // 0 = Sunday, 1 = Monday, etc.
|
|
}
|
|
|
|
interface WeeklyTaskItemProps {
|
|
task: Task;
|
|
onClick?: () => void;
|
|
}
|
|
|
|
const WeeklyTaskItem: React.FC<WeeklyTaskItemProps> = ({ task, onClick }) => {
|
|
const handleTaskClick = () => {
|
|
if (onClick) {
|
|
onClick();
|
|
}
|
|
};
|
|
|
|
return (
|
|
<div
|
|
className={`task-item ${task.completed ? 'completed' : ''} weekly-task`}
|
|
onClick={handleTaskClick}
|
|
>
|
|
<h4>{task.title}</h4>
|
|
{task.description && <p>{task.description}</p>}
|
|
{task.startTime && task.endTime && (
|
|
<div className="time-indicator">
|
|
<span>{task.startTime} - {task.endTime}</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default WeeklyTaskItem; |