Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Jan 5, 2023
1 parent cd26564 commit ac45b8a
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 53 deletions.
1 change: 0 additions & 1 deletion webclient/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ node_modules/*
dist/*
cdn/*
.vscode/*

22 changes: 12 additions & 10 deletions webclient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ npm install
## Run

Ensure that _NavigaTUM-server_ is running in the background:
- either via following the [guide to local development](../server/README.md), or
- via [docker](https://docs.docker.com/)
*docker isolates the network, but we want these two containers to communicate to each other without being as brittle as IPs.*
*Naming the `navigatum-mieli-search` container `search` makes us able to connect to it via <`http://search:7700`> from the server*
```bash
docker network create navigatum-net
docker run -it --rm -p 7700:7700 --name search --network navigatum-net ghcr.io/tum-dev/navigatum-mieli-search:main
docker run -it --rm -p 8080:8080 --network navigatum-net -e MIELI_SEARCH_ADDR=search ghcr.io/tum-dev/navigatum-server:main
```

- either via following the [guide to local development](../server/README.md), or
- via [docker](https://docs.docker.com/)
_docker isolates the network, but we want these two containers to communicate to each other without being as brittle as IPs._
_Naming the `navigatum-mieli-search` container `search` makes us able to connect to it via <`http://search:7700`> from the server_
```bash
docker network create navigatum-net
docker run -it --rm -p 7700:7700 --name search --network navigatum-net ghcr.io/tum-dev/navigatum-mieli-search:main
docker run -it --rm -p 8080:8080 --network navigatum-net -e MIELI_SEARCH_ADDR=search ghcr.io/tum-dev/navigatum-server:main
```

By default, the webclient will connect to the server on `http://localhost:8080`.
If you want to connect to the public API instead, change `VITE_APP_URL` in [`env/.env`](./env/.env) to `https://nav.tum.de`.

Expand Down Expand Up @@ -67,7 +69,7 @@ If you serve the release build with a webserver (such as Nginx) you need to sele
```plain
<theme>-<lang>.html
↑ ↑
│ └── The page language. Either "de" or "en" at the moment.
│ └── The page language. Either "de" or "en" at the moment.
│ It should be selected based on the "lang" Cookie or else the "Accept-Language" header.
└── The page theme. Either "light" or "dark" at the moment.
It should be selected based on the "theme" Cookie ("light" by default).
Expand Down
2 changes: 1 addition & 1 deletion webclient/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ done


# compress data (only using gzip, because brotli on ngnix is a royal pain)
gzip --force --keep --recursive ../dist
gzip --force --keep --recursive ../dist
2 changes: 1 addition & 1 deletion webclient/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
<script type="module" src="/src/modules/outdatedBrowser.ts" defer></script>
<!-- At this point we might already include the displayed data -->
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion webclient/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const global = useGlobalStore();
/* === Content === */
#content {
min-height: calc(100vh - 200px);
min-height: calc(100vh - 200px);
}
// 10px + 60px for header
Expand Down
2 changes: 1 addition & 1 deletion webclient/src/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ body {
background: $toast-btn-bg;
border-color: $light-color;
}
}
}
2 changes: 1 addition & 1 deletion webclient/src/codegen/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.36
3.0.36
10 changes: 7 additions & 3 deletions webclient/src/components/DetailsFeedbackButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ function openFeedbackForm(addLocationPicker) {
const body = _getFeedbackBody(currentEdits);
const subject = _getFeedbackSubject(currentEdits);
window.setTimeout(()=>document
.getElementById("feedback-coordinate-picker")
.addEventListener("click", addLocationPicker),100)
window.setTimeout(
() =>
document
.getElementById("feedback-coordinate-picker")
.addEventListener("click", addLocationPicker),
100
);
useGlobalStore().openFeedback(FeedbackCategory.Entry, subject, body);
}
Expand Down
17 changes: 13 additions & 4 deletions webclient/src/components/DetailsOverviewSections.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,16 @@ function updateRoomsOverview(setSelected = undefined) {
</div>-->
</div>
<div class="columns">
<template v-for="(b, i) in state.data.sections.buildings_overview.entries">
<div class="column col-4 col-md-12 content"
v-if="i < state.data.sections.buildings_overview.n_visible || buildings_overview_expanded">
<template
v-for="(b, i) in state.data.sections.buildings_overview.entries"
>
<div
class="column col-4 col-md-12 content"
v-if="
i < state.data.sections.buildings_overview.n_visible ||
buildings_overview_expanded
"
>
<RouterLink v-bind:to="'/view/' + b.id">
<div class="tile tile-centered">
<div class="tile-icon">
Expand All @@ -115,7 +122,9 @@ function updateRoomsOverview(setSelected = undefined) {
: 'Default-thumbnail, as no thumbnail is available'
"
v-bind:src="
b.thumb ? '/cdn/thumb/' + b.thumb : '/src/assets/thumb-building.webp'
b.thumb
? '/cdn/thumb/' + b.thumb
: '/src/assets/thumb-building.webp'
"
/>
</figure>
Expand Down
60 changes: 39 additions & 21 deletions webclient/src/components/DetailsRoomfinderMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,28 @@ function loadRoomfinderMap(mapIndex: number, fromUi = false) {
}
function loadRoomfinderModalMap() {
const map = state.data.maps.roomfinder.available[state.map.roomfinder.selected_index];
const map =
state.data.maps.roomfinder.available[state.map.roomfinder.selected_index];
const rect = document
.getElementById("roomfinder-modal-container")
.getBoundingClientRect();
.getElementById("roomfinder-modal-container")
.getBoundingClientRect();
// -1023px, -1023px is top left corner, 16px = 2*8px is element padding
state.map.roomfinder.modalX =
-1023 + (map.x / map.width) * (rect.width - 65);
state.map.roomfinder.modalX = -1023 + (map.x / map.width) * (rect.width - 65);
// We cannot use "height" here as it might be still zero before layouting
// finished, so we use the aspect ratio here.
state.map.roomfinder.modalY =
-1023 +
(map.y / map.height) * (rect.width - 65) * (map.height / map.width);
-1023 + (map.y / map.height) * (rect.width - 65) * (map.height / map.width);
}
function delayedLoadRoomfinderModalMap () {
function delayedLoadRoomfinderModalMap() {
setTimeout(loadRoomfinderModalMap, 1000);
}
</script>

<template>
<a
@click="state.map.roomfinder.modal_open=true"
@click="state.map.roomfinder.modal_open = true"
v-on:click="delayedLoadRoomfinderModalMap"
>
<div
Expand Down Expand Up @@ -164,43 +163,62 @@ function delayedLoadRoomfinderModalMap () {
<div
class="modal modal-lg"
id="roomfinder-modal"
v-bind:class="{active: state.map.roomfinder.modal_open}"
v-bind:class="{ active: state.map.roomfinder.modal_open }"
>
<a
class="modal-overlay"
v-bind:aria-label="$t('view_view.roomfinder_modal.close')"
@click="state.map.roomfinder.modal_open=false"
@click="state.map.roomfinder.modal_open = false"
>
</a>
<div class="modal-container modal-fullheight" id="roomfinder-modal-container">
<div
class="modal-container modal-fullheight"
id="roomfinder-modal-container"
>
<div class="modal-header">
<button
class="btn btn-clear float-right"
v-bind:aria-label="$t('view_view.roomfinder_modal.close')"
@click="state.map.roomfinder.modal_open=false"
>
</button>
<h5 class="modal-title">{{ $t("view_view.roomfinder_modal.header") }}</h5>
@click="state.map.roomfinder.modal_open = false"
></button>
<h5 class="modal-title">
{{ $t("view_view.roomfinder_modal.header") }}
</h5>
</div>
<div class="modal-body">
<div class="roomfinder-map-container">
<img
alt="Cross showing where the room is located on the hand-drawn roomfinder map image"
src="../assets/map/roomfinder_cross-v2.webp"
v-bind:style="{'transform': 'translate(' + state.map.roomfinder.modalX + 'px, ' + state.map.roomfinder.modalY + 'px)'}"
v-bind:style="{
transform:
'translate(' +
state.map.roomfinder.modalX +
'px, ' +
state.map.roomfinder.modalY +
'px)',
}"
id="roomfinder-modal-map-cross"
/>
<img
alt="Hand-drawn roomfinder map image"
v-bind:src="'/cdn/maps/roomfinder/' + state.data.maps.roomfinder.available[state.map.roomfinder.selected_index].file"
v-bind:src="
'/cdn/maps/roomfinder/' +
state.data.maps.roomfinder.available[
state.map.roomfinder.selected_index
].file
"
class="img-responsive"
v-bind:width="state.map.roomfinder.width"
v-bind:height="state.map.roomfinder.height"
id="roomfinder-modal-map-img"
/>
<div>
{{ $t("view_view.map.img_source") }}: {{
state.data.maps.roomfinder.available[state.map.roomfinder.selected_index].source
{{ $t("view_view.map.img_source") }}:
{{
state.data.maps.roomfinder.available[
state.map.roomfinder.selected_index
].source
}}
</div>
</div>
Expand Down Expand Up @@ -270,7 +288,7 @@ function delayedLoadRoomfinderModalMap () {
#roomfinder-modal-map-cross {
position: absolute;
transition: transform .3s;
transition: transform 0.3s;
pointer-events: none;
}
Expand Down
2 changes: 1 addition & 1 deletion webclient/src/components/FeedbackModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function _assuereTokenValidity() {
if (r.status === 201) {
token.value = {
creation: Date.now(),
value: r.response.replace(/^"(.*)"$/, '$1'),
value: r.response.replace(/^"(.*)"$/, "$1"),
};
setLocalStorageWithExpiry("feedback-token", token.value, 6);
} else if (r.status === 429) {
Expand Down
2 changes: 1 addition & 1 deletion webclient/src/locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,4 @@ view_view:
modal_roomfinder:
header: "Lageplan"
close: "Schließen"
image_alt: "Ein Bild welches den Lageplan zeigt"
image_alt: "Ein Bild welches den Lageplan zeigt"
4 changes: 2 additions & 2 deletions webclient/src/stores/details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const useDetailsStore = defineStore({
x: -1023 - 10, // Outside in top left corner
y: -1023 - 10,
modal_open: false,
modalX: -1023 -10, // Outside in top left corner
modalY: -1023 -10,
modalX: -1023 - 10, // Outside in top left corner
modalY: -1023 - 10,
width: 400,
height: 300,
},
Expand Down
10 changes: 8 additions & 2 deletions webclient/src/views/DetailsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ onMounted(() => {
</button>
<button
class="btn btn-primary btn-sm"
@click="(addLocationPicker)=>$refs.feedbackButton.openFeedbackForm(addLocationPicker)"
@click="
(addLocationPicker) =>
$refs.feedbackButton.openFeedbackForm(addLocationPicker)
"
>
<i class="icon icon-check"></i>
{{ $t("view_view.msg.coordinate-counter.send") }}
Expand Down Expand Up @@ -328,7 +331,10 @@ onMounted(() => {

<DetailsInteractiveMap
ref="interactiveMap"
@open-feedback-form="(addLocationPicker)=>$refs.feedbackButton.openFeedbackForm(addLocationPicker)"
@open-feedback-form="
(addLocationPicker) =>
$refs.feedbackButton.openFeedbackForm(addLocationPicker)
"
/>
<DetailsRoomfinderMap ref="roomfinderMap" />
<div class="btn-group btn-group-block">
Expand Down
4 changes: 3 additions & 1 deletion webclient/src/views/MainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ function less(id: string) {
<button
class="btn btn-link"
v-bind:style="{ visibility: site.id ? '' : 'hidden' }"
v-bind:aria-label="`show the details for the campus '` + site.name + `'`"
v-bind:aria-label="
`show the details for the campus '` + site.name + `'`
"
>
<i class="icon icon-forward"></i>
</button>
Expand Down
3 changes: 2 additions & 1 deletion webclient/src/views/SearchView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ function genDescription(): string {
v-else
class="avatar avatar-sm"
src="../assets/thumb-building.webp"
alt="Thumbnail for said building"/>
alt="Thumbnail for said building"
/>
</div>
<div class="tile-content">
<div class="tile-title">
Expand Down
2 changes: 1 addition & 1 deletion webclient/tsconfig.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*"],
"compilerOptions": {
"composite": true,
"types": ["node","@intlify/unplugin-vue-i18n/messages"]
"types": ["node", "@intlify/unplugin-vue-i18n/messages"]
}
}

0 comments on commit ac45b8a

Please sign in to comment.