Allow characters to be undefined in state
This commit is contained in:
parent
89766abba5
commit
4d8a7d4007
1 changed files with 83 additions and 83 deletions
|
|
@ -1,96 +1,96 @@
|
||||||
import { proxy } from "valtio";
|
import { proxy } from "valtio"
|
||||||
|
|
||||||
const emptyJob: Job = {
|
const emptyJob: Job = {
|
||||||
id: "-1",
|
id: "-1",
|
||||||
row: "",
|
row: "",
|
||||||
ml: false,
|
ml: false,
|
||||||
order: 0,
|
order: 0,
|
||||||
name: {
|
name: {
|
||||||
en: "",
|
en: "",
|
||||||
ja: ""
|
ja: "",
|
||||||
},
|
},
|
||||||
proficiency: {
|
proficiency: {
|
||||||
proficiency1: 0,
|
proficiency1: 0,
|
||||||
proficiency2: 0
|
proficiency2: 0,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AppState {
|
interface AppState {
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
|
|
||||||
party: {
|
party: {
|
||||||
id: string | undefined,
|
id: string | undefined
|
||||||
editable: boolean,
|
editable: boolean
|
||||||
detailsVisible: boolean,
|
detailsVisible: boolean
|
||||||
name: string | undefined,
|
name: string | undefined
|
||||||
description: string | undefined,
|
description: string | undefined
|
||||||
job: Job,
|
job: Job
|
||||||
raid: Raid | undefined,
|
raid: Raid | undefined
|
||||||
element: number,
|
element: number
|
||||||
extra: boolean,
|
extra: boolean
|
||||||
user: User | undefined,
|
user: User | undefined
|
||||||
favorited: boolean,
|
favorited: boolean
|
||||||
created_at: string
|
created_at: string
|
||||||
updated_at: string
|
updated_at: string
|
||||||
},
|
}
|
||||||
grid: {
|
grid: {
|
||||||
weapons: {
|
weapons: {
|
||||||
mainWeapon: GridWeapon | undefined,
|
mainWeapon: GridWeapon | undefined
|
||||||
allWeapons: GridArray<GridWeapon>
|
allWeapons: GridArray<GridWeapon>
|
||||||
},
|
}
|
||||||
summons: {
|
summons: {
|
||||||
mainSummon: GridSummon | undefined,
|
mainSummon: GridSummon | undefined
|
||||||
friendSummon: GridSummon | undefined,
|
friendSummon: GridSummon | undefined
|
||||||
allSummons: GridArray<GridSummon>
|
allSummons: GridArray<GridSummon>
|
||||||
},
|
}
|
||||||
characters: GridArray<GridCharacter>
|
characters: GridArray<GridCharacter | undefined>
|
||||||
},
|
}
|
||||||
search: {
|
search: {
|
||||||
recents: {
|
recents: {
|
||||||
characters: Character[]
|
characters: Character[]
|
||||||
weapons: Weapon[]
|
weapons: Weapon[]
|
||||||
summons: Summon[]
|
summons: Summon[]
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
raids: Raid[]
|
raids: Raid[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const initialAppState: AppState = {
|
export const initialAppState: AppState = {
|
||||||
party: {
|
party: {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
editable: false,
|
editable: false,
|
||||||
detailsVisible: false,
|
detailsVisible: false,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
description: undefined,
|
description: undefined,
|
||||||
job: emptyJob,
|
job: emptyJob,
|
||||||
raid: undefined,
|
raid: undefined,
|
||||||
element: 0,
|
element: 0,
|
||||||
extra: false,
|
extra: false,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
favorited: false,
|
favorited: false,
|
||||||
created_at: new Date().toISOString(),
|
created_at: new Date().toISOString(),
|
||||||
updated_at: new Date().toISOString()
|
updated_at: new Date().toISOString(),
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
weapons: {
|
||||||
|
mainWeapon: undefined,
|
||||||
|
allWeapons: {},
|
||||||
},
|
},
|
||||||
grid: {
|
summons: {
|
||||||
weapons: {
|
mainSummon: undefined,
|
||||||
mainWeapon: undefined,
|
friendSummon: undefined,
|
||||||
allWeapons: {}
|
allSummons: {},
|
||||||
},
|
|
||||||
summons: {
|
|
||||||
mainSummon: undefined,
|
|
||||||
friendSummon: undefined,
|
|
||||||
allSummons: {}
|
|
||||||
},
|
|
||||||
characters: {}
|
|
||||||
},
|
},
|
||||||
search: {
|
characters: {},
|
||||||
recents: {
|
},
|
||||||
characters: [],
|
search: {
|
||||||
weapons: [],
|
recents: {
|
||||||
summons: []
|
characters: [],
|
||||||
}
|
weapons: [],
|
||||||
|
summons: [],
|
||||||
},
|
},
|
||||||
raids: []
|
},
|
||||||
|
raids: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
export const appState = proxy(initialAppState)
|
export const appState = proxy(initialAppState)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue