diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/README.md b/README.md index b9e011c..439e863 100644 --- a/README.md +++ b/README.md @@ -1,79 +1,77 @@ -# Frontend Code Assessment - To-Do List Application +# code-assessment-fe (TODO List) -![To Do List Application Preview](./source/app.jpg) +![TODO List](https://i.ibb.co/cSTcyhgP/todo-list.png) -## Overview +Este projeto é uma aplicação de lista de tarefas construída com React, Vite, Tailwind e Zustand. A aplicação permite que o usuário cadastre itens na lista de "Para fazer" e os mova facilmente para a lista de "Concluído" com um simples clique no checkbox. Além disso, há a funcionalidade de arrastar e soltar, permitindo que o usuário reorganize os itens em ambas as listas de forma intuitiva. -This repository contains a code challenge for developing a To-Do List web application. The challenge aims to evaluate your frontend development skills, code quality, and attention to design details. +## **Destaques** -## Design Specifications +- **Arrastar e Soltar**: A funcionalidade de arrastar e soltar (drag-and-drop) permite que os itens sejam reorganizados dentro de suas listas ou movidos entre as listas de "Para fazer" e "Concluído". +- **Testes Unitários**: Cobertura completa de todos os componentes, páginas e utils. +- **Tailwind**: A interface é totalmente responsiva, projetada com Tailwind CSS para garantir uma experiência fluida em dispositivos móveis e desktop. +- **Zustand**: O Zustand é usado para gerenciar o estado de forma simples e eficiente, sem a complexidade de outros gerenciadores de estado. -- The complete UI design is available in [Figma File](./source/fe-challenge-todo_list.fig). -- The design includes all components, states, and interactions. -- Please ensure pixel-perfect implementation and responsive design. +## **Página:** -## Core Features +### Home +Página inicial onde o usuário pode encontrar a aplicação com todos os componentes renderizados. -- Display a list of pending tasks -- Add new tasks to the list -- Edit existing tasks -- Mark tasks as completed -- View completed tasks in a separate list +## **Componentes** -## Technical Requirements +### AddTask +Componente responsável por adicionar um novo ítem (tarefa) na lista "Para fazer". -Required technologies: +### CompletedTasks +Componente responsável por exibir a lista de ítens (tarefas) que já estão em "Concluído". -- [React 19](https://react.dev) -- [TypeScript (v5+)](https://www.typescriptlang.org/) -- [Vite (v5+)](https://vite.dev/) -- [React Router (v7+)](https://reactrouter.com/home) -- [Tailwind CSS (v3+)](https://tailwindcss.com/) +### DraggableTask +Componente responsável por controlar a área e as funcionalidades de arrastar e soltar. -Additional requirements: +### CheckLogo +Componente responsável por exibir o ícone de logo. -- State management solution (Context API, Zustand, Redux, etc.) -- Unit testing framework (Vitest, Jest, etc.) -- Code formatting (Biomejs or ESLint + Prettier) +### Navbar +Componente Header da aplicação, com um ícone simulando a logo e um texto "TODO List" -## API Integration +### ToDoList +Componente responsável por exibir a lista de ítens (tarefas) que estão em "Para fazer". -While this challenge doesn't require a backend integration, you should structure your code to demonstrate how you would integrate with a REST API. +### Checkbox +Componente responsável por renderizar o checkbox personalizado. -Create service files that would handle these API calls. You can mock these API calls using local state management and localStorage for persistence. -## Submission Guidelines +## **store** -- Fork this repository. -- Create a new branch for your implementation. -- Submit your commits. -- Include a README.md with: - - Setup instructions. - - Technologies used. - - Architecture decisions. - - Any additional features implemented. -- Send your public repository for evaluation by email. +### useToDoStore +Hook responsável por gerenciar todo o contexto da aplicação com o Zustand, adicionar, alterar e remover os estados. -## Bonus Points (Optional) -- Technical +## **Utils** - - Implement drag and drop for task reordering - - Add E2E tests (Cypress/Playwright) - - Add error boundaries +### storage +Funções `loadFromStorage` e `saveToStorage` responsáveis por carregar e salvar dados no localStorage do navegador. -- Features - - Task due dates - - Task categories/tags +## **Inicialização do Projeto** -- UX/UI - - Smooth animations - - Loading states - - Error states - - Empty states +Para inicializar o projeto, siga os passos abaixo: -## Time Expectation +1. **Clone o repositório:** +```bash +git clone https://github.com/wendellchrys/code-assessment-fe.git +``` -- Expected completion time: 5 days -- Please let us know if you need more time. +2. **Navegue até o diretório do projeto:** +```bash +cd code-assessment-fe +``` + +3. **Instale as dependências:** +```bash +pnpm install +``` + +4. **Inicie o servidor de desenvolvimento:** +```bash +pnpm dev +``` diff --git a/biome.config.js b/biome.config.js new file mode 100644 index 0000000..a8581db --- /dev/null +++ b/biome.config.js @@ -0,0 +1,4 @@ +module.exports = { + extends: ["@biomejs/biome"], + }; + \ No newline at end of file diff --git a/coverage/lcov-report/CompletedTasks.tsx.html b/coverage/lcov-report/CompletedTasks.tsx.html new file mode 100644 index 0000000..8af81c1 --- /dev/null +++ b/coverage/lcov-report/CompletedTasks.tsx.html @@ -0,0 +1,277 @@ + + + + +
++ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 | 1x +1x +1x +1x +1x + +1x +1x +1x + + + + + + +1x +5x +5x + +5x + + + +5x +2x +1x +1x +1x +1x +2x + +5x +5x +5x + + +5x + +5x + +5x + +5x +5x +5x +5x +5x +4x +8x +8x +8x +8x +8x +8x +8x +8x +4x + +1x + +5x +5x + +5x + | import React, { useRef } from 'react'; +import { useToDoStore, Task } from '../../store/todoStore'; +import { DraggableTask } from '../DraggableTask'; +import { useDrop } from 'react-dnd'; +import { Checkbox } from '../ui/Checkbox'; + +const ItemType = { + TASK: 'task', +}; + +interface CompletedTasksProps { + onDrop: (item: { id: number; completed: boolean }) => void; + onTaskToggle?: (taskId: number) => void; +} + +export const CompletedTasks: React.FC<CompletedTasksProps> = ({ onDrop, onTaskToggle }) => { + const { tasks, markTaskIncomplete } = useToDoStore(); + const ref = useRef<HTMLDivElement>(null); + + const handleDrop = (item: { id: number; completed: boolean }) => { + onDrop(item); + }; + + const handleToggle = (taskId: number) => { + if (onTaskToggle) { + onTaskToggle(taskId); + } else { + markTaskIncomplete(taskId); + } + }; + + const [, drop] = useDrop({ + accept: ItemType.TASK, + drop: (item: { id: number; completed: boolean }) => { + handleDrop(item); + }, + }); + + drop(ref); + + const completedTasks = tasks.filter((task) => task.completed); + + return ( + <div ref={ref} className="rounded-lg" data-testid="completed-tasks-container"> + <h2 className="text-xs font-bold mb-3.75 text-stoneGray-700">Concluído</h2> + <ul className="space-y-2" data-testid="completed-tasks-list"> + {completedTasks.length > 0 ? ( + completedTasks.map((task: Task) => ( + <DraggableTask key={task.id} task={task} onDrop={handleDrop}> + <Checkbox + checked={task.completed} + onChange={() => handleToggle(task.id)} + label={task.title} + data-testid={`task-checkbox-${task.id}`} + /> + </DraggableTask> + )) + ) : ( + <li className="text-sm text-stoneGray-700">Nenhuma tarefa concluída.</li> + )} + </ul> + </div> + ); +}; + |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
---|---|---|---|---|---|---|---|---|---|
CompletedTasks.tsx | +
+
+ |
+ 91.66% | +44/48 | +100% | +8/8 | +60% | +3/5 | +91.66% | +44/48 | +