diff --git a/.gitignore b/.gitignore index 9f860c6..8ee54e8 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,3 @@ coverage *.sw? *.tsbuildinfo -*~ diff --git a/CHANGELOG.md b/CHANGELOG.md index db28db8..bf57eca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,30 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -## 0.1.11 - 2025-10-06 -### Changed -- update source code info for about page - -## 0.1.10 - 2024-06-09 -### Changed -- Fix URL bug when refreshing weather radar. - -## 0.1.9 - 2024-06-09 -### Changed -- Warning notification should not butt up against forecast panel. -- Add timestamp param to bust cache when refreshing radar images. - -## 0.1.8 - 2024-06-09 -### Added -- Add link to national radar map (live image). -- Add refresh buttons to weather data pages. -### Changed -- Convert all view components to use Composition API. - -## 0.1.7 - 2024-06-08 -### Added -- Add basic support for active weather alerts. - ## 0.1.6 - 2024-06-08 ### Changed - Add proper About page. diff --git a/package-lock.json b/package-lock.json index 8dc30e3..da7cc0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "myweather", - "version": "0.1.11", + "version": "0.1.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "myweather", - "version": "0.1.11", + "version": "0.1.6", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.5.2", "@fortawesome/free-solid-svg-icons": "^6.5.2", diff --git a/package.json b/package.json index 46a5d15..c12ea00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "myweather", - "version": "0.1.11", + "version": "0.1.6", "private": true, "type": "module", "scripts": { diff --git a/src/router/index.js b/src/router/index.js index 7430367..464d998 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,7 +1,6 @@ import { createRouter, createWebHistory } from 'vue-router' import HomeView from '../views/HomeView.vue' import WeatherView from '../views/WeatherView.vue' -import AlertsView from '../views/AlertsView.vue' import HourlyView from '../views/HourlyView.vue' import EditListView from '../views/EditListView.vue' @@ -18,11 +17,6 @@ const router = createRouter({ name: 'weather', component: WeatherView, }, - { - path: '/alerts', - name: 'alerts', - component: AlertsView, - }, { path: '/hourly', name: 'hourly', diff --git a/src/stores/weather.js b/src/stores/weather.js index f02e4a9..c8c91ab 100644 --- a/src/stores/weather.js +++ b/src/stores/weather.js @@ -10,7 +10,6 @@ const getDefaults = () => { coordinates, cityState, weather: null, - alerts: null, forecast: null, radarLatestURL: null, radarLoopURL: null, @@ -26,26 +25,21 @@ export const useWeatherStore = defineStore('weather', { actions: { - clearWeather(keepCoordinates) { - if (!keepCoordinates) { - this.setCoordinates(null) - this.setCityState(null) - } + clearWeather() { + this.setCoordinates(null) + this.setCityState(null) this.setWeather(null) this.setForecast(null) this.radarLatestURL = null this.radarLoopURL = null - this.alerts = null }, async getWeather() { if (!this.weather) { - let url - let response - url = `https://api.weather.gov/points/${this.coordinates}` - response = await fetch(url) + const url = `https://api.weather.gov/points/${this.coordinates}` + const response = await fetch(url) const weather = await response.json() if (weather.status == 404) { throw new Error(`Data not found for ${this.coordinates}`) @@ -63,65 +57,6 @@ export const useWeatherStore = defineStore('weather', { this.radarLoopURL = `https://radar.weather.gov/ridge/standard/${station}_loop.gif` this.setWeather(weather) - - // fetch zone to get its official id - url = weather.properties.forecastZone - response = await fetch(url) - const zone = await response.json() - - // fetch alerts for zone - url = `https://api.weather.gov/alerts/active/zone/${zone.properties.id}` - response = await fetch(url) - const zoneAlerts = await response.json() - - // fetch county to get its official id - url = weather.properties.county - response = await fetch(url) - const county = await response.json() - - // fetch alerts for county - url = `https://api.weather.gov/alerts/active/zone/${county.properties.id}` - response = await fetch(url) - const countyAlerts = await response.json() - - const newAlerts = {} - - // use latest timestamp from either zone or county - newAlerts.updated = zoneAlerts.updated - if (countyAlerts.updated > zoneAlerts.updated) { - newAlerts.updated = countyAlerts.updated - } - - // collect all alert "features" but de-duplicate them - newAlerts.features = {} - for (let feature of zoneAlerts.features) { - newAlerts.features[feature.properties.id] = feature - } - for (let feature of countyAlerts.features) { - newAlerts.features[feature.properties.id] = feature - } - newAlerts.features = Object.values(newAlerts.features) - - // put "likely" before "possible" alerts - newAlerts.features.sort((a, b) => { - - if (a.properties.certainty == 'Likely' && b.properties.certainty != 'Likely') { - return -1 - } - if (a.properties.certainty != 'Likely' && b.properties.certainty == 'Likely') { - return 1 - } - - // if (a.properties.certainty == b.properties.certainty) { - // return 0 - // } - - // TODO: what else should this do? - return 0 - }) - - // we have our final alerts - this.alerts = newAlerts } return this.weather @@ -131,7 +66,7 @@ export const useWeatherStore = defineStore('weather', { if (!this.forecast) { - const weather = await this.getWeather() + const weather = await this.getWeather(this.coordinates) const url = weather.properties.forecast const response = await fetch(url) diff --git a/src/views/AboutView.vue b/src/views/AboutView.vue index c1deb33..f04a514 100644 --- a/src/views/AboutView.vue +++ b/src/views/AboutView.vue @@ -2,6 +2,17 @@ import appsettings from '../appsettings' + +