From 524a7036f5fce9488b80118dcbb13c3bc4d31da1 Mon Sep 17 00:00:00 2001
From: tisachi
Date: Fri, 23 Oct 2026 00:07:34 +0200
Subject: [PATCH] Trening: zapisany komentarz serii widoczny na wierszu sesji
(ikona + tekst, dotychczas tylko w historii); prettier src
---
app/src/pages/DayExecution.tsx | 9 +++++++-
app/src/pages/plans/PlanDetail.tsx | 22 +++++++++----------
.../plans/plan-editor/ExerciseEditor.tsx | 5 ++++-
app/test/DayExecution.test.tsx | 3 +++
app/test/e2e/day-execution.spec.ts | 2 ++
5 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/app/src/pages/DayExecution.tsx b/app/src/pages/DayExecution.tsx
index eec5cae..229fe01 100644
--- a/app/src/pages/DayExecution.tsx
+++ b/app/src/pages/DayExecution.tsx
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState, type ReactNode } from 'react';
import { useParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { useQueryClient } from '@tanstack/react-query';
-import { Check, ChevronDown, Plus, Trash2 } from 'lucide-react';
+import { Check, ChevronDown, MessageSquare, Plus, Trash2 } from 'lucide-react';
import {
abandonSession,
addSessionExercise,
@@ -248,6 +248,13 @@ function SetRow({
))}
)}
+ {/* komentarz trenujący zapisany przy serii (ten sam co w historii i u trenera) */}
+ {set.note && (
+
+
+ {set.note}
+
+ )}
{done && set.reps != null && (
diff --git a/app/src/pages/plans/PlanDetail.tsx b/app/src/pages/plans/PlanDetail.tsx
index 7be2fd3..59196fd 100644
--- a/app/src/pages/plans/PlanDetail.tsx
+++ b/app/src/pages/plans/PlanDetail.tsx
@@ -130,17 +130,17 @@ export default function PlanDetail() {
]
: // plan zamknięty (ukończony/porzucony) — wznowienie tylko dla
// właściciela (trener nie wznawia planów podopiecznych)
- (isOwner
- ? [
- {
- label: t('actions.reopen'),
- icon: RotateCcw,
- variant: 'secondary' as const,
- disabled: busy || hasOtherActivePlan,
- onClick: () => setConfirm('reopen'),
- },
- ]
- : [])),
+ isOwner
+ ? [
+ {
+ label: t('actions.reopen'),
+ icon: RotateCcw,
+ variant: 'secondary' as const,
+ disabled: busy || hasOtherActivePlan,
+ onClick: () => setConfirm('reopen'),
+ },
+ ]
+ : []),
// udostępnianie = tylko właściciel planu
...(isOwner
? [
diff --git a/app/src/pages/plans/plan-editor/ExerciseEditor.tsx b/app/src/pages/plans/plan-editor/ExerciseEditor.tsx
index 989809d..a64f4d2 100644
--- a/app/src/pages/plans/plan-editor/ExerciseEditor.tsx
+++ b/app/src/pages/plans/plan-editor/ExerciseEditor.tsx
@@ -93,7 +93,10 @@ export function ExerciseEditor({
nie zostają rozbite między wiersze */}
{exerciseMeta && (
-
+
{muscleName(exerciseMeta.primaryMuscle)}
)}
diff --git a/app/test/DayExecution.test.tsx b/app/test/DayExecution.test.tsx
index ef51441..af1900d 100644
--- a/app/test/DayExecution.test.tsx
+++ b/app/test/DayExecution.test.tsx
@@ -749,6 +749,9 @@ describe('Kolejka serii w sesji', () => {
await user.type(screen.getByRole('textbox', { name: 'Komentarz do serii' }), 'ostatnia seria ciężka');
await user.click(screen.getByRole('button', { name: 'Zapisz' }));
+ // komentarz musi być widoczny też na wierszu serii (dowód zapisu), nie tylko w oknie
+ expect(await screen.findByText('ostatnia seria ciężka')).toBeInTheDocument();
+
// mock utrzymuje zapis (jak serwer) — ss-1 jest już uzupełniona, wracamy do niej
// przez „Edytuj”, by sprawdzić, że komentarz przeżył zapis
await user.click(screen.getByRole('button', { name: 'Edytuj' }));
diff --git a/app/test/e2e/day-execution.spec.ts b/app/test/e2e/day-execution.spec.ts
index 9a46686..c2fd23d 100644
--- a/app/test/e2e/day-execution.spec.ts
+++ b/app/test/e2e/day-execution.spec.ts
@@ -121,6 +121,8 @@ test('okno „Uzupełnij serię” zapisuje opcjonalny komentarz serii', async (
await page.getByRole('button', { name: 'Zapisz' }).click();
const req = await patch;
expect(JSON.parse(req.postData() ?? '')).toMatchObject({ note: 'plecy bolały' });
+ // zapisany komentarz widoczny na wierszu serii (dowód, że nie zniknął)
+ await expect(page.getByText('plecy bolały')).toBeVisible();
});
test('przycisk „Norma spełniona” wypełnia wartości z planu', async ({ page }) => {