diff --git a/src/app/weather/[id]/page.tsx b/src/app/weather/[id]/page.tsx
index 554ce4c..7af13bb 100644
--- a/src/app/weather/[id]/page.tsx
+++ b/src/app/weather/[id]/page.tsx
@@ -2,7 +2,7 @@ import { notFound } from 'next/navigation';
import Link from 'next/link';
import { auth } from '@/lib/auth';
import { getWorkshop, getSessionsTabUrl } from '@/lib/workshops';
-import { getWeatherSessionById } from '@/services/weather';
+import { getWeatherSessionById, getPreviousWeatherEntriesForUsers } from '@/services/weather';
import { getUserTeams } from '@/services/teams';
import { WeatherBoard, WeatherLiveWrapper, WeatherInfoPanel, WeatherAverageBar } from '@/components/weather';
import { Badge } from '@/components/ui';
@@ -20,15 +20,22 @@ export default async function WeatherSessionPage({ params }: WeatherSessionPageP
return null;
}
- const [session, userTeams] = await Promise.all([
- getWeatherSessionById(id, authSession.user.id),
- getUserTeams(authSession.user.id),
- ]);
+ const session = await getWeatherSessionById(id, authSession.user.id);
if (!session) {
notFound();
}
+ const allUserIds = [
+ session.user.id,
+ ...session.shares.map((s: { userId: string }) => s.userId),
+ ];
+
+ const [previousEntries, userTeams] = await Promise.all([
+ getPreviousWeatherEntriesForUsers(session.id, session.date, allUserIds),
+ getUserTeams(authSession.user.id),
+ ]);
+
return (
{/* Header */}
@@ -99,6 +106,7 @@ export default async function WeatherSessionPage({ params }: WeatherSessionPageP
email: session.user.email ?? '',
}}
canEdit={session.canEdit}
+ previousEntries={previousEntries}
/>
diff --git a/src/components/weather/WeatherBoard.tsx b/src/components/weather/WeatherBoard.tsx
index acab0ce..9cae558 100644
--- a/src/components/weather/WeatherBoard.tsx
+++ b/src/components/weather/WeatherBoard.tsx
@@ -28,6 +28,13 @@ interface Share {
};
}
+type PreviousEntry = {
+ performanceEmoji: string | null;
+ moralEmoji: string | null;
+ fluxEmoji: string | null;
+ valueCreationEmoji: string | null;
+};
+
interface WeatherBoardProps {
sessionId: string;
currentUserId: string;
@@ -44,6 +51,7 @@ interface WeatherBoardProps {
email: string;
};
canEdit: boolean;
+ previousEntries: Map;
}
export function WeatherBoard({
@@ -53,6 +61,7 @@ export function WeatherBoard({
shares,
owner,
canEdit,
+ previousEntries,
}: WeatherBoardProps) {
// Get all users who have access: owner + shared users
const allUsers = useMemo(() => {
@@ -137,6 +146,7 @@ export function WeatherBoard({
currentUserId={currentUserId}
entry={entry}
canEdit={canEdit}
+ previousEntry={previousEntries.get(entry.userId) ?? null}
/>
))}
diff --git a/src/components/weather/WeatherCard.tsx b/src/components/weather/WeatherCard.tsx
index 20a38ff..134d86d 100644
--- a/src/components/weather/WeatherCard.tsx
+++ b/src/components/weather/WeatherCard.tsx
@@ -22,14 +22,22 @@ interface WeatherEntry {
};
}
+type PreviousEntry = {
+ performanceEmoji: string | null;
+ moralEmoji: string | null;
+ fluxEmoji: string | null;
+ valueCreationEmoji: string | null;
+};
+
interface WeatherCardProps {
sessionId: string;
currentUserId: string;
entry: WeatherEntry;
canEdit: boolean;
+ previousEntry?: PreviousEntry | null;
}
-export function WeatherCard({ sessionId, currentUserId, entry, canEdit }: WeatherCardProps) {
+export function WeatherCard({ sessionId, currentUserId, entry, canEdit, previousEntry }: WeatherCardProps) {
const [isPending, startTransition] = useTransition();
const [notes, setNotes] = useState(entry.notes || '');
const [performanceEmoji, setPerformanceEmoji] = useState(entry.performanceEmoji || null);
@@ -104,6 +112,9 @@ export function WeatherCard({ sessionId, currentUserId, entry, canEdit }: Weathe
// For now, we'll use a placeholder - in real app, you'd pass user info as prop
const user = entry.user;
+ // previousEntry is available for future use in Task 6
+ void previousEntry;
+
return (
{/* User column */}