This commit is contained in:
Dominik Klarkowski
2026-06-18 11:02:31 +02:00
parent d00a5a42ac
commit 047e580da0
32 changed files with 735 additions and 189 deletions

View File

@@ -6,6 +6,7 @@ import { formatDate, formatDateShort } from "@/lib/format";
import { getLatestAnalysisForTarget, serializeAnalysis } from "@/lib/models/analysis";
import { getStrengthWorkout, listStrengthWorkouts } from "@/lib/models/strength";
import { exerciseE1rm, getExerciseHistory } from "@/lib/strength/stats";
import { getCurrentUserId } from "@/lib/session";
export const dynamic = "force-dynamic";
@@ -17,14 +18,15 @@ export default async function StrengthWorkoutPage({
params: Promise<{ id: string }>;
}) {
const { id } = await params;
const workout = await getStrengthWorkout(id);
const userId = await getCurrentUserId();
const workout = await getStrengthWorkout(userId, id);
if (!workout) {
notFound();
}
const analysis = await getLatestAnalysisForTarget("strength", workout._id);
const allWorkouts = await listStrengthWorkouts();
const analysis = await getLatestAnalysisForTarget(userId, "strength", workout._id);
const allWorkouts = await listStrengthWorkouts(userId);
const pastWorkouts = allWorkouts.filter((w) => w.date <= workout.date);
const exercisesWithHistory = workout.exercises.map((exercise) => ({
@@ -73,9 +75,9 @@ export default async function StrengthWorkoutPage({
{exercisesWithHistory.some(({ history }) => history.length >= 2) ? (
<div className="flex flex-col gap-3">
<h2 className="flex items-center gap-1.5 text-sm font-semibold text-fg/70">
Postęp ćwiczeń
<InfoTooltip text="Wolumen (ciężar × powtórzenia) i maksymalny ciężar na tle poprzednich sesji z tym samym ćwiczeniem." />
</h2>
Postęp ćwiczeń
<InfoTooltip text="Wolumen (ciężar × powtórzenia) i maksymalny ciężar na tle poprzednich sesji z tym samym ćwiczeniem." />
</h2>
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
{exercisesWithHistory
.filter(({ history }) => history.length >= 2)