-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update index.jsx #371
Update index.jsx #371
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/components/RunMap/index.jsx
Outdated
@@ -16,6 +16,10 @@ import RunMarker from './RunMaker'; | |||
import RunMapButtons from './RunMapButtons'; | |||
import styles from './style.module.scss'; | |||
|
|||
//change 'dispaly' to 'hide' if you want to hide the road label; | |||
const RoadLabelDisplay = 'display'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it to bool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to 'true' and 'false'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not that way, you are still using string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, not string this time
src/components/RunMap/index.jsx
Outdated
const RoadLabelDisplay = true; | ||
const layerList=['road-label', 'waterway-label', 'natural-line-label', 'natural-point-label', 'water-line-label', 'water-point-label', 'poi-label', 'airport-label', 'settlement-subdivision-label', 'settlement-label', 'state-label', 'country-label']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to config file like we did maybe better
src/components/RunMap/index.jsx
Outdated
@@ -34,6 +38,13 @@ const RunMap = ({ | |||
const map = ref.getMap(); | |||
if (map && IS_CHINESE) { | |||
map.addControl(new MapboxLanguage({ defaultLanguage: 'zh-Hans' })); | |||
if (RoadLabelDisplay == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!RoadLabelDisplay)
src/components/RunMap/index.jsx
Outdated
for(let layerId of layerList){ | ||
map.removeLayer(layerId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use layerList.forEach((layerId) => {map.removeLayer(layerId)})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all done 😁
src/components/RunMap/index.jsx
Outdated
map.on('load', () => { | ||
MAP_LAYER_LIST.forEach((layerId) => {map.removeLayer(layerId)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add two spaces for this lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it looks better and it works fine, but i don't it's right or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM can you test in your local env?
i tested both locally and they both worked fine, now i run the pulled version in vercel for two days it seems ok too |
OK will merge tonight or tomorrow after test |
@lingdeyiyicifang thanks a lot |
Update index.jsx
make road label hideable, display road label in default.