Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/pages/manager/ManagerLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Button, Nav } from 'react-bootstrap';
import { Nav } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { NavLink, Outlet } from 'react-router';
import { useSubmitFade } from '../../components/SubmitFade';
import { Link, NavLink, Outlet } from 'react-router';
import { ExcelButton } from './ExcelButton';

const PAGES = [
Expand All @@ -11,17 +10,17 @@ const PAGES = [

export function ManagerLayout() {
const { t } = useTranslation();
const fade = useSubmitFade();
return (
<div className="d-flex gap-4">
<Nav className="manager-nav flex-column">
{PAGES.map(([path, key]) => (
<Nav.Link key={key} as={NavLink} to={path ? `/manager/${path}` : "/manager"} end={path === ''}>{t(`m.nav.${key}`)}</Nav.Link>
))}
<ExcelButton />
{/* Leave the organisers' rooms: a button like "Update my Excel" in the dark ink, fading back to the house. */}
{/* Leave the organisers' rooms: a button like "Update my Excel" in the dark ink. Back to the house the way the
brand in the top bar goes (a plain link to "/", no fade). */}
<div className="mt-3 px-2">
<Button size="sm" variant="secondary" className="w-100" onClick={() => fade(t('m.exitFade'))}>{t('m.nav.exit')}</Button>
<Link to="/" className="btn btn-sm btn-secondary w-100">{t('m.nav.exit')}</Link>
</div>
</Nav>
<div className="flex-grow-1" style={{ minWidth: 0 }}><Outlet /></div>
Expand Down
19 changes: 19 additions & 0 deletions test/managerExit.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { describe, expect, it } from 'vitest';
import appShell from '../src/components/AppShell.tsx?raw';
import managerLayout from '../src/pages/manager/ManagerLayout.tsx?raw';
import myTrip from '../src/pages/MyTrip.tsx?raw';
import questionnaire from '../src/pages/Questionnaire.tsx?raw';

// The tests type-check without JSX (tsconfig.worker.json), so the wiring is checked in the source.
describe('the organisers\' Exit', () => {
it('goes to the house like the brand in the top bar: a plain link to "/", no dark fade', () => {
expect(appShell).toMatch(/<Navbar\.Brand as=\{Link\} to="\/"/);
expect(managerLayout).toContain('<Link to="/" className="btn btn-sm btn-secondary w-100">{t(\'m.nav.exit\')}</Link>');
expect(managerLayout).not.toMatch(/useSubmitFade|exitFade/);
});

it('leaves the attendees\' Exits with their fade', () => {
expect(questionnaire).toContain("startFade(t('m.exitFade'))");
expect(myTrip).toContain("fade(t('m.exitFade'))");
});
});