"use client"; import { useIsPluginEnabled } from "@/lib/plugins/client"; import { useT } from "@/lib/i18n/client"; import type { AccessType } from "@/generated/prisma/enums"; /** * Badge route+fleuve vs fleuve only. Gated par le plugin `access-type`. * Si le plugin est désactivé, rien n'est rendu. Label i18n via useT(). */ export function AccessTypeBadge({ accessType, size = "sm", }: { accessType: AccessType; size?: "sm" | "md"; }) { const enabled = useIsPluginEnabled("access-type"); const t = useT(); if (!enabled) return null; const isExpedition = accessType === "RIVER_ONLY"; const label = isExpedition ? t("access.riverOnly") : t("access.roadAndRiver"); const styles = isExpedition ? "bg-[var(--color-karbe-laterite-300)]/25 text-[var(--color-karbe-laterite-700)] ring-[var(--color-karbe-laterite-500)]/30" : "bg-[var(--color-karbe-canopy-50)] text-[var(--color-karbe-canopy-700)] ring-[var(--color-karbe-canopy-500)]/30"; const sizing = size === "md" ? "px-3 py-1.5 text-xs" : "px-2 py-0.5 text-[11px]"; return ( {label} ); }