Zeller Coding Challenge Front End ✨

The site can be found at https://mydatahack.github.io/zeller-code-challenge. The design system can be found at https://mydatahack.github.io/zeller-design.

(1) Get Started

Make sure to use Node version 14.

  1. Start the main app
yarn install
yarn start
  1. Start the design system
yarn storybook-install
yarn storybook

(2) Running tests

  1. Unit tests
# For main app
yarn test
# For design system
yarn storybook-test
  1. Cypress tests
# For local development
yarn integration-local
# For dev environment
yarn integration-dev

(3) Solution Documentation

  1. Design first approach

The solution is driven by the design first approach by using Storybook. Each design elements are converted to React components in the design system. Then, these components are pulled in the main app. The design system lives in the same repo. They are simply imported in the main app components from the frontend-component folder. For styling, I am using CSS Module.

  1. State management

I opted for using Context because it is more extensible when the new app requirements come. When the page loads, it fetches all the data and store in the context. Context also holds UI states like loading or error. Context also holds what user type is selected. The user type is updated onChange in the radio input. Users are displayed by the type from the context.

  1. Testing

Unit testing to cover most of the component. Testing implementation details is minimised. For the context provider and the logic to retrieve data from AppSync, I opted not to write unit tests. It is more appropriate to do integration tests. Therefore, the integration of the frontend and AppSync is tested by the integration test.

  1. CI/CD

Github action to Github page upon push to the main branch.

  1. Codegen for GraphQL TypeScript definitions

I assume I cannot generate TypeScript definitions from the AppSync endpoint without AWS CLI configured properly? Ideally, GraphQL type should be generated by codegen. As I couldn't do this, I have created the types manually in src/types.