Plany: usunieto przycisk Anuluj - stopka to tylko belka podsumowania (guard przez Wstecz)

This commit is contained in:
tisachi
2026-09-11 20:36:17 +02:00
parent ca2998f2b7
commit 0f66333aef
2 changed files with 4 additions and 9 deletions

View File

@@ -15,7 +15,6 @@ import {
import { CalendarX, Check } from 'lucide-react';
import {
BackButton,
Button,
ConfirmDialog,
EmptyState,
ErrorText,
@@ -406,18 +405,13 @@ export default function PlanEditor() {
{/* sticky stopka; na mobile pod stałym dolnym paskiem topmenu (+ safe-area) */}
<div className="sticky bottom-0 -mx-4 px-4 py-3 bg-bg/95 backdrop-blur border-t border-line mt-2 md:-mx-8 md:px-8 max-md:bottom-[calc(43px+max(0.5rem,env(safe-area-inset-bottom)))]">
{error && <ErrorText>{error}</ErrorText>}
<div className="mb-2 text-dim text-[0.8125rem]">
<div className="text-dim text-[0.8125rem]">
{dayCountLabel(totals.days)} · {exerciseCountLabel(totals.exercises)} ·{' '}
{setCountLabel(totals.sets)}
{totals.emptyWeeks > 0 && (
<span className="text-warn"> · {weekCountLabel(totals.emptyWeeks)} bez ćwiczeń</span>
)}
</div>
<div className="flex justify-end">
<Button variant="secondary" onClick={requestExit} className="w-full sm:w-auto">
Anuluj
</Button>
</div>
</div>
<ConfirmDialog

View File

@@ -341,7 +341,7 @@ describe('PlanEditor — tryb podopiecznego', () => {
expect(screen.getByDisplayValue('60')).toBeInTheDocument();
});
it('„Anuluj" przy niezapisanych zmianach pyta o potwierdzenie', async () => {
it('„Wstecz" przy niezapisanych zmianach pyta o potwierdzenie', async () => {
mockApi();
const user = userEvent.setup();
renderAt(`/trainees/${TRAINEE_ID}/plans/new`);
@@ -349,7 +349,8 @@ describe('PlanEditor — tryb podopiecznego', () => {
await screen.findByRole('heading', { name: 'Plan dla podopiecznego' });
// zmiana tytułu → stan dirty
await user.type(screen.getByPlaceholderText('np. Plan masowy 8-tygodniowy'), 'X');
await user.click(screen.getByRole('button', { name: 'Anuluj' }));
// „Wstecz” w treści (w jsdom jest też „<” topbara mobile — oba prowadzą do guardu)
await user.click(screen.getAllByRole('button', { name: 'Wstecz' }).at(-1)!);
expect(await screen.findByRole('heading', { name: 'Niezapisane zmiany' })).toBeInTheDocument();
// potwierdzenie → powrót do zakładki planów podopiecznego
await user.click(screen.getByRole('button', { name: 'Opuść' }));