41 |
42 | );
43 | }
44 |
45 | export default Header;
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Trello Clone
2 |
3 | Trello is a Trello-like web application built using Next.js, TypeScript, React Beautiful DnD for drag and drop functionality, and Zustand as state management. It provides a simple and intuitive interface for managing tasks with three columns: Todo, In Progress, and Done. Users can easily drag and drop columns and todos to organize their tasks efficiently.
4 |
5 |
6 |
7 | ## Features
8 |
9 | - Three Columns: The app consists of three columns - Todo, In Progress, and Done, representing different stages of task completion.
10 | - Drag and Drop: Users can easily drag and drop todos within columns or between columns to change their status and reorder them.
11 | - Add and Remove Todos: Users can add new todos to any column and remove existing todos when they are no longer needed.
12 | - Update Todo Status: By dragging a todo to a different column, users can update its status and move it to the corresponding stage.
13 | - Responsive Design: The app is designed to be responsive, ensuring a seamless experience across different devices and screen sizes.
14 |
15 | ## Technologies Used
16 |
17 | - [Next.js](https://nextjs.org/): A React framework for server-side rendering and building modern web applications.
18 | - [TypeScript](https://www.typescriptlang.org/): A typed superset of JavaScript that provides static type-checking.
19 | - [React Beautiful DnD](https://github.com/atlassian/react-beautiful-dnd): A library for adding drag and drop functionality to React applications.
20 | - [Zustand](https://github.com/pmndrs/zustand): A small, fast, and scalable state management library for React.
21 |
22 | ## Installation
23 |
24 | 1. Clone the repository: `git clone https://github.com/AhmedMohsen600/Trello.git`
25 | 2. Navigate to the project directory: `cd Trello`
26 | 3. Install dependencies: `npm install` or `yarn install`
27 | 4. Start the development server: `npm run dev` or `yarn dev`
28 | 5. Open your browser and visit `http://localhost:3000` to see the app.
29 |
30 | ## Contributing
31 |
32 | Contributions are welcome! If you have any ideas, improvements, or bug fixes, please submit a pull request. Ensure that your code adheres to the project's coding standards and includes appropriate tests.
33 |
34 | ## License
35 |
36 | This project is licensed under the [MIT License](LICENSE).
37 |
38 | ## Acknowledgments
39 |
40 | - The Trello Clone app is inspired by the concept of the original [Trello](https://trello.com/) application.
41 | - Special thanks to the creators and maintainers of the open-source libraries used in this project.
42 |
--------------------------------------------------------------------------------
/components/TodoCard.tsx:
--------------------------------------------------------------------------------
1 | import { getUrl } from '@/lib/getUrl';
2 | import { useBoardStore } from '@/store/boardStore';
3 | import { XCircleIcon } from '@heroicons/react/24/solid';
4 | import Image from 'next/image';
5 | import { useEffect, useState } from 'react';
6 | import {
7 | DraggableProvidedDraggableProps,
8 | DraggableProvidedDragHandleProps,
9 | } from 'react-beautiful-dnd';
10 |
11 | // -------------------------------------------------------
12 |
13 | interface TodoCardProps {
14 | todo: Todo;
15 | imgUrl?: string;
16 | index: number;
17 | id: TypedColumn;
18 | innerRef: (element: HTMLElement | null) => void;
19 | draggableProps: DraggableProvidedDraggableProps;
20 | dragHandleProps?: DraggableProvidedDragHandleProps | null;
21 | }
22 |
23 | // -------------------------------------------------------
24 |
25 | function TodoCard({
26 | todo,
27 | index,
28 | innerRef,
29 | id,
30 | dragHandleProps,
31 | draggableProps,
32 | }: TodoCardProps) {
33 | const deleteTodo = useBoardStore((state) => state.deleteTodo);
34 | const [imageUrl, setImageUrl] = useState(null);
35 | const [loading, setLoading] = useState(false);
36 |
37 | // ---------------------------------------
38 |
39 | useEffect(() => {
40 | if (!todo.image) return;
41 | const fetchImage = async () => {
42 | try {
43 | setLoading(true);
44 | const url = await getUrl(todo.image!);
45 | setImageUrl(url.toString());
46 | setLoading(false);
47 | } catch (error) {
48 | setLoading(false);
49 | }
50 | };
51 |
52 | fetchImage();
53 | }, [todo, loading]);
54 |
55 | // ---------------------------------------
56 |
57 | if (loading) {
58 | return (
59 |