'use client' import { ArrowLeft, X } from 'lucide-react' import { Fragment, type ReactNode } from 'react' import { useCampaignListTransition } from '@/components/campaign/shared/CampaignListPending' import { CampaignWizardNavLink } from '@/components/campaign/shared/CampaignWizardNavLink' import { useCampaignHomeSearchChrome } from '@/components/campaign/shell/CampaignHomeSearchChromeContext' import { useCampaignHeaderActions, useCampaignPageChromeRole, } from '@/components/campaign/shell/CampaignPageChromeContext' import { CampaignPageChromeDisplay } from '@/components/campaign/shell/CampaignPageChromeDisplay' import { useCampaignWizardChrome } from '@/components/campaign/shell/CampaignWizardChromeContext' import { Button } from '@/components/ui/button' import { SidebarTrigger } from '@/components/ui/Sidebar' import { Skeleton } from '@/components/ui/skeleton' import { HOME_SEARCH_COLLAPSE_ARIA_LABEL } from '@/lib/campaignHomeSearchContract' import { isStaffCampaignRole } from '@/lib/campaignRoles' import { WIZARD_APP_TOP_BAR_ARIA_LABEL, WIZARD_DISMISS_ARIA_LABEL, wizardFlowChromeAriaLabel, wizardMunicipalityChromeAriaLabel, } from '@/lib/campaignWizardCopy' import { cn } from '@/lib/utils' const wizardNavButtonClass = 'min-h-11 shrink-0 gap-1 px-2 text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground' const wizardDismissButtonClass = 'size-11 shrink-0 text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground' const wizardTitleSkeletonClass = 'mx-auto motion-reduce:animate-none bg-primary-foreground/20' /** * Shared look for icon controls registered into the app top bar's right * cluster (C94/C95 slot) — the same white-on-primary treatment the wizard * buttons and the notification bell use. Consumers compose `md:` overrides on * top (e.g. the bell switches to muted on desktop). */ export const campaignMobileHeaderIconClassName = 'text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground' export const CampaignMobileTopBar = ({ notificationBell }: { notificationBell?: ReactNode }) => { const chrome = useCampaignWizardChrome() const homeSearchChrome = useCampaignHomeSearchChrome() const headerActions = useCampaignHeaderActions() const role = useCampaignPageChromeRole() const { isPending } = useCampaignListTransition() if (chrome) { return (
{chrome.stepKind === 'continue' && chrome.previousHref ? ( ) : (
)}
{isPending ? ( <> {chrome.municipalityLabel ? ( ) : null} ) : ( <> {chrome.flowTitle} {chrome.municipalityLabel ? ( {chrome.municipalityLabel} ) : null} )}
) } return (
{homeSearchChrome?.focused ? ( ) : isStaffCampaignRole(role) ? null : ( // C102: staff navigates from the bottom bar + "Mais" — the hamburger is // only the leader's (lockdown, no bottom nav). The sheet itself is // unmounted for staff in CampaignSidebar. )}
{Object.entries(headerActions).map(([id, node]) => ( {node} ))} {notificationBell ?? null}
) }