- Implemented navigation controls with week switching and view toggling - Added drag-and-drop functionality for task reorganization - Enhanced UI with visual feedback and delete confirmation - Implemented complete recurring task functionality - Created tag/category assignment system - Added reminder notification mechanism - Enhanced task prioritization - Expanded description capabilities SUMMARY: .planning/phases/02-ux-and-advanced-features/02-04-SUMMARY.md
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import React, { createContext, useContext, ReactNode } from 'react';
|
|
|
|
// Define types for drag and drop
|
|
export interface DragItem {
|
|
type: 'task';
|
|
taskId: string;
|
|
sourceDay: string;
|
|
}
|
|
|
|
export interface DropResult {
|
|
taskId: string;
|
|
targetDay: string;
|
|
}
|
|
|
|
// Create context for drag and drop
|
|
interface DragDropContextType {
|
|
dragItem: DragItem | null;
|
|
setDragItem: (item: DragItem | null) => void;
|
|
onDrop: (result: DropResult) => void;
|
|
}
|
|
|
|
const DragDropContext = createContext<DragDropContextType | undefined>(undefined);
|
|
|
|
// Provider component
|
|
export const DragDropProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
|
|
const [dragItem, setDragItem] = React.useState<DragItem | null>(null);
|
|
|
|
const onDrop = (result: DropResult) => {
|
|
// This will be implemented by the consumer
|
|
console.log('Dropped task:', result);
|
|
};
|
|
|
|
return (
|
|
<DragDropContext.Provider value={{ dragItem, setDragItem, onDrop }}>
|
|
{children}
|
|
</DragDropContext.Provider>
|
|
);
|
|
};
|
|
|
|
// Hook to use drag and drop context
|
|
export const useDragDrop = () => {
|
|
const context = useContext(DragDropContext);
|
|
if (!context) {
|
|
throw new Error('useDragDrop must be used within a DragDropProvider');
|
|
}
|
|
return context;
|
|
}; |