Skip to content

Commit 843682f

Browse files
migrated to nuxt (#1058)
* migrated the webclient to nuxt * implemented #1032 * formatting/system theme improvements * optimised tailwind to only include the actually used colors * added a better favicon configuration * fixed the feedback modals not being findable * fixed a hydration mismatch * made sure that base urls can be properly configured * formatting fixes * typing fixes * fixed the details page layout * made type checking stricter * rebase * de-bumped `vue-tsc` * fixed a type error * tmp * tmp * refactored the interactive map to use tailwind * added plausible via partytown * migrated the docs * fixed the lockfile
1 parent 3284e08 commit 843682f

File tree

90 files changed

+7995
-1954
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+7995
-1954
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ repos:
99
- --allow-multiple-documents
1010
exclude: "(data/data_format_geo-entry.yaml)|(deployment/k3s/.*)|(webclient/pnpm-lock.yaml)"
1111
- id: check-json
12+
exclude: "(webclient/tsconfig.json)"
1213
- id: check-executables-have-shebangs
1314
- id: check-shebang-scripts-are-executable
1415
- id: check-case-conflict
@@ -48,17 +49,17 @@ repos:
4849
- id: python-check-blanket-noqa
4950
- id: python-use-type-annotations
5051
- repo: https://github.com/astral-sh/ruff-pre-commit
51-
rev: v0.3.2
52+
rev: v0.3.5
5253
hooks:
5354
- id: ruff
5455
args: [ --fix ]
5556
- id: ruff-format
5657
- repo: https://github.com/PyCQA/bandit
57-
rev: 1.7.7
58+
rev: 1.7.8
5859
hooks:
5960
- id: bandit
60-
args: ["-c", "pyproject.toml"]
61-
additional_dependencies: ["bandit[toml]"]
61+
args: [ "-c", "pyproject.toml" ]
62+
additional_dependencies: [ "bandit[toml]" ]
6263
# markdown
6364
- repo: https://github.com/DavidAnson/markdownlint-cli2
6465
rev: v0.9.2

webclient/.dockerignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
node_modules/*
2-
dist/*
3-
cdn/*
4-
.vscode/*
1+
node_modules
2+
dist
3+
cdn
4+
.output
5+
.nuxt

webclient/.eslintrc.cjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/* eslint-env node */
2-
require("@rushstack/eslint-patch/modern-module-resolution");
3-
42
module.exports = {
53
root: true,
64
extends: [

webclient/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ dist
1212
dist-ssr
1313
coverage
1414
*.local
15+
.nuxt
16+
.output
1517

1618
# Editor directories and files
1719
.vscode/*

webclient/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
tsconfig.json
2+
.output
3+
.nuxt
4+
node_modules

webclient/App.vue

Lines changed: 0 additions & 30 deletions
This file was deleted.

webclient/Dockerfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ ARG GIT_COMMIT_SHA
1212
ENV GIT_COMMIT_SHA=${GIT_COMMIT_SHA}
1313
ARG GIT_COMMIT_MESSAGE
1414
ENV GIT_COMMIT_MESSAGE=${GIT_COMMIT_MESSAGE}
15-
RUN npm run build-only
16-
RUN gzip --force --keep --recursive ./dist
15+
RUN NITRO_PRESET=deno-server pnpm run build
1716

1817

19-
FROM nginx:1.25 as production-stage
20-
COPY nginx.conf /etc/nginx/nginx.conf
21-
RUN mkdir /app && apt update && apt upgrade -y
22-
COPY --from=build-stage /app/dist /app
18+
FROM denoland/deno:alpine as production-stage
19+
RUN apk update --no-progress --quiet && apk add curl --no-progress --quiet
2320

21+
COPY --from=build-stage /app/.output /app/.output
22+
COPY --from=build-stage /app/node_modules /app/node_modules
23+
COPY --from=build-stage /app/.nuxt /app/.nuxt
24+
25+
ENV NUXT_HOST=0.0.0.0
26+
ENV NUXT_PORT=3000
2427
EXPOSE 3000
28+
2529
HEALTHCHECK CMD curl --fail localhost:3000/health || exit 1
26-
CMD sh -c "sed -i 's|TILESERVER_URL|${TILESERVER_URL}|g' /etc/nginx/nginx.conf && sed -i 's|CDN_URL|${CDN_URL}|g' /etc/nginx/nginx.conf && sed -i 's|MAIN_API_URL|${MAIN_API_URL}|g' /etc/nginx/nginx.conf && sed -i 's|FEEDBACK_API_URL|${FEEDBACK_API_URL}|g' /etc/nginx/nginx.conf && nginx -g 'daemon off;'"
30+
CMD deno run --unstable --allow-net --allow-read --allow-env /app/.output/server/index.mjs

webclient/README.md

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pnpm install
3131

3232
Ensure that _NavigaTUM-server_ is running in the background.
3333
By default, the webclient will connect to the server on `https://nav.tum.de`.
34-
If you want to connect to a local version instead, change `VITE_APP_URL` in [`env/.env`](./env/.env) to `http://localhost:3003`.
34+
If you want to connect to a local version instead, change the environemnt variable `NUXT_PUBLIC_{API,CDN,FEEDBACK,MAPS}_URL` to the appropriate value.
3535

3636
To get a local server running, please:
3737

@@ -73,53 +73,35 @@ pnpm run lint
7373
pnpm run format
7474
```
7575

76-
## Build files & Serving release build
77-
78-
We create a lot of index HTML files in the build process.
79-
Each of those files are similar but differ in some aspects.
80-
If you serve the release build with a webserver (such as Nginx) you need to select the correct files based on the request URL and headers.
81-
82-
```plain
83-
<theme>.html
84-
85-
└── The page theme. Either "light" or "dark" at the moment.
86-
It should be selected based on the "theme" Cookie ("light" by default).
87-
```
88-
89-
The language-selector is working in development and this differentialtion is only happening in the build.
90-
For the theme we can not do so for some reason (If you know of a better way, hit us up).
91-
To test a different theme, you can change `theme='...'` [here](./index.html). Values are `light` and `dark`.
92-
9376
## Architecture
9477

95-
The NavigaTUM webclient is made as a single-page application based on [Vue.js](https://vuejs.org/) and [Vue Router](https://router.vuejs.org/).
96-
For state management we use [pinia](https://pinia.vuejs.org/).
97-
Our CSS framework is currently being migrated from [Spectre.css](https://picturepan2.github.io/spectre/) to [Tailwind](https://tailwindcss.com/). (if you're interested in helping out, please contact us ^^)
78+
The NavigaTUM webclient is made as a nuxt3 server side rendered application based on [Vue.js](https://vuejs.org/) and [Vue Router](https://router.vuejs.org/).
79+
Our CSS framework is [Tailwind](https://tailwindcss.com/).
9880

9981
### Directory structure (only the important parts)
10082

10183
```plain
10284
webclient
103-
├── public/ # 🠔 Static assets such as icons, which cannot get inlined
104-
├── api_types/ # 🠔 code generated via openapi.yaml for typechecking reasons
105-
├── assets/ # 🠔 Static assets such as icons
106-
│ ├── md/ # 🠔 Static pages written in markdown. Served at `/about/<filename>`.
107-
│ ├── main.scss # 🠔 Sass CSS code for all non-view parts
108-
│ └── logos # 🠔 The Logos used by the app
109-
├── components/ # 🠔 Vue components, which are used in views.
110-
├── pages/ # 🠔 The views are parts of App.vue, which are loaded dynamically based on our routes.
111-
├── router.ts # 🠔 The routes of our app. This is where the views are loaded.
112-
├── App.vue # 🠔 Main view
113-
├── main.ts # 🠔 Inialization of Vue.js. This is the entrypoint of our app, from which App.vue and associated views/components are loaded
114-
├── vite.config.ts # 🠔 Build configuration
115-
└── package.json # 🠔 Node package definition and dependencies
85+
├── public/ # 🠔 Static assets such as icons, which cannot get inlined
86+
├── api_types/ # 🠔 code generated via openapi.yaml for typechecking reasons
87+
├── content/ # 🠔 Static pages written in markdown. Served at `/about/<filename>`.
88+
├── assets/ # 🠔 Static assets such as icons
89+
│ ├── main.scss # 🠔 Sass CSS code for all non-view parts
90+
│ └── logos # 🠔 The Logos used by the app
91+
├── components/ # 🠔 Vue components, which are used in views.
92+
├── pages/ # 🠔 The pages are parts of App.vue, which are loaded based their file names.
93+
├── nuxt.config.ts # 🠔 core configuration of nuxt
94+
└── package.json # 🠔 Node package definition and dependencies
11695
```
11796

11897
Note that new views are automatically included in the build, but they are not routed.
11998
To add a new view, you need to add a new route in `router.ts`.
12099

121100
## Testing
122101

102+
> [!NOTE]
103+
> cypress is currently temporarily disabled to help in the nuxt transition
104+
123105
For this part of the project, the tests consist mainly of hot-path e2e tests and tests of critical components.
124106
PRs improving the coverage are very likely to be accepted.
125107
The reason behind these tests is that they fundamentally increase the future productivity by allowing faster review cycles.

webclient/assets/logos/pin.svg

Lines changed: 86 additions & 0 deletions
Loading

webclient/assets/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99

1010
.focusable {
11-
@apply focus:ring-2 focus:ring-tumBlue-500 focus:ring-offset-2 focus-visible:outline-0;
11+
@apply focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus-visible:outline-0;
1212
}
1313

1414
/* see https://www.youtube.com/watch?v=cH8VbLM1958 why this is here */

0 commit comments

Comments
 (0)