diff --git a/src/lib/types/api/weaponSeries.ts b/src/lib/types/api/weaponSeries.ts index fc301b99..16021637 100644 --- a/src/lib/types/api/weaponSeries.ts +++ b/src/lib/types/api/weaponSeries.ts @@ -20,7 +20,7 @@ export interface WeaponSeriesRef { name: { en: string; ja: string } hasWeaponKeys: boolean hasAwakening: boolean - /** Type of augment this series supports: "ax", "befoulment", or "none" */ + /** Type of augment this series supports: "ax", "befoulment", or "no_augment" */ augmentType: AugmentType extra: boolean elementChangeable: boolean @@ -40,7 +40,7 @@ export interface WeaponSeries { elementChangeable: boolean hasWeaponKeys: boolean hasAwakening: boolean - /** Type of augment this series supports: "ax", "befoulment", or "none" */ + /** Type of augment this series supports: "ax", "befoulment", or "no_augment" */ augmentType: AugmentType // Only included in :full view (show endpoint) weaponCount?: number diff --git a/src/lib/types/api/weaponStatModifier.ts b/src/lib/types/api/weaponStatModifier.ts index a6dd6547..56f3348a 100644 --- a/src/lib/types/api/weaponStatModifier.ts +++ b/src/lib/types/api/weaponStatModifier.ts @@ -11,7 +11,7 @@ * Augment type enum for weapon series. * Determines whether a weapon series supports AX skills, befoulments, or neither. */ -export type AugmentType = 'none' | 'ax' | 'befoulment' +export type AugmentType = 'no_augment' | 'ax' | 'befoulment' /** * WeaponStatModifier from the API. diff --git a/src/lib/utils/augmentType.ts b/src/lib/utils/augmentType.ts new file mode 100644 index 00000000..545dda45 --- /dev/null +++ b/src/lib/utils/augmentType.ts @@ -0,0 +1,42 @@ +import type { AugmentType } from '$lib/types/api/weaponStatModifier' + +interface AugmentTypeData { + en: string + ja: string +} + +export const AUGMENT_TYPES: Record = { + no_augment: { en: 'None', ja: 'なし' }, + ax: { en: 'AX Skills', ja: 'AXスキル' }, + befoulment: { en: 'Befoulment', ja: '禍スキル' } +} + +export const AUGMENT_TYPE_LABELS: Record = { + no_augment: 'None', + ax: 'AX Skills', + befoulment: 'Befoulment' +} + +export function getAugmentTypeLabel(type?: AugmentType): string { + if (!type) return '—' + return AUGMENT_TYPE_LABELS[type] || '—' +} + +export function getAugmentTypeName(type?: AugmentType, locale: 'en' | 'ja' = 'en'): string { + if (!type) return '—' + const data = AUGMENT_TYPES[type] + if (!data) return '—' + return data[locale] +} + +export function getAugmentTypeOptions(): Array<{ value: AugmentType; label: string }> { + return Object.entries(AUGMENT_TYPE_LABELS).map(([value, label]) => ({ + value: value as AugmentType, + label + })) +} + +export function getAugmentTypeClass(type?: AugmentType): string { + if (!type || type === 'no_augment') return '' + return `augment-${type}` +}