-
Notifications
You must be signed in to change notification settings - Fork 28
5) How to's
Sometimes, we want to implement / merge a feature without having it visible on production yet. Here's how to do it
- Declare a flag in https://github.com/Qwant/erdapfel/blob/master/config/default_config.yml
flagName:
enabled: false
- In the code source, surround the feature with flag tests:
const config = useConfig();
if (config.flagName.enabled) { ... }
- To enable the flag locally, set it to true in youe .env file:
TILEVIEW_flagName_enabled=true
-
To enable the flag on dev / plive / prod environments, set the env var to true in the yml files of the Erdapfel CI project
-
When the features becomes permanent, the flag can be cleaned up by removing the corresponding tests, the default config, and the env vars.
The suggest's data is fetched and ordered in suggest.js and suggest_sources.js
There are 3 kinds of icons in Qwant Maps:
To add new icons or edit the existing ones:
- Clone https://github.com/Qwant/qwant-basic-gl-style
- Do your adds/edits in the icons folder and merge on master
- Do a release (bump the version number then
npm publish
) - Update the version number of @qwant/qwant-basic-gl-style in erdapfel/package.json
These icons are currently read-only.
Add an icon not present in the design system:
- Add a svg file in /public/images/remix/ ("line" svg files from https://remixicon.com/ or provided by the design team)
- export this file as React component in src/components/ui/icons.js
- Note: these SVG must use the props "width" and "height" (instead of "size"), and have "fill='currentColor'" set explicitly to not appear black.
See router's doc here: https://github.com/Qwant/erdapfel/blob/master/docs/src/routing.md
Extra tips:
- Add a new route: see app_router.js > router.addRoute.
- Create links between different pages of the app: use in HTML or navigateTo("page_name") in JS.
- Edit the .env file:
TILEVIEW_mapStyle_baseMapUrl='["http://your-server/path-to-basemap-tiles/{z}/{x}/{y}.pbf"]' # map tiles
TILEVIEW_mapStyle_poiMapUrl='["http://your-server/path-to-poi-tiles/{z}/{x}/{y}.pbf"]' # poi tiles
The suffix {z}/{x}/{y}.pbf
lets erdapfel specify zoom and position
-
all tests:
TEST=true npm run build
thennpm run test
-
unit tests only:
npm run unit-test
-
integration tests only:
npm run integration-test
NB: on Windows 10+ and WSL2, it's possible that puppetteer doesn't find chrome to launch the integration tests. If it happens, run:
sudo apt-get update
sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
sudo apt-get install -y libgbm-dev
# then, try running `npm run test`
A style builder is used behind the scene to build the style of the map and to ease the usage of the icons for the front end.
The fonts used for the text displayed on the map are also built using an OpenMapTiles script.