Registra catálogo B84 no registry B79: Nova atividade e Planejar giro na lista; wizards A1–A5 com ?municipio= no detalhe quando há município, mais atalhos Editar/Tarefas/Atualizações. Context bridge no detalhe; drawer omitido em /atividades/giros (compositor E13 já tem CTAs). Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
/** Client-safe `/campanha/atividades` path helpers for the B84 quick-action registry. */
|
|
|
|
export const ACTIVITY_LIST_PATH = '/campanha/atividades' as const
|
|
|
|
export const ACTIVITY_NEW_PATH = '/campanha/atividades/nova' as const
|
|
|
|
export const ACTIVITY_TOUR_COMPOSER_PATH = '/campanha/atividades/giros' as const
|
|
|
|
export type ActivityQuickActionSurface =
|
|
| { kind: 'list' }
|
|
| { kind: 'detail'; activitySlug: string }
|
|
|
|
const normalizePathname = (pathname: string): string =>
|
|
pathname.length > 1 && pathname.endsWith('/') ? pathname.slice(0, -1) : pathname
|
|
|
|
const activityDetailSlug = (pathname: string): string | null => {
|
|
const prefix = `${ACTIVITY_LIST_PATH}/`
|
|
if (!pathname.startsWith(prefix)) return null
|
|
const rest = pathname.slice(prefix.length)
|
|
if (!rest || rest.includes('/')) return null
|
|
if (rest === 'nova' || rest === 'giros') return null
|
|
return rest
|
|
}
|
|
|
|
export const parseActivityQuickActionSurface = (
|
|
pathname: string,
|
|
): ActivityQuickActionSurface | null => {
|
|
const normalized = normalizePathname(pathname)
|
|
if (normalized === ACTIVITY_LIST_PATH) return { kind: 'list' }
|
|
const slug = activityDetailSlug(normalized)
|
|
return slug ? { kind: 'detail', activitySlug: slug } : null
|
|
}
|
|
|
|
export const isActivityTourComposerPath = (pathname: string): boolean =>
|
|
normalizePathname(pathname) === ACTIVITY_TOUR_COMPOSER_PATH
|