Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into preview
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Ribiere committed Mar 13, 2024
2 parents 3cc5e54 + 91f97c4 commit cf0f72f
Show file tree
Hide file tree
Showing 19 changed files with 169 additions and 42 deletions.
21 changes: 20 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@
</div>
<AppLegend/>
<VirtualVisit v-if="store.getState().virtualVisitAlreadyOpened"/>
<div
v-if="store.getState().informationTooltip.visible"
class="information-tooltip"
:style="tooltipPosition"
>
<p class="information-tooltip-title">{{ store.getState().informationTooltip.content.title }}</p>
<p class="information-tooltip-text">{{ store.getState().informationTooltip.content.text }}</p>
</div>
</template>

<script lang="ts" setup>
import { store } from "./main"
import { onMounted } from "vue"
import { computed, onMounted, watch } from "vue"
import AppHeader from "./components/Header.vue"
import AppLegend from "./components/MapLegend.vue"
import BaseMap from "./components/BaseMap.vue"
Expand All @@ -30,4 +38,15 @@ onMounted(() => {
store.initStore()
})
const tooltipPosition = computed(() => {
console.log(store.getTooltipPosition())

Check failure on line 42 in src/App.vue

View workflow job for this annotation

GitHub Actions / build-and-deploy

Unexpected console statement
return store.getTooltipPosition()
})
watch(() => store.getState().informationTooltip.visible, () => {
if (store.getState().informationTooltip.visible) {
console.log("x:" + store.getState().informationTooltip.position.x + " y: " + store.getState().informationTooltip.position.y)

Check failure on line 48 in src/App.vue

View workflow job for this annotation

GitHub Actions / build-and-deploy

Unexpected console statement
}
})
</script>
33 changes: 31 additions & 2 deletions src/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,20 @@ export class Store {
harbor: true,
srr: true,
incident: false,
death: true,
shipwreck: true
death: false,
shipwreck: false
},
informationTooltip: {
visible: false,
position: {
orientation: "left",
x: 0,
y: 0
},
content: {
title: "",
text: ""
}
}
})

Expand All @@ -52,6 +64,23 @@ export class Store {
this.appState.virtualVisitAlreadyOpened = !this.appState.virtualVisitAlreadyOpened
}

public setInformationTooltipParameters (visible: boolean, position?: ApplicationState["informationTooltip"]["position"], content?: ApplicationState["informationTooltip"]["content"]) {
if (position) this.appState.informationTooltip.position = position
if (content) this.appState.informationTooltip.content = content
this.appState.informationTooltip.visible = visible
}

public getTooltipPosition () {
const position: any = {}
this.appState.informationTooltip.position.orientation === "right"
? position.top = this.appState.informationTooltip.position.y - 15 + "px"
: position.bottom = (window.innerHeight - this.appState.informationTooltip.position.y) + 5 + "px"
this.appState.informationTooltip.position.orientation === "right"
? position.left = this.appState.informationTooltip.position.x + 15 + "px"
: position.right = (window.innerWidth - this.appState.informationTooltip.position.x) + 15 + "px"
return position
}

// ////////////// ---------DATA STATE---------- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

private dataState: DataState = reactive({
Expand Down
1 change: 1 addition & 0 deletions src/assets/question.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 24 additions & 1 deletion src/assets/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,27 @@

.BaseMapPicker__itemBtnGrp {
overflow: hidden;
}
}

.more-information-button{
height: 12px;
cursor: pointer;
}

.information-tooltip{
position: fixed;
z-index: 3000;
background-color: rgba(26, 39, 71, 0.9);
color: white;
padding: 15px;
max-width: 350px;
border-radius: 5px;
}

.information-tooltip-title{
color: #F03E1B;
font-size: 1.2em;
font-weight: bold;
}

/* .information-tooltip-text */
14 changes: 13 additions & 1 deletion src/classes/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,19 @@ export interface ApplicationState {
virtualVisitAlreadyOpened: boolean;
minDate: Date;
maxDate: Date;
switch: { [key in SwitchType]: boolean }
switch: { [key in SwitchType]: boolean };
informationTooltip: {
visible: boolean;
position: {
orientation: "right" | "left";
x: number;
y: number;
};
content: {
title: string;
text: string;
}
};
}

export interface DataState {
Expand Down
2 changes: 1 addition & 1 deletion src/components/BaseMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ watch(() => store.getData().dataLoaded, () => {
position: absolute;
background-color: rgba(26, 39, 71, 0.8);
color: white;
padding: 10px;
padding: 2px 5px;
border-radius: 5px;
z-index: 1000;
}
Expand Down
7 changes: 6 additions & 1 deletion src/components/HistogramSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,15 @@ export default defineComponent({
<style>
.histo{
margin-left: 3% !important;
height: 20% !important;
padding: 20px !important;
}
@media only screen and (min-width: 500px) {
.histo{
height: 9rem !important;
}
}
@media only screen and (max-width: 500px){
.histo{
padding: 0px !important;
Expand Down
8 changes: 8 additions & 0 deletions src/components/LegendSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<div v-if="color" class="legend-marker mr-2" :style="{ backgroundColor: color}"></div>
<div v-if="iconName" class="legend-marker mr-2"><img :src="`./basemaps-icons/${iconName}`" alt=""></div>
<label :for="id" class="text-xs label-color">{{title}}</label>
<img v-if="tooltip" class="more-information-button ml-1" src="@/assets/question.svg" alt="" @mouseenter="setInformationTooltip($event, tooltip[0], tooltip[1])" @mouseleave="removeInformationTooltip">
</div>
<div class="relative inline-block w-8 mr-2 align-middle select-none transition duration-200 ease-in" v-if="switchable">
<input
Expand Down Expand Up @@ -33,11 +34,18 @@ defineProps<{
title: string
iconName? : string
color?: string
tooltip?: [string, string]
}>()
const url = process.env.BASE_URL
function toggle (id: SwitchType) {
store.toggleSwitch(id)
}
function setInformationTooltip (event: MouseEvent, title: string, text: string) {
store.setInformationTooltipParameters(true, { orientation: "left", x: event.clientX, y: event.clientY }, { title, text })
}
function removeInformationTooltip () {
store.setInformationTooltipParameters(false)
}
</script>

<style>
Expand Down
7 changes: 4 additions & 3 deletions src/components/MapLegend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
class="flex flex-col rounded-2xl w-1/2 legend-background absolute top-32 ml-4 legend-position-mobile sm:w-60 md:right-5 md:absolute md:bottom-5 md:top-auto">
<p class="text-xs text-center font-bold text-secondary">{{ $t("legend.title").toUpperCase() }}</p>
<Legend-switch :id="SwitchType.rescue" :checked="switchState.rescue" :title="$t(`legend.${SwitchType.rescue}`)" color="#F03E1B" :switchable="true"></Legend-switch>
<Legend-switch :id="SwitchType.transfer" :checked="switchState.transfer" :title="$t(`legend.${SwitchType.transfer}`)" color="#9CA3AF" :switchable="true"></Legend-switch>
<Legend-switch v-if="showAllLegend" :id="SwitchType.medEvac" :checked="switchState.medEvac" :title="$t(`legend.${SwitchType.medEvac}`)" color="#1A2747" :switchable="true"></Legend-switch>
<Legend-switch :id="SwitchType.transfer" :checked="switchState.transfer" :title="$t(`legend.${SwitchType.transfer}`)" color="#9CA3AF" :switchable="true" :tooltip="[$t(`legend.${SwitchType.transfer}`), $t('legend.transferDescription')]"></Legend-switch>
<Legend-switch v-if="showAllLegend" :id="SwitchType.medEvac" :checked="switchState.medEvac" :title="$t(`legend.${SwitchType.medEvac}`)" color="#1A2747" :switchable="true" :tooltip="[$t(`legend.${SwitchType.medEvac}`), $t('legend.medEvacDescription')]"></Legend-switch>
<Legend-switch :id="SwitchType.death" :checked="switchState.death" :title="$t(`legend.${SwitchType.death}`)" iconName="deaths.svg" :switchable="true"></Legend-switch>
<Legend-switch v-if="showAllLegend" :id="SwitchType.shipwreck" :checked="switchState.shipwreck" :title="$t(`legend.${SwitchType.shipwreck}`)" iconName="shipwreck.png" :switchable="true"></Legend-switch>
<Legend-switch v-if="showAllLegend" :id="SwitchType.incident" :checked="switchState.incident" :title="$t(`legend.${SwitchType.incident}`)" iconName="incident.png" :switchable="true"></Legend-switch>
Expand All @@ -13,7 +13,7 @@
<line x1="0" y1="20" x2="100" y2="20" stroke="black"/>
</svg>
<Legend-switch :id="SwitchType.harbor" :checked="switchState.harbor" :title="$t(`legend.${SwitchType.harbor}`)" iconName="harbor.png" :switchable="false"></Legend-switch>
<Legend-switch :id="SwitchType.srr" :checked="switchState.srr" :title="$t(`legend.${SwitchType.srr}`)" iconName="srr.png" class="srr" :switchable="false"></Legend-switch>
<Legend-switch :id="SwitchType.srr" :checked="switchState.srr" :title="$t(`legend.${SwitchType.srr}`)" iconName="srr.png" class="srr" :switchable="false" :tooltip="[$t(`legend.${SwitchType.srr}`), $t('legend.srrDescription')]"></Legend-switch>
</div>
</template>

Expand All @@ -25,6 +25,7 @@ import LegendSwitch from "./LegendSwitch.vue"
const switchState = computed(() => store.getState().switch)
const showAllLegend = ref(false)
</script>

<style>
Expand Down
5 changes: 4 additions & 1 deletion src/components/PopUp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const popUpType = computed(() => store.getState().popUpType)
.divider{
margin: 10px 40px;
border-bottom: 1px solid var(--text-color);
/* border-bottom: 1px solid var(--text-color); */
}
.testimony-text{
text-decoration: underline dotted;
}
</style>
38 changes: 22 additions & 16 deletions src/components/Stats.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- eslint-disable vue/multi-word-component-names -->
<template>

<!-- mobile version -->
Expand Down Expand Up @@ -35,7 +36,10 @@
</h1>
<div class="flex flex-col pb-3 pl-6 pr-6">
<span class="icon icon-rescue text-3xl text-center text-secondary"/>
<p class="text-main text-xl font-bold mb-2"><span id="statsNbSurvivor" class="text-secondary"/> {{ $t("stats.peoples") }}</p>
<p class="text-main text-xl font-bold mb-2 flex justify-center">
<span id="statsNbSurvivor" class="text-secondary mr-2"/> {{ $t("stats.peoples") }}
<img class="more-information-button ml-2" src="@/assets/question.svg" alt="" @mouseenter="setInformationTooltip($event, $t('stats.peoples'), $t('stats.peoplesDescription'))" @mouseleave="removeInformationTooltip">
</p>
<div class="flex flex-row justify-around mb-2 text-main">
<div class="flex flex-col">
<span class="icon icon-female text-3xl text-center"/>
Expand Down Expand Up @@ -80,27 +84,29 @@
<div class="flex flex-col flex-wrap align-center cursor-pointer virtual-visit-shower" @click.stop="showVirtualVisit()">
<span class="icon icon-tour text-8xl leading-6 text-center text-secondary mb-2"/>
<span class="icon icon-sosmed-ship text-8xl leading-6 text-center text-secondary mb-2"/>
<p class="text-center text-main text-xl font-bold"><span id="statsOps3" class="text-secondary"/> {{ $t("stats.rescueNb") }}</p>
<p class="text-center text-main text-xl font-bold flex justify-center">
<span id="statsOps3" class="text-secondary mr-2"/> {{ $t("stats.rescueNb") }}
<img class="more-information-button ml-2" src="@/assets/question.svg" alt="" @mouseenter="setInformationTooltip($event, $t('stats.rescueNb'), $t('stats.rescueDescription'))" @mouseleave="removeInformationTooltip">
</p>
</div>
</div>
</div>
</template>

<script lang="ts">
import { defineComponent } from "vue"
<script lang="ts" setup>
import { store } from "@/main"
export default defineComponent({
data () {
return { displayingStats: true }
},
name: "Base-Map-Stats",
methods: {
showVirtualVisit (): void {
store.switchVirtualVisitVisibility()
}
}
})
import { ref } from "vue"
const displayingStats = ref(true)
function showVirtualVisit (): void {
store.switchVirtualVisitVisibility()
}

function setInformationTooltip (event: MouseEvent, title: string, text: string) {
store.setInformationTooltipParameters(true, { orientation: "right", x: event.clientX, y: event.clientY }, { title, text })
}
function removeInformationTooltip () {
store.setInformationTooltipParameters(false)
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
Expand Down
2 changes: 1 addition & 1 deletion src/components/popUpContent/DeathDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="divider"></div>
<p class="text-sm flex" v-if="deathData.testimonySrc.length > 0">
<img src="@/assets/comments.svg" class="popup-icon"> {{ $t("popup.testimony") }}:
<span class="font-bold ml-2 underline" v-for="(src, i) in deathData.testimonySrc" :key="src+i">
<span class="font-bold ml-2 testimony-text" v-for="(src, i) in deathData.testimonySrc" :key="src+i">
<a :href="src" target="_blank">{{ deathData.testimonyName[i] }} {{ i < deathData.testimonySrc.length -1 ? "," : "" }}</a>
</span>
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/components/popUpContent/IncidentDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</p>
<p class="text-sm flex" v-if="incidentData.testimonySrc.length > 0">
<img src="@/assets/comments.svg" class="popup-icon"> {{ $t("popup.testimony") }}:
<span class="font-bold ml-2 underline" v-for="(src, i) in incidentData.testimonySrc" :key="src+i">
<span class="font-bold ml-2 testimony-text" v-for="(src, i) in incidentData.testimonySrc" :key="src+i">
<a :href="src" target="_blank">{{ incidentData.testimonyName[i] }} {{ i < incidentData.testimonySrc.length -1 ? "," : "" }}</a>
</span>
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/components/popUpContent/OperationDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</div>
<p class="text-sm flex" v-if="opsData.testimonySrc.length > 0">
<img src="@/assets/comments.svg" class="popup-icon"> {{ $t("popup.testimony") }}:
<span class="font-bold ml-2 underline" v-for="(src, i) in opsData.testimonySrc" :key="src+i">
<span class="font-bold ml-2 testimony-text" v-for="(src, i) in opsData.testimonySrc" :key="src+i">
<a :href="src" target="_blank">{{ opsData.testimonyName[i] }} {{ i < opsData.testimonySrc.length -1 ? "," : "" }}</a>
</span>
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/components/popUpContent/ShipwreckDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="divider"></div>
<p class="text-sm flex" v-if="shipwreckData.testimonySrc.length > 0">
<img src="@/assets/comments.svg" class="popup-icon"> {{ $t("popup.testimony") }}:
<span class="font-bold ml-2 underlinex" v-for="(src, i) in shipwreckData.testimonySrc" :key="src+i">
<span class="font-bold ml-2 testimony-text" v-for="(src, i) in shipwreckData.testimonySrc" :key="src+i">
<a :href="src" target="_blank">{{ shipwreckData.testimonyName[i] }} {{ i < shipwreckData.testimonySrc.length -1 ? "," : "" }}</a>
</span>
</p>
Expand Down
9 changes: 7 additions & 2 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
"title": "Ansicht",
"rescue": "Rettung",
"transfer": "Überführung",
"transferDescription": "Überführung geretteter Personen zwischen zwei Schiffen. Dies kann durch RIBs oder daneben erfolgen.",
"medEvac": "medizinische Evakuierung",
"medEvacDescription": "Rettungstechnik, die auf dem schnellen Transport und der medizinischen Betreuung von verletzten und kranken Personen zu einer besser ausgestatteten Gesundheitseinrichtung beruht.",
"srr": "Such- und Rettungsregion",
"srrDescription": "Ein mit aRCC verbundener Bereich mit definierten Abmessungen, in dem SAR-Dienste bereitgestellt werden. Suche: Eine Operation, die normalerweise von einer Rettungsleitstelle oder einer Rettungsunterzentrale koordiniert wird und bei der das verfügbare Personal und die verfügbaren Einrichtungen genutzt werden, um in Not geratene Personen zu lokalisieren. Rettung Eine Operation, um in Not geratene Personen zu bergen, ihren ersten medizinischen oder anderen Bedarf zu decken und sie an einen sicheren Ort zu bringen; (Quelle: SAR-Übereinkommen 1979, Kapitel 1.3.1-2)",
"harbor": "Hafen",
"shipwreck": "Schiffbruch",
"incident": "Zwischenfall",
Expand All @@ -38,11 +41,13 @@
"minors": "Minderjährige",
"pregnants": "Schwangere Frauen",
"unaccompanied": "Unbegleitete Minderjährige",
"children": "Kinder",
"children": "Kinder unter 5 Jahren",
"nationalities": "Nationalitäten",
"peoples": "Überlebende",
"peoplesDescription": "Offizieller Begriff zur Bezeichnung der aus einer Notsituation geretteten Personen.",
"opDays": "Tage der Operation",
"rescueNb" : "Rettungseinsätze",
"rescueDescription" : "",
"since": "Seit"
},
"popup": {
Expand All @@ -63,4 +68,4 @@
"histogram": {
"text": "Anzahl der Operationen pro Monat"
}
}
}
Loading

0 comments on commit cf0f72f

Please sign in to comment.