mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-21 20:03:08 +00:00
436 seeded Praças (municipality-based; per-TSE-zone in Salvador/Camaçari) become the operational unit; roles renamed to coordinator/advisor/leader with advisors scoped to administered Praças. Leadership is one record per person across many Praças/organizations; vote pledges split leader-declared vs staff-estimated (estimates never serialized to leaders). Adds organizations, demand workflow with staff-only cost/receipts, action-plan results with deputy presence, manual political trend, multi-candidate comparison and the diverging red/white/blue map mode. Migration 20260721_020109_remodel_plazas deliberately resets the campaign vertical in production (public site untouched); test suite ported to the new model (unit 187 / int 306 / e2e 9 green).
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
import {
|
|
CalendarDaysIcon,
|
|
HandshakeIcon,
|
|
HomeIcon,
|
|
InboxIcon,
|
|
MapPinIcon,
|
|
UsersIcon,
|
|
type LucideIcon,
|
|
} from 'lucide-react'
|
|
|
|
import type { CampaignUser } from '@/payload-types'
|
|
import { canAccessSupporterArea } from '@/utilities/supporterUi'
|
|
|
|
export type CampaignNavItem = {
|
|
title: string
|
|
href: string
|
|
icon: LucideIcon
|
|
}
|
|
|
|
const staffNav: CampaignNavItem[] = [
|
|
{ title: 'Início', href: '/campanha', icon: HomeIcon },
|
|
{ title: 'Praças', href: '/campanha/pracas', icon: MapPinIcon },
|
|
{ title: 'Lideranças', href: '/campanha/liderancas', icon: HandshakeIcon },
|
|
{ title: 'Planos', href: '/campanha/planos', icon: CalendarDaysIcon },
|
|
{ title: 'Demandas', href: '/campanha/demandas', icon: InboxIcon },
|
|
{ title: 'Apoiadores', href: '/campanha/apoiadores', icon: UsersIcon },
|
|
]
|
|
|
|
const leaderNav: CampaignNavItem[] = [
|
|
{ title: 'Início', href: '/campanha', icon: HomeIcon },
|
|
{ title: 'Minhas Praças', href: '/campanha/pracas', icon: MapPinIcon },
|
|
{ title: 'Planos', href: '/campanha/planos', icon: CalendarDaysIcon },
|
|
{ title: 'Demandas', href: '/campanha/demandas', icon: InboxIcon },
|
|
]
|
|
|
|
export const getCampaignNav = (role: CampaignUser['role']): CampaignNavItem[] => {
|
|
if (role === 'leader') return leaderNav
|
|
|
|
return staffNav.filter(
|
|
(item) => item.href !== '/campanha/apoiadores' || canAccessSupporterArea(role),
|
|
)
|
|
}
|
|
|
|
/**
|
|
* Compact set for the mobile bottom bar (max 5 items with a home slot);
|
|
* organizações fica acessível pela sidebar e pelas fichas.
|
|
*/
|
|
export const getCampaignBottomNav = (role: CampaignUser['role']): CampaignNavItem[] =>
|
|
getCampaignNav(role).filter((item) => item.href !== '/campanha/apoiadores')
|
|
|
|
/** Home matches only exactly; other items also match nested paths. */
|
|
export const isCampaignNavActive = (pathname: string, href: string): boolean => {
|
|
if (href === '/campanha') {
|
|
return pathname === '/campanha' || pathname === '/campanha/'
|
|
}
|
|
return pathname === href || pathname.startsWith(`${href}/`)
|
|
}
|