Skip to content

Commit 9c093b6

Browse files
authored
Merge pull request #464 from hotosm/feat/matomo
Add matomo cookie / tracking acceptance banner
2 parents 1e3fac5 + fd1760f commit 9c093b6

File tree

5 files changed

+43
-5
lines changed

5 files changed

+43
-5
lines changed

src/frontend/.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22.13.0
1+
v22

src/frontend/Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
# ARG for the base image
2-
ARG NODE_BASE=22.13.0-bullseye-slim
2+
ARG NODE_BASE=22-slim
33
ARG MINIO_TAG=RELEASE.2024-08-03T04-33-23Z
44
ARG BASE64_ARGS_TO_ENV=ENV_VARS_BASE64_ENCODED_FOR_LIVE
55

66
# Base image with frontend code
77
FROM node:${NODE_BASE} AS base
8+
ENV PNPM_HOME="/pnpm"
9+
ENV PATH="$PNPM_HOME:$PATH"
810
RUN mkdir -p /app
911
WORKDIR /app
1012

13+
1114
# Run development environment
1215
FROM base AS development
16+
COPY ./package.json pnpm-lock.yaml .
17+
# FIXME this npm install is a workaround due to https://github.com/nodejs/corepack/issues/627
18+
RUN npm install -g corepack@0.31.0
19+
# FIXME delete this line after fixed upstream
20+
RUN corepack prepare pnpm@9.15.5 --activate && corepack enable && corepack install
1321
ENTRYPOINT ["/bin/sh", "-c", "pnpm install; pnpm run start --host 0.0.0.0;"]
1422

23+
24+
1525
# Generate frontend build files
1626
FROM base AS build
1727
ARG BASE64_ARGS_TO_ENV
18-
1928
COPY ./package.json pnpm-lock.yaml .
2029
# FIXME this npm install is a workaround due to https://github.com/nodejs/corepack/issues/627
2130
RUN npm install -g corepack@0.31.0
@@ -26,6 +35,8 @@ COPY . /app
2635
RUN ( echo ${BASE64_ARGS_TO_ENV} | base64 -di ) > .env
2736
RUN pnpm run build
2837

38+
39+
2940
# Copy static files to minio and generated index.html to volume
3041
FROM docker.io/minio/minio:${MINIO_TAG} AS live
3142
COPY --from=build /app/dist /tmp/dist

src/frontend/package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"@cyntler/react-doc-viewer": "^1.17.0",
44
"@geomatico/maplibre-cog-protocol": "^0.3.1",
55
"@hotosm/gcp-editor": "^0.0.9",
6-
"@hotosm/ui": "0.2.0-b6",
76
"@mapbox/mapbox-gl-draw": "^1.4.2",
87
"@mapbox/mapbox-gl-draw-static-mode": "^1.0.1",
98
"@radix-ui/react-popover": "^1.0.6",
@@ -58,6 +57,9 @@
5857
"wkt": "^0.1.1"
5958
},
6059
"devDependencies": {
60+
"@babel/preset-env": "^7.26.7",
61+
"@babel/preset-react": "^7.26.3",
62+
"@babel/preset-typescript": "^7.26.0",
6163
"@tanstack/eslint-plugin-query": "^4.29.4",
6264
"@types/file-saver": "^2.0.5",
6365
"@types/geojson": "^7946.0.10",
@@ -90,6 +92,9 @@
9092
"typescript": "^4.9.3",
9193
"vite": "^4.2.0"
9294
},
95+
"peerDependencies": {
96+
"@hotosm/ui": "0.2.0-b6"
97+
},
9398
"lint-staged": {
9499
"*.{js,jsx,ts,tsx}": [
95100
"eslint --fix",
@@ -107,5 +112,5 @@
107112
},
108113
"type": "module",
109114
"version": "0.0.0",
110-
"packageManager": "pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0"
115+
"packageManager": "pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0"
111116
}

src/frontend/pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/frontend/src/App.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
import '@hotosm/ui/dist/style.css';
2+
3+
// Workaround required, as @hotosm/gcp-editor already imports all components
4+
if (!customElements.get('hot-tracking')) {
5+
import('@hotosm/ui/components/tracking/tracking');
6+
}
7+
18
import { useLocation } from 'react-router-dom';
29
import { initDomToCode } from 'dom-to-code';
310
import { ToastContainer } from 'react-toastify';
11+
412
import { useTypedDispatch, useTypedSelector } from '@Store/hooks';
513
import generateRoutes from '@Routes/generateRoutes';
614
import appRoutes from '@Routes/appRoutes';
@@ -99,6 +107,11 @@ export default function App() {
99107
</div>
100108
<ScrollToTop />
101109
</div>
110+
<hot-tracking
111+
style={{position: 'fixed', bottom: '0%'}}
112+
site-id={'35'} domain={'dronetm.org'}
113+
force={true}>
114+
</hot-tracking>
102115
</>
103116
);
104117
}

0 commit comments

Comments
 (0)