Admin: topbar z menu kontekstowym 1:1 jak w aplikacji (dolna pigulka, plywajacy tytul, animacje grup, MonthPickerCore z wariantem allowAll)
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<!-- viewport-fit=cover: pola safe-area (notch, home-indicator) niezerowe także
|
||||
w przeglądarce — poprawiają je env(safe-area-inset-*) w .safe-pad-* (styles.css)
|
||||
i w dolnym pasku menu (Topbar). -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#141210" />
|
||||
<link rel="icon" href="/icons/icon-192.png" type="image/png" />
|
||||
<title>FitOS Admin</title>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useMemo, useState } from 'react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { ScrollText } from 'lucide-react';
|
||||
import { useTopbar } from '../topbar';
|
||||
import { MonthPicker } from '../topbar/MonthPicker';
|
||||
import { MonthPickerCore } from '../topbar/MonthPicker';
|
||||
import { api } from '../api/client';
|
||||
import type { ActivityLog, ActivityLogPage } from '../api/types';
|
||||
import { Badge, EmptyState, ErrorText, Loading, Select, type BadgeColor } from '../components/ui';
|
||||
@@ -146,10 +146,11 @@ export default function Logs() {
|
||||
},
|
||||
});
|
||||
|
||||
// lata do panelu selektora: z załadowanych logów + bieżący rok (nowe → stare)
|
||||
const years = useMemo(() => {
|
||||
const set = new Set((data?.logs ?? []).map((l) => l.createdAt.slice(0, 4)));
|
||||
set.add(String(new Date().getFullYear()));
|
||||
// miesiące do panelu selektora: z załadowanych logów + bieżący (chip lata)
|
||||
const availableMonths = useMemo(() => {
|
||||
const d = new Date();
|
||||
const current = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}`;
|
||||
const set = new Set([...(data?.logs ?? []).map((l) => l.createdAt.slice(0, 7)), current]);
|
||||
return [...set].sort().reverse();
|
||||
}, [data?.logs]);
|
||||
|
||||
@@ -157,13 +158,14 @@ export default function Logs() {
|
||||
title: 'Logi',
|
||||
search: 'logs',
|
||||
dateFilter: (
|
||||
<MonthPicker
|
||||
value={month}
|
||||
onChange={(m) => {
|
||||
<MonthPickerCore
|
||||
month={month}
|
||||
setMonth={(m) => {
|
||||
setMonth(m);
|
||||
setLimit(PAGE_SIZE);
|
||||
}}
|
||||
years={years}
|
||||
availableMonths={availableMonths}
|
||||
allowAll
|
||||
/>
|
||||
),
|
||||
filters: [
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
CartesianGrid,
|
||||
} from 'recharts';
|
||||
import { useTopbar } from '../../topbar';
|
||||
import { MonthPicker } from '../../topbar/MonthPicker';
|
||||
import { MonthPickerCore } from '../../topbar/MonthPicker';
|
||||
import {
|
||||
BackButton,
|
||||
Button,
|
||||
@@ -170,8 +170,12 @@ export default function UserBodyParameters() {
|
||||
const { data: bp, isLoading: bpLoading, error: bpError } = useUserBodyParameters(id);
|
||||
|
||||
const [visible, setVisible] = useState<Record<string, number>>({});
|
||||
// miesiąc w topmenu: '' = wszystkie; dostępność i lata liczone z danych
|
||||
const [month, setMonth] = useState('');
|
||||
// miesiąc w topmenu: zawsze wybrany (domyślnie bieżący), jak w aplikacji;
|
||||
// strzałki i siatka skaczą tylko po miesiącach z danymi
|
||||
const [month, setMonth] = useState(() => {
|
||||
const d = new Date();
|
||||
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}`;
|
||||
});
|
||||
|
||||
// miesiące z danymi (nowe → stare) — do selektora w topmenu
|
||||
const monthKeys = [
|
||||
@@ -179,15 +183,13 @@ export default function UserBodyParameters() {
|
||||
...(bp?.circumferences ?? []).flatMap((s) => s.points.map((p) => p.date.slice(0, 7))),
|
||||
];
|
||||
const availableMonths = [...new Set(monthKeys)].sort().reverse();
|
||||
const monthYears =
|
||||
availableMonths.length > 0
|
||||
? [...new Set(availableMonths.map((m) => m.slice(0, 4)))].sort().reverse()
|
||||
: [String(new Date().getFullYear())];
|
||||
|
||||
useTopbar({
|
||||
title: 'Parametry ciała',
|
||||
back: id ? `/users/${id}` : '/users',
|
||||
dateFilter: <MonthPicker value={month} onChange={setMonth} years={monthYears} />,
|
||||
dateFilter: (
|
||||
<MonthPickerCore month={month} setMonth={setMonth} availableMonths={availableMonths} />
|
||||
),
|
||||
filterActive: month !== '',
|
||||
});
|
||||
|
||||
@@ -198,13 +200,13 @@ export default function UserBodyParameters() {
|
||||
|
||||
// wybrany miesiąc bez danych → najnowszy miesiąc z danymi
|
||||
useEffect(() => {
|
||||
if (availableMonths.length > 0 && month !== '' && !availableMonths.includes(month)) {
|
||||
if (availableMonths.length > 0 && !availableMonths.includes(month)) {
|
||||
setMonth(availableMonths[0]);
|
||||
}
|
||||
}, [availableMonths.join(','), month]);
|
||||
|
||||
// zakres: wybrany w topmenu miesiąc (YYYY-MM)
|
||||
const inMonth = (date: string) => month === '' || date.startsWith(month);
|
||||
const inMonth = (date: string) => date.startsWith(month);
|
||||
|
||||
const weightPoints = [...(bp?.weight ?? [])]
|
||||
.filter((w) => inMonth(w.date))
|
||||
@@ -319,7 +321,7 @@ export default function UserBodyParameters() {
|
||||
|
||||
{circGroups.length === 0 && (
|
||||
<MeasurementCard icon={Ruler} title="Obwody">
|
||||
<p className="text-dim">Brak pomiarów{month ? ' w wybranym miesiącu' : ''}.</p>
|
||||
<p className="text-dim">Brak pomiarów w wybranym miesiącu.</p>
|
||||
</MeasurementCard>
|
||||
)}
|
||||
{circGroups.map((g) => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useState } from 'react';
|
||||
import { useParams, useSearchParams } from 'react-router-dom';
|
||||
import { History } from 'lucide-react';
|
||||
import { useTopbar } from '../../topbar';
|
||||
import { MonthPicker } from '../../topbar/MonthPicker';
|
||||
import { MonthPickerCore } from '../../topbar/MonthPicker';
|
||||
import { BackButton, Card, EmptyState, ErrorText, PageHeader, Skeleton } from '../../components/ui';
|
||||
import { useUserHistory } from './user-queries';
|
||||
import HistoryTable from '../../components/HistoryTable';
|
||||
@@ -26,15 +26,18 @@ export default function UserHistory() {
|
||||
]
|
||||
.sort()
|
||||
.reverse();
|
||||
const years =
|
||||
availableMonths.length > 0
|
||||
? [...new Set(availableMonths.map((m) => m.slice(0, 4)))].sort().reverse()
|
||||
: [String(new Date().getFullYear())];
|
||||
|
||||
useTopbar({
|
||||
title: 'Historia treningów',
|
||||
back: id ? `/users/${id}` : '/users',
|
||||
dateFilter: <MonthPicker value={month} onChange={setMonth} years={years} />,
|
||||
dateFilter: (
|
||||
<MonthPickerCore
|
||||
month={month}
|
||||
setMonth={setMonth}
|
||||
availableMonths={availableMonths}
|
||||
allowAll
|
||||
/>
|
||||
),
|
||||
filterActive: month !== '',
|
||||
});
|
||||
|
||||
|
||||
@@ -299,6 +299,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* PWA (standalone) na iOS/Android: pływający tytuł i dolny pasek menu muszą
|
||||
„dopełniać” pola safe-area (notch, home-indicator) — w przeglądarkowej
|
||||
wersji robi to UI paska (theme-color), więc w media nie ma = zero kosztu */
|
||||
@media (display-mode: standalone) {
|
||||
.safe-pad-top {
|
||||
padding-top: env(safe-area-inset-top);
|
||||
background-color: var(--bg);
|
||||
}
|
||||
}
|
||||
|
||||
/* dolny pasek menu istnieje tylko na telefonie (<md) — padding safe-area
|
||||
wyłącznie tam, żeby nie rozsuwać inline’owych akcji w nagłówku (md+) */
|
||||
@media (display-mode: standalone) and (max-width: 767px) {
|
||||
.safe-pad-bottom {
|
||||
padding-bottom: max(env(safe-area-inset-bottom), 0.75rem);
|
||||
background-color: var(--bg-card);
|
||||
}
|
||||
}
|
||||
|
||||
/* Checkbox w stylu aplikacji: ciemne pole z krawędzią; po zaznaczeniu
|
||||
wypełnienie akcentem i ciemny „ptaszek" (look kontrolowany przez design,
|
||||
nie przez natywne widgety OS) */
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { LucideIcon } from 'lucide-react';
|
||||
import { cn } from '../lib/utils';
|
||||
|
||||
/** Telefon (<md): panel grupy renderowany płasko w dolnym pasku zamiast akordeonu. */
|
||||
function useIsMobile() {
|
||||
export function useIsMobile() {
|
||||
const [isMobile, setIsMobile] = useState(
|
||||
() =>
|
||||
typeof window !== 'undefined' &&
|
||||
@@ -71,7 +71,15 @@ export function GroupButton({
|
||||
if (e.key === 'Escape') onToggle();
|
||||
};
|
||||
const onClickOutside = (e: MouseEvent) => {
|
||||
if (ref.current && !ref.current.contains(e.target as Node)) onToggle();
|
||||
if (ref.current && !ref.current.contains(e.target as Node)) {
|
||||
const el = e.target as HTMLElement;
|
||||
// telefon: panel grupy żyje w pigułce Topbar (poza tym refem) — klik
|
||||
// w jego akcje nie może zamknąć menu przed dojściem click do przycisku
|
||||
if (el.closest('[data-topbar-panel]')) return;
|
||||
// klik w inną ikonę grupy: jej click otworzy własną grupę (przełączenie)
|
||||
if (el.closest('[aria-haspopup="true"]')) return;
|
||||
onToggle();
|
||||
}
|
||||
};
|
||||
document.addEventListener('keydown', onKey);
|
||||
document.addEventListener('mousedown', onClickOutside);
|
||||
@@ -94,7 +102,8 @@ export function GroupButton({
|
||||
alwaysInlineFromMd ? 'md:flex' : 'lg:flex',
|
||||
flat
|
||||
? 'max-md:static max-md:flex-row max-md:items-center max-md:gap-2'
|
||||
: 'max-md:absolute max-md:inset-x-0 max-md:bottom-full max-md:z-50 max-md:flex-col max-md:items-stretch max-md:gap-1.5 max-md:rounded-t-xl max-md:border-t max-md:border-line max-md:bg-card max-md:p-2.5 max-md:shadow-card max-md:animate-none',
|
||||
: // telefon: panel grupy renderuje Topbar (w pigułce na dole) — ten nie żyje <md
|
||||
'max-md:hidden',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -18,7 +18,20 @@ export const MONTH_NAMES = [
|
||||
];
|
||||
|
||||
/** Krótkie nazwy do siatki miesięcy w panelu selektora. */
|
||||
export const MONTH_SHORT = ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'];
|
||||
export const MONTH_SHORT = [
|
||||
'Sty',
|
||||
'Lut',
|
||||
'Mar',
|
||||
'Kwi',
|
||||
'Maj',
|
||||
'Cze',
|
||||
'Lip',
|
||||
'Sie',
|
||||
'Wrz',
|
||||
'Paź',
|
||||
'Lis',
|
||||
'Gru',
|
||||
];
|
||||
|
||||
/** `2026-08` → `Sierpień 2026`. */
|
||||
export function formatMonth(month: string): string {
|
||||
@@ -26,31 +39,61 @@ export function formatMonth(month: string): string {
|
||||
return `${MONTH_NAMES[m - 1]} ${y}`;
|
||||
}
|
||||
|
||||
function currentMonthStr(): string {
|
||||
const d = new Date();
|
||||
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
/** Przesuwa miesiąc o `delta` (kalendarzowo, bez sprawdzania danych). */
|
||||
function shiftMonth(month: string, delta: number): string {
|
||||
const [y, m] = month.split('-').map(Number);
|
||||
const d = new Date(y, m - 1 + delta, 1);
|
||||
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
interface MonthPickerProps {
|
||||
/** `YYYY-MM` albo `''` (brak filtra). */
|
||||
value: string;
|
||||
onChange: (month: string) => void;
|
||||
/** Lata pokazywane w panelu (nowe → stare). */
|
||||
years: string[];
|
||||
export interface MonthPickerCoreProps {
|
||||
/** Wybrany miesiąc (YYYY-MM); pusty = „Wszystkie” (tylko gdy `allowAll`). */
|
||||
month: string;
|
||||
setMonth: (month: string) => void;
|
||||
/** Miesiące z danymi (YYYY-MM, najnowsze pierwsze). */
|
||||
availableMonths: string[];
|
||||
/**
|
||||
* „Wszystkie” (miesiąc '') + strzałki/siatka kalendarzowe (bez „z danymi”).
|
||||
* Bez `allowAll`: strzałki skaczą między miesiącami z danymi, siatka gasi puste.
|
||||
*/
|
||||
allowAll?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selektor miesiąca (YYYY-MM) — widget top menu.
|
||||
* ◀/▶ przeklikują do poprzedniego/następnego miesiąca, panel: lata + siatka 12 miesięcy.
|
||||
* Wariant domyślny (parametry ciała): tylko miesiące z danymi.
|
||||
* Wariant `allowAll` (historia): „Wszystkie” + pełna siatka kalendarzowa.
|
||||
*/
|
||||
export function MonthPicker({ value, onChange, years }: MonthPickerProps) {
|
||||
export function MonthPickerCore({
|
||||
month,
|
||||
setMonth,
|
||||
availableMonths,
|
||||
allowAll = false,
|
||||
}: MonthPickerCoreProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [panelYear, setPanelYear] = useState<number | null>(null);
|
||||
const now = new Date();
|
||||
const base = value || `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`;
|
||||
const prevMonth = shiftMonth(base, -1);
|
||||
const nextMonth = shiftMonth(base, 1);
|
||||
|
||||
// allowAll: strzałki = sąsiedni miesiąc kalendarzowy (przy „Wszystkie” nieaktywne);
|
||||
// inaczej: poprzedni/następny miesiąc Z danymi (skaczą puste)
|
||||
const prevMonth = allowAll
|
||||
? month
|
||||
? shiftMonth(month, -1)
|
||||
: null
|
||||
: ([...availableMonths].reverse().find((m) => m < month) ?? null);
|
||||
const nextMonth = allowAll
|
||||
? month
|
||||
? shiftMonth(month, 1)
|
||||
: null
|
||||
: (availableMonths.find((m) => m > month) ?? null);
|
||||
|
||||
// lata do filtra: z danych; bez danych (allowAll) — bieżący rok
|
||||
const years = [...new Set(availableMonths.map((m) => m.slice(0, 4)))].sort().reverse();
|
||||
const yearOptions = years.length > 0 ? years : [Number(currentMonthStr().slice(0, 4))];
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
@@ -58,33 +101,36 @@ export function MonthPicker({ value, onChange, years }: MonthPickerProps) {
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => onChange(prevMonth)}
|
||||
aria-label="Poprzedni miesiąc"
|
||||
disabled={!prevMonth}
|
||||
onClick={() => prevMonth && setMonth(prevMonth)}
|
||||
aria-label={allowAll ? 'Poprzedni miesiąc' : 'Poprzedni miesiąc z danymi'}
|
||||
>
|
||||
<ChevronLeft className="w-4 h-4" />
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
className="whitespace-nowrap h-9"
|
||||
onClick={() => {
|
||||
if (open) setOpen(false);
|
||||
else {
|
||||
setPanelYear(Number(base.slice(0, 4)));
|
||||
setPanelYear(Number((month || currentMonthStr()).slice(0, 4)));
|
||||
setOpen(true);
|
||||
}
|
||||
}}
|
||||
aria-haspopup="true"
|
||||
aria-expanded={open}
|
||||
/* telefon: rozciąga się między strzałkami na pełną szerokość panelu */
|
||||
className="max-md:flex-1"
|
||||
>
|
||||
<Calendar className="w-4 h-4" />
|
||||
{value ? formatMonth(value) : 'Miesiąc'}
|
||||
{month === '' && allowAll ? 'Wszystkie' : formatMonth(month)}
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => onChange(nextMonth)}
|
||||
aria-label="Następny miesiąc"
|
||||
disabled={!nextMonth}
|
||||
onClick={() => nextMonth && setMonth(nextMonth)}
|
||||
aria-label={allowAll ? 'Następny miesiąc' : 'Następny miesiąc z danymi'}
|
||||
>
|
||||
<ChevronRight className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -92,48 +138,117 @@ export function MonthPicker({ value, onChange, years }: MonthPickerProps) {
|
||||
{open && (
|
||||
<>
|
||||
<div className="fixed inset-0 z-40" onClick={() => setOpen(false)} />
|
||||
<div className="absolute right-0 top-full z-50 mt-2 w-72 bg-card border border-line rounded-2xl p-3 shadow-lg">
|
||||
{/* filtr po roku */}
|
||||
<div className="flex flex-wrap gap-1.5 mb-3">
|
||||
{years.map((y) => (
|
||||
{/* telefon: panel filtrów jest nad dolnym paskiem — dropdown rozwija się w górę
|
||||
(top-full wypadałby poza viewport); md+ (topbar u góry) — w dół.
|
||||
Na mobilce center + overflow-widoczny: pigułka menu przycina w poziomie
|
||||
tylko w czasie animacji rozwijania */}
|
||||
<div className="absolute right-0 top-full z-50 mt-2 w-72 bg-card border border-line rounded-xl p-3 shadow-lg max-md:top-auto max-md:right-auto max-md:bottom-full max-md:left-1/2 max-md:mb-2 max-md:w-[min(18rem,80vw)] max-md:-translate-x-1/2 max-md:overflow-visible">
|
||||
{allowAll ? (
|
||||
<>
|
||||
{/* „Wszystkie” — pełna historia */}
|
||||
<button
|
||||
key={y}
|
||||
type="button"
|
||||
onClick={() => setPanelYear(Number(y))}
|
||||
className={`px-2.5 py-1.5 rounded-[10px] text-[0.85rem] font-semibold cursor-pointer ${
|
||||
panelYear === Number(y)
|
||||
? 'bg-accent/15 text-accent-text'
|
||||
: 'text-dim hover:text-ink hover:bg-line/30'
|
||||
onClick={() => {
|
||||
setMonth('');
|
||||
setOpen(false);
|
||||
}}
|
||||
className={`mb-3 w-full rounded-[10px] px-3 py-2 text-[0.9rem] font-semibold cursor-pointer ${
|
||||
month === '' ? 'bg-accent/15 text-accent-text' : 'text-ink hover:bg-line/30'
|
||||
}`}
|
||||
>
|
||||
{y}
|
||||
Wszystkie
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{/* siatka 12 miesięcy wybranego roku */}
|
||||
<div className="grid grid-cols-4 gap-1.5">
|
||||
{Array.from({ length: 12 }, (_, i) => {
|
||||
const m = `${panelYear ?? base.slice(0, 4)}-${String(i + 1).padStart(2, '0')}`;
|
||||
const selected = m === value;
|
||||
return (
|
||||
<button
|
||||
key={m}
|
||||
type="button"
|
||||
title={selected ? 'Odznacz (wszystkie miesiące)' : undefined}
|
||||
onClick={() => {
|
||||
// ponowne kliknięcie zaznaczonego miesiąca odznacza filtr
|
||||
onChange(selected ? '' : m);
|
||||
setOpen(false);
|
||||
}}
|
||||
className={`px-1 py-2 rounded-[10px] text-[0.85rem] font-semibold cursor-pointer ${
|
||||
selected ? 'bg-accent/15 text-accent-text' : 'text-ink hover:bg-line/30'
|
||||
}`}
|
||||
>
|
||||
{MONTH_SHORT[i]}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{/* filtr po roku: lata z danymi (nowe → stare) */}
|
||||
<div className="flex flex-wrap gap-1.5 mb-3">
|
||||
{yearOptions.map((y) => (
|
||||
<button
|
||||
key={y}
|
||||
type="button"
|
||||
onClick={() => setPanelYear(Number(y))}
|
||||
className={`px-2.5 py-1.5 rounded-[10px] text-[0.85rem] font-semibold cursor-pointer ${
|
||||
panelYear === Number(y)
|
||||
? 'bg-accent/15 text-accent-text'
|
||||
: 'text-dim hover:text-ink hover:bg-line/30'
|
||||
}`}
|
||||
>
|
||||
{y}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{/* siatka 12 miesięcy wybranego roku — wszystkie aktywne */}
|
||||
<div className="grid grid-cols-4 gap-1.5">
|
||||
{Array.from({ length: 12 }, (_, i) => {
|
||||
const m = `${panelYear ?? Number(currentMonthStr().slice(0, 4))}-${String(i + 1).padStart(2, '0')}`;
|
||||
return (
|
||||
<button
|
||||
key={m}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setMonth(m);
|
||||
setOpen(false);
|
||||
}}
|
||||
className={`px-1 py-2 rounded-[10px] text-[0.85rem] font-semibold cursor-pointer ${
|
||||
m === month
|
||||
? 'bg-accent/15 text-accent-text'
|
||||
: 'text-ink hover:bg-line/30'
|
||||
}`}
|
||||
>
|
||||
{MONTH_SHORT[i]}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
) : availableMonths.length === 0 ? (
|
||||
<p className="text-dim text-[0.85rem] px-1">Brak danych</p>
|
||||
) : (
|
||||
<>
|
||||
{/* filtr po roku: lata z danymi (nowe → stare) */}
|
||||
<div className="flex flex-wrap gap-1.5 mb-3">
|
||||
{years.map((y) => (
|
||||
<button
|
||||
key={y}
|
||||
type="button"
|
||||
onClick={() => setPanelYear(Number(y))}
|
||||
className={`px-2.5 py-1.5 rounded-[10px] text-[0.85rem] font-semibold cursor-pointer ${
|
||||
panelYear === Number(y)
|
||||
? 'bg-accent/15 text-accent-text'
|
||||
: 'text-dim hover:text-ink hover:bg-line/30'
|
||||
}`}
|
||||
>
|
||||
{y}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{/* siatka 12 miesięcy wybranego roku: z danymi = aktywne, bez = przygaszone */}
|
||||
<div className="grid grid-cols-4 gap-1.5">
|
||||
{Array.from({ length: 12 }, (_, i) => {
|
||||
const m = `${panelYear ?? month.slice(0, 4)}-${String(i + 1).padStart(2, '0')}`;
|
||||
const hasData = availableMonths.includes(m);
|
||||
return (
|
||||
<button
|
||||
key={m}
|
||||
type="button"
|
||||
disabled={!hasData}
|
||||
onClick={() => {
|
||||
setMonth(m);
|
||||
setOpen(false);
|
||||
}}
|
||||
className={`px-1 py-2 rounded-[10px] text-[0.85rem] font-semibold ${
|
||||
m === month
|
||||
? 'bg-accent/15 text-accent-text'
|
||||
: hasData
|
||||
? 'text-ink hover:bg-line/30 cursor-pointer'
|
||||
: 'text-dim/50 cursor-default'
|
||||
}`}
|
||||
>
|
||||
{MONTH_SHORT[i]}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useTopbarStore } from './store';
|
||||
import { useListSearch, type SearchableSection } from '../store/list-search';
|
||||
import { Button, Input } from '../components/ui';
|
||||
import { cn } from '../lib/utils';
|
||||
import { GroupButton } from './GroupButton';
|
||||
import { GroupButton, useIsMobile } from './GroupButton';
|
||||
import type { TopbarAction } from './types';
|
||||
|
||||
const SEARCH_LABELS: Record<SearchableSection, string> = {
|
||||
@@ -93,7 +93,11 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
const config = useTopbarStore((s) => s.config);
|
||||
const openGroup = useTopbarStore((s) => s.openGroup);
|
||||
const setOpenGroup = useTopbarStore((s) => s.setOpenGroup);
|
||||
const toggleGroup = useTopbarStore((s) => s.toggleGroup);
|
||||
const navigate = useNavigate();
|
||||
// telefon: panel grupy renderowany przez Topbar tylko na <md (md+ → GroupButton);
|
||||
// w jsdom bez matchMedia = false → brak duplikatów w testach
|
||||
const isMobile = useIsMobile();
|
||||
// telefon: dolny pasek podąża za widzialnym viewportem (klawiatura / pasek adresu)
|
||||
const vvBottom = useVisualViewportBottom();
|
||||
const section = config?.search;
|
||||
@@ -104,7 +108,7 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
const plusActions = actions.filter((a) => a.icon?.displayName === 'Plus');
|
||||
const otherActions = actions.filter((a) => a.icon?.displayName !== 'Plus');
|
||||
const hasFilters = config?.dateFilter != null || (config?.filters?.length ?? 0) > 0;
|
||||
const toggle = (group: string) => setOpenGroup(openGroup === group ? null : group);
|
||||
const toggle = (group: string) => toggleGroup(group);
|
||||
|
||||
// X tylko gdy otwarta grupa naprawdę istnieje na tej stronie (stare id z innej
|
||||
// strony nie może pokazywać zamknięcia „nierozwiniętego” menu)
|
||||
@@ -114,130 +118,211 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
if (plusActions.length > 0) presentGroups.add('add');
|
||||
if (otherActions.length > 0) presentGroups.add('actions');
|
||||
if (config?.search) presentGroups.add('search');
|
||||
const menuOpen = openGroup != null && presentGroups.has(openGroup);
|
||||
const menuOpen = isMobile && openGroup != null && presentGroups.has(openGroup);
|
||||
|
||||
// Telefon: dolny pasek tylko gdy strona ma w nim coś do pokazania
|
||||
// (nawigacja „Wstecz” też liczy się jako zawartość).
|
||||
const mobileBarEmpty =
|
||||
!config?.back &&
|
||||
!hasFilters &&
|
||||
(config?.groups?.length ?? 0) === 0 &&
|
||||
actions.length === 0 &&
|
||||
!config?.search &&
|
||||
config?.navWidget == null;
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-30 border-b border-line bg-bg">
|
||||
<div className="mx-auto flex max-w-5xl items-center justify-between gap-3 px-4 py-2.5 md:px-8 md:py-3">
|
||||
{onMenuOpen && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onMenuOpen}
|
||||
aria-label="Otwórz menu"
|
||||
className="grid h-[34px] w-[34px] flex-none cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-ink md:hidden"
|
||||
>
|
||||
<Menu className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
<h1 className="min-w-0 flex-1 truncate text-[1.15rem] font-bold tracking-[-0.01em] md:flex-none">
|
||||
{config?.title}
|
||||
</h1>
|
||||
{/* akcje kontekstowe: md+ inline w nagłówku; telefon = pasek na dole ekranu */}
|
||||
<div
|
||||
className={cn(
|
||||
'flex shrink-0 items-center gap-2 md:flex-wrap md:justify-end',
|
||||
'max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:z-40 max-md:justify-center max-md:gap-2 max-md:border-t max-md:border-line max-md:bg-card max-md:px-3 max-md:pt-2 max-md:pb-[max(0.5rem,env(safe-area-inset-bottom))]',
|
||||
)}
|
||||
style={vvBottom > 0 ? { bottom: vvBottom } : undefined}
|
||||
>
|
||||
{/* nawigacja (np. Kalendarz) zawsze widoczna, nie jest grupą */}
|
||||
{config?.navWidget}
|
||||
{/* telefon: „<” = wróć do strony-rodzica zadeklarowanej przez podstronę */}
|
||||
{config?.back && (
|
||||
<header className="sticky top-0 z-30 border-b border-line bg-bg max-md:contents">
|
||||
{/* telefon: header rozbity (contents) — tytuł jako pływająca pigułka z shadow;
|
||||
akcje kontekstowe i tak żyją w dolnym pasku */}
|
||||
<div className="safe-pad-top mx-auto max-w-5xl px-4 max-md:sticky max-md:top-0 max-md:z-20 md:px-8">
|
||||
{/* md+: stała wysokość paska (kontrolki mieszczą się w nim i nie rozpychają
|
||||
layoutu — pasek wygląda identycznie z akcjami i bez nich) */}
|
||||
<div className="flex items-center justify-between gap-3 py-2.5 max-md:justify-end max-md:gap-2 md:h-[52px] md:py-0">
|
||||
{/* telefon: otoczka tytułu na szerokość napisu, przylega do prawej (przy hamburgerze) */}
|
||||
<h1 className="min-w-0 truncate rounded-[10px] text-[1.15rem] font-bold tracking-[-0.01em] max-md:-mb-[7px] max-md:-mt-[7px] max-md:flex max-md:h-9 max-md:max-w-[60vw] max-md:items-center max-md:border max-md:border-line/60 max-md:bg-bg/72 max-md:px-3 max-md:text-[1rem] max-md:shadow-[0_8px_24px_-10px_rgba(0,0,0,0.55)] max-md:backdrop-blur-md md:flex-none">
|
||||
{config?.title}
|
||||
</h1>
|
||||
{/* telefon: hamburger pływający po prawej (ta sama wysokość co tytuł);
|
||||
md+: sidebar ma własny */}
|
||||
{onMenuOpen && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => (config.onBack ? config.onBack() : navigate(config.back!))}
|
||||
aria-label="Wstecz"
|
||||
className="grid h-[34px] w-[34px] flex-none cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-ink md:hidden"
|
||||
onClick={onMenuOpen}
|
||||
aria-label="Otwórz menu"
|
||||
/* telefon: te samo wykończenie co pigułka tytułu (tło+blur, border,
|
||||
zaokrąglenie), kreski w kolorze tekstu nagłówka */
|
||||
className="grid h-[34px] w-[34px] flex-none cursor-pointer place-items-center rounded-[10px] border border-line/60 bg-bg/72 text-ink shadow-[0_8px_24px_-10px_rgba(0,0,0,0.55)] backdrop-blur-md transition-colors hover:text-accent-text max-md:h-9 max-md:w-9 md:hidden"
|
||||
>
|
||||
<ChevronLeft className="h-4 w-4" />
|
||||
<Menu className="h-[17px] w-[17px]" />
|
||||
</button>
|
||||
)}
|
||||
{hasFilters && (
|
||||
<GroupButton
|
||||
icon={Filter}
|
||||
label="Filtry"
|
||||
active={config?.filterActive}
|
||||
open={openGroup === 'filters'}
|
||||
onToggle={() => toggle('filters')}
|
||||
>
|
||||
{config?.dateFilter}
|
||||
{config?.filters?.map((filter, i) => (
|
||||
<div key={i}>{filter}</div>
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* własne grupy tematyczne strony (np. Edycja/Galeria/Urządzenia) */}
|
||||
{(config?.groups ?? []).map((g) => (
|
||||
<GroupButton
|
||||
key={g.id}
|
||||
icon={g.icon}
|
||||
label={g.label}
|
||||
open={openGroup === `grp:${g.id}`}
|
||||
onToggle={() => toggle(`grp:${g.id}`)}
|
||||
>
|
||||
{g.actions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
))}
|
||||
{plusActions.length > 0 && (
|
||||
<GroupButton
|
||||
icon={Plus}
|
||||
label="Dodawanie"
|
||||
open={openGroup === 'add'}
|
||||
onToggle={() => toggle('add')}
|
||||
>
|
||||
{plusActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{otherActions.length > 0 && (
|
||||
<GroupButton
|
||||
icon={MoreHorizontal}
|
||||
label="Akcje"
|
||||
open={openGroup === 'actions'}
|
||||
onToggle={() => toggle('actions')}
|
||||
flatOnMobile={config?.flatActionsMobile}
|
||||
alwaysInlineFromMd={config?.alwaysInlineActions}
|
||||
>
|
||||
{otherActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* wyszukiwarka zawsze maksymalnie z prawej */}
|
||||
{config?.search && (
|
||||
<GroupButton
|
||||
icon={Search}
|
||||
label="Wyszukiwarka"
|
||||
active={searchQuery !== ''}
|
||||
open={openGroup === 'search'}
|
||||
onToggle={() => toggle('search')}
|
||||
>
|
||||
<div className="w-56 max-md:w-full">
|
||||
<SectionSearchInput section={config.search} />
|
||||
</div>
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* telefon: X zamykający otwarte menu, skrajny prawy róg; szerokość
|
||||
animowana, więc reszta elementów płynnie się przesuwa */}
|
||||
{/* akcje kontekstowe: md+ inline w nagłówku; telefon = pływająca pigułka.
|
||||
Dwie warstwy: zewnętrzna = pełnej szerokości, przezroczysty „tor”
|
||||
(centruje i animuje odstęp od dołu), wewnętrzna = właściwa pigułka
|
||||
na szerokość treści (flex na osi pionowej → szerokość z treści), otwarta
|
||||
grupa rozpycha ją w dół i płynnie poszerza (max-width) */}
|
||||
<div
|
||||
className={cn(
|
||||
'md:hidden shrink-0 overflow-hidden transition-all duration-200',
|
||||
menuOpen ? 'w-[34px] opacity-100' : 'w-0 opacity-0 pointer-events-none',
|
||||
'md:contents',
|
||||
'max-md:fixed max-md:inset-x-1 max-md:bottom-1 max-md:z-40 max-md:flex max-md:justify-center max-md:transition-[bottom,inset-x] max-md:duration-200 max-md:ease-out',
|
||||
menuOpen && 'max-md:inset-x-4 max-md:bottom-4',
|
||||
mobileBarEmpty && 'max-md:hidden',
|
||||
)}
|
||||
style={vvBottom > 0 ? { bottom: vvBottom + 4 } : undefined}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Zamknij menu"
|
||||
tabIndex={menuOpen ? 0 : -1}
|
||||
onClick={() => setOpenGroup(null)}
|
||||
className="grid h-[34px] w-[34px] cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-danger"
|
||||
<div
|
||||
className={cn(
|
||||
'safe-pad-bottom md:contents',
|
||||
'max-md:flex max-md:max-w-[calc(100vw-2rem)] max-md:flex-col max-md:items-center max-md:rounded-2xl max-md:border max-md:border-line max-md:bg-card max-md:px-2 max-md:py-2 max-md:transition-[padding,max-width] max-md:duration-200 max-md:ease-out',
|
||||
'max-md:shadow-[0_-12px_32px_-14px_rgba(0,0,0,0.6)]',
|
||||
menuOpen
|
||||
? 'max-md:px-3 max-md:pb-[max(0.75rem,env(safe-area-inset-bottom))]'
|
||||
: null,
|
||||
)}
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</button>
|
||||
{/* panel otwartej grupy (akordeon) — wewnątrz pigułki nad ikonami; animacja
|
||||
max-width poszerza też rząd ikon (rozszerzane rodzeństwo w kolumnie);
|
||||
overflow-x: clip tnie w poziomie, w pionie widać (monthpicker nad paskiem) */}
|
||||
<div
|
||||
className={cn(
|
||||
'order-first md:hidden max-md:flex max-md:min-w-0 max-md:overflow-x-clip max-md:transition-[max-width] max-md:duration-200 max-md:ease-out',
|
||||
menuOpen ? 'max-md:max-w-[380px]' : 'max-md:max-w-0',
|
||||
)}
|
||||
>
|
||||
{menuOpen ? (
|
||||
<div
|
||||
key={openGroup}
|
||||
data-topbar-panel
|
||||
className="topbar-expand max-md:flex max-md:flex-col max-md:items-stretch max-md:gap-1.5 max-md:pt-2 max-md:pb-3"
|
||||
>
|
||||
{openGroup === 'filters' && (
|
||||
<>
|
||||
{config?.dateFilter}
|
||||
{config?.filters?.map((filter, i) => (
|
||||
<div key={i}>{filter}</div>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
{openGroup === 'add' &&
|
||||
plusActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
{openGroup === 'actions' &&
|
||||
otherActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
{openGroup?.startsWith('grp:') &&
|
||||
(config?.groups ?? [])
|
||||
.find((g) => `grp:${g.id}` === openGroup)
|
||||
?.actions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
{openGroup === 'search' && config?.search && (
|
||||
<SectionSearchInput section={config.search} />
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
{/* rząd ikon: na md+ pojedynczy flex w nagłówku (contents rodzica),
|
||||
na telefonie rząd wewnątrz pigułki */}
|
||||
<div className="flex shrink-0 flex-wrap items-center justify-end gap-2 max-md:flex-nowrap max-md:justify-center">
|
||||
{/* telefon: „<” = wróć do strony-rodzica zadeklarowanej przez podstronę */}
|
||||
{config?.back && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => (config.onBack ? config.onBack() : navigate(config.back!))}
|
||||
aria-label="Wstecz"
|
||||
className="grid h-[34px] w-[34px] flex-none cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-ink md:hidden"
|
||||
>
|
||||
<ChevronLeft className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
{/* nawigacja (np. Kalendarz) zawsze widoczna, nie jest grupą */}
|
||||
{config?.navWidget}
|
||||
{hasFilters && (
|
||||
<GroupButton
|
||||
icon={Filter}
|
||||
label="Filtry"
|
||||
active={config?.filterActive}
|
||||
open={openGroup === 'filters'}
|
||||
onToggle={() => toggle('filters')}
|
||||
>
|
||||
{/* telefon: treść renderuje panel w pigułce (Topbar) — children to md+ */}
|
||||
{config?.dateFilter}
|
||||
{config?.filters?.map((filter, i) => (
|
||||
<div key={i}>{filter}</div>
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* własne grupy tematyczne strony (np. Edycja/Galeria/Urządzenia) */}
|
||||
{(config?.groups ?? []).map((g) => (
|
||||
<GroupButton
|
||||
key={g.id}
|
||||
icon={g.icon}
|
||||
label={g.label}
|
||||
open={openGroup === `grp:${g.id}`}
|
||||
onToggle={() => toggle(`grp:${g.id}`)}
|
||||
>
|
||||
{g.actions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
))}
|
||||
{plusActions.length > 0 && (
|
||||
<GroupButton
|
||||
icon={Plus}
|
||||
label="Dodawanie"
|
||||
open={openGroup === 'add'}
|
||||
onToggle={() => toggle('add')}
|
||||
>
|
||||
{plusActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{otherActions.length > 0 && (
|
||||
<GroupButton
|
||||
icon={MoreHorizontal}
|
||||
label="Akcje"
|
||||
open={openGroup === 'actions'}
|
||||
onToggle={() => toggle('actions')}
|
||||
flatOnMobile={config?.flatActionsMobile}
|
||||
alwaysInlineFromMd={config?.alwaysInlineActions}
|
||||
>
|
||||
{otherActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* wyszukiwarka zawsze maksymalnie z prawej */}
|
||||
{config?.search && (
|
||||
<GroupButton
|
||||
icon={Search}
|
||||
label="Wyszukiwarka"
|
||||
active={searchQuery !== ''}
|
||||
open={openGroup === 'search'}
|
||||
onToggle={() => toggle('search')}
|
||||
>
|
||||
<div className="w-56">
|
||||
<SectionSearchInput section={config.search} />
|
||||
</div>
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* telefon: X zamykający otwarte menu; renderowany tylko gdy menu otwarte
|
||||
(zamknięty nie zostawia śladu w rządzie — inaczej jego gap psuje
|
||||
wyśrodkowanie samych ikon) */}
|
||||
{menuOpen && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Zamknij menu"
|
||||
onClick={() => setOpenGroup(null)}
|
||||
className="topbar-expand grid h-[34px] w-[34px] flex-none cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-danger md:hidden"
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export { Topbar } from './Topbar';
|
||||
export { MonthPickerCore } from './MonthPicker';
|
||||
export { useTopbar } from './useTopbar';
|
||||
export { useTopbarStore } from './store';
|
||||
export type { TopbarAction, TopbarConfig, TopbarCustomGroup, TopbarGroup } from './types';
|
||||
|
||||
@@ -11,6 +11,8 @@ interface TopbarState {
|
||||
/** Rejestracja strony (mount): ustawia konfigurację i resetuje grupę (null = czyszczenie). */
|
||||
registerPage: (config: TopbarConfig | null) => void;
|
||||
setOpenGroup: (group: string | null) => void;
|
||||
/** Przełączenie grupy na aktualnym stanie (odporne na wyścig mousedown+click). */
|
||||
toggleGroup: (group: string) => void;
|
||||
}
|
||||
|
||||
export const useTopbarStore = create<TopbarState>((set) => ({
|
||||
@@ -20,4 +22,5 @@ export const useTopbarStore = create<TopbarState>((set) => ({
|
||||
registerPage: (config) =>
|
||||
set({ config, openGroup: config ? (config.defaultOpenGroup ?? null) : null }),
|
||||
setOpenGroup: (group) => set({ openGroup: group }),
|
||||
toggleGroup: (group) => set((s) => ({ openGroup: s.openGroup === group ? null : group })),
|
||||
}));
|
||||
|
||||
@@ -129,7 +129,7 @@ describe('admin Logs page', () => {
|
||||
await screen.findByText('Jan Kowalski');
|
||||
// otwieramy grupę „Filtry”, potem panel selektora miesiąca i wybieramy sierpień bieżącego roku
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Filtry' }));
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Miesiąc' }));
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Wszystkie' }));
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Sie' }));
|
||||
// refetch z nowym queryKey — czekamy na drugi wywołany fetch
|
||||
await vi.waitFor(() => expect(calls.length).toBe(2));
|
||||
@@ -138,14 +138,14 @@ describe('admin Logs page', () => {
|
||||
expect(url.searchParams.get('to')).toBe('2026-08-31');
|
||||
// etykieta przycisku pokazuje wybrany miesiąc
|
||||
expect(screen.getByRole('button', { name: 'Sierpień 2026' })).toBeInTheDocument();
|
||||
// ponowne kliknięcie zaznaczonego miesiąca odznacza filtr (brak from/to)
|
||||
// ponowne otwarcie panelu i wybór „Wszystkie” cofa filtr miesiąca (brak from/to)
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Sierpień 2026' }));
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Sie' }));
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Wszystkie' }));
|
||||
await vi.waitFor(() => expect(calls.length).toBe(3));
|
||||
const url2 = new URL(calls.at(-1)!.url, 'http://localhost');
|
||||
expect(url2.searchParams.get('from')).toBeNull();
|
||||
expect(url2.searchParams.get('to')).toBeNull();
|
||||
expect(screen.getByRole('button', { name: 'Miesiąc' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'Wszystkie' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('filters the loaded page by the header search box', async () => {
|
||||
|
||||
Reference in New Issue
Block a user