The challenge consists in creating the client interface for a web application that lets the personal vote for the "employee of the month", with the objective of demonstrating technical knowledge of different technologies, such as:
Starting the challenge, we get a folder with some files:
README
file.When accessing the web app, we can see a "loading screen" with Cumplo's Logo. Then the main screen, this screen will display all the employees with a button to vote for the employee, this information comes from the backend API.
The countdown timer is on the top right of the application, personal can vote for the employee they like if the timer hasn't ended yet.
When a user votes, they will see a screen saying "thanks for voting" and after a few seconds they will be redirected to a "wait for results" screen.
If the user refreshes the app or tries to go to the main screen after they voted, they are redirected to the "wait for results" screen (if the countdown timer hasn't ended yet).
When the timer finishes it redirects the users to the "winner" screen showing the person who won.
Router
was used to manage the routing of the application.useState
was used to manage component local state.useContext
was used to create & consume contexts to keep track of state changes
in children components.useEffect
was used to create different effects when loading a certain
screen or components (mostly API calls).To accomplish all of this, we consume the API to show the generated information of employees, we also used it to send information when the user votes for a person.
When voting, we send the id of the person and the API will increment the user score. When the timer finishes, the API will expose the person with the most amount of votes and we will consume the API to show on the client who is the person who won.