diff --git a/src/components/campaign/shell/CampaignAppScrollChrome.tsx b/src/components/campaign/shell/CampaignAppScrollChrome.tsx index 64358860..062f1c72 100644 --- a/src/components/campaign/shell/CampaignAppScrollChrome.tsx +++ b/src/components/campaign/shell/CampaignAppScrollChrome.tsx @@ -1,5 +1,6 @@ 'use client' +import { usePathname } from 'next/navigation' import type { ReactNode } from 'react' import { CampaignGlobalSearchProvider } from '@/components/campaign/dashboard/CampaignGlobalSearchMount' @@ -9,6 +10,7 @@ import { useQuickActionsChromeActive, } from '@/components/campaign/shell/CampaignQuickActionsHost' import { CampaignQuickActionsSnapProvider } from '@/components/campaign/shell/CampaignQuickActionsSnapContext' +import { isCampaignHomePath } from '@/lib/campaignQuickActionMount' import type { CampaignRole } from '@/lib/campaignRoles' export const CampaignAppScrollChrome = ({ @@ -18,10 +20,19 @@ export const CampaignAppScrollChrome = ({ role: CampaignRole children: ReactNode }) => { + const pathname = usePathname() const quickActionsActive = useQuickActionsChromeActive(role) + const compactHomeBottomPadding = isCampaignHomePath(pathname) if (!quickActionsActive) { - return {children} + return ( + + {children} + + ) } return ( diff --git a/src/components/campaign/shell/CampaignMobileTopBar.tsx b/src/components/campaign/shell/CampaignMobileTopBar.tsx index 38bd5b8e..a92ed8aa 100644 --- a/src/components/campaign/shell/CampaignMobileTopBar.tsx +++ b/src/components/campaign/shell/CampaignMobileTopBar.tsx @@ -1,6 +1,7 @@ 'use client' import { ArrowLeft, X } from 'lucide-react' +import Link from 'next/link' import type { ReactNode } from 'react' import { useCampaignListTransition } from '@/components/campaign/shared/CampaignListPending' @@ -11,7 +12,9 @@ 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 { CAMPAIGN_HOME } from '@/lib/campaignPaths' import { + CAMPAIGN_HOME_TOP_BAR_LINK_ARIA_LABEL, WIZARD_APP_TOP_BAR_ARIA_LABEL, WIZARD_DISMISS_ARIA_LABEL, wizardFlowChromeAriaLabel, @@ -156,8 +159,16 @@ export const CampaignMobileTopBar = ({ )}
- Jorge Solla - Campanha · Bahia + + Jorge Solla + + Campanha · Bahia + + {opsSyncStatus ? (
{opsSyncStatus} diff --git a/src/components/campaign/shell/CampaignQuickActionsHost.tsx b/src/components/campaign/shell/CampaignQuickActionsHost.tsx index c2f46818..801ab2c8 100644 --- a/src/components/campaign/shell/CampaignQuickActionsHost.tsx +++ b/src/components/campaign/shell/CampaignQuickActionsHost.tsx @@ -78,15 +78,22 @@ const CampaignContentScrollWithPeek = ({ children }: { children: ReactNode }) => export const CampaignContentScroll = ({ children, quickActionsPeek, + compactHomeBottomPadding = false, }: { children: ReactNode quickActionsPeek: boolean + /** B116 — Início mobile: half the default scrollport padding below the search dock. */ + compactHomeBottomPadding?: boolean }) => { if (!quickActionsPeek) { return (
{children}
diff --git a/src/lib/campaignWizardCopy.ts b/src/lib/campaignWizardCopy.ts index d47e99fa..2227e671 100644 --- a/src/lib/campaignWizardCopy.ts +++ b/src/lib/campaignWizardCopy.ts @@ -14,6 +14,8 @@ export const WIZARD_STEP_PENDING_MESSAGE = 'Carregando passo…' as const export const WIZARD_APP_TOP_BAR_ARIA_LABEL = 'Campanha Jorge Solla' as const +export const CAMPAIGN_HOME_TOP_BAR_LINK_ARIA_LABEL = 'Ir para o início' as const + export const wizardMunicipalityChromeAriaLabel = (municipalityLabel: string): string => `Município em atualização: ${municipalityLabel}` diff --git a/tests/unit/campaignMobileTopBar.unit.spec.tsx b/tests/unit/campaignMobileTopBar.unit.spec.tsx index 56d61633..6ded157b 100644 --- a/tests/unit/campaignMobileTopBar.unit.spec.tsx +++ b/tests/unit/campaignMobileTopBar.unit.spec.tsx @@ -20,6 +20,7 @@ import { type CampaignWizardChromeState, } from '@/components/campaign/shell/CampaignWizardChromeContext' import { SidebarProvider } from '@/components/ui/Sidebar' +import { CAMPAIGN_HOME_TOP_BAR_LINK_ARIA_LABEL } from '@/lib/campaignWizardCopy' import { stubMatchMedia } from '../helpers/matchMedia' const WizardChromeProbe = ({ chrome }: { chrome: CampaignWizardChromeState | null }) => { @@ -64,6 +65,11 @@ describe('CampaignMobileTopBar', () => { const topBar = container.querySelector('[data-slot="campaign-mobile-top-bar"]') expect(topBar?.getAttribute('data-mode')).toBe('app') expect(screen.getByText('Jorge Solla')).toBeTruthy() + expect( + screen + .getByRole('link', { name: CAMPAIGN_HOME_TOP_BAR_LINK_ARIA_LABEL }) + .getAttribute('href'), + ).toBe('/campanha') expect(screen.queryByRole('link', { name: /Voltar/ })).toBeNull() expect(screen.queryByRole('button', { name: 'Fechar busca' })).toBeNull() expect(screen.queryByRole('link', { name: 'Sair da ação' })).toBeNull() diff --git a/tests/unit/campaignQuickActionsDrawer.unit.spec.tsx b/tests/unit/campaignQuickActionsDrawer.unit.spec.tsx index a890a182..6c9db69c 100644 --- a/tests/unit/campaignQuickActionsDrawer.unit.spec.tsx +++ b/tests/unit/campaignQuickActionsDrawer.unit.spec.tsx @@ -430,6 +430,20 @@ describe('CampaignQuickActionsDrawer (B105)', () => { }) describe('CampaignContentScroll quick-actions direction (B105)', () => { + it('uses compact bottom padding on Início when quick-actions peek is off (B116)', () => { + render( + +
+ , + ) + + const scrollport = document.querySelector('[data-slot="campaign-content-scroll"]') + expect(scrollport?.getAttribute('data-home-compact-bottom-padding')).toBe('true') + expect(scrollport?.className).toContain('pb-2') + expect(scrollport?.className).toContain('px-4') + expect(scrollport?.className).not.toContain(' p-4') + }) + it('collapses on scroll down and re-docks on scroll up', () => { renderQuickActionsChrome( <>