fix: resolve typescript and build errors across admin and guest apps
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-07 13:25:30 +01:00
parent 1ec4987b38
commit 22cb7ed7ce
43 changed files with 1057 additions and 30446 deletions

View File

@@ -1,20 +1,30 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useLocation } from 'react-router-dom';
import { useEventContext } from '../../context/EventContext';
import { NavKey } from '../components/BottomNav';
import { resolveTabTarget } from '../lib/tabHistory';
import { adminPath } from '../../constants';
export function useMobileNav(currentSlug?: string | null) {
const navigate = useNavigate();
const location = useLocation();
const { activeEvent } = useEventContext();
const slug = currentSlug ?? activeEvent?.slug ?? null;
const go = React.useCallback(
(key: NavKey) => {
const target = resolveTabTarget(key, slug);
// Tap-to-reset: If we are already at the target, and it is the home tab,
// and we are not at the dashboard root, then go to dashboard.
if (key === 'home' && location.pathname === target && target !== adminPath('/mobile/dashboard')) {
navigate(adminPath('/mobile/dashboard'));
return;
}
navigate(target);
},
[navigate, slug]
[navigate, location.pathname, slug]
);
return { go, slug };