Skip to content

Commit

Permalink
Use remainingDaysToStart for upcoming events
Browse files Browse the repository at this point in the history
  • Loading branch information
tnagorra committed Sep 6, 2024
1 parent e882d5b commit 549114c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export interface GeneralEvent {
typeDisplay: string;
icon: React.ReactNode;
name: string;
date: string;
remainingDays: number;
}

Expand Down
24 changes: 5 additions & 19 deletions src/views/DailyStandup/DeadlineSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import {
FcNightLandscape,
FcSportsMode,
} from 'react-icons/fc';
import {
compareDate,
getDifferenceInDays,
} from '@togglecorp/fujs';
import { compareNumber } from '@togglecorp/fujs';
import {
gql,
useQuery,
Expand Down Expand Up @@ -50,19 +47,13 @@ const DEADLINES_AND_EVENTS = gql`
id
name
remainingDays
endDate
totalDays
usedDays
projectId
}
}
relativeEvents {
id
name
startDate
remainingDaysToStart
typeDisplay
dates
endDate
type
}
}
Expand Down Expand Up @@ -112,7 +103,6 @@ function DeadlineSection(props: Props) {
typeDisplay: 'Deadline',
icon: iconsMap.DEADLINE,
name: deadline.name,
date: deadline.endDate,
remainingDays: deadline.remainingDays,
})) ?? []),
...(events?.map((otherEvent) => ({
Expand All @@ -121,14 +111,10 @@ function DeadlineSection(props: Props) {
icon: iconsMap[otherEvent.type],
typeDisplay: otherEvent.typeDisplay,
name: otherEvent.name,
date: otherEvent.startDate,
remainingDays: getDifferenceInDays(
otherEvent.startDate,
date,
),
remainingDays: otherEvent.remainingDaysToStart,
})) ?? []),
].sort((a, b) => compareDate(a.date, b.date));
}, [events, projects, date]);
].sort((a, b) => compareNumber(a.remainingDays, b.remainingDays));
}, [events, projects]);

return (
<Slide
Expand Down

0 comments on commit 549114c

Please sign in to comment.