mirror of
https://github.com/fsolla/teqo.git
synced 2026-12-02 13:13:06 +00:00
B118 — hide list page title, subtitle and scope chip on mobile
Extract CampaignListPageHeader with sr-only/md:not-sr-only h1 and hidden subtitle/scope below md. Apply to all 8 list index routes. Unit + e2e pins. Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
parent
dde938bbb1
commit
586ac7d218
11 changed files with 199 additions and 116 deletions
|
|
@ -6,6 +6,7 @@ import { getPayload } from 'payload'
|
||||||
|
|
||||||
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
import {
|
||||||
CampaignListPendingBoundary,
|
CampaignListPendingBoundary,
|
||||||
CampaignListResults,
|
CampaignListResults,
|
||||||
|
|
@ -109,35 +110,35 @@ export default async function SupportersPage({ searchParams }: SupportersPagePro
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CampaignPageShell>
|
<CampaignPageShell>
|
||||||
<header className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
<CampaignListPageHeader
|
||||||
<div className="flex flex-col gap-2">
|
title="Apoiadores"
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Apoiadores</h1>
|
description="Base nominal de apoio com intenção de voto e vínculo opcional a municípios."
|
||||||
<p className="text-muted-foreground">
|
scope={
|
||||||
Base nominal de apoio com intenção de voto e vínculo opcional a municípios.
|
|
||||||
</p>
|
|
||||||
<CampaignScopeBadge>
|
<CampaignScopeBadge>
|
||||||
{isCampaignUnrestricted(user)
|
{isCampaignUnrestricted(user)
|
||||||
? `${campaignRoleLabels[user.role]} · todos os apoiadores`
|
? `${campaignRoleLabels[user.role]} · todos os apoiadores`
|
||||||
: getSupporterScopeLabel(result.totalDocs)}
|
: getSupporterScopeLabel(result.totalDocs)}
|
||||||
</CampaignScopeBadge>
|
</CampaignScopeBadge>
|
||||||
</div>
|
}
|
||||||
<div className="flex flex-col gap-2 sm:flex-row">
|
actions={
|
||||||
{isCampaignCoordinator(user) ? (
|
<div className="flex flex-col gap-2 sm:flex-row">
|
||||||
<Button asChild variant="outline" className="min-h-11">
|
{isCampaignCoordinator(user) ? (
|
||||||
<Link href="/campanha/apoiadores/importar">
|
<Button asChild variant="outline" className="min-h-11">
|
||||||
<FileUpIcon data-icon="inline-start" aria-hidden="true" />
|
<Link href="/campanha/apoiadores/importar">
|
||||||
Importar CSV
|
<FileUpIcon data-icon="inline-start" aria-hidden="true" />
|
||||||
|
Importar CSV
|
||||||
|
</Link>
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
<Button asChild className="min-h-11">
|
||||||
|
<Link href="/campanha/apoiadores/novo">
|
||||||
|
<PlusIcon data-icon="inline-start" aria-hidden="true" />
|
||||||
|
Novo
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
</div>
|
||||||
<Button asChild className="min-h-11">
|
}
|
||||||
<Link href="/campanha/apoiadores/novo">
|
/>
|
||||||
<PlusIcon data-icon="inline-start" aria-hidden="true" />
|
|
||||||
Novo
|
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{main}
|
{main}
|
||||||
</CampaignPageShell>
|
</CampaignPageShell>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import type { ReactNode } from 'react'
|
||||||
|
|
||||||
import { AdvisorsTable } from '@/components/campaign/advisor/AdvisorsTable'
|
import { AdvisorsTable } from '@/components/campaign/advisor/AdvisorsTable'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
import {
|
||||||
CampaignListPendingBoundary,
|
CampaignListPendingBoundary,
|
||||||
CampaignListResults,
|
CampaignListResults,
|
||||||
|
|
@ -105,13 +106,10 @@ export default async function AdvisorsPage({ searchParams }: AdvisorsPageProps)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CampaignPageShell>
|
<CampaignPageShell>
|
||||||
<header className="flex flex-col gap-2">
|
<CampaignListPageHeader
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Assessores</h1>
|
title="Assessores"
|
||||||
<p className="text-muted-foreground">
|
description="Consulte na tabela; ative Editar para alterar campos e carteira. Nome abre a ficha; e-mail/celular copiam; município abre o município."
|
||||||
Consulte na tabela; ative Editar para alterar campos e carteira. Nome abre a ficha;
|
/>
|
||||||
e-mail/celular copiam; município abre o município.
|
|
||||||
</p>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{main}
|
{main}
|
||||||
</CampaignPageShell>
|
</CampaignPageShell>
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import { ActivityFilters } from '@/components/campaign/activity/ActivityFilters'
|
||||||
import { ActivityList } from '@/components/campaign/activity/ActivityList'
|
import { ActivityList } from '@/components/campaign/activity/ActivityList'
|
||||||
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import type { Activity } from '@/payload-types'
|
import type { Activity } from '@/payload-types'
|
||||||
|
|
@ -53,32 +54,30 @@ export default async function ActivityListPage({ searchParams }: ActivityListPag
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CampaignPageShell>
|
<CampaignPageShell>
|
||||||
<header className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
<CampaignListPageHeader
|
||||||
<div className="flex flex-col gap-2">
|
title="Atividades"
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Atividades</h1>
|
description="Organize caminhadas, comícios, panfletagens e demais ações de campanha."
|
||||||
<p className="text-muted-foreground">
|
actions={
|
||||||
Organize caminhadas, comícios, panfletagens e demais ações de campanha.
|
canCreate ? (
|
||||||
</p>
|
<div className="flex flex-wrap gap-2">
|
||||||
</div>
|
{/* E13: the planner generates several drafts at once, so it sits next
|
||||||
{canCreate ? (
|
to "Nova atividade" rather than replacing it. */}
|
||||||
<div className="flex flex-wrap gap-2">
|
<Button asChild variant="outline" className="min-h-11">
|
||||||
{/* E13: the planner generates several drafts at once, so it sits next
|
<Link href={TOUR_COMPOSER_PATH}>
|
||||||
to "Nova atividade" rather than replacing it. */}
|
<MapPinnedIcon data-icon="inline-start" aria-hidden="true" />
|
||||||
<Button asChild variant="outline" className="min-h-11">
|
Planejar giro
|
||||||
<Link href={TOUR_COMPOSER_PATH}>
|
</Link>
|
||||||
<MapPinnedIcon data-icon="inline-start" aria-hidden="true" />
|
</Button>
|
||||||
Planejar giro
|
<Button asChild className="min-h-11">
|
||||||
</Link>
|
<Link href="/campanha/atividades/nova">
|
||||||
</Button>
|
<PlusIcon data-icon="inline-start" aria-hidden="true" />
|
||||||
<Button asChild className="min-h-11">
|
Nova atividade
|
||||||
<Link href="/campanha/atividades/nova">
|
</Link>
|
||||||
<PlusIcon data-icon="inline-start" aria-hidden="true" />
|
</Button>
|
||||||
Nova atividade
|
</div>
|
||||||
</Link>
|
) : null
|
||||||
</Button>
|
}
|
||||||
</div>
|
/>
|
||||||
) : null}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<CampaignListPendingBoundary>
|
<CampaignListPendingBoundary>
|
||||||
<ActivityFilters
|
<ActivityFilters
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { getPayload } from 'payload'
|
||||||
import { CampaignFilterChips } from '@/components/campaign/shared/CampaignFilterChips'
|
import { CampaignFilterChips } from '@/components/campaign/shared/CampaignFilterChips'
|
||||||
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
import {
|
||||||
CampaignListPendingBoundary,
|
CampaignListPendingBoundary,
|
||||||
CampaignListResults,
|
CampaignListResults,
|
||||||
|
|
@ -186,24 +187,23 @@ export default async function DemandsPage({ searchParams }: DemandsPageProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CampaignPageShell>
|
<CampaignPageShell>
|
||||||
<header className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
<CampaignListPageHeader
|
||||||
<div className="flex flex-col gap-2">
|
title="Demandas"
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Demandas</h1>
|
description="Necessidades da campanha abertas pelas lideranças, revisadas pela assessoria e — quando preciso — decididas pelo Coordenador Geral."
|
||||||
<p className="text-muted-foreground">
|
scope={
|
||||||
Necessidades da campanha abertas pelas lideranças, revisadas pela assessoria e — quando
|
|
||||||
preciso — decididas pelo Coordenador Geral.
|
|
||||||
</p>
|
|
||||||
<Badge variant="estimate-pending" className="w-fit">
|
<Badge variant="estimate-pending" className="w-fit">
|
||||||
{openCount} {openCount === 1 ? 'demanda em aberto' : 'demandas em aberto'}
|
{openCount} {openCount === 1 ? 'demanda em aberto' : 'demandas em aberto'}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
}
|
||||||
<Button asChild className="min-h-11">
|
actions={
|
||||||
<Link href="/campanha/demandas/nova">
|
<Button asChild className="min-h-11">
|
||||||
<PlusIcon data-icon="inline-start" aria-hidden="true" />
|
<Link href="/campanha/demandas/nova">
|
||||||
Nova demanda
|
<PlusIcon data-icon="inline-start" aria-hidden="true" />
|
||||||
</Link>
|
Nova demanda
|
||||||
</Button>
|
</Link>
|
||||||
</header>
|
</Button>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
{main}
|
{main}
|
||||||
</CampaignPageShell>
|
</CampaignPageShell>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { redirect } from 'next/navigation'
|
||||||
import { getPayload } from 'payload'
|
import { getPayload } from 'payload'
|
||||||
|
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
import {
|
||||||
CampaignListPendingBoundary,
|
CampaignListPendingBoundary,
|
||||||
CampaignListResults,
|
CampaignListResults,
|
||||||
|
|
@ -282,21 +283,18 @@ export default async function StateDeputiesPage({ searchParams }: StateDeputiesP
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CampaignPageShell>
|
<CampaignPageShell>
|
||||||
<header className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
<CampaignListPageHeader
|
||||||
<div className="flex flex-col gap-2">
|
title="Dobradinhas"
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Dobradinhas</h1>
|
description="Deputados estaduais com quem a campanha dobra — vincule lideranças e municípios direto na lista."
|
||||||
<p className="text-muted-foreground">
|
actions={
|
||||||
Deputados estaduais com quem a campanha dobra — vincule lideranças e municípios direto
|
<Button asChild className="min-h-11">
|
||||||
na lista.
|
<Link href="/campanha/dobradinhas/nova">
|
||||||
</p>
|
<PlusIcon data-icon="inline-start" aria-hidden="true" />
|
||||||
</div>
|
Nova dobradinha
|
||||||
<Button asChild className="min-h-11">
|
</Link>
|
||||||
<Link href="/campanha/dobradinhas/nova">
|
</Button>
|
||||||
<PlusIcon data-icon="inline-start" aria-hidden="true" />
|
}
|
||||||
Nova dobradinha
|
/>
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{main}
|
{main}
|
||||||
</CampaignPageShell>
|
</CampaignPageShell>
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import {
|
||||||
} from '@/components/campaign/leadership/LeadershipSortableHead'
|
} from '@/components/campaign/leadership/LeadershipSortableHead'
|
||||||
import { CampaignCopyableCell } from '@/components/campaign/shared/CampaignCopyableCell'
|
import { CampaignCopyableCell } from '@/components/campaign/shared/CampaignCopyableCell'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
import {
|
||||||
CampaignListPendingBoundary,
|
CampaignListPendingBoundary,
|
||||||
CampaignListResults,
|
CampaignListResults,
|
||||||
|
|
@ -436,20 +437,18 @@ export default async function LeadershipsPage({ searchParams }: LeadershipsPageP
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CampaignPageShell>
|
<CampaignPageShell>
|
||||||
<header className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
<CampaignListPageHeader
|
||||||
<div className="flex flex-col gap-2">
|
title="Lideranças"
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Lideranças</h1>
|
description="Uma ficha por pessoa — cada liderança pode atuar em vários municípios e organizações."
|
||||||
<p className="text-muted-foreground">
|
actions={
|
||||||
Uma ficha por pessoa — cada liderança pode atuar em vários municípios e organizações.
|
<Button asChild className="min-h-11">
|
||||||
</p>
|
<Link href="/campanha/liderancas/nova">
|
||||||
</div>
|
<PlusIcon data-icon="inline-start" aria-hidden="true" />
|
||||||
<Button asChild className="min-h-11">
|
Nova liderança
|
||||||
<Link href="/campanha/liderancas/nova">
|
</Link>
|
||||||
<PlusIcon data-icon="inline-start" aria-hidden="true" />
|
</Button>
|
||||||
Nova liderança
|
}
|
||||||
</Link>
|
/>
|
||||||
</Button>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{main}
|
{main}
|
||||||
</CampaignPageShell>
|
</CampaignPageShell>
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import { MunicipalityFilters } from '@/components/campaign/municipality/Municipa
|
||||||
import { MunicipalityList } from '@/components/campaign/municipality/MunicipalityList'
|
import { MunicipalityList } from '@/components/campaign/municipality/MunicipalityList'
|
||||||
import { MunicipalityListOverview } from '@/components/campaign/municipality/MunicipalityListOverview'
|
import { MunicipalityListOverview } from '@/components/campaign/municipality/MunicipalityListOverview'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import { CampaignScopeBadge } from '@/components/campaign/shared/CampaignScopeBadge'
|
import { CampaignScopeBadge } from '@/components/campaign/shared/CampaignScopeBadge'
|
||||||
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
import { OpsListPage } from '@/components/campaign/shared/OpsListPage'
|
||||||
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell'
|
||||||
|
|
@ -185,14 +186,11 @@ export default async function MunicipalitiesPage({ searchParams }: Municipalitie
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CampaignPageShell>
|
<CampaignPageShell>
|
||||||
<header className="flex flex-col gap-2">
|
<CampaignListPageHeader
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Municípios</h1>
|
title="Municípios"
|
||||||
<p className="text-muted-foreground">
|
description="Os 435 municípios da campanha: um por município da Bahia — em Salvador, uma zona eleitoral cada."
|
||||||
Os 435 municípios da campanha: um por município da Bahia — em Salvador, uma zona eleitoral
|
scope={<CampaignScopeBadge>{getCampaignScopeLabel(user.role, scopeTotal)}</CampaignScopeBadge>}
|
||||||
cada.
|
/>
|
||||||
</p>
|
|
||||||
<CampaignScopeBadge>{getCampaignScopeLabel(user.role, scopeTotal)}</CampaignScopeBadge>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{main}
|
{main}
|
||||||
{listVisitLabel ? (
|
{listVisitLabel ? (
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { getPayload } from 'payload'
|
||||||
import { TerritoryFilters } from '@/components/campaign/municipality/TerritoryFilters'
|
import { TerritoryFilters } from '@/components/campaign/municipality/TerritoryFilters'
|
||||||
import { TerritoryList } from '@/components/campaign/municipality/TerritoryList'
|
import { TerritoryList } from '@/components/campaign/municipality/TerritoryList'
|
||||||
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter'
|
||||||
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
import {
|
import {
|
||||||
CampaignListPendingBoundary,
|
CampaignListPendingBoundary,
|
||||||
CampaignListResults,
|
CampaignListResults,
|
||||||
|
|
@ -81,15 +82,13 @@ export default async function TerritoriesPage({ searchParams }: TerritoriesPageP
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CampaignPageShell>
|
<CampaignPageShell>
|
||||||
<header className="flex max-w-prose flex-col gap-2">
|
<CampaignListPageHeader
|
||||||
<h1 className="text-2xl font-semibold tracking-tight text-balance">
|
className="max-w-prose"
|
||||||
Territórios de Identidade
|
title="Territórios de Identidade"
|
||||||
</h1>
|
titleClassName="text-balance"
|
||||||
<p className="text-muted-foreground text-pretty">
|
description="Compare a concentração histórica e a cobertura de assessoria das regiões da Bahia. Abra um território para ver seus municípios."
|
||||||
Compare a concentração histórica e a cobertura de assessoria das regiões da Bahia. Abra um
|
descriptionClassName="text-pretty"
|
||||||
território para ver seus municípios.
|
/>
|
||||||
</p>
|
|
||||||
</header>
|
|
||||||
{main}
|
{main}
|
||||||
</CampaignPageShell>
|
</CampaignPageShell>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
47
src/components/campaign/shared/CampaignListPageHeader.tsx
Normal file
47
src/components/campaign/shared/CampaignListPageHeader.tsx
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
type CampaignListPageHeaderProps = {
|
||||||
|
title: string
|
||||||
|
description: string
|
||||||
|
scope?: ReactNode
|
||||||
|
actions?: ReactNode
|
||||||
|
className?: string
|
||||||
|
titleClassName?: string
|
||||||
|
descriptionClassName?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const CampaignListPageHeader = ({
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
scope,
|
||||||
|
actions,
|
||||||
|
className,
|
||||||
|
titleClassName,
|
||||||
|
descriptionClassName,
|
||||||
|
}: CampaignListPageHeaderProps) => (
|
||||||
|
<header
|
||||||
|
className={cn(
|
||||||
|
'flex flex-col gap-2',
|
||||||
|
actions && 'gap-4 sm:flex-row sm:items-start sm:justify-between',
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div className="flex flex-col gap-2">
|
||||||
|
<h1
|
||||||
|
className={cn(
|
||||||
|
'sr-only text-2xl font-semibold tracking-tight md:not-sr-only',
|
||||||
|
titleClassName,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{title}
|
||||||
|
</h1>
|
||||||
|
<p className={cn('hidden text-muted-foreground md:block', descriptionClassName)}>
|
||||||
|
{description}
|
||||||
|
</p>
|
||||||
|
{scope ? <div className="hidden md:contents">{scope}</div> : null}
|
||||||
|
</div>
|
||||||
|
{actions}
|
||||||
|
</header>
|
||||||
|
)
|
||||||
|
|
@ -39,6 +39,23 @@ test.describe('Municípios — shell (OH8)', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test.describe('Municípios — list header mobile (B118)', () => {
|
||||||
|
test.use({ viewport: { width: 390, height: 844 } })
|
||||||
|
|
||||||
|
test('hides page title chrome on mobile but keeps list tools', async ({ campaign, page }) => {
|
||||||
|
const { fixtures } = campaign
|
||||||
|
const coordinator = await fixtures.createCampaignUser('coordinator', {
|
||||||
|
name: fixtures.value('Coordenador Mobile Header'),
|
||||||
|
})
|
||||||
|
|
||||||
|
await campaign.login(page, coordinator.email!, coordinator.password)
|
||||||
|
await page.goto(`${campaign.baseURL}/campanha/municipios`)
|
||||||
|
await expect(page.getByRole('heading', { name: 'Municípios', exact: true })).toBeHidden()
|
||||||
|
await expect(page.getByLabel('Buscar município')).toBeVisible()
|
||||||
|
await expect(page.getByText(/\d+ municípios encontrados/)).toBeVisible()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
test.describe('Municípios — jornadas por papel', () => {
|
test.describe('Municípios — jornadas por papel', () => {
|
||||||
test('coordinator opens the municipalities list, edits strategy and assigns an advisor', async ({
|
test('coordinator opens the municipalities list, edits strategy and assigns an advisor', async ({
|
||||||
campaign,
|
campaign,
|
||||||
|
|
|
||||||
27
tests/unit/campaignListPageHeader.unit.spec.ts
Normal file
27
tests/unit/campaignListPageHeader.unit.spec.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { createElement } from 'react'
|
||||||
|
import { renderToStaticMarkup } from 'react-dom/server'
|
||||||
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
|
import { CampaignListPageHeader } from '@/components/campaign/shared/CampaignListPageHeader'
|
||||||
|
import { CampaignScopeBadge } from '@/components/campaign/shared/CampaignScopeBadge'
|
||||||
|
|
||||||
|
describe('CampaignListPageHeader (B118)', () => {
|
||||||
|
it('keeps h1 in the DOM with sr-only on mobile and hides subtitle and scope chip below md', () => {
|
||||||
|
const html = renderToStaticMarkup(
|
||||||
|
createElement(CampaignListPageHeader, {
|
||||||
|
title: 'Municípios',
|
||||||
|
description: 'Os 435 municípios da campanha.',
|
||||||
|
scope: createElement(CampaignScopeBadge, null, '435 municípios'),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(html).toContain('<h1')
|
||||||
|
expect(html).toContain('sr-only')
|
||||||
|
expect(html).toContain('md:not-sr-only')
|
||||||
|
expect(html).toContain('hidden')
|
||||||
|
expect(html).toContain('md:block')
|
||||||
|
expect(html).toContain('md:contents')
|
||||||
|
expect(html).toContain('Municípios')
|
||||||
|
expect(html).toContain('Os 435 municípios da campanha.')
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
Reference in a new issue