27 lines
1020 B
TypeScript
27 lines
1020 B
TypeScript
/**
|
|
* Sampradāya (spiritual lineage) options for the profile field.
|
|
*
|
|
* Stored as a lowercase `code` on the account; the `name` is the display
|
|
* label shown in the searchable picker. Only Gaudiya exists today —
|
|
* append more entries here as they're supported (the BFF allow-list in
|
|
* user_service.go must be extended in lockstep).
|
|
*/
|
|
|
|
export const SAMPRADAYAS: { code: string; name: string }[] = [
|
|
{ code: "gaudiya", name: "Gaudiya" },
|
|
];
|
|
|
|
/** Display label for a sampradāya code, or null when unknown. */
|
|
export function sampradayaName(code: string | null | undefined): string | null {
|
|
if (!code) return null;
|
|
return SAMPRADAYAS.find((s) => s.code === code)?.name ?? null;
|
|
}
|
|
|
|
/** Resolve a typed display name back to its code (case-insensitive), or
|
|
* null when it doesn't match a known lineage. */
|
|
export function sampradayaCode(name: string): string | null {
|
|
const n = name.trim().toLowerCase();
|
|
if (!n) return null;
|
|
return SAMPRADAYAS.find((s) => s.name.toLowerCase() === n)?.code ?? null;
|
|
}
|