This commit is contained in:
Andras Schmelczer 2026-05-14 20:42:48 +01:00
parent 273d7a83ee
commit 084117cea8
48 changed files with 2283 additions and 890 deletions

View file

@ -14,7 +14,8 @@ import { SpinnerIcon } from './icons/SpinnerIcon';
interface MobileMenuProps {
activePage: Page;
onPageChange: (page: Page) => void;
activeHash: string;
onPageChange: (page: Page, hash?: string) => void;
theme: 'light' | 'dark';
onToggleTheme: () => void;
exportState: HeaderExportState | null;
@ -32,6 +33,7 @@ interface MobileMenuProps {
export default function MobileMenu({
activePage,
activeHash,
onPageChange,
theme,
onToggleTheme,
@ -52,25 +54,30 @@ export default function MobileMenu({
const emailLocal = emailParts?.[0] ?? '';
const emailDomain = emailParts && emailParts.length > 1 ? emailParts.slice(1).join('@') : '';
const mobileNavItem = (page: Page, label: string) => (
<a
key={page}
href={PAGE_PATHS[page]}
className={`block w-full cursor-pointer text-left px-3 py-2 text-sm font-medium rounded ${
activePage === page
? 'bg-navy-700 text-white'
: 'text-warm-300 hover:bg-navy-800 hover:text-white'
}`}
onClick={(e) => {
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;
e.preventDefault();
onPageChange(page);
onClose();
}}
>
{label}
</a>
);
const mobileNavItem = (page: Page, label: string, hash?: string) => {
const isActive =
activePage === page &&
(hash ? activeHash === hash : page !== 'account' || activeHash !== 'invites');
const href = hash ? `${PAGE_PATHS[page]}#${hash}` : PAGE_PATHS[page];
return (
<a
key={hash ? `${page}-${hash}` : page}
href={href}
className={`block w-full cursor-pointer text-left px-3 py-2 text-sm font-medium rounded ${
isActive ? 'bg-navy-700 text-white' : 'text-warm-300 hover:bg-navy-800 hover:text-white'
}`}
onClick={(e) => {
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;
e.preventDefault();
onPageChange(page, hash);
onClose();
}}
>
{label}
</a>
);
};
const dashboardActionClass =
'w-full flex cursor-pointer items-center justify-center gap-2 px-3 py-2 rounded bg-navy-800 text-sm font-semibold text-white border border-navy-700 shadow-sm hover:bg-navy-700 disabled:opacity-50 transition-colors';
@ -169,7 +176,7 @@ export default function MobileMenu({
{user?.subscription !== 'licensed' &&
!user?.isAdmin &&
mobileNavItem('pricing', t('header.pricing'))}
{user && mobileNavItem('invites', t('header.inviteFriends'))}
{user && mobileNavItem('account', t('header.inviteFriends'), 'invites')}
{user && mobileNavItem('account', t('userMenu.account'))}
{activePage !== 'dashboard' && user && mobileNavItem('saved', t('header.saved'))}
</nav>