2026-05-09 13:03:36 -05:00
|
|
|
import React, { useMemo } from 'react';
|
|
|
|
|
import { NavLink } from 'react-router-dom';
|
|
|
|
|
|
refactor(ts): convert the app shell to TSX (B7)
App.tsx (routing + QueryClient), main.tsx (entry; index.html updated to
main.tsx), useAuth.tsx (typed AuthContextValue/User + MeResponse; uses the safe
useContext()||defaults pattern so no `never` trap), and the layout components
(Layout, Sidebar, NavPill, BrandBlock — NavItem type, LucideIcon-typed nav
config, casts for the untyped overdue/simplefin API responses). TS caught a dead
prop: App passed mainContentId to TrackerPage, which takes no params — removed.
typecheck 0, lint 0 errors (39 warns), build green, 17/17 e2e probe.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 19:49:57 -05:00
|
|
|
export const BrandBlock = React.memo(function BrandBlock({ adminMode = false }: { adminMode?: boolean }) {
|
2026-05-09 13:03:36 -05:00
|
|
|
const logoSrc = useMemo(() => '/img/logo.png', []);
|
refactor(ts): convert the app shell to TSX (B7)
App.tsx (routing + QueryClient), main.tsx (entry; index.html updated to
main.tsx), useAuth.tsx (typed AuthContextValue/User + MeResponse; uses the safe
useContext()||defaults pattern so no `never` trap), and the layout components
(Layout, Sidebar, NavPill, BrandBlock — NavItem type, LucideIcon-typed nav
config, casts for the untyped overdue/simplefin API responses). TS caught a dead
prop: App passed mainContentId to TrackerPage, which takes no params — removed.
typecheck 0, lint 0 errors (39 warns), build green, 17/17 e2e probe.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 19:49:57 -05:00
|
|
|
|
2026-05-09 13:03:36 -05:00
|
|
|
return (
|
|
|
|
|
<NavLink
|
|
|
|
|
to={adminMode ? '/admin' : '/'}
|
|
|
|
|
aria-label="BillTracker"
|
|
|
|
|
className="flex items-center gap-2 rounded-xl focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src={logoSrc}
|
|
|
|
|
alt="BillTracker"
|
|
|
|
|
className="h-16 w-auto max-w-[9rem] object-contain drop-shadow-[0_1px_2px_rgba(0,0,0,0.45)]"
|
|
|
|
|
/>
|
|
|
|
|
{adminMode && (
|
|
|
|
|
<span className="hidden sm:inline-flex rounded-full border border-destructive/25 bg-destructive/10 px-2 py-0.5 text-[10px] font-semibold uppercase text-destructive">
|
|
|
|
|
Admin
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</NavLink>
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
BrandBlock.displayName = 'BrandBlock';
|