rename augment type 'none' to 'no_augment', add util helpers

This commit is contained in:
Justin Edmund 2025-12-31 23:50:53 -08:00
parent adc7a6e2fe
commit 5f2167b1c3
3 changed files with 45 additions and 3 deletions

View file

@ -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

View file

@ -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.

View file

@ -0,0 +1,42 @@
import type { AugmentType } from '$lib/types/api/weaponStatModifier'
interface AugmentTypeData {
en: string
ja: string
}
export const AUGMENT_TYPES: Record<AugmentType, AugmentTypeData> = {
no_augment: { en: 'None', ja: 'なし' },
ax: { en: 'AX Skills', ja: 'AXスキル' },
befoulment: { en: 'Befoulment', ja: '禍スキル' }
}
export const AUGMENT_TYPE_LABELS: Record<AugmentType, string> = {
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}`
}