feat(weather): show trend indicators on team averages
This commit is contained in:
@@ -40,6 +40,16 @@ export default async function WeatherSessionPage({ params }: WeatherSessionPageP
|
||||
getUserTeams(authSession.user.id),
|
||||
getWeatherSessionsHistory(authSession.user.id),
|
||||
]);
|
||||
const currentHistoryIndex = history.findIndex((point) => point.sessionId === session.id);
|
||||
const previousTeamAverages =
|
||||
currentHistoryIndex > 0
|
||||
? {
|
||||
performance: history[currentHistoryIndex - 1].performance,
|
||||
moral: history[currentHistoryIndex - 1].moral,
|
||||
flux: history[currentHistoryIndex - 1].flux,
|
||||
valueCreation: history[currentHistoryIndex - 1].valueCreation,
|
||||
}
|
||||
: null;
|
||||
|
||||
return (
|
||||
<main className="mx-auto max-w-7xl px-4">
|
||||
@@ -70,7 +80,7 @@ export default async function WeatherSessionPage({ params }: WeatherSessionPageP
|
||||
canEdit={session.canEdit}
|
||||
userTeams={userTeams}
|
||||
>
|
||||
<WeatherAverageBar entries={session.entries} />
|
||||
<WeatherAverageBar entries={session.entries} previousAverages={previousTeamAverages} />
|
||||
<WeatherBoard
|
||||
sessionId={session.id}
|
||||
currentUserId={authSession.user.id}
|
||||
|
||||
Reference in New Issue
Block a user