- About the Project
- How does this application work
- Running this application locally and testing
- Having problem running the application
- Some Choices made
- What could have been done better
- Recording
- This project enables users to give feedback/reviews on a product/service
- This project uses the Atomic Design Methodology to structure the components
- Works well on mobile and desktop devices (Responsive Design)
- It is built with
- React,
- Typescript a superScript of JavaScript that introduces strong typing,
- React router for Route management,
- Context API for State management,
- local Storage for persistence,
- Docker,
- Rechart for display of the bar chart
- Bootstrapped with Create React App
- The application is properly tested(Unit tests) using
- Jest, and
- React Testing Library
You can find tests in the same folders as the components or modules. The tests usually are in the format of
*.spec.tsx
As mentioned earlier, users can give feedback on a product/service through this application. To give a feedback/review on a product, the user must provide the following information:
- Author: The name of the author (must be atleast one character)
- Email: A valid email address (validated with regex)
- Rating: A value between 1 and 5
- Comment: Text describing the feedback/review
On submission, if all required information is provided, then the user is directed to the Comments page. The Comments page displays a bar chart which shows the distribution of the received feedback/reviews over time, and the latest comments (the newest comments are displayed first). Each comment displays the email address of the author and the actual text comment.
NB: You need to start the application locally to access the following routes
- Open your workspace terminal
- Clone this repository
- Cd into the cloned repository
- There are two ways you can start or test this application locally:
- To run the tests with docker-compose, simply run: (on MacOS)
docker-compose up test
- To run the tests with docker-compose, simply run: (on Ubuntu)
sudo docker compose up test
- To start the application with docker-compose, simply run (on MacOS):
docker-compose up web
- To start the application with docker-compose, simply run (on Ubuntu):
sudo docker compose up web
- Press
Cmd + C
on a MacOS orCtrl+ C
on Ubuntu to stop the application - Run (on MacOS):
docker-compose down
- Run (on Ubuntu):
sudo docker compose down
- Install the dependencies with:
npm install
- Run the tests with:
npm test
- Install the dependencies with:
npm install
- Start the application with:
npm start
Visit localhost:3000
on your favourite browser to view the application
- Press
Cmd + C
on MacOs orCtrl + C
on Ubuntu to stop the application
- Be sure to confirm that you do not have another project running on port 3000
- Seeing an Error like this error when trying to install depdencies on Ubuntu?
Error: EACCES: Permission denied, mkdir '/<file_path>
Solution:
- Run
rm -rf node_modules
in the repository and thennpm install
again Why did that happen?: Well, it's possible that you had randocker-compose web
earlier
- Used the atomic design pattern for many reasons including:
- to ease the categorization/classification of components
- avoid unnecessary nesting of components across the application
- promote component reusability, and a pattern for component breakdown
- ease of testing
- Testing hooks is debatable. However, the choice was made in this case as
useHome
hook handles some important logic - To improve the UX: Expectations for an input field are immediately validated, against the current input with feedback displayed once the user starts typing in an input field. This helps the user immediately understand what is required in a specific field
- Used labelled interactive elements over identification with placeholder to improve the accessibility
- Creating a simple wrapper component for the interactive components(Input, TextArea e.t.c), this wrapper component would then handle the label, and errors, hence reducing code duplication. However, that would be a "too early abstraction" in this case
- Displaying the author's name rather than the email to promote privacy but I assume there are reasons for the choice of displaying the email instead