// ─────────────────────────────────────────────────────────────
// Alternate navigation chromes (Settings → Darstellung → Bedienung).
// All wrap the SAME screens/state — only the navigation shell changes.
// command — Befehlsleiste: central search/command field + quick + button
// launcher — Springboard: one action button opens a full grid launcher
// rail — Daumen-Rail: vertical glass rail on the right edge
// 'classic' keeps the original bottom InteractiveTabBar (handled in App).
// ─────────────────────────────────────────────────────────────
const NAV_TABS = [
{ id: 'home', label: 'Start', d: 'M3 12L12 3l9 9M5 10v10h14V10' },
{ id: 'cal', label: 'Kalender', d: icons.cal },
{ id: 'eq', label: 'Equipment', d: 'M3 7l9-4 9 4v10l-9 4-9-4V7zM3 7l9 4 9-4M12 11v10' },
{ id: 'eur', label: 'Finanzen', d: icons.euro },
{ id: 'doc', label: 'Akten', d: icons.doc },
];
const NAV_SETTINGS = { id: 'settings', label: 'Einstellungen', d: 'M12 9a3 3 0 100 6 3 3 0 000-6zM19 12a7 7 0 00-.1-1.2l2-1.6-2-3.4-2.4 1a7 7 0 00-2-1.2l-.4-2.6H10l-.4 2.6a7 7 0 00-2 1.2l-2.4-1-2 3.4 2 1.6A7 7 0 005 12a7 7 0 00.1 1.2l-2 1.6 2 3.4 2.4-1a7 7 0 002 1.2l.4 2.6h4l.4-2.6a7 7 0 002-1.2l2.4 1 2-3.4-2-1.6A7 7 0 0019 12z' };
function AltNav({ layout, active, dark, theme, onTab, onNew, onSearch, onSettings }) {
const t = theme || useTheme();
const [open, setOpen] = React.useState(false);
const ACTIONS = [
{ id: 'new', label: 'Neue Miete', d: icons.plus, run: () => { setOpen(false); onNew && onNew(); }, primary: true },
{ id: 'cal', label: 'Kalender', d: icons.cal, run: () => { setOpen(false); onTab('cal'); } },
{ id: 'eq', label: 'Verfügbarkeit', d: NAV_TABS[2].d, run: () => { setOpen(false); onTab('eq'); } },
];
const wrap = { position: 'fixed', zIndex: 30, bottom: 'calc(env(safe-area-inset-bottom, 0px) + 14px)', left: 12, right: 12 };
// ── COMMAND: a single bar centred on a search/command field ─────────
if (layout === 'command') {
return (
{/* compact section switcher */}
{NAV_TABS.map((tab) => {
const on = tab.id === active;
return (
onTab(tab.id)} scale={0.86}>
);
})}
{/* the command field */}
onSearch && onSearch()} scale={0.98} style={{ flex: 1 }}>
Suchen oder Befehl …
onNew && onNew()} scale={0.9}>
);
}
// ── LAUNCHER: one button opens a full springboard of sections+actions ─
if (layout === 'launcher') {
const TILES = [
...ACTIONS.map((a) => ({ ...a, kind: 'action' })),
...NAV_TABS.map((s) => ({ id: s.id, label: s.label, d: s.d, run: () => { setOpen(false); onTab(s.id); }, kind: 'section' })),
{ id: 'settings', label: NAV_SETTINGS.label, d: NAV_SETTINGS.d, run: () => { setOpen(false); onSettings && onSettings(); }, kind: 'section' },
];
return (
<>
{open &&
setOpen(false)} style={{ position: 'fixed', inset: 0, zIndex: 40, background: t.scrim, backdropFilter: 'blur(18px) saturate(160%)', WebkitBackdropFilter: 'blur(18px) saturate(160%)', animation: 'rfFade 0.2s ease', display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', padding: '0 18px calc(env(safe-area-inset-bottom,0px) + 110px)' }}>
e.stopPropagation()}>
Schnellaktionen
{TILES.filter((x) => x.kind === 'action').map((x, i) => (
{x.label}
))}
Bereiche
{TILES.filter((x) => x.kind === 'section').map((x, i) => {
const on = x.id === active;
return (
{x.label}
);
})}
}
{/* the launcher button + a tiny "where am I" label */}
setOpen((v) => !v)} scale={0.9}>
{!open &&
{(NAV_TABS.find((s) => s.id === active) || {}).label || 'Menü'}}
>);
}
// ── RAIL: vertical glass rail hugging the right edge (thumb zone) ────
if (layout === 'rail') {
const items = NAV_TABS;
return (
onNew && onNew()} scale={0.88}>
{items.map((tab) => {
const on = tab.id === active;
return (
onTab(tab.id)} scale={0.85}>
);
})}
onSearch && onSearch()} scale={0.85}>
);
}
return null;
}
(function ensureNavAnims() {
if (document.getElementById('rf-nav-anims')) return;
const s = document.createElement('style');
s.id = 'rf-nav-anims';
s.textContent = '@keyframes rfFade{from{opacity:0}to{opacity:1}}@keyframes rfRise{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes rfPop{from{opacity:0;transform:scale(0.82) translateY(8px)}to{opacity:1;transform:scale(1) translateY(0)}}';
document.head.appendChild(s);
})();
Object.assign(window, { AltNav });