refactor(types): enhance + switch from static types to KeyValuePairs type definitions
This commit is contained in:
parent
7badc5a83b
commit
2b2a5483e5
17
src/types/Converters.d.ts
vendored
17
src/types/Converters.d.ts
vendored
@ -1,19 +1,14 @@
|
||||
import type {
|
||||
IEffectMapLibrary,
|
||||
IFigureDataPalette,
|
||||
IFigureDataSetType,
|
||||
IFigureMapLibrary,
|
||||
IFurni,
|
||||
IProduct
|
||||
} from './SubConverters'
|
||||
import type { IFigureDataPalette, IFigureDataSetType, IFigureMapLibrary, IFurni, IProduct } from './SubConverters'
|
||||
import type { KeyValuePairs } from './global'
|
||||
|
||||
export interface IFigureData {
|
||||
palettes: IFigureDataPalette[]
|
||||
setTypes: IFigureDataSetType[]
|
||||
setTypes: KeyValuePairs<string, IFigureDataSetType>
|
||||
}
|
||||
|
||||
export interface IFigureMap {
|
||||
libraries: IFigureMapLibrary[]
|
||||
parts: KeyValuePairs<string, KeyValuePairs<number, number>>
|
||||
}
|
||||
|
||||
export interface IFurniData {
|
||||
@ -21,9 +16,7 @@ export interface IFurniData {
|
||||
wallItemTypes: IFurni[]
|
||||
}
|
||||
|
||||
export interface IEffectMap {
|
||||
effects: IEffectMapLibrary[]
|
||||
}
|
||||
export type IEffectMap = KeyValuePairs<string, KeyValuePairs<string, string>>
|
||||
|
||||
export interface IProductData {
|
||||
productData: { product: IProduct }
|
||||
|
56
src/types/SubConverters.d.ts
vendored
56
src/types/SubConverters.d.ts
vendored
@ -1,3 +1,5 @@
|
||||
import type { KeyValuePairs } from './global'
|
||||
|
||||
export interface IFurni {
|
||||
id: number
|
||||
classname: string
|
||||
@ -26,47 +28,43 @@ export interface IFurni {
|
||||
rare: boolean
|
||||
}
|
||||
|
||||
export interface IFigureDataColor {
|
||||
id: number
|
||||
export type Club = 'idle' | 'HC' | 'VIP'
|
||||
|
||||
export interface IFigureDataPaletteType {
|
||||
index: number
|
||||
club: number // must be changed to something, either 0, 1, 2
|
||||
selectable: boolean // has been changed to boolean, can be either 1, 0
|
||||
hexCode: string
|
||||
club: number
|
||||
selectable: boolean
|
||||
color: string
|
||||
}
|
||||
|
||||
export interface IFigureDataPalette {
|
||||
id: number
|
||||
color: IFigureDataColor[]
|
||||
}
|
||||
export type IFigureDataPalette = KeyValuePairs<number, IFigureDataPaletteType>
|
||||
|
||||
export interface IFigureDataPart {
|
||||
id: number
|
||||
type: string // must be changed (i guess)
|
||||
colorable: boolean // has been changed to boolean, can be either 1, 0
|
||||
type: string
|
||||
colorable: boolean
|
||||
index: number
|
||||
colorindex: number
|
||||
}
|
||||
|
||||
export interface IFigureDataSet {
|
||||
id: number
|
||||
gender: 'M' | 'F' | 'U' // has been changed
|
||||
club: number // must be changed to something, either 0, 1, 2
|
||||
colorable: boolean // has been changed to boolean, can be either 1, 0
|
||||
selectable: boolean // has been changed to boolean, can be either 1, 0
|
||||
preselectable: boolean // has been changed to boolean, can be either 1, 0
|
||||
sellable?: boolean // has been changed to boolean, can be either 1, 0, null
|
||||
gender: 'M' | 'F' | 'U'
|
||||
club: number
|
||||
colorable: boolean
|
||||
selectable: boolean
|
||||
preselectable: boolean
|
||||
sellable?: boolean
|
||||
hiddenLayers?: string[]
|
||||
parts: IFigureDataPart[]
|
||||
hiddenLayers: Array<{ partType: string }> // !! can be empty
|
||||
}
|
||||
|
||||
export interface IFigureDataSetType {
|
||||
type: string // must be changed (i guess)
|
||||
paletteId: number
|
||||
mandatoryF0: boolean // has been changed to boolean, can be either 1, 0
|
||||
mandatoryF1: boolean // has been changed to boolean, can be either 1, 0
|
||||
mandatoryM0: boolean // has been changed to boolean, can be either 1, 0
|
||||
mandatoryM1: boolean // has been changed to boolean, can be either 1, 0
|
||||
sets: IFigureDataSet[]
|
||||
mandatoryF0: boolean
|
||||
mandatoryF1: boolean
|
||||
mandatoryM0: boolean
|
||||
mandatoryM1: boolean
|
||||
sets: KeyValuePairs<number, IFigureDataSet>
|
||||
}
|
||||
|
||||
export interface IFigureMapLibraryPart {
|
||||
@ -77,14 +75,6 @@ export interface IFigureMapLibraryPart {
|
||||
export interface IFigureMapLibrary {
|
||||
id: string
|
||||
revision: number
|
||||
part: IFigureMapLibraryPart[]
|
||||
}
|
||||
|
||||
export interface IEffectMapLibrary {
|
||||
id: number
|
||||
lib: string
|
||||
type: string // dance || fx
|
||||
revision: number
|
||||
}
|
||||
|
||||
export interface IProduct {
|
||||
|
4
src/types/global.d.ts
vendored
4
src/types/global.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
export type StateTypes = 'idle' | 'loading' | 'error' | 'success'
|
||||
export type ConvertionHandler = (message: string, state: StateTypes) => void
|
||||
|
||||
export interface KeyValuePairs {
|
||||
[index: string]: string
|
||||
export type KeyValuePairs<KeyType extends number | string, ValueType> = {
|
||||
[key in KeyType]: ValueType
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user