-
Notifications
You must be signed in to change notification settings - Fork 11
/
game.lazy.tsx
42 lines (40 loc) · 1.24 KB
/
game.lazy.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { GatherChat } from "@/components/layout/GatherChat";
import { GatherContractLoader } from "@/features/ao/components/GatherContractLoader";
import WalletLoader from "@/features/ao/components/WalletLoader";
import { Register } from "@/features/profile/components/Register";
import { createLazyFileRoute } from "@tanstack/react-router";
import { Suspense } from "react";
export const Route = createLazyFileRoute("/game")({
component: Game,
});
function Game() {
return (
<Suspense
fallback={
<div className="h-screen w-screen text-center flex flex-col justify-center">
<p className="text-xl">Loading...</p>
</div>
}
>
<WalletLoader>
{(arweaveAddress) => (
<GatherContractLoader>
{(state, events) => {
if (state.users[arweaveAddress] === undefined) {
return <Register events={events} />;
}
return (
<GatherChat
key={state.worldId}
playerAddress={arweaveAddress}
state={state}
events={events}
/>
);
}}
</GatherContractLoader>
)}
</WalletLoader>
</Suspense>
);
}