A sophisticated Todo application built with React and TypeScript, implementing software engineering best practices and modern architectural patterns.
- β Task management with multiple priority levels
- π Advanced search and filtering capabilities
- π Real-time task statistics
- π¨ Modern and interactive design
- π± Responsive design for all devices
- β‘ Optimized performance with best practices
- React 18 - Core UI library
- TypeScript - Type safety and better developer experience
- Tailwind CSS - Utility-first CSS framework
- Lucide React - Modern icon library
useState- Local state managementuseReducer- Complex state managementuseMemo- Performance optimization and memoizationuseCallback- Preventing unnecessary re-renders
private taskMap: Map<string, Task> = new Map();- Purpose: O(1) fast task lookup
- Benefit: Accelerates task finding and updating operations
private priorityOrder = { high: 3, medium: 2, low: 1 };- Purpose: Task ordering by priority
- Benefit: Display high-priority tasks first
filterTasks(tasks, filter, searchQuery, priorityFilter)- Purpose: Efficient multi-criteria filtering
- Complexity: O(n log n) for filtering and sorting
- Fast filtering using multiple predicates
- Advanced sorting by priority and date
// Each component has a single responsibility
const TaskItem = () => {} // Display task only
const TaskForm = () => {} // Create tasks only
const TaskFilters = () => {} // Filtering only
const TaskStats = () => {} // Statistics only// TaskAction types are extensible without modifying existing code
type TaskAction =
| { type: 'ADD_TASK'; payload: Omit<Task, 'id' | 'createdAt'> }
| { type: 'UPDATE_TASK'; payload: { id: string; updates: Partial<Task> } }
// New types can be added without modifying existing ones// All Task components are substitutable with the base interface
interface Task {
id: string;
title: string;
// ... other properties
}// Small, specific interfaces
interface TaskItemProps {
task: Task;
onToggle: (id: string) => void;
onDelete: (id: string) => void;
onEdit: (id: string, updates: Partial<Task>) => void;
}// Components depend on abstractions, not concrete implementations
const TaskForm: React.FC<{ onAddTask: (task: Omit<Task, 'id' | 'createdAt'>) => void }>class TaskFactory {
static createTask(title, description, priority, dueDate, tags) {
return {
title: title.trim(),
description: description.trim(),
completed: false,
priority,
dueDate,
tags
};
}
}- Purpose: Consistent and unified Task object creation
const taskManager = new TaskManager();- Purpose: Ensure single instance of TaskManager
function taskReducer(state: TaskState, action: TaskAction): TaskState {
switch (action.type) {
case 'ADD_TASK':
case 'UPDATE_TASK':
case 'DELETE_TASK':
// ...
}
}- Purpose: Encapsulate operations in executable and reversible commands
type TaskAction =
| { type: 'ADD_TASK'; payload: Omit<Task, 'id' | 'createdAt'> }
| { type: 'UPDATE_TASK'; payload: { id: string; updates: Partial<Task> } }
// ...- Purpose: Define algorithm families and use them interchangeably
const { state, dispatch, filteredTasks, stats } = useTasks();- Purpose: Automatically notify components of state changes
// Clear and expressive names
const handleToggleTask = useCallback((id: string) => {
dispatch({ type: 'TOGGLE_TASK', payload: id });
}, [dispatch]);// Small, focused functions
const handleSave = useCallback(() => {
if (editTitle.trim()) {
onEdit(task.id, { title: editTitle.trim(), description: editDescription.trim() });
setIsEditing(false);
}
}, [editTitle, editDescription, task.id, onEdit]);// Pure functions without side effects
const filteredTasks = useMemo(() => {
return taskManager.filterTasks(
state.tasks,
state.filter,
state.searchQuery,
state.selectedPriority
);
}, [state.tasks, state.filter, state.searchQuery, state.selectedPriority]);// Don't Repeat Yourself - using Factory Pattern
const newTask = TaskFactory.createTask(title, description, priority);- Tailwind CSS Grid and Flexbox implementation
- Mobile-first responsive design for all screen sizes
- Smooth hover effects and transitions
- Visual feedback for user actions
- Interactive icons and buttons
const priorityColors = {
low: 'border-l-green-500 bg-green-50',
medium: 'border-l-yellow-500 bg-yellow-50',
high: 'border-l-red-500 bg-red-50'
};- Gradients and shadows implementation
- Material Design inspired components
- Clear typography hierarchy
const filteredTasks = useMemo(() => {
// expensive filtering operation
}, [dependencies]);const handleToggleTask = useCallback((id: string) => {
// stable reference
}, [dispatch]);- Map usage for O(1) fast lookups
- Avoiding unnecessary operations
- Total Tasks: Count of all tasks
- Completed Tasks: Finished tasks
- Active Tasks: Incomplete tasks
- High Priority Tasks: Important incomplete tasks
- β Add new tasks
- βοΈ Edit existing tasks
- ποΈ Delete tasks
- βοΈ Mark tasks as complete
- π Text search
- π Filter by status (All/Active/Completed)
- π― Filter by priority
- π§Ή Clear completed tasks
- π΄ High Priority
- π‘ Medium Priority
- π’ Low Priority
- Node.js (v14 or higher)
- npm or yarn
# Clone the repository
git clone https://github.com/abdelrahman-samy-dev/TaskMasterTS.git
# Navigate to project directory
cd TaskMasterTS
# Install dependencies
npm install
# Start development server
npm run devnpm run build-
Local Storage Integration
- Save tasks in browser storage
- Persist tasks on page reload
-
Drag & Drop
- Reorder tasks
- Change priority with drag and drop
-
Categories & Tags
- Task categorization
- Tag system implementation
-
Due Dates
- Task deadlines
- Overdue task notifications
-
Dark Mode
- Theme switching
- User preference persistence
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Abdelrahman Samy Ali
- GitHub: @abdelrahman-samy-dev
- LinkedIn: Abdelrahman Samy
- Email: abdelrahman.samy.dev@outlook.com
This application demonstrates best practices in:
- Software Architecture: SOLID principles and Design Patterns
- Performance: Optimized Data Structures and Algorithms
- Code Quality: Clean Code principles
- User Experience: Modern and interactive UI/UX
- Maintainability: Organized and extensible code
β Star this repository if you find it helpful!