Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"date-fns": "^4.1.0",
"detect-browser": "^5.3.0",
"emotion": "^11.0.0",
"es-toolkit": "^1.45.1",
"geolib": "^3.3.4",
"i18next": "^25.8.13",
"i18next-browser-languagedetector": "^8.2.1",
Expand All @@ -37,7 +38,6 @@
"linkify-html": "^4.3.2",
"linkify-react": "^4.3.2",
"linkifyjs": "^4.3.2",
"lodash": "^4.17.23",
"metar-taf-parser": "^9.1.2",
"react": "^19.2.4",
"react-dom": "^19.2.4",
Expand Down Expand Up @@ -109,7 +109,6 @@
"@types/chroma-js": "^3.1.2",
"@types/geojson": "^7946.0.16",
"@types/leaflet": "^1.9.21",
"@types/lodash": "^4.17.24",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@types/react-page-visibility": "^6.4.4",
Expand Down
32 changes: 21 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/features/alerts/JumpActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { css } from "@emotion/react";
import styled from "@emotion/styled";
import { faAngleDown, faAngleUp } from "@fortawesome/pro-light-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import throttle from "lodash/throttle";
import { throttle } from "es-toolkit";
import { useLayoutEffect, useState } from "react";

const Button = styled(FontAwesomeIcon)<{ disabled: boolean }>`
Expand Down
5 changes: 2 additions & 3 deletions src/features/alerts/gairmet/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { GAirmetFeature } from "../../../services/aviationWeather";
import { capitalizeFirstLetter } from "../../../helpers/string";
import { formatSeverity } from "../../../helpers/aviationAlerts";
import React from "react";
import omit from "lodash/omit";
import { isEqual, omit } from "es-toolkit";
import styled from "@emotion/styled";
import { getAlertEnd, getAlertStart } from "../alertsSlice";
import { useAppSelector } from "../../../hooks";
import { timeZoneSelector } from "../../weather/weatherSlice";
import isEqual from "lodash/isEqual";
import { format } from "date-fns";
import { TZDate } from "@date-fns/tz";

Expand Down Expand Up @@ -114,7 +113,7 @@ export default function Description({ alerts }: DescriptionProps) {

function hasSimilarData(a: GAirmetFeature, b: GAirmetFeature): boolean {
const simplify = (alert: GAirmetFeature) =>
omit(alert.properties, "issueTime", "forecast", "validTime");
omit(alert.properties, ["issueTime", "forecast", "validTime"]);

return isEqual(simplify(a), simplify(b));
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/outlook/OutlookTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { timeZoneSelector, Weather } from "../weather/weatherSlice";
import { OpenMeteoWeather } from "../../services/openMeteo";
import { useMemo } from "react";
import OutlookRow from "./OutlookRow";
import compact from "lodash/fp/compact";
import { compact } from "es-toolkit";
import styled from "@emotion/styled";
import Day from "./Day";
import { TZDate } from "@date-fns/tz";
Expand Down
2 changes: 1 addition & 1 deletion src/features/rap/Hours.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ReportWatchdog from "./ReportWatchdog";
import Nav from "./Nav";
import roundedScrollbar from "./roundedScrollbar";
import { css } from "@emotion/react";
import throttle from "lodash/throttle";
import { throttle } from "es-toolkit";
import ReportElevationDiscrepancy, {
ELEVATION_DISCREPANCY_THRESHOLD,
} from "./warnings/ReportElevationDiscrepancy";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { differenceInMinutes, formatDistanceToNow } from "date-fns";
import { useAppSelector } from "../../../../hooks";
import styled from "@emotion/styled";
import { DataListItem } from "../../../../DataList";
import capitalize from "lodash/capitalize";
import { capitalize } from "es-toolkit";

const Label = styled.div``;

Expand Down
7 changes: 4 additions & 3 deletions src/features/weather/header/NWSWeather.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import lowerCase from "lodash/lowerCase";
import capitalize from "lodash/capitalize";
import { capitalize, compact, lowerCase } from "es-toolkit";
import { IconProp } from "@fortawesome/fontawesome-svg-core";
import {
faCloudHail,
Expand Down Expand Up @@ -45,7 +44,9 @@ export default function NWSWeather({
return capitalize(
observations
.map((observation) =>
[observation.coverage, observation.weather].map(lowerCase).join(" "),
compact([observation.coverage, observation.weather])
.map(lowerCase)
.join(" "),
)
.join(", "),
);
Expand Down
9 changes: 4 additions & 5 deletions src/helpers/aviationAlerts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sortBy from "lodash/sortBy";
import { sortBy } from "es-toolkit";
import {
isGAirmetAlert,
isISigmetAlert,
Expand Down Expand Up @@ -186,10 +186,9 @@ export function extractIssuedTimestamp(
}

if (isGAirmetAlert(alert)) {
const initialRelatedAlert = sortBy(
relatedAlerts,
"properties.validTime",
)[0];
const initialRelatedAlert = sortBy(relatedAlerts, [
(a) => a.properties.validTime,
])[0];

return initialRelatedAlert.properties.validTime;
}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/string.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import startCase from "lodash/startCase";
import { startCase } from "es-toolkit";

export function capitalizeFirstLetter(string: string) {
return string.charAt(0).toUpperCase() + string.slice(1);
Expand Down
52 changes: 27 additions & 25 deletions src/helpers/weather.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { addHours } from "date-fns";
import sortBy from "lodash/sortBy";
import { sortBy } from "es-toolkit";
import {
Alert,
isGAirmetAlert,
Expand Down Expand Up @@ -43,36 +43,38 @@ export function sortAlerts(
const NON_DANGEROUS_OFFSET = 1e15;
const GAIRMET_READ_OFFSET = 2e15;

return sortBy(alerts, (alert) => {
const dangerousPrefix = isAlertDangerous(alert)
? DANGEROUS_OFFSET
: NON_DANGEROUS_OFFSET;
return sortBy(alerts, [
(alert) => {
const dangerousPrefix = isAlertDangerous(alert)
? DANGEROUS_OFFSET
: NON_DANGEROUS_OFFSET;

// If the setting for always marking G-Airmets as read is on,
// push all G-Airmets to the bottom of the list of alerts
if (gAirmetRead === OnOff.On && isGAirmetAlert(alert))
return (
-new Date(
extractIssuedTimestamp(alert, findRelatedAlerts(alert, allAlerts)),
).getTime() + GAIRMET_READ_OFFSET
);

if (isWeatherAlert(alert))
return -new Date(alert.properties.onset).getTime() + dangerousPrefix;

if (isTFRAlert(alert))
return (
-new Date(
alert.properties.coreNOTAMData.notam.effectiveStart,
).getTime() + dangerousPrefix
);

// If the setting for always marking G-Airmets as read is on,
// push all G-Airmets to the bottom of the list of alerts
if (gAirmetRead === OnOff.On && isGAirmetAlert(alert))
return (
-new Date(
extractIssuedTimestamp(alert, findRelatedAlerts(alert, allAlerts)),
).getTime() + GAIRMET_READ_OFFSET
);

if (isWeatherAlert(alert))
return -new Date(alert.properties.onset).getTime() + dangerousPrefix;

if (isTFRAlert(alert))
return (
-new Date(
alert.properties.coreNOTAMData.notam.effectiveStart,
).getTime() + dangerousPrefix
);

return (
-new Date(
extractIssuedTimestamp(alert, findRelatedAlerts(alert, allAlerts)),
).getTime() + dangerousPrefix
);
});
},
]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/services/aviationWeather.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";
import type { GeometryObject } from "geojson";
import uniqBy from "lodash/uniqBy";
import { uniqBy } from "es-toolkit";

export interface TAFReport {
raw: string;
Expand Down
3 changes: 1 addition & 2 deletions src/services/faa.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import axios from "axios";
import type { GeoJsonObject } from "geojson";
import uniqWith from "lodash/uniqWith";
import isEqual from "lodash/isEqual";
import { isEqual, uniqWith } from "es-toolkit";

export interface TFRFeature {
properties: {
Expand Down
2 changes: 1 addition & 1 deletion src/services/openMeteo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from "axios";
import { WindsAloftReport } from "../models/WindsAloft";
import { notEmpty } from "../helpers/array";
import zipObject from "lodash/zipObject";
import { zipObject } from "es-toolkit";
import * as velitherm from "velitherm";

const FORECAST_DAYS = 7;
Expand Down
Loading