- npm install
- npm run dev
- Access the dev build http://localhost:3000
- Login using abbas/abbas as username/password
- npm install
- npm start
- Access the prod build http://localhost:3000
- Login using abbas/abbas as username/password
- Starting dev or prod also starts the mock api server on port 3001
- npm-run-all is used to trigger multiple comamnds in parallel
- Click on bookmark links and see they are updated in bookmarks page
- Themes and translations are loaded based on language.
- Language is honored using query params, cookies, localstorage etc.
- Following is one of the patternusing query param
- localhost:3001?lng=fr
- localhost:3001?lng=en
Application has apis and the UI components
Apis are mocked using module "node-server"
- /bookmarks
- GET- returns all the stored bookmarks
- POST - stores the bookmarks
- /drivers
- GET - fetches all the drivers
- /races
- GET - fetches all the races
- /authenticate
- POST - Matches the username/password and returns the dummy token
UI Layer is built using React, React router, redux, material ui
Consists of all apis which invokes the mock apis and returns the promise
Application is built using the following Components
- App
- Application Root component which wraps the entire application with themeProvider, Router, cssbaseline
- common
- consists common componets Spinner, Icons, PrivateRoute(checks for login before any route)
- login
- Login page
- Drivers
- DriverPage
- Components to display driver details
- DriverPage
- Races
- RacesPage
- Components to display race details
- RacesPage
- bookmarks
- BookmarksPage - Displays stored bookmarks
- BookmarkLink - Stores the boomark
- langugae specific themes are defined.
- They are applied using material UI theme provider from root component APP
- i18n is implemented using library i18next
- They are configured and initialized from index.js
- Hooks are used to access the translation functions inside components
-
React - UI library to handle the routes and render the components
-
Redux - UI state management
-
materialUI
- Ready to use accessible, responsive react components
- well written documentation, Javascript style sheets support, community, free templates and demos
-
i18next - for loclaization
-
ServiceWorker
- caches the images and serves onconsequent requests
-
themes
- Implemented using materialUI themeprovider
-
json-server
- Wrapper on express to mock apis from predefined mockData
-
localstorage
- stores language and logged in user
-
Unit tests
- jest, enzyme - the default of create-react-app for unit testing