-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathhome.tsx
More file actions
31 lines (24 loc) · 990 Bytes
/
home.tsx
File metadata and controls
31 lines (24 loc) · 990 Bytes
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
"use client";
import { Login } from "@/components/Login";
import { MainScreen } from "@/components/MainScreen";
import { useCrossmintAuth, useWallet } from "@crossmint/client-sdk-react-ui";
import { useProcessWithdrawal } from "@/hooks/useProcessWithdrawal";
export function HomeContent() {
const { wallet, status: walletStatus } = useWallet();
const { status, status: authStatus, user } = useCrossmintAuth();
useProcessWithdrawal(user?.id, wallet);
const walletAddress = wallet?.address;
const isLoggedIn = wallet != null && status === "logged-in";
const isLoading = walletStatus === "in-progress" || authStatus === "initializing";
if (isLoading) {
return (
<div className="flex h-full w-full items-center justify-center">
<div className="border-primary h-8 w-8 animate-spin rounded-full border-4 border-t-transparent" />
</div>
);
}
if (!isLoggedIn) {
return <Login />;
}
return <MainScreen walletAddress={walletAddress} />;
}