Skip to content

Commit 4713f56

Browse files
committed
Simplfy logics
1 parent b2f86fe commit 4713f56

File tree

6 files changed

+59
-120
lines changed

6 files changed

+59
-120
lines changed

src/app/(demo)/api-wallet/page.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,7 @@ export default function Home() {
2828
}
2929

3030
return (
31-
<div className="relative min-h-screen overflow-hidden">
32-
{/* Animated Background Orbs */}
33-
<div className="absolute inset-0 overflow-hidden pointer-events-none">
34-
<div className="floating-orb absolute top-20 left-10 w-32 h-32 bg-gradient-to-r from-primary/20 to-secondary/20 rounded-full blur-xl"></div>
35-
<div
36-
className="floating-orb absolute top-40 right-20 w-48 h-48 bg-gradient-to-r from-accent/15 to-primary/15 rounded-full blur-2xl"
37-
style={{ animationDelay: "2s" }}
38-
></div>
39-
<div
40-
className="floating-orb absolute bottom-32 left-1/4 w-40 h-40 bg-gradient-to-r from-secondary/20 to-accent/20 rounded-full blur-xl"
41-
style={{ animationDelay: "4s" }}
42-
></div>
43-
</div>
44-
31+
<div className="relative min-h-screen">
4532
<div className="relative z-10 flex flex-col items-center min-h-screen p-8 pb-20 gap-16 sm:p-20">
4633
{/* Top Right Docs Button */}
4734
<div className="absolute top-8 right-8 z-20">

src/app/(demo)/embedded-wallet/layout.tsx

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,46 @@ export default function Layout({
1818

1919
return (
2020
<WalletProvider>
21-
{children}
21+
<div className="relative">
22+
{/* Top Right Buttons */}
23+
<div className="absolute top-8 right-8 z-20 flex gap-3">
24+
<a
25+
href="https://github.com/magiclabs/nextauth-api-wallets-express-demo"
26+
target="_blank"
27+
className="inline-flex items-center gap-2 px-6 py-3 bg-gradient-to-r from-gray-700 to-gray-800 text-white rounded-xl hover:from-gray-600 hover:to-gray-700 transition-all duration-300"
28+
>
29+
<svg
30+
className="w-4 h-4"
31+
fill="currentColor"
32+
viewBox="0 0 24 24"
33+
>
34+
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
35+
</svg>
36+
View GitHub
37+
</a>
38+
<a
39+
href="https://magic.link/docs"
40+
target="_blank"
41+
className="inline-flex items-center gap-2 px-6 py-3 bg-gradient-to-r from-primary to-secondary text-white rounded-xl hover:from-primary-dark hover:to-primary transition-all duration-300 glow-primary"
42+
>
43+
<svg
44+
className="w-4 h-4"
45+
fill="none"
46+
stroke="currentColor"
47+
viewBox="0 0 24 24"
48+
>
49+
<path
50+
strokeLinecap="round"
51+
strokeLinejoin="round"
52+
strokeWidth={2}
53+
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
54+
/>
55+
</svg>
56+
View Magic Docs
57+
</a>
58+
</div>
59+
{children}
60+
</div>
2261
</WalletProvider>
2362
);
2463
}

src/app/(demo)/embedded-wallet/page.tsx

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,8 @@ import { OAuthAuth } from "../../../components/embedded-wallet/OAuthAuth";
55
export default function Home() {
66

77
return (
8-
<div className="relative min-h-screen overflow-hidden">
9-
{/* Animated Background Orbs */}
10-
<div className="absolute inset-0 overflow-hidden pointer-events-none">
11-
<div className="floating-orb absolute top-20 left-10 w-32 h-32 bg-gradient-to-r from-primary/20 to-secondary/20 rounded-full blur-xl"></div>
12-
<div
13-
className="floating-orb absolute top-40 right-20 w-48 h-48 bg-gradient-to-r from-accent/15 to-primary/15 rounded-full blur-2xl"
14-
style={{ animationDelay: "2s" }}
15-
></div>
16-
<div
17-
className="floating-orb absolute bottom-32 left-1/4 w-40 h-40 bg-gradient-to-r from-secondary/20 to-accent/20 rounded-full blur-xl"
18-
style={{ animationDelay: "4s" }}
19-
></div>
20-
</div>
21-
8+
<div className="relative min-h-screen">
229
<div className="relative z-10 flex flex-col items-center min-h-screen p-8 pb-20 gap-16 sm:p-20">
23-
{/* Top Right Docs Button */}
24-
<div className="absolute top-8 right-8 z-20">
25-
<a
26-
href="https://magic.link/docs"
27-
target="_blank"
28-
className="inline-flex items-center gap-2 px-6 py-3 bg-gradient-to-r from-primary to-secondary text-white rounded-xl hover:from-primary-dark hover:to-primary transition-all duration-300 glow-primary"
29-
>
30-
<svg
31-
className="w-4 h-4"
32-
fill="none"
33-
stroke="currentColor"
34-
viewBox="0 0 24 24"
35-
>
36-
<path
37-
strokeLinecap="round"
38-
strokeLinejoin="round"
39-
strokeWidth={2}
40-
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
41-
/>
42-
</svg>
43-
View Magic Docs
44-
</a>
45-
</div>
46-
4710
{/* Header */}
4811
<div className="flex flex-col items-center gap-6 text-center">
4912
<div className="relative">

src/app/(demo)/embedded-wallet/wallet/page.tsx

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -10,75 +10,12 @@ export default function WalletPage() {
1010
const {
1111
publicAddress,
1212
selectedNetwork,
13-
handleLogout,
14-
isLoading
13+
handleLogout,
1514
} = useWallet();
1615

17-
if (isLoading) {
18-
return (
19-
<div className="relative min-h-screen overflow-hidden flex items-center justify-center">
20-
<div className="flex flex-col items-center gap-4">
21-
<div className="animate-spin w-12 h-12 border-4 border-primary border-t-transparent rounded-full"></div>
22-
<p className="text-muted-foreground">Loading wallet...</p>
23-
</div>
24-
</div>
25-
);
26-
}
27-
2816
return (
29-
<div className="relative min-h-screen overflow-hidden">
30-
{/* Animated Background Orbs */}
31-
<div className="absolute inset-0 overflow-hidden pointer-events-none">
32-
<div className="floating-orb absolute top-20 left-10 w-32 h-32 bg-gradient-to-r from-primary/20 to-secondary/20 rounded-full blur-xl"></div>
33-
<div
34-
className="floating-orb absolute top-40 right-20 w-48 h-48 bg-gradient-to-r from-accent/15 to-primary/15 rounded-full blur-2xl"
35-
style={{ animationDelay: "2s" }}
36-
></div>
37-
<div
38-
className="floating-orb absolute bottom-32 left-1/4 w-40 h-40 bg-gradient-to-r from-secondary/20 to-accent/20 rounded-full blur-xl"
39-
style={{ animationDelay: "4s" }}
40-
></div>
41-
</div>
42-
17+
<div className="relative min-h-screen">
4318
<div className="relative z-10 flex flex-col items-center min-h-screen p-8 pb-20 gap-16 sm:p-20">
44-
{/* Top Right Buttons */}
45-
<div className="absolute top-8 right-8 z-20 flex gap-3">
46-
<a
47-
href="https://github.com/magiclabs/nextauth-api-wallets-express-demo"
48-
target="_blank"
49-
className="inline-flex items-center gap-2 px-6 py-3 bg-gradient-to-r from-gray-700 to-gray-800 text-white rounded-xl hover:from-gray-600 hover:to-gray-700 transition-all duration-300"
50-
>
51-
<svg
52-
className="w-4 h-4"
53-
fill="currentColor"
54-
viewBox="0 0 24 24"
55-
>
56-
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
57-
</svg>
58-
View GitHub
59-
</a>
60-
<a
61-
href="https://magic.link/docs"
62-
target="_blank"
63-
className="inline-flex items-center gap-2 px-6 py-3 bg-gradient-to-r from-primary to-secondary text-white rounded-xl hover:from-primary-dark hover:to-primary transition-all duration-300 glow-primary"
64-
>
65-
<svg
66-
className="w-4 h-4"
67-
fill="none"
68-
stroke="currentColor"
69-
viewBox="0 0 24 24"
70-
>
71-
<path
72-
strokeLinecap="round"
73-
strokeLinejoin="round"
74-
strokeWidth={2}
75-
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
76-
/>
77-
</svg>
78-
View Magic Docs
79-
</a>
80-
</div>
81-
8219
{/* Header */}
8320
<div className="flex flex-col items-center gap-6 text-center">
8421
<div className="relative">

src/app/(demo)/layout.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,20 @@ export default function DemoLayout({
119119
return (
120120
<ConsoleProvider>
121121
<div className="min-h-screen flex">
122-
<div className="flex-1">
122+
<div className="flex-1 relative overflow-hidden">
123+
{/* Animated Background Orbs */}
124+
<div className="absolute inset-0 overflow-hidden pointer-events-none">
125+
<div className="floating-orb absolute top-20 left-10 w-32 h-32 bg-gradient-to-r from-primary/20 to-secondary/20 rounded-full blur-xl"></div>
126+
<div
127+
className="floating-orb absolute top-40 right-20 w-48 h-48 bg-gradient-to-r from-accent/15 to-primary/15 rounded-full blur-2xl"
128+
style={{ animationDelay: "2s" }}
129+
></div>
130+
<div
131+
className="floating-orb absolute bottom-32 left-1/4 w-40 h-40 bg-gradient-to-r from-secondary/20 to-accent/20 rounded-full blur-xl"
132+
style={{ animationDelay: "4s" }}
133+
></div>
134+
</div>
135+
123136
{children}
124137
</div>
125138
<ConsolePanel />

src/contexts/WalletContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function WalletProvider({ children }: { children: ReactNode }) {
123123
// Check if user is already authenticated on component mount
124124
useEffect(() => {
125125
checkAuthStatus();
126-
}, [checkAuthStatus]);
126+
}, []);
127127

128128
const handleNetworkChange = (network: string) => {
129129
setSelectedNetwork(network);

0 commit comments

Comments
 (0)