App: czytelniejszy dialog zmiany tygodnia startu - tekst wskazuje pierwszy tydzien treningu, dni do usuniecia kazdy w nowej linii (whitespace-pre-line w opisie ConfirmDialog, startChangeDesc w i18n pl/en; testy unit + e2e)

This commit is contained in:
tisachi
2026-11-06 01:01:16 +01:00
parent 1f98b71b3a
commit 6a5fddc77d
6 changed files with 11 additions and 12 deletions

View File

@@ -85,7 +85,7 @@ export function ConfirmDialog({
const { t } = useTranslation();
return (
<Modal open={open} onClose={onClose} title={title}>
<p className="text-dim text-[0.95rem]">{description}</p>
<p className="text-dim text-[0.95rem] whitespace-pre-line">{description}</p>
<div className="flex flex-col-reverse sm:flex-row sm:items-center sm:justify-end gap-3 mt-5">
<Button variant="secondary" onClick={onClose} className="w-full sm:w-auto">
{t('cancel')}

View File

@@ -137,7 +137,7 @@
"pastDayDesc": "The plan has a start week marked, and {{day}} of week {{week}} falls before today. A training cannot be scheduled in the past — pick another day or change the start week.",
"pastDayOk": "Got it",
"startChangeTitle": "Change the start week?",
"startChangeDesc": "With the new start, these days would fall in the past and will be removed: {{days}}.",
"startChangeDesc": "With the new start, the first training week loses days that would fall in the past:",
"startChangeLabel": "Remove days and change",
"saveError": "Save error",
"noGymTrainee": "The trainee does not belong to any gym.",

View File

@@ -137,7 +137,7 @@
"pastDayDesc": "Plan ma zaznaczony start, a {{day}} w tygodniu {{week}} wypada przed dzisiaj. Trening nie może być zaplanowany w przeszłości — wybierz inny dzień albo zmień tydzień startu.",
"pastDayOk": "Rozumiem",
"startChangeTitle": "Zmienić tydzień startu?",
"startChangeDesc": "Przy nowym starcie te dni wpadłyby w przeszłość i zostaną usunięte: {{days}}.",
"startChangeDesc": "Przy nowym starcie pierwszy tydzień treningu straci dni, które wpadłyby w przeszłość:",
"startChangeLabel": "Usuń dni i zmień",
"saveError": "Błąd zapisu",
"noGymTrainee": "Podopieczny nie należy do żadnej siłowni.",

View File

@@ -1091,13 +1091,12 @@ export default function PlanEditor() {
title={t('wizard.startChangeTitle')}
description={
startChangeReq
? t('wizard.startChangeDesc', {
days: startChangeReq.days
.map(({ wi, dow }) =>
wi === 0 ? dayName(dow) : `${t('week.title', { n: wi + 1 })}: ${dayName(dow)}`,
)
.join(', '),
})
? `${t('wizard.startChangeDesc')}\n${startChangeReq.days
.map(
({ wi, dow }) =>
`- ${wi === 0 ? dayName(dow) : `${t('week.title', { n: wi + 1 })}: ${dayName(dow)}`}`,
)
.join('\n')}`
: ''
}
confirmLabel={t('wizard.startChangeLabel')}

View File

@@ -1071,7 +1071,7 @@ describe('PlanEditor — cofniecie tygodnia startu: potwierdzenie usunięcia dni
await user.click(screen.getByRole('button', { name: 'Ten tydzień' }));
const dialog = await screen.findByRole('dialog');
expect(within(dialog).getByText('Zmienić tydzień startu?')).toBeInTheDocument();
expect(within(dialog).getByText(new RegExp(`usunięte: ${soonPastDay}`))).toBeInTheDocument();
expect(within(dialog).getByText(new RegExp(`- ${soonPastDay}`))).toBeInTheDocument();
// anuluj: stary start i dzień zostają bez zmian
await user.click(within(dialog).getByRole('button', { name: 'Anuluj' }));

View File

@@ -134,7 +134,7 @@ test('cofniecie tygodnia startu pyta o usunięcie dni, które wpadną w przeszł
await page.getByRole('button', { name: 'Ten tydzień' }).click();
const dialog = page.getByRole('dialog');
await expect(dialog.getByText('Zmienić tydzień startu?')).toBeVisible();
await expect(dialog.getByText(new RegExp(`usunięte: ${soonPastDay}`))).toBeVisible();
await expect(dialog.getByText(new RegExp(`- ${soonPastDay}`))).toBeVisible();
await dialog.getByRole('button', { name: 'Usuń dni i zmień' }).click();
// krok 2: dzień usunięty — komórka oznaczona jako miniona, niezaznaczona