Skip to content

Commit

Permalink
Updated combined MET window
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlk96 committed Oct 11, 2024
1 parent 8c8b92f commit 00df2e1
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
32 changes: 32 additions & 0 deletions frontend/src/components/Full.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- frontend/src/components/Full.vue -->
<template>
<div class="full-component">
<Sun :id="props.id" />
<hr class="component-divider">
<Metreport :id="props.id" />
<hr class="component-divider">
<Metsensor :id="props.id" />
</div>
</template>

<script setup lang="ts">
import Sun from "@/components/Sun.vue"
import Metreport from "@/components/Metreport.vue"
import Metsensor from "@/components/Metsensor.vue"
const props = defineProps<{ id: string }>()
</script>

<style scoped>
.full-component {
display: flex;
flex-direction: column;
gap: 5px;
}
.component-divider {
width: 100%;
border: none;
border-top: 2px solid #808080;
}
</style>
6 changes: 6 additions & 0 deletions frontend/src/components/menu/MainMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ import Submenu from "@/components/menu/Submenu.vue"
import { useWindowsStore } from "@/stores/windows"
const windows = useWindowsStore()
import Full from "@/components/Full.vue"
const menuItems = {
MET: {
ALL: {
// This will be filled in with ICAO codes
} as { [key: string]: string },
METREPORT: {
// filled in code
} as { [key: string]: string },
Expand Down Expand Up @@ -59,6 +64,7 @@ const menuItems = {
import { wxAirports } from "@/stores/wx"
for (const icao of wxAirports) {
menuItems.MET.ALL[icao] = `full${icao}`
menuItems.MET.METREPORT[icao] = `metrep${icao}`
menuItems.MET.METSENSOR[icao] = `metsen${icao}`
menuItems.MET.SUN[icao] = `sun${icao}`
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/stores/wx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,14 @@ export const useWxStore = defineStore("wx", () => {
}

function fetch(icao: string) {
if (!(icao in viewIdByIcao)) throw `No viewId for icao ${icao}`
if (!icao) {
console.error("Attempted to fetch weather data with undefined ICAO");
return;
}
if (!(icao in viewIdByIcao)) {
console.error(`No viewId for icao ${icao}`);
return;
}
if (!(icao in wx)) wx[icao] = "Loading..."
lastFetch[icao] = new Date()
console.log(`Fetch wx ${icao}`)
Expand Down
1 change: 1 addition & 0 deletions frontend/src/views/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import Image from "@/components/Image.vue"
import ECFMP from "@/components/ECFMP.vue"
import Iframe from "@/components/Iframe.vue"
import Sun from "@/components/Sun.vue"
import Full from "@/components/Full.vue"
import { onBeforeUnmount, onUnmounted } from "vue"
import { useWindowsStore } from "@/stores/windows"
Expand Down

0 comments on commit 00df2e1

Please sign in to comment.