This project is a versatile and interactive monthly calendar timeline built with React and TypeScript. It supports event management with drag-and-drop functionality, resource allocation, and responsive design. The calendar provides an intuitive interface for viewing and managing events across different resources.
- Event Management: Create, update, and delete events.
- Resource Allocation: Add and manage resources.
- Drag-and-Drop: Move and resize events using drag-and-drop.
- Interactive Modals: Edit events and resources through modals.
- Responsive Design: Adjusts to different screen sizes.
- Dynamic Color Coding: Events can be color-coded for better visibility.
- Save Events and Resources in Local Storage
- Resizeable EventBar from both sides
To set up this project locally, follow these steps:
-
Clone the Repository
git clone https://github.com/devmustafa03/monthly-calendar-timeline.git
-
Navigate to the Project Directory
cd monthly-calendar-timeline
-
Install Dependencies
Make sure you have Node.js and npm installed. Then, run:
npm install
-
Start the Development Server
npm run dev
This will start the development server and open the application in your default web browser.
The CalendarProvider
component uses React Context and Reducer to manage the state of the calendar. It provides the following functionalities:
createEvent(date: Dayjs, resource: string)
: Creates a new event and adds it to the calendar.
FinalCalendar
: The main calendar component that integrates the header, grid, and modals.CalendarHeader
: Displays the current month and provides navigation and resource management.CalendarGrid
: Renders the calendar cells for each day and resource.CalendarCell
: A cell in the calendar grid where events are displayed and managed.EventBar
: Represents an event in the calendar with drag-and-drop and resizing capabilities.EventModal
: A modal for creating or editing events.ResourceModal
: A modal for adding new resources.
useCalendar
: Custom hook for accessing the calendar context and dispatching actions.
- State:
CalendarState
includes events, resources, and the current date. - Actions:
ADD_EVENT
: Adds a new event to the calendar.UPDATE_EVENT
: Updates an existing event.DELETE_EVENT
: Deletes an event.ADD_RESOURCE
: Adds a new resource.SET_CURRENT_DATE
: Sets the current date in the calendar.
src/
: Contains all source files.components/
: React components.context/
: Calendar context and provider.hooks/
: Custom React hooks.types/
: TypeScript type definitions.utils/
: Utility functions and constants.
- React: For building the user interface.
- Day.js: For date manipulation.
- React DnD: For drag-and-drop functionality.
- Tailwind CSS: For styling.
- Dayjs library: I learn to use dayjs for finding date calculate the timing finding the between range using isBetween. This library ease work of calculation.
- Drag Drop Feature: I learn how to use react-dnd library to implement drag n drop between cells.
- Resizable event bar: I learn about how to merge the date and time to implement resizability of the event bars.
The main difficult part is to implement the overlaping of the multiple events so I make them come below the previous ones but it doen't cover some edge cases.
I would make the UX more smooth, implement dark and light mode, added language support other than english and a collab feature.
For any questions or feedback, please contact [email protected].