The task of this code challenge is to add the functionality described below to this existing sample application: https://github.com/dfds-frontend/frontend-dev-challenge. Clone this project to get started.
The application is built using NextJS, TypeScript, Prisma, React Query, Tailwind, Zod, and https://ui.shadcn.com/ for ready-made components. It is expected that you will complete the tasks below using these technologies.
The challenge consists of various frontend tasks. Tailor your implementation as closely as possible to the description provided, and document any deviations.
- Copy
.env.example
to.env
- Run
yarn db:reset
,npm run db:reset
, orpnpm db:reset
- Start the project with
yarn dev
,npm run dev
, orpnpm dev
The Swagger documentation for the Mock API is available at: http://localhost:3000/api-doc
At the root of the application, place a "Create" button on the top left of the list of mock voyages. When pressed, the button should open a Sheet component with the form for creating a voyage inside. The form should have the following validations:
- All fields are required.
- Departure date and time should be before arrival date and time.
Refresh the list of voyages once a voyage has been successfully created. Display a Toast component with a success message.
To handle form validation and management, use Zod and React Hook Form.
Enable adding at least 5 UnitTypes to a voyage. Ensure the selection of a minimum of 5 UnitTypes.
Add a "unittypes" column to the voyages table. Display the unit type count for each voyage. Clicking on the unit type count opens a PopOver showing the selected UnitTypes using the Popover component. The list should include:
- Name
- Default length
Add error handling to inform the user when deleting a voyage fails. Display a Toast component with the appropriate error message.
Create a custom component that allows users to select both a date and a time. Use the available components in the ShadCN library to combine date and time selection within the same interface.