Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
18 lines
781 B
TypeScript
18 lines
781 B
TypeScript
import type { LegacyEventRedirectLookup } from '@/lib/seo/serverApi'
|
|
import { CONSUMER_ROUTES, SEO_ROUTES } from '@/constants/routes'
|
|
|
|
const CANONICAL_EVENT_STATUSES = new Set(['published', 'full', 'completed'])
|
|
|
|
export function resolveLegacyEventDestination(event: LegacyEventRedirectLookup): string | null {
|
|
if (!event.slug) return null
|
|
if (event.settings?.isDiscoverable === false) return null
|
|
if (!CANONICAL_EVENT_STATUSES.has(event.status)) return null
|
|
|
|
return SEO_ROUTES.EVENT_LANDING(event.slug)
|
|
}
|
|
|
|
/** Public event detail href: canonical slug when available, otherwise private UUID route. */
|
|
export function resolveEventDetailHref(event: LegacyEventRedirectLookup): string {
|
|
return resolveLegacyEventDestination(event) ?? CONSUMER_ROUTES.EVENT_DETAIL(event.id)
|
|
}
|