test-task-reactjs

TravelTrucks

Overview

TravelTrucks is the front-end part of a web application designed for the rental of campers. Built using ReactJS on Vite, it provides customers with an intuitive interface to explore available campers, manage their favorites, and make bookings seamlessly.

Functionalities:

Features

API Integration

The application uses a pre-built backend-api available at MockAPI to manage camper listings.

Main Endpoints

Technical Stack

  1. Frameworks and Libraries:

    • Vite: Used as a fast development bundler.
    • React: For building the user interface.
    • Redux: Manages the app state.
    • React Router: Handles routing between pages.
    • Axios: For making API requests.
    • CSS Modules: For styling components.
  2. Routing:

    • / - Home Page.
    • /catalog - Catalog Page.
    • /catalog/:id - Individual Camper Page.
    • /favorites - Favorites Page (extra feature).
    • /404 - NotFound.
  3. State Management:

    • Global state management using Redux to store the list of campers, filter states, and favorites.
    • Reset previous search results before making new API requests to ensure data accuracy.
  4. Dependencies: The project utilizes several key libraries to enhance functionality:

    • react-datepicker: For selecting dates in the booking form.
    • react-hot-toast: For displaying notifications upon successful actions like bookings, filters, favorites applied.
    • react-loader-spinner: For loading indicators during asynchronous operations.

Design:

UI Kit:

The design of the TravelTrucks application is guided by a UI Kit that includes:

Project Structure Overview

└── travel-trucks
    ├── public/
    ├── src
    │   ├── App.jsx
    │   ├── main.jsx
    │   ├── index.css
    │   ├── api
    │   │   └── apiService.js
    │   ├── common
    │   │   └── components
    │   │       ├── Booking
    │   │       │   ├── Booking.jsx
    │   │       │   └── index.module.css
    │   │       ├── Buttons
    │   │       │   ├── Button.jsx
    │   │       │   ├── Button.module.css
    │   │       │   ├── Checkbox.jsx
    │   │       │   └── RadioButton.jsx
    │   │       ├── CardBadge
    │   │       │   ├── CardBadge.jsx
    │   │       │   └── index.module.css
    │   │       ├── CardContent
    │   │       │   ├── CardContent.jsx
    │   │       │   ├── CardFiltered.jsx
    │   │       │   └── index.module.css
    │   │       ├── CardDetails
    │   │       │   ├── FeaturesTab.jsx
    │   │       │   ├── Gallery.jsx
    │   │       │   ├── ReviewsTab.jsx
    │   │       │   ├── TabButton.jsx
    │   │       │   ├── helper.js
    │   │       │   └── index.module.css
    │   │       ├── CardFilter
    │   │       │   ├── CardFilter.jsx
    │   │       │   └── index.module.css
    │   │       ├── CardList
    │   │       │   ├── CardList.jsx
    │   │       │   └── index.module.css
    │   │       ├── UI
    │   │       │   ├── EmptyList
    │   │       │   │   ├── EmptyList.jsx
    │   │       │   │   └── index.module.css
    │   │       │   ├── Input
    │   │       │   │   ├── Input.jsx
    │   │       │   │   └── index.module.css
    │   │       │   ├── Loader
    │   │       │   │   ├── Loader.jsx
    │   │       │   │   └── index.module.css
    │   │       │   ├── ScrollToTop
    │   │       │   │   ├── ScrollToTop.jsx
    │   │       │   │   └── index.module.css
    │   │       │   └── Textarea
    │   │       │       ├── Textarea.jsx
    │   │       │       └── index.module.css
    │   │       ├── icons/
    │   │       ├── img/
    │   │       └── layouts
    │   │           └── SharedLayout
    │   │               ├── SharedLayout.jsx
    │   │               └── SharedLayout.module.css
    │   ├── hooks
    │   │   └── useCamperDetails.jsx
    │   ├── pages
    │   │   ├── CatalogPage
    │   │   │   └── CatalogPage.jsx
    │   │   ├── DetailsPage
    │   │   │   ├── DetailsPage.jsx
    │   │   │   └── index.module.css
    │   │   ├── FavoritesPage
    │   │   │   └── FavoritesPage.jsx
    │   │   ├── HomePage
    │   │   │   ├── HomePage.jsx
    │   │   │   └── index.module.css
    │   │   └── NotFoundPage
    │   │       ├── NotFound.jsx
    │   │       └── index.module.css
    │   ├── store
    │   │   ├── dataSlice.jsx
    │   │   ├── favoritesSlice.jsx
    │   │   ├── reducer.jsx
    │   │   ├── selectors.jsx
    │   │   └── store.jsx
    │   └── utils
    │       ├── Fallback.jsx
    │       ├── FavoriteIcon.jsx
    │       ├── FormatLabel.jsx
    │       ├── StarRating.jsx
    │       ├── context.jsx
    │       ├── error.jsx
    │       ├── filterData.jsx
    │       ├── filterIcons.jsx
    │       ├── filterParams.jsx
    │       ├── pagination.jsx
    │       ├── placeholder.jsx
    │       ├── scroller.jsx
    │       └── validator.js
    ├── index.html
    ├── package-lock.json
    ├── package.json
    ├── README.md
    └── vite.config.js