🗻 Table of Contents
Normally, A ride-hailing system will generally cover the following functions, the cost of location selection often conflicts with user experience considerations, so i make an experimental project to optimize efficiency when relying on google map API
This project only focus on No.2 step
This project start from TypeScript and React, and has some base lint rule (eslint and commitlint), so the development may need to pay attention to
React Router 6 https://reactrouter.com/docs/en/v6/getting-started/tutorial
RTKQ https://redux-toolkit.js.org/rtk-query/overview
In my previous work experience, I learned that the most traffic-consuming points were predictive queries and map selection
- I expect to use RTKQ and IndexDB for optimizing the prediction queries part.
- The map selection part will use a slow trigger strategy
Other areas that could be optimized are the user experience of selecting addresses
-
When dragging the map to select a location, somethings should be noted
-
When fetch history data, you may encounter a situation where the default display usually specifies a certain number of orders to be displayed, and the origin and destination information may exist at the same time as the history of orders, so you may have the problem of not knowing how many orders to take to just meet the demand.
-
There is one of user action you should be noted, in this situation, The user may take the following four actions (Let's ignore the possibility that it will just close and go away)
- Press the previous button, but the input text
taipei macdona
is need to be handle, In this project, it will revert to the previous input state - Continue entering text, normal operation
- Click on the address element, normal operation
- Press the map select button, but the input text
taipei macdona
is need to be handle, In this project, it will use the first prediction as input and move the map center to the location
- Press the previous button, but the input text
-
In handling user input predictions, we want the predicted value to be as close as possible to the value in the user's mind, so that we can avoid costly redundant operations by the user, and therefore need to pay more attention to the
bound
value
After you have cloned, there are a few things you must do
- Add local env
.env.local
to place your google map key
REACT_APP_GOOGLE_KEY="YOUR_KEY"
- Install the dependencies
yarn
- Start this project
yarn run start
- If you just want to see the UI, you can find him through storybook (not yet 😂)
yarn run storybook
.env
file has some function trigger to try a different user experience
To make my work easier and to ensure the quality of the code, I have designed some processes for this project
-
Because I can't find a space where I can deploy Sonarqube without spending money, so I set up a local docker and provided the code scanning service to myself
-
Because heroku instance PORT is random, so I did some work on the dockerFile and nginx config files, those are not proper usage
My folder structure is separated by feature, as the project is still small, so I want to avoid over-design.
Project
├─ .asset # docs asset
├─ .husky # husky config folder (lint check before commit)
├─ .vscode # vscode config folder (extension convenience)
├─ public
│ ├─ mainifest.json # I will add PWA feature after refactor
│ └─ index.html
├─ src
│ ├─ feature # core Logic Components
│ ├─ layout # UI that is not part of the main program
│ ├─ router # the act of splitting the router
│ ├─ store # RTK slice
│ ├─ stories # storybook component stories (not yet 😂)
│ └─ ...
└─ ...