Skip to content

Commit b74a7fa

Browse files
committed
Check wallet state in empty states
1 parent f839f10 commit b74a7fa

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/components/EmptyState/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
CardFooter,
55
CardHeader,
66
} from '@oasisprotocol/ui-library/src/components/ui/card';
7+
import { useAccount } from 'wagmi';
78

89
interface EmptyStateProps {
910
title: string;
@@ -12,16 +13,22 @@ interface EmptyStateProps {
1213
}
1314

1415
export function EmptyState({ title, description, children }: EmptyStateProps) {
16+
const { isConnected } = useAccount();
17+
1518
return (
1619
<Card className="h-full rounded-md border-0 flex justify-center p-8 gap-2">
1720
<CardHeader className="text-xl font-semibold text-white text-center">
18-
{title}
21+
{isConnected ? title : 'Connect is not connected'}
1922
</CardHeader>
2023
<CardContent className="max-w-[60%] mx-auto text-gray-400 text-sm text-balance text-center leading-relaxed">
21-
{description}
24+
{isConnected
25+
? description
26+
: 'Please connect your wallet to to gain access to the view.'}
2227
</CardContent>
2328

24-
<CardFooter className="flex justify-center pt-2">{children}</CardFooter>
29+
<CardFooter className="flex justify-center pt-2">
30+
{isConnected ? children : null}
31+
</CardFooter>
2532
</Card>
2633
);
2734
}

0 commit comments

Comments
 (0)