Icon caching

This commit is contained in:
2026-06-26 20:52:54 -04:00
parent aeffa30417
commit 73f1453daf
15 changed files with 29 additions and 60 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import Loading from '@/components/Loading.vue';
import {inject, onMounted, ref} from 'vue';
import {api} from '../services/api';
import {api, BASE} from '../services/api';
const data = ref<any>();
const openGraph = inject<(key: string) => void>('openGraph');
@@ -80,7 +80,7 @@ onMounted(async () => {
<div class="flex-r align-items-center justify-between">
<div v-if="!data" class="pos-rel br-2 overflow-hidden" style="width: 75px; height: 50px"><Loading/></div>
<div v-else class="flex-c justify-center align-items-center mx-3">
<img :src="'https://openweathermap.org/img/wn/' + data.icon + '@2x.png'" class="today-icon" alt="weather" />
<img :src="BASE + '/api/icon/' + data.icon" class="today-icon" alt="weather" />
<div class="today-label">{{ data.label }}</div>
</div>
<div class="flex-r align-items-center gap-2">

View File

@@ -67,7 +67,7 @@ onMounted(async () => {
<div v-if="days?.length" class="strip">
<div v-for="d in days" class="day">
<div class="day-name">{{ formatDate('ddd, MMM D', d.time) }}</div>
<img :src="BASE + d.icon" class="day-icon" :alt="(d.label?.toString() || '')" />
<img :src="BASE + '/api/icon/' + d.icon" class="day-icon" :alt="(d.label?.toString() || '')" />
<div class="day-label">{{ d.label }}</div>
<div class="day-temps">
<span>{{ ~~(d.temperature_max) + '°' || '—' }}</span>

View File

@@ -87,7 +87,7 @@ onMounted(async () => {
<template v-if="hours?.length">
<div v-for="h in hours" class="hour-row">
<span class="hour-time">{{ formatDate('h A', h.time) }}</span>
<img :src="BASE + h.icon" class="hour-icon" :alt="h.label?.toString() || ''" />
<img :src="BASE + '/api/icon/' + h.icon" class="hour-icon" :alt="h.label?.toString() || ''" />
<span class="hour-label">{{ h.label }}</span>
<div class="hour-meta">
<span>🌧 {{ (h.precipitation as any || 0).toFixed(1) }}mm</span>