From e8c54abffba51ee756712d4750fb4ad95dd9fa68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Sat, 24 Aug 2024 10:32:51 -0700 Subject: [PATCH] Use wind speed and direction averages --- package.json | 14 +- .../APITables/WeatherTable/WeatherTable.tsx | 20 +- yarn.lock | 186 ++++++++++-------- 3 files changed, 124 insertions(+), 96 deletions(-) diff --git a/package.json b/package.json index 86e629e..1585512 100644 --- a/package.json +++ b/package.json @@ -22,31 +22,31 @@ "@mantine/core": "7.12.1", "@mantine/hooks": "7.12.1", "@mantine/notifications": "^7.12.1", - "@next/bundle-analyzer": "^14.2.5", + "@next/bundle-analyzer": "^14.2.6", "@tabler/icons": "^3.12.0", "@tabler/icons-react": "^3.12.0", "@visx/visx": "^3.11.0", - "next": "14.2.5", + "next": "14.2.6", "react": "18.3.1", "react-dom": "18.3.1", "react-use": "^17.5.1" }, "devDependencies": { "@babel/core": "^7.25.2", - "@next/eslint-plugin-next": "^14.2.5", + "@next/eslint-plugin-next": "^14.2.6", "@storybook/addon-essentials": "^8.2.9", "@storybook/addon-styling-webpack": "^1.0.0", "@storybook/blocks": "^8.2.9", "@storybook/nextjs": "^8.2.9", "@storybook/react": "^8.2.9", "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "^6.4.8", + "@testing-library/jest-dom": "^6.5.0", "@testing-library/react": "^16.0.0", "@testing-library/user-event": "^14.5.2", "@types/jest": "^29.5.12", - "@types/node": "^22.4.1", + "@types/node": "^22.5.0", "@types/postcss-modules-values": "^4.0.2", - "@types/react": "18.3.3", + "@types/react": "18.3.4", "@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/parser": "^7.18.0", "babel-loader": "^9.1.3", @@ -71,7 +71,7 @@ "storybook-dark-mode": "^4.0.2", "stylelint": "^16.8.2", "stylelint-config-standard-scss": "^13.1.0", - "ts-jest": "^29.2.4", + "ts-jest": "^29.2.5", "typescript": "5.5.4" }, "packageManager": "yarn@4.4.0" diff --git a/src/components/APITables/WeatherTable/WeatherTable.tsx b/src/components/APITables/WeatherTable/WeatherTable.tsx index d8c1eb4..4a7d107 100644 --- a/src/components/APITables/WeatherTable/WeatherTable.tsx +++ b/src/components/APITables/WeatherTable/WeatherTable.tsx @@ -25,6 +25,9 @@ type WeatherResponse = { wind_speed_min: number; wind_speed_avg: number; wind_speed_max: number; + wind_speed_avg_5m: number; + wind_dir_avg_5m: number; + wind_gust_5m: number; relative_humidity: number; air_pressure: number; rain_intensity: number; @@ -52,7 +55,8 @@ export default function WeatherTable() { const timestamp = weather?.[0]?.ts .replace(/T/, ' ') .replace(/Z/, '') - .replace(/\.\d+/, ''); + .replace(/\.\d+/, '') + .split(' ')[1]; const elements = [ { @@ -68,14 +72,20 @@ export default function WeatherTable() { }, { key: 'wind_speed_avg', - label: 'Wind Speed (avg.)', - value: weather?.[0]?.wind_speed_avg.toFixed(1), + label: 'Wind Speed (5m avg.)', + value: weather?.[0]?.wind_speed_avg_5m.toFixed(1), + unit: ' mph', + }, + { + key: 'wind_gust', + label: 'Wind Gust (5m max.)', + value: weather?.[0]?.wind_gust_5m.toFixed(1), unit: ' mph', }, { key: 'wind_dir_avg', - label: 'Wind Direction (avg.)', - value: weather?.[0]?.wind_dir_avg, + label: 'Wind Dir. (5m avg.)', + value: weather?.[0]?.wind_dir_avg_5m.toFixed(1), unit: ' degrees', }, { diff --git a/yarn.lock b/yarn.lock index df3feb9..ccf6ff6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3380,90 +3380,90 @@ __metadata: languageName: node linkType: hard -"@next/bundle-analyzer@npm:^14.2.5": - version: 14.2.5 - resolution: "@next/bundle-analyzer@npm:14.2.5" +"@next/bundle-analyzer@npm:^14.2.6": + version: 14.2.6 + resolution: "@next/bundle-analyzer@npm:14.2.6" dependencies: webpack-bundle-analyzer: "npm:4.10.1" - checksum: 10c0/0f5b8657e7797c4b30335fe0300a362eb32d3d96a93ee24e85e55fdee6fa3896a86ce81429003949e21d6c9f03114f42293bb74c6fba745c4f0fee9968e2d027 + checksum: 10c0/738620dbd27982ad2a6bab9b65091c5591c0054196b672d296985eaf35c4a5b393a4019fb350ca52985813f5b012f2b60d55c16f0f6d2d26c676e91ba869528c languageName: node linkType: hard -"@next/env@npm:14.2.5": - version: 14.2.5 - resolution: "@next/env@npm:14.2.5" - checksum: 10c0/63d8b88ac450b3c37940a9e2119a63a1074aca89908574ade6157a8aa295275dcb3ac5f69e00883fc55d0f12963b73b74e87ba32a5768a489f9609c6be57b699 +"@next/env@npm:14.2.6": + version: 14.2.6 + resolution: "@next/env@npm:14.2.6" + checksum: 10c0/9217847e1beb087d4adf25052337712d29150ff7f29e31616dd059154a319c9a8170c3a6d6d273b7adadf568cc604a5c2d0379a15aa3c149c0f78441a514c31c languageName: node linkType: hard -"@next/eslint-plugin-next@npm:^14.2.5": - version: 14.2.5 - resolution: "@next/eslint-plugin-next@npm:14.2.5" +"@next/eslint-plugin-next@npm:^14.2.6": + version: 14.2.6 + resolution: "@next/eslint-plugin-next@npm:14.2.6" dependencies: glob: "npm:10.3.10" - checksum: 10c0/13eefc2a17e37925ded8e43ae2446a73cbc5a23ade7a73c33adb75d3d2907ec75cedd8534f89a361ce8e63b5141d7e2d38aed40abd8b4eb3e7c21ba84f6bda8a + checksum: 10c0/52ca55d98bb72a3bccaa08859036d312bc4936be00923bd8c6399472928e6d2b295f4e2f5f94bec30c8b9274f02bb170ee272b1242ca6cad3ae3d1b4a0ceb53e languageName: node linkType: hard -"@next/swc-darwin-arm64@npm:14.2.5": - version: 14.2.5 - resolution: "@next/swc-darwin-arm64@npm:14.2.5" +"@next/swc-darwin-arm64@npm:14.2.6": + version: 14.2.6 + resolution: "@next/swc-darwin-arm64@npm:14.2.6" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@next/swc-darwin-x64@npm:14.2.5": - version: 14.2.5 - resolution: "@next/swc-darwin-x64@npm:14.2.5" +"@next/swc-darwin-x64@npm:14.2.6": + version: 14.2.6 + resolution: "@next/swc-darwin-x64@npm:14.2.6" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@next/swc-linux-arm64-gnu@npm:14.2.5": - version: 14.2.5 - resolution: "@next/swc-linux-arm64-gnu@npm:14.2.5" +"@next/swc-linux-arm64-gnu@npm:14.2.6": + version: 14.2.6 + resolution: "@next/swc-linux-arm64-gnu@npm:14.2.6" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-arm64-musl@npm:14.2.5": - version: 14.2.5 - resolution: "@next/swc-linux-arm64-musl@npm:14.2.5" +"@next/swc-linux-arm64-musl@npm:14.2.6": + version: 14.2.6 + resolution: "@next/swc-linux-arm64-musl@npm:14.2.6" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@next/swc-linux-x64-gnu@npm:14.2.5": - version: 14.2.5 - resolution: "@next/swc-linux-x64-gnu@npm:14.2.5" +"@next/swc-linux-x64-gnu@npm:14.2.6": + version: 14.2.6 + resolution: "@next/swc-linux-x64-gnu@npm:14.2.6" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-x64-musl@npm:14.2.5": - version: 14.2.5 - resolution: "@next/swc-linux-x64-musl@npm:14.2.5" +"@next/swc-linux-x64-musl@npm:14.2.6": + version: 14.2.6 + resolution: "@next/swc-linux-x64-musl@npm:14.2.6" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@next/swc-win32-arm64-msvc@npm:14.2.5": - version: 14.2.5 - resolution: "@next/swc-win32-arm64-msvc@npm:14.2.5" +"@next/swc-win32-arm64-msvc@npm:14.2.6": + version: 14.2.6 + resolution: "@next/swc-win32-arm64-msvc@npm:14.2.6" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@next/swc-win32-ia32-msvc@npm:14.2.5": - version: 14.2.5 - resolution: "@next/swc-win32-ia32-msvc@npm:14.2.5" +"@next/swc-win32-ia32-msvc@npm:14.2.6": + version: 14.2.6 + resolution: "@next/swc-win32-ia32-msvc@npm:14.2.6" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@next/swc-win32-x64-msvc@npm:14.2.5": - version: 14.2.5 - resolution: "@next/swc-win32-x64-msvc@npm:14.2.5" +"@next/swc-win32-x64-msvc@npm:14.2.6": + version: 14.2.6 + resolution: "@next/swc-win32-x64-msvc@npm:14.2.6" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -4657,19 +4657,18 @@ __metadata: languageName: node linkType: hard -"@testing-library/jest-dom@npm:^6.4.8": - version: 6.4.8 - resolution: "@testing-library/jest-dom@npm:6.4.8" +"@testing-library/jest-dom@npm:^6.5.0": + version: 6.5.0 + resolution: "@testing-library/jest-dom@npm:6.5.0" dependencies: "@adobe/css-tools": "npm:^4.4.0" - "@babel/runtime": "npm:^7.9.2" aria-query: "npm:^5.0.0" chalk: "npm:^3.0.0" css.escape: "npm:^1.5.1" dom-accessibility-api: "npm:^0.6.3" lodash: "npm:^4.17.21" redent: "npm:^3.0.0" - checksum: 10c0/8eececcac1ec7728c038b9d9eabfc8b8dcf4dc1e997c959450bff16d946e3344275862b84bfe0e1d1beb3817368e782464816aca47ab5c94f0ebf66db71df55d + checksum: 10c0/fd5936a547f04608d8de15a7de3ae26516f21023f8f45169b10c8c8847015fd20ec259b7309f08aa1031bcbc37c6e5e6f532d1bb85ef8f91bad654193ec66a4c languageName: node linkType: hard @@ -5191,12 +5190,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^22.4.1": - version: 22.4.1 - resolution: "@types/node@npm:22.4.1" +"@types/node@npm:^22.5.0": + version: 22.5.0 + resolution: "@types/node@npm:22.5.0" dependencies: undici-types: "npm:~6.19.2" - checksum: 10c0/e42607438fcbd3a6aebd09084868fa0b22a4b0daf9eda79ed615df7ff8ae95e35ea56e090e1f3140ebae76b640abe42d4a6d5b60c0819eadf499adca737305b6 + checksum: 10c0/45aa75c5e71645fac42dced4eff7f197c3fdfff6e8a9fdacd0eb2e748ff21ee70ffb73982f068a58e8d73b2c088a63613142c125236cdcf3c072ea97eada1559 languageName: node linkType: hard @@ -5246,7 +5245,7 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:18.3.3": +"@types/react@npm:*": version: 18.3.3 resolution: "@types/react@npm:18.3.3" dependencies: @@ -5256,6 +5255,16 @@ __metadata: languageName: node linkType: hard +"@types/react@npm:18.3.4": + version: 18.3.4 + resolution: "@types/react@npm:18.3.4" + dependencies: + "@types/prop-types": "npm:*" + csstype: "npm:^3.0.2" + checksum: 10c0/5c52e1e6f540cff21e3c2a5212066d02e005f6fb21e4a536a29097fae878db9f407cd7a4b43778f51359349c5f692e08bc77ddb5f5cecbfca9ca4d4e3c91a48e + languageName: node + linkType: hard + "@types/react@npm:^16.8.0 || ^17.0.0 || ^18.0.0": version: 18.2.65 resolution: "@types/react@npm:18.2.65" @@ -7367,7 +7376,7 @@ __metadata: languageName: node linkType: hard -"bs-logger@npm:0.x": +"bs-logger@npm:^0.2.6": version: 0.2.6 resolution: "bs-logger@npm:0.2.6" dependencies: @@ -12563,7 +12572,7 @@ __metadata: languageName: node linkType: hard -"lodash.memoize@npm:4.x": +"lodash.memoize@npm:^4.1.2": version: 4.1.2 resolution: "lodash.memoize@npm:4.1.2" checksum: 10c0/c8713e51eccc650422716a14cece1809cfe34bc5ab5e242b7f8b4e2241c2483697b971a604252807689b9dd69bfe3a98852e19a5b89d506b000b4187a1285df8 @@ -12701,7 +12710,7 @@ __metadata: languageName: node linkType: hard -"make-error@npm:1.x": +"make-error@npm:^1.3.6": version: 1.3.6 resolution: "make-error@npm:1.3.6" checksum: 10c0/171e458d86854c6b3fc46610cfacf0b45149ba043782558c6875d9f42f222124384ad0b468c92e996d815a8a2003817a710c0a160e49c1c394626f76fa45396f @@ -12744,8 +12753,8 @@ __metadata: "@mantine/core": "npm:7.12.1" "@mantine/hooks": "npm:7.12.1" "@mantine/notifications": "npm:^7.12.1" - "@next/bundle-analyzer": "npm:^14.2.5" - "@next/eslint-plugin-next": "npm:^14.2.5" + "@next/bundle-analyzer": "npm:^14.2.6" + "@next/eslint-plugin-next": "npm:^14.2.6" "@storybook/addon-essentials": "npm:^8.2.9" "@storybook/addon-styling-webpack": "npm:^1.0.0" "@storybook/blocks": "npm:^8.2.9" @@ -12754,13 +12763,13 @@ __metadata: "@tabler/icons": "npm:^3.12.0" "@tabler/icons-react": "npm:^3.12.0" "@testing-library/dom": "npm:^10.4.0" - "@testing-library/jest-dom": "npm:^6.4.8" + "@testing-library/jest-dom": "npm:^6.5.0" "@testing-library/react": "npm:^16.0.0" "@testing-library/user-event": "npm:^14.5.2" "@types/jest": "npm:^29.5.12" - "@types/node": "npm:^22.4.1" + "@types/node": "npm:^22.5.0" "@types/postcss-modules-values": "npm:^4.0.2" - "@types/react": "npm:18.3.3" + "@types/react": "npm:18.3.4" "@typescript-eslint/eslint-plugin": "npm:^7.18.0" "@typescript-eslint/parser": "npm:^7.18.0" "@visx/visx": "npm:^3.11.0" @@ -12777,7 +12786,7 @@ __metadata: eslint-plugin-testing-library: "npm:^6.3.0" jest: "npm:^29.7.0" jest-environment-jsdom: "npm:^29.7.0" - next: "npm:14.2.5" + next: "npm:14.2.6" postcss: "npm:^8.4.41" postcss-modules-values: "npm:^4.0.0" postcss-preset-mantine: "npm:1.17.0" @@ -12790,7 +12799,7 @@ __metadata: storybook-dark-mode: "npm:^4.0.2" stylelint: "npm:^16.8.2" stylelint-config-standard-scss: "npm:^13.1.0" - ts-jest: "npm:^29.2.4" + ts-jest: "npm:^29.2.5" typescript: "npm:5.5.4" languageName: unknown linkType: soft @@ -13238,20 +13247,20 @@ __metadata: languageName: node linkType: hard -"next@npm:14.2.5": - version: 14.2.5 - resolution: "next@npm:14.2.5" +"next@npm:14.2.6": + version: 14.2.6 + resolution: "next@npm:14.2.6" dependencies: - "@next/env": "npm:14.2.5" - "@next/swc-darwin-arm64": "npm:14.2.5" - "@next/swc-darwin-x64": "npm:14.2.5" - "@next/swc-linux-arm64-gnu": "npm:14.2.5" - "@next/swc-linux-arm64-musl": "npm:14.2.5" - "@next/swc-linux-x64-gnu": "npm:14.2.5" - "@next/swc-linux-x64-musl": "npm:14.2.5" - "@next/swc-win32-arm64-msvc": "npm:14.2.5" - "@next/swc-win32-ia32-msvc": "npm:14.2.5" - "@next/swc-win32-x64-msvc": "npm:14.2.5" + "@next/env": "npm:14.2.6" + "@next/swc-darwin-arm64": "npm:14.2.6" + "@next/swc-darwin-x64": "npm:14.2.6" + "@next/swc-linux-arm64-gnu": "npm:14.2.6" + "@next/swc-linux-arm64-musl": "npm:14.2.6" + "@next/swc-linux-x64-gnu": "npm:14.2.6" + "@next/swc-linux-x64-musl": "npm:14.2.6" + "@next/swc-win32-arm64-msvc": "npm:14.2.6" + "@next/swc-win32-ia32-msvc": "npm:14.2.6" + "@next/swc-win32-x64-msvc": "npm:14.2.6" "@swc/helpers": "npm:0.5.5" busboy: "npm:1.6.0" caniuse-lite: "npm:^1.0.30001579" @@ -13292,7 +13301,7 @@ __metadata: optional: true bin: next: dist/bin/next - checksum: 10c0/8df7d8ccc1a5bab03fa50dd6656c8a6f3750e81ef0b087dc329fea9346847c3094a933a890a8e87151dc32f0bc55020b8f6386d4565856d83bcc10895d29ec08 + checksum: 10c0/262cf21a179f394aedfae36724d3ece46f717d618beebfbb75986be7f4d6093a6cf183c36871462c16d1ec490fd0a765d1944d04d30e282b4cca41b71aaf8eea languageName: node linkType: hard @@ -15439,6 +15448,15 @@ __metadata: languageName: node linkType: hard +"semver@npm:^7.6.3": + version: 7.6.3 + resolution: "semver@npm:7.6.3" + bin: + semver: bin/semver.js + checksum: 10c0/88f33e148b210c153873cb08cfe1e281d518aaa9a666d4d148add6560db5cd3c582f3a08ccb91f38d5f379ead256da9931234ed122057f40bb5766e65e58adaf + languageName: node + linkType: hard + "send@npm:0.18.0": version: 0.18.0 resolution: "send@npm:0.18.0" @@ -16679,19 +16697,19 @@ __metadata: languageName: node linkType: hard -"ts-jest@npm:^29.2.4": - version: 29.2.4 - resolution: "ts-jest@npm:29.2.4" +"ts-jest@npm:^29.2.5": + version: 29.2.5 + resolution: "ts-jest@npm:29.2.5" dependencies: - bs-logger: "npm:0.x" + bs-logger: "npm:^0.2.6" ejs: "npm:^3.1.10" - fast-json-stable-stringify: "npm:2.x" + fast-json-stable-stringify: "npm:^2.1.0" jest-util: "npm:^29.0.0" json5: "npm:^2.2.3" - lodash.memoize: "npm:4.x" - make-error: "npm:1.x" - semver: "npm:^7.5.3" - yargs-parser: "npm:^21.0.1" + lodash.memoize: "npm:^4.1.2" + make-error: "npm:^1.3.6" + semver: "npm:^7.6.3" + yargs-parser: "npm:^21.1.1" peerDependencies: "@babel/core": ">=7.0.0-beta.0 <8" "@jest/transform": ^29.0.0 @@ -16712,7 +16730,7 @@ __metadata: optional: true bin: ts-jest: cli.js - checksum: 10c0/43be1d5625d44bc48815d91810e796d74682757b4f64677b54aae1f4da855476e50c01b92d54add4b02976ecf2cbb2f318d7c7788844328de44f145b95185fac + checksum: 10c0/acb62d168faec073e64b20873b583974ba8acecdb94681164eb346cef82ade8fb481c5b979363e01a97ce4dd1e793baf64d9efd90720bc941ad7fc1c3d6f3f68 languageName: node linkType: hard @@ -17761,7 +17779,7 @@ __metadata: languageName: node linkType: hard -"yargs-parser@npm:^21.0.1, yargs-parser@npm:^21.1.1": +"yargs-parser@npm:^21.1.1": version: 21.1.1 resolution: "yargs-parser@npm:21.1.1" checksum: 10c0/f84b5e48169479d2f402239c59f084cfd1c3acc197a05c59b98bab067452e6b3ea46d4dd8ba2985ba7b3d32a343d77df0debd6b343e5dae3da2aab2cdf5886b2