-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6b5866
commit 27aeadd
Showing
13 changed files
with
253 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,45 @@ | ||
// World loading state | ||
import { create } from "zustand"; | ||
|
||
interface WorldState { | ||
isWorldLoading: boolean; | ||
export interface WorldStore { | ||
isSelectedStructureLoading: boolean; | ||
isMarketLoading: boolean; | ||
isStructuresLoading: boolean; | ||
setWorldLoading: (loading: boolean) => void; | ||
isPlayerStructuresLoading: boolean; | ||
isArrivalsLoading: boolean; | ||
isMapLoading: boolean; | ||
isBankLoading: boolean; | ||
isWorldLoading: boolean; | ||
isHyperstructureLoading: boolean; | ||
isSingleKeyLoading: boolean; | ||
isConfigLoading: boolean; | ||
setSelectedStructureLoading: (loading: boolean) => void; | ||
setMarketLoading: (loading: boolean) => void; | ||
setStructuresLoading: (loading: boolean) => void; | ||
setPlayerStructuresLoading: (loading: boolean) => void; | ||
setArrivalsLoading: (loading: boolean) => void; | ||
setMapLoading: (loading: boolean) => void; | ||
setBankLoading: (loading: boolean) => void; | ||
setWorldLoading: (loading: boolean) => void; | ||
setHyperstructureLoading: (loading: boolean) => void; | ||
setSingleKeyLoading: (loading: boolean) => void; | ||
setConfigLoading: (loading: boolean) => void; | ||
} | ||
|
||
export const useWorldStore = create<WorldState>((set) => ({ | ||
isWorldLoading: true, | ||
isMarketLoading: true, | ||
isStructuresLoading: true, | ||
setWorldLoading: (loading: boolean) => set({ isWorldLoading: loading }), | ||
export const createWorldStoreSlice = (set: any) => ({ | ||
isSelectedStructureLoading: false, | ||
isMarketLoading: false, | ||
isPlayerStructuresLoading: false, | ||
isArrivalsLoading: false, | ||
isMapLoading: false, | ||
isBankLoading: false, | ||
isWorldLoading: false, | ||
isHyperstructureLoading: false, | ||
isSingleKeyLoading: false, | ||
isConfigLoading: false, | ||
setSelectedStructureLoading: (loading: boolean) => set({ isSelectedStructureLoading: loading }), | ||
setMarketLoading: (loading: boolean) => set({ isMarketLoading: loading }), | ||
setStructuresLoading: (loading: boolean) => set({ isStructuresLoading: loading }), | ||
})); | ||
setPlayerStructuresLoading: (loading: boolean) => set({ isPlayerStructuresLoading: loading }), | ||
setArrivalsLoading: (loading: boolean) => set({ isArrivalsLoading: loading }), | ||
setMapLoading: (loading: boolean) => set({ isMapLoading: loading }), | ||
setBankLoading: (loading: boolean) => set({ isBankLoading: loading }), | ||
setWorldLoading: (loading: boolean) => set({ isWorldLoading: loading }), | ||
setHyperstructureLoading: (loading: boolean) => set({ isHyperstructureLoading: loading }), | ||
setSingleKeyLoading: (loading: boolean) => set({ isSingleKeyLoading: loading }), | ||
setConfigLoading: (loading: boolean) => set({ isConfigLoading: loading }), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import useUIStore from "@/hooks/store/useUIStore"; | ||
|
||
export const WorldLoading = () => { | ||
const isSelectedStructureLoading = useUIStore((state) => state.isSelectedStructureLoading); | ||
const isMarketLoading = useUIStore((state) => state.isMarketLoading); | ||
const isPlayerStructuresLoading = useUIStore((state) => state.isPlayerStructuresLoading); | ||
const isArrivalsLoading = useUIStore((state) => state.isArrivalsLoading); | ||
const isMapLoading = useUIStore((state) => state.isMapLoading); | ||
const isBankLoading = useUIStore((state) => state.isBankLoading); | ||
const isWorldLoading = useUIStore((state) => state.isWorldLoading); | ||
const isHyperstructureLoading = useUIStore((state) => state.isHyperstructureLoading); | ||
const isSingleKeyLoading = useUIStore((state) => state.isSingleKeyLoading); | ||
const isConfigLoading = useUIStore((state) => state.isConfigLoading); | ||
|
||
const anyLoading = | ||
isSelectedStructureLoading || | ||
isMarketLoading || | ||
isPlayerStructuresLoading || | ||
isArrivalsLoading || | ||
isMapLoading || | ||
isBankLoading || | ||
isWorldLoading || | ||
isHyperstructureLoading || | ||
isSingleKeyLoading || | ||
isConfigLoading; | ||
|
||
console.log({ isArrivalsLoading }); | ||
|
||
const getLoadingItems = () => { | ||
const items = []; | ||
if (isSelectedStructureLoading) items.push("Structure"); | ||
if (isMarketLoading) items.push("Market"); | ||
if (isPlayerStructuresLoading) items.push("Player Structures"); | ||
if (isArrivalsLoading) items.push("Arrivals"); | ||
if (isMapLoading) items.push("Map"); | ||
if (isBankLoading) items.push("Bank"); | ||
if (isWorldLoading) items.push("World"); | ||
if (isHyperstructureLoading) items.push("Hyperstructure"); | ||
if (isSingleKeyLoading) items.push("Single Key"); | ||
if (isConfigLoading) items.push("Config"); | ||
return items.join(", "); | ||
}; | ||
|
||
return ( | ||
<div | ||
className={` | ||
z-1000 | ||
fixed left-1/2 transform -translate-x-1/2 | ||
bg-black/80 p-2 rounded-lg | ||
transition-all duration-200 ease-in-out | ||
origin-bottom scale-75 md:scale-100 | ||
${anyLoading ? "bottom-0 opacity-100" : "translate-y-full opacity-0"} | ||
`} | ||
id="world-loading" | ||
> | ||
{anyLoading && ( | ||
<div className="flex flex-row items-center justify-center h-full p-2"> | ||
<img src="/images/eternumloader.png" className="w-10" /> | ||
<div className="ml-4">Loading: {getLoadingItems()}</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.