React Trip app
Create a new React project using Vite:
npm create vite@latestChoose your project name and framework (
React) and variant (JavaScript).Navigate to your new project folder and install dependencies:
cd [project-name] npm install npm run devEnsure your Vite development server is running successfully.
Fetch data from the provided API endpoint: https://tripapi.cphbusinessapps.dk/api/mock/trips.
Structure your
fetchcall to retrieve the list of trips when your React app loads. UseuseEffectanduseStatehooks for managing state and lifecycle.Verify the response data structure:
[ { "id": 11, "starttime": "2025-01-25T12:34:06.865979", "endtime": "2025-01-28T12:34:06.865979", "longitude": 14.94, "latitude": 58.75, "name": "Test", "price": 10.0, "category": "CITY", "guide": { "id": 1, "firstname": "Andreas", "lastname": "Turkey", "email": "andreas@mail.com", "phone": "33293922", "yearsOfExperience": 10, "trips": ["Beach Holiday", "City Tour", "Snow boarding", "Living under a bridge"] } }, ... ]
- Render all trips on the left side of the screen as a list (or a table or as card layout or whatever you fancy).
- Display key information for each trip, such as:
- Trip name
- Start and end dates
- Price
- Duration
- Add a dropdown (
selectelement) above the trip list that allows users to filter trips based on theircategory. Get the categories from here: https://packingapi.cphbusinessapps.dk/packinglist/ - When a category is selected, only trips belonging to that category should be displayed.
- When a trip is clicked, display a
Trip Detailsview on the right side of the screen. Details about a trip can be found by id like this: https://tripapi.cphbusinessapps.dk/api/mock/trips/11. - This view should display detailed trip information, including:
- Trip name
- Start and end dates
- Price
- Category
- Guide details (name, email, phone, years of experience)
- If the selected trip includes packing items, render them in a table within the
Trip Detailsview. - Display the following columns:
- Item name
- Weight in grams
- Quantity
- Description
- Category
- Available buying options (shop name, price)
- Below the table, calculate and display:
- The total summed weight of all packing items for the trip.
- The total cheapest price for each packing item, if applicable.
Good luck and have fun! Remember to read instructions carefully, collaborate with your teammates, and ask for help if needed.