Nav: wzajemne linki Panel admina/Aplikacja z SSO + rowne ikony w railu (p-2.5 nadpisywalo p-0)

This commit is contained in:
tisachi
2026-10-17 04:16:23 +02:00
parent 2ed575a13b
commit 9bcbb0877f
13 changed files with 372 additions and 95 deletions

View File

@@ -4,4 +4,8 @@
// Wystawienie osobnego API tylko dla awaryjnych scenariuszy — wpisz pelny URL.
window.__FITOS_CONFIG__ = {
apiUrl: '',
// Link „Aplikacja" w menu panelu. Puste = odgadnij port aplikacji z portu
// panelu (dev 9000->9001, vite 5174->5173, staging 13000->13001).
// Inne mapowanie portow (prod) = wpisz pelny adres, np. 'https://app.example.com'.
appUrl: '',
};

View File

@@ -1,6 +1,7 @@
import { useState } from 'react';
import { NavLink, Outlet, useNavigate } from 'react-router-dom';
import {
AppWindow,
Building2,
Dumbbell,
LogOut,
@@ -15,6 +16,7 @@ import {
type LucideIcon,
} from 'lucide-react';
import { useAuth } from '../store/auth';
import { APP_URL } from '../config';
import { Button, ThemeToggle } from './ui';
import { Topbar } from '../topbar';
import { Brandmark } from './Brandmark';
@@ -26,6 +28,8 @@ interface NavItem {
label: string;
icon: LucideIcon;
end: boolean;
/** Link na inny origin (np. aplikacja) — <a href>, nie <NavLink>. */
external?: boolean;
}
interface NavSection {
@@ -53,7 +57,12 @@ const SECTIONS: NavSection[] = [
},
{
label: 'System',
items: [{ to: '/logs', label: 'Logi', icon: ScrollText, end: true }],
items: [
{ to: '/logs', label: 'Logi', icon: ScrollText, end: true },
// Powrót do aplikacji użytkownika — zawsze na końcu, inny origin (aplikacja
// wznowi sesję z własnego ciastka fitos_refresh, panelu nie dotyka).
{ to: APP_URL, label: 'Aplikacja', icon: AppWindow, end: false, external: true },
],
},
];
@@ -82,41 +91,60 @@ function NavLinks({
className={cn('flex flex-col gap-0.5', collapsed ? 'px-2' : 'px-3')}
aria-label="Nawigacja główna"
>
{items.map((item) => (
<NavLink
key={item.to}
to={item.to}
end={item.end}
onClick={onNavigate}
title={collapsed ? item.label : undefined}
aria-label={collapsed ? item.label : undefined}
className={({ isActive }) =>
cn(
'relative flex h-[38px] items-center gap-2.5 rounded-[10px] text-[13.5px] font-semibold transition-colors duration-150',
collapsed ? 'justify-center px-0' : 'px-3',
isActive
? 'bg-accent/11 text-accent-text'
: 'text-dim hover:bg-line/30 hover:text-ink',
)
}
>
{({ isActive }) => (
<>
{isActive && (
<span
aria-hidden="true"
className={cn(
'absolute bottom-[9px] top-[9px] w-[3px] rounded-full bg-(image:--nav-bar-grad)',
collapsed ? '-left-2' : '-left-3',
)}
/>
)}
<item.icon className="h-[17px] w-[17px] shrink-0" strokeWidth={1.9} />
{!collapsed && <span className="min-w-0 truncate">{item.label}</span>}
</>
)}
</NavLink>
))}
{items.map((item) => {
const rowClass = (isActive: boolean) =>
cn(
'relative flex h-[38px] items-center gap-2.5 rounded-[10px] text-[13.5px] font-semibold transition-colors duration-150',
collapsed ? 'justify-center px-0' : 'px-3',
isActive ? 'bg-accent/11 text-accent-text' : 'text-dim hover:bg-line/30 hover:text-ink',
);
const icon = <item.icon className="h-[17px] w-[17px] shrink-0" strokeWidth={1.9} />;
const label = !collapsed && <span className="min-w-0 truncate">{item.label}</span>;
if (item.external) {
return (
<a
key={item.to}
href={item.to}
onClick={onNavigate}
title={collapsed ? item.label : undefined}
aria-label={collapsed ? item.label : undefined}
className={rowClass(false)}
>
{icon}
{label}
</a>
);
}
return (
<NavLink
key={item.to}
to={item.to}
end={item.end}
onClick={onNavigate}
title={collapsed ? item.label : undefined}
aria-label={collapsed ? item.label : undefined}
className={({ isActive }) => rowClass(isActive)}
>
{({ isActive }) => (
<>
{isActive && (
<span
aria-hidden="true"
className={cn(
'absolute bottom-[9px] top-[9px] w-[3px] rounded-full bg-(image:--nav-bar-grad)',
collapsed ? '-left-2' : '-left-3',
)}
/>
)}
{icon}
{label}
</>
)}
</NavLink>
);
})}
</nav>
);
}
@@ -185,13 +213,13 @@ export default function Layout() {
const footerRail = (
<div className="mt-auto flex flex-col items-center gap-2.5 border-t border-line px-2 pb-4 pt-3">
<Avatar name={fullName} size={32} />
<ThemeToggle className="h-8 w-8 p-0" />
<ThemeToggle />
<button
type="button"
onClick={doLogout}
aria-label="Wyloguj"
title="Wyloguj"
className="grid h-8 w-8 cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:border-danger/45 hover:text-danger"
className="grid h-[38px] w-[38px] cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:border-danger/45 hover:text-danger"
>
<LogOut className="h-5 w-5" />
</button>

View File

@@ -8,7 +8,7 @@ export function ThemeToggle({ className = '' }: { className?: string }) {
onClick={toggle}
aria-label="Przełącz motyw"
title="Przełącz motyw"
className={`inline-flex shrink-0 items-center justify-center p-2.5 rounded-[10px] bg-card border border-line text-dim shadow-card hover:text-ink hover:border-accent/45 cursor-pointer transition-all duration-150 ${className}`.trim()}
className={`inline-flex items-center justify-center p-2.5 rounded-[10px] bg-card border border-line text-dim shadow-card hover:text-ink hover:border-accent/45 cursor-pointer transition-all duration-150 ${className}`.trim()}
>
{theme === 'dark' ? <Sun className="w-5 h-5" /> : <Moon className="w-5 h-5" />}
</button>

View File

@@ -2,7 +2,7 @@
declare global {
interface Window {
__FITOS_CONFIG__?: { apiUrl?: string };
__FITOS_CONFIG__?: { apiUrl?: string; appUrl?: string };
}
}
@@ -12,3 +12,18 @@ export const API_URL: string =
window.location.origin;
export const API_BASE = `${API_URL}/api/v1`;
/**
* Origin aplikacji użytkownika (link „Aplikacja" w menu panelu).
* config.js: `appUrl` (pełny adres) ma pierwszeństwo. Fallback: ten sam host,
* port aplikacji wg znanego mapowania stosów (dev 9000→9001, vite 5174→5173,
* staging 13000→13001). Własne mapowanie portów (prod) = wpis w config.js.
*/
export const APP_URL: string =
window.__FITOS_CONFIG__?.appUrl ||
(() => {
const { protocol, hostname, port } = window.location;
const appPort =
port === '9000' ? '9001' : port === '5174' ? '5173' : port === '13000' ? '13001' : port;
return `${protocol}//${hostname}${appPort ? `:${appPort}` : ''}`;
})();

View File

@@ -40,6 +40,8 @@ export const useAuth = create<AuthState>((set) => ({
init: async () => {
try {
// Ciastka nie znają portów — zalogowany w aplikacji admin (której API
// wystawiło przy loginie też fitos_admin_refresh) wchodzi tu bez hasła.
const refreshRes = await fetch(`${API_BASE}/auth/refresh`, {
method: 'POST',
credentials: 'include',

View File

@@ -10,6 +10,15 @@ async function loginAsAdmin(page: Page) {
await expect(page).toHaveURL(/\/gyms$/);
}
test('sidebar zawiera link „Aplikacja” prowadzący do aplikacji użytkownika', async ({ page }) => {
mockApi(page, { gyms: { gyms: [TEST_GYM] } });
await loginAsAdmin(page);
const link = page.getByRole('link', { name: 'Aplikacja' });
await expect(link).toBeVisible();
// dev (vite 5174) → port aplikacji 5173 wg mapowania z src/config.ts
await expect(link).toHaveAttribute('href', /:5173\/?$/);
});
test('kliknięcie w siłownię otwiera podstronę z detalami', async ({ page }) => {
mockApi(page, { gyms: { gyms: [TEST_GYM] } });
await loginAsAdmin(page);

View File

@@ -104,7 +104,7 @@ export function createAuthRoutes({ prisma }: AppDeps) {
* summary: Login with email + password
* tags: [Auth]
* responses:
* 200: { description: OK, returns user + access token }
* 200: { description: 'OK, returns user + access token; dla konta z isAdmin=true (login z aplikacji) wystawiamy tez ciastko fitos_admin_refresh — SSO panelu' }
* 401: { description: Invalid credentials }
*/
router.post(
@@ -115,6 +115,12 @@ export function createAuthRoutes({ prisma }: AppDeps) {
const data = req.body as z.infer<typeof loginSchema>;
const result = await login(prisma, data);
setRefreshCookie(res, result.refreshToken, isAdminClient(req));
// Administrator logujacy sie przez aplikacje dostaje dodatkowo ciastko
// panelu — link „Panel admina" otwiera admina juz zalogowanego (te same
// ciastka po tej samej domenie; rotacja nie uniewaznia starych wartosci).
if (!isAdminClient(req) && result.user.isAdmin) {
setRefreshCookie(res, result.refreshToken, true);
}
res.json({ user: result.user, accessToken: result.accessToken });
}),
);

View File

@@ -152,9 +152,7 @@ describe('auth routes', () => {
await agent.post('/api/v1/auth/login').send({ email: user.email, password });
const res = await agent.post('/api/v1/auth/logout');
expect(res.status).toBe(204);
const setCookie = (res.headers['set-cookie'] ?? []).find((c) =>
c.startsWith('fitos_refresh='),
);
const setCookie = (res.headers['set-cookie'] ?? []).find((c) => c.startsWith('fitos_refresh='));
expect(setCookie).toBeDefined();
expect(setCookie).toMatch(/Expires=Thu, 01 Jan 1970|Max-Age=0/);
});
@@ -204,6 +202,36 @@ describe('auth routes', () => {
expect(asApp.status).toBe(401);
});
it('login z aplikacji: admin dostaje tez ciastko panelu (SSO), cwiczacy nie', async () => {
const app = buildApp();
const { user, password } = await createUser({ isAdmin: true });
const login = await app.post('/api/v1/auth/login').send({ email: user.email, password });
expect(login.status).toBe(200);
const cookies = (login.headers['set-cookie'] ?? []).join('\n');
expect(cookies).toContain('fitos_refresh=');
expect(cookies).toContain('fitos_admin_refresh=');
// ciastko panelu odswieza sie jak normalna sesja admina
const adminToken = (login.headers['set-cookie'] ?? [])
.find((c) => c.startsWith('fitos_admin_refresh='))!
.split('=')[1]
.split(';')[0];
const asAdmin = await app
.post('/api/v1/auth/refresh')
.set('X-Client', 'admin')
.set('Cookie', [`fitos_admin_refresh=${adminToken}`]);
expect(asAdmin.status).toBe(200);
// zwykly user — tylko ciastko aplikacji
const { user: member, password: memberPassword } = await createUser();
const memberLogin = await app
.post('/api/v1/auth/login')
.send({ email: member.email, password: memberPassword });
expect((memberLogin.headers['set-cookie'] ?? []).join('\n')).not.toContain(
'fitos_admin_refresh=',
);
});
it('logout (admin client): clears both cookie names and revokes tokens', async () => {
const app = buildApp();
const { user, password } = await createUser();

View File

@@ -4,4 +4,8 @@
// Wystawienie osobnego API tylko dla awaryjnych scenariuszy — wpisz pelny URL.
window.__FITOS_CONFIG__ = {
apiUrl: '',
// Link „Panel admina" w aplikacji. Puste = odgadnij port admina z portu
// aplikacji (dev 9001->9000, vite 5173->5174, staging 13001->13000).
// Inne mapowanie portow (prod) = wpisz pelny adres, np. 'https://admin.example.com'.
adminUrl: '',
};

View File

@@ -11,12 +11,14 @@ import {
Menu,
MessageSquare,
Play,
ShieldCheck,
User,
Users,
X,
type LucideIcon,
} from 'lucide-react';
import { useAuth } from '../store/auth';
import { ADMIN_URL } from '../config';
import {
useActiveSession,
useConversations,
@@ -38,6 +40,8 @@ interface NavItem {
icon: LucideIcon;
end: boolean;
badge?: number;
/** Link na inny origin (np. panel admina) — <a href>, nie <NavLink>. */
external?: boolean;
}
const NAV: NavItem[] = [
@@ -67,6 +71,14 @@ const ANNOUNCEMENTS_NAV: NavItem = {
icon: Megaphone,
end: false,
};
// Panel admina — zawsze na końcu listy, tylko dla kont z isAdmin=true.
const ADMIN_NAV: NavItem = {
to: ADMIN_URL,
label: 'Panel admina',
icon: ShieldCheck,
end: false,
external: true,
};
const SIDEBAR_KEY = 'fitos-sidebar-collapsed';
@@ -93,53 +105,73 @@ function NavLinks({
className={cn('flex flex-col gap-0.5', collapsed ? 'px-2' : 'px-3')}
aria-label="Nawigacja główna"
>
{items.map((item) => (
<NavLink
key={item.to}
to={item.to}
end={item.end}
onClick={onNavigate}
title={collapsed ? item.label : undefined}
aria-label={collapsed ? item.label : undefined}
className={({ isActive }) =>
cn(
'relative flex h-[38px] items-center gap-2.5 rounded-[10px] text-[13.5px] font-semibold transition-colors duration-150',
collapsed ? 'justify-center px-0' : 'px-3',
isActive
? 'bg-accent/11 text-accent-text'
: 'text-dim hover:bg-line/30 hover:text-ink',
)
}
>
{({ isActive }) => (
<>
{isActive && (
<span
aria-hidden="true"
className={cn(
'absolute bottom-[9px] top-[9px] w-[3px] rounded-full bg-(image:--nav-bar-grad)',
collapsed ? '-left-2' : '-left-3',
)}
/>
)}
<item.icon className="h-[17px] w-[17px] shrink-0" strokeWidth={1.9} />
{!collapsed && <span className="min-w-0 truncate">{item.label}</span>}
{typeof item.badge === 'number' &&
item.badge > 0 &&
(collapsed ? (
<span
aria-hidden="true"
className="absolute right-1.5 top-1.5 h-2 w-2 rounded-full bg-accent"
/>
) : (
<span className="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1.5 text-[0.7rem] font-bold text-accent-ink">
{item.badge}
</span>
))}
</>
)}
</NavLink>
))}
{items.map((item) => {
const rowClass = (isActive: boolean) =>
cn(
'relative flex h-[38px] items-center gap-2.5 rounded-[10px] text-[13.5px] font-semibold transition-colors duration-150',
collapsed ? 'justify-center px-0' : 'px-3',
isActive ? 'bg-accent/11 text-accent-text' : 'text-dim hover:bg-line/30 hover:text-ink',
);
const icon = <item.icon className="h-[17px] w-[17px] shrink-0" strokeWidth={1.9} />;
const label = !collapsed && <span className="min-w-0 truncate">{item.label}</span>;
const navBar = (
<span
aria-hidden="true"
className={cn(
'absolute bottom-[9px] top-[9px] w-[3px] rounded-full bg-(image:--nav-bar-grad)',
collapsed ? '-left-2' : '-left-3',
)}
/>
);
if (item.external) {
return (
<a
key={item.to}
href={item.to}
onClick={onNavigate}
title={collapsed ? item.label : undefined}
aria-label={collapsed ? item.label : undefined}
className={rowClass(false)}
>
{icon}
{label}
</a>
);
}
return (
<NavLink
key={item.to}
to={item.to}
end={item.end}
onClick={onNavigate}
title={collapsed ? item.label : undefined}
aria-label={collapsed ? item.label : undefined}
className={({ isActive }) => rowClass(isActive)}
>
{({ isActive }) => (
<>
{isActive && navBar}
{icon}
{label}
{typeof item.badge === 'number' &&
item.badge > 0 &&
(collapsed ? (
<span
aria-hidden="true"
className="absolute right-1.5 top-1.5 h-2 w-2 rounded-full bg-accent"
/>
) : (
<span className="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1.5 text-[0.7rem] font-bold text-accent-ink">
{item.badge}
</span>
))}
</>
)}
</NavLink>
);
})}
</nav>
);
}
@@ -198,6 +230,8 @@ export default function Layout() {
if (isTrainer) navItems = [...navItems.slice(0, -1), TRAINEES_NAV, navItems[navItems.length - 1]];
if (pendingInvitations > 0)
navItems = [...navItems.slice(0, -1), INVITATIONS_NAV, navItems[navItems.length - 1]];
// „Panel admina” — zawsze na samym końcu, tylko dla administratorów.
if (user?.isAdmin) navItems = [...navItems, ADMIN_NAV];
const fullName =
[user?.firstName, user?.lastName].filter(Boolean).join(' ') || user?.email || '?';
@@ -234,13 +268,13 @@ export default function Layout() {
const footerRail = (
<div className="mt-auto flex flex-col items-center gap-2.5 border-t border-line px-2 pb-4 pt-3">
<Avatar name={fullName} size={32} />
<ThemeToggle className="h-8 w-8 p-0" />
<ThemeToggle />
<button
type="button"
onClick={doLogout}
aria-label="Wyloguj"
title="Wyloguj"
className="grid h-8 w-8 cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:border-danger/45 hover:text-danger"
className="grid h-[38px] w-[38px] cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:border-danger/45 hover:text-danger"
>
<LogOut className="h-5 w-5" />
</button>

View File

@@ -8,7 +8,7 @@ export function ThemeToggle({ className = '' }: { className?: string }) {
onClick={toggle}
aria-label="Przełącz motyw"
title="Przełącz motyw"
className={`inline-flex shrink-0 items-center justify-center p-2.5 rounded-[10px] bg-card border border-line text-dim shadow-card hover:text-ink hover:border-accent/45 cursor-pointer transition-all duration-150 ${className}`.trim()}
className={`inline-flex items-center justify-center p-2.5 rounded-[10px] bg-card border border-line text-dim shadow-card hover:text-ink hover:border-accent/45 cursor-pointer transition-all duration-150 ${className}`.trim()}
>
{theme === 'dark' ? <Sun className="w-5 h-5" /> : <Moon className="w-5 h-5" />}
</button>

View File

@@ -2,7 +2,7 @@
declare global {
interface Window {
__FITOS_CONFIG__?: { apiUrl?: string };
__FITOS_CONFIG__?: { apiUrl?: string; adminUrl?: string };
}
}
@@ -13,3 +13,18 @@ export const API_URL: string =
window.location.origin;
export const API_BASE = `${API_URL}/api/v1`;
/**
* Origin panelu admina (link „Panel admina" dla administratorów).
* config.js: `adminUrl` (pełny adres) ma pierwszeństwo. Fallback: ten sam host,
* port admina wg znanego mapowania stosów (dev 9001→9000, vite 5173→5174,
* staging 13001→13000). Własne mapowanie portów (prod) = wpis w config.js.
*/
export const ADMIN_URL: string =
window.__FITOS_CONFIG__?.adminUrl ||
(() => {
const { protocol, hostname, port } = window.location;
const adminPort =
port === '9001' ? '9000' : port === '5173' ? '5174' : port === '13001' ? '13000' : port;
return `${protocol}//${hostname}${adminPort ? `:${adminPort}` : ''}`;
})();

View File

@@ -0,0 +1,132 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { MemoryRouter } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import App from '../src/App';
import { ADMIN_URL } from '../src/config';
import { useAuth } from '../src/store/auth';
import { setAccessToken } from '../src/api/client';
import type { User } from '../src/api/types';
function user(overrides: Partial<User> = {}): User {
return {
id: 'u1',
email: 'jan@test.local',
firstName: 'Jan',
lastName: 'Kowalski',
age: 30,
heightCm: 180,
phone: null,
isAdmin: false,
availability: null,
priorities: 'chest',
exclusions: 'knee',
developMuscles: [],
canDoMuscles: [],
difficultMuscles: [],
avoidMuscles: [],
createdAt: '2026-08-22T10:00:00.000Z',
...overrides,
};
}
function jsonResponse(status: number, body: unknown) {
return new Response(JSON.stringify(body), {
status,
headers: { 'Content-Type': 'application/json' },
});
}
function mockApi(current: User) {
vi.stubGlobal(
'fetch',
vi.fn(async (input: RequestInfo | URL) => {
const url = String(input);
if (url.includes('/auth/refresh'))
return jsonResponse(401, { error: { code: 'UNAUTHORIZED', message: 'no cookie' } });
if (url.includes('/auth/login'))
return jsonResponse(200, { user: current, accessToken: 'tok-1' });
if (url.includes('/me/active-session')) return jsonResponse(200, { session: null });
if (url.includes('/me/feed/unread-count')) return jsonResponse(200, { count: 0 });
if (url.includes('/me')) return jsonResponse(200, { user: current, memberships: [] });
if (url.includes('/messages/conversations')) return jsonResponse(200, { conversations: [] });
if (url.includes('/gyms/invitations')) return jsonResponse(200, { invitations: [] });
if (url.includes('/trainer/invitations')) return jsonResponse(200, { invitations: [] });
if (url.includes('/gyms')) return jsonResponse(200, { gyms: [] });
if (url.includes('/dashboard'))
return jsonResponse(200, {
killstreak: 0,
activePlan: null,
nextTraining: null,
progress: null,
});
return jsonResponse(404, { error: { code: 'NOT_FOUND', message: 'not found' } });
}),
);
}
async function login(current: User) {
mockApi(current);
const tester = userEvent.setup();
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: 0, refetchOnWindowFocus: false } },
});
render(
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={['/dashboard']}>
<App />
</MemoryRouter>
</QueryClientProvider>,
);
expect(await screen.findByRole('heading', { name: 'FitOS' })).toBeInTheDocument();
const email = document.querySelector('input[type="email"]') as HTMLInputElement;
const password = document.querySelector('input[type="password"]') as HTMLInputElement;
await tester.type(email, 'jan@test.local');
await tester.type(password, 'Password123!');
await tester.click(screen.getByRole('button', { name: 'Zaloguj' }));
expect(await screen.findByRole('heading', { name: 'Dashboard' })).toBeInTheDocument();
}
beforeEach(() => {
setAccessToken(null);
localStorage.clear();
useAuth.setState({ user: null, ready: false });
});
afterEach(() => {
vi.unstubAllGlobals();
});
describe('Panel admina w aplikacji', () => {
it('administrator widzi link „Panel admina” w stopce sidebaru', async () => {
await login(user({ isAdmin: true }));
const link = screen.getByRole('link', { name: 'Panel admina' });
expect(link).toBeInTheDocument();
expect(link.getAttribute('href')).toBe(ADMIN_URL);
});
it('ikony w railu (przyciemniony sidebar) są tej samej wielkości', async () => {
await login(user({ isAdmin: true }));
// rail = zwinięty sidebar; jedyna instancja ThemeToggle to ta w stopce raila
const toggle = screen.getByRole('button', { name: 'Przełącz motyw' });
const logout = screen.getByRole('button', { name: 'Wyloguj' });
const ts = toggle.getBoundingClientRect();
const ls = logout.getBoundingClientRect();
expect(Math.round(ts.width)).toBe(Math.round(ls.width));
expect(Math.round(ts.height)).toBe(Math.round(ls.height));
const tsvg = toggle.querySelector('svg')!.getBoundingClientRect();
const lsvg = logout.querySelector('svg')!.getBoundingClientRect();
expect(Math.round(tsvg.width)).toBe(Math.round(lsvg.width));
expect(Math.round(tsvg.height)).toBe(Math.round(lsvg.height));
});
it('zwykły użytkownik nie widzi linku „Panel admina”', async () => {
await login(user({ isAdmin: false }));
expect(screen.queryByRole('link', { name: 'Panel admina' })).not.toBeInTheDocument();
});
});