From 6b5f2b486889c71d1585d0b82e6e733296dbe017 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 17 Sep 2025 07:12:37 -0700 Subject: [PATCH] Add race and gender utility mappings --- src/lib/utils/gender.ts | 22 ++++++++++++++++++++++ src/lib/utils/race.ts | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/lib/utils/gender.ts create mode 100644 src/lib/utils/race.ts diff --git a/src/lib/utils/gender.ts b/src/lib/utils/gender.ts new file mode 100644 index 00000000..b1781f90 --- /dev/null +++ b/src/lib/utils/gender.ts @@ -0,0 +1,22 @@ +/** + * Gender mapping utilities for Granblue Fantasy + */ + +export const GENDER_LABELS: Record = { + 0: 'Unknown', + 1: 'Male', + 2: 'Female', + 3: 'Male/Female' +} + +export function getGenderLabel(gender?: number | null): string { + if (gender === null || gender === undefined) return '—' + return GENDER_LABELS[gender] || '—' +} + +export function getGenderIcon(gender?: number | null): string { + const label = getGenderLabel(gender) + if (label === '—' || label === 'Unknown') return '' + // Gender icons may use different naming convention + return `/images/labels/gender/Label_Gender_${label.replace('/', '_')}.png` +} \ No newline at end of file diff --git a/src/lib/utils/race.ts b/src/lib/utils/race.ts new file mode 100644 index 00000000..054a0990 --- /dev/null +++ b/src/lib/utils/race.ts @@ -0,0 +1,23 @@ +/** + * Race mapping utilities for Granblue Fantasy + */ + +export const RACE_LABELS: Record = { + 0: 'Unknown', + 1: 'Human', + 2: 'Erune', + 3: 'Draph', + 4: 'Harvin', + 5: 'Primal' +} + +export function getRaceLabel(race?: number | null): string { + if (race === null || race === undefined) return '—' + return RACE_LABELS[race] || '—' +} + +export function getRaceIcon(race?: number | null): string { + const label = getRaceLabel(race) + if (label === '—' || label === 'Unknown') return '' + return `/images/labels/race/Label_Race_${label}.png` +} \ No newline at end of file