Skip to content

Commit

Permalink
Use wind speed and direction averages
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Aug 24, 2024
1 parent c275cd0 commit e8c54ab
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 96 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
20 changes: 15 additions & 5 deletions src/components/APITables/WeatherTable/WeatherTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = [
{
Expand All @@ -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',
},
{
Expand Down
Loading

0 comments on commit e8c54ab

Please sign in to comment.