-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #764 from InternetHealthReport/dev
Integrating latest changes
- Loading branch information
Showing
14 changed files
with
228 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<script setup> | ||
import { ref, onMounted } from 'vue' | ||
import { QDialog, QCard, QCardSection, QBtn } from 'quasar' | ||
const dialog = ref(false) | ||
const openDialog = () => { | ||
dialog.value = true | ||
} | ||
const closeDialog = () => { | ||
dialog.value = false | ||
} | ||
const onAcceptClick = () => { | ||
localStorage.setItem('cookie-preference', true) | ||
closeDialog() | ||
} | ||
const onDeclineClick = () => { | ||
closeDialog() | ||
} | ||
onMounted(() => { | ||
const preferenceValue = localStorage.getItem('cookie-preference') | ||
if (preferenceValue === null || preferenceValue === undefined || preferenceValue !== 'true') { | ||
openDialog() | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<QDialog v-model="dialog" persistent no-shake seamless :position="'bottom'"> | ||
<QCard style="width: 350px; border-radius: 6px; background-color: #323232"> | ||
<QCardSection class="items-center no-wrap cookieBanner_Container"> | ||
<p class="cookieBanner_Message"> | ||
This website use cookies, which are necessary for its functioning and required to achieve | ||
the purposes illustrated in the Data and Cookie policy. | ||
</p> | ||
<div class="cookieBanner_Buttons"> | ||
<QBtn flat style="color: yellow" label="Accept" @click="onAcceptClick" /> | ||
<QBtn flat style="color: darkgray" label="Decline" @click="onDeclineClick" /> | ||
</div> | ||
</QCardSection> | ||
</QCard> | ||
</QDialog> | ||
</template> | ||
|
||
<style> | ||
.fixed-bottom { | ||
right: 0px !important; | ||
bottom: 10px !important; | ||
left: auto !important; | ||
} | ||
.q-dialog__inner--minimized { | ||
padding: 10px !important; | ||
} | ||
.cookieBanner_Buttons { | ||
align-self: flex-end; | ||
} | ||
.cookieBanner_Container { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.cookieBanner_Message { | ||
font-size: 16px; | ||
font-weight: 600; | ||
font-family: inherit; | ||
color: white; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<script setup> | ||
import { ref, onMounted, inject } from 'vue' | ||
import ReactiveChart from '@/components/charts/ReactiveChart.vue' | ||
import { CountryQuery } from '@/plugins/IhrApi' | ||
const ihr_api = inject('ihr_api') | ||
const countryQuery = ref(new CountryQuery().orderedByCode()) | ||
const countryNames = ref([]) | ||
const countryCodes = ref([]) | ||
const loading = ref(false) | ||
const emit = defineEmits(['country-selected']) | ||
const layout = { | ||
title: 'Select a country', | ||
geo: { | ||
showframe: false, | ||
projection: { | ||
type: 'equirectangular' | ||
}, | ||
showcountries: true, | ||
showcoastlines: 'yes' | ||
}, | ||
autosize: true | ||
} | ||
const traces = ref([{ | ||
type: 'choropleth', | ||
locationmode: 'country names', | ||
locations: [], | ||
z: [], | ||
text: [], | ||
hoverinfo: 'text', | ||
autocolorscale: false, | ||
showscale: false | ||
}]) | ||
const fetchData = async () => { | ||
try { | ||
loading.value = true | ||
countryQuery.value.containsName('') | ||
ihr_api.country(countryQuery.value, (result) => { | ||
result.results.forEach((country) => { | ||
countryNames.value.push(country.name) | ||
countryCodes.value.push(country.code) | ||
}) | ||
traces.value[0].locations = countryNames.value | ||
traces.value[0].text = countryNames.value | ||
traces.value[0].z = countryNames.value.map(() => 0) | ||
loading.value = false | ||
}) | ||
} catch (error) { | ||
console.error('Error loading data:', error) | ||
loading.value = false | ||
} | ||
} | ||
onMounted(()=>{ | ||
fetchData() | ||
}) | ||
const onCountryClick = (eventData) => { | ||
if (eventData && eventData.points && eventData.points[0]) { | ||
const countryCodeIndex = eventData.points[0].pointIndex | ||
const countryCode = countryCodes.value[countryCodeIndex] | ||
emit('country-selected', countryCode) | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div class="map-container"> | ||
<ReactiveChart | ||
:layout="layout" | ||
:traces="traces" | ||
@plotly-click="onCountryClick" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.map-container { | ||
width: 100%; | ||
} | ||
@media screen and (max-width: 768px) { | ||
.map-container { | ||
display: none; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.