Skip to content

Commit

Permalink
fix: alert annotations not applied for travel times graph on station …
Browse files Browse the repository at this point in the history
…change (#899)

* fix: alerts not applied for travel times graph

* fix: whoops forgot to commit
  • Loading branch information
rudiejd authored Dec 21, 2023
1 parent 425f911 commit 2a4e213
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/tripexplorer/AlertStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ interface AlertStore {

export const useAlertStore = create<AlertStore>((set, get) => ({
alerts: [],
setAlerts: (alerts) => set(() => ({ alerts: alerts })),
setAlerts: (alerts) =>
set(() => ({
alerts: alerts?.map((alert) => {
const match = get().alerts?.find(
(other) =>
other.valid_from === alert.valid_from &&
other.valid_to === alert.valid_to &&
other.text === alert.text
);
return match ? match : alert;
}),
})),
changeAlertApplied: (alerts, index) => {
if (!alerts)
return set(() => ({
Expand Down

0 comments on commit 2a4e213

Please sign in to comment.