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