From 5c4fb6219c7aa80efea9e879043486ea06132c18 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Josu=C3=A9=20Brenes?=
<123853174+JosueBrenes@users.noreply.github.com>
Date: Fri, 4 Jul 2025 22:31:18 -0600
Subject: [PATCH 1/3] feat: enforce wallet login for dashboard
---
frontend/src/app/dashboard/layout.tsx | 21 +++++++++++++++----
.../modules/auth/hooks/wallet.hook.ts | 3 +++
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/frontend/src/app/dashboard/layout.tsx b/frontend/src/app/dashboard/layout.tsx
index 4af76189..9d9fe9f6 100644
--- a/frontend/src/app/dashboard/layout.tsx
+++ b/frontend/src/app/dashboard/layout.tsx
@@ -1,19 +1,32 @@
"use client";
-import React from "react";
+import React, { useEffect } from "react";
import { Header } from "@/components/layouts/header/Header";
+import { useWalletContext } from "@/providers/wallet.provider";
+import { useRouter } from "next/navigation";
export default function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
+ const { walletAddress } = useWalletContext();
+ const router = useRouter();
+
+ useEffect(() => {
+ if (!walletAddress) {
+ router.replace("/");
+ }
+ }, [walletAddress, router]);
+
+ if (!walletAddress) {
+ return null;
+ }
+
return (
-
- {children}
-
+ {children}
);
}
diff --git a/frontend/src/components/modules/auth/hooks/wallet.hook.ts b/frontend/src/components/modules/auth/hooks/wallet.hook.ts
index 31e7a90a..a5b68dc8 100644
--- a/frontend/src/components/modules/auth/hooks/wallet.hook.ts
+++ b/frontend/src/components/modules/auth/hooks/wallet.hook.ts
@@ -4,10 +4,12 @@ import { ISupportedWallet } from "@creit.tech/stellar-wallets-kit";
import { db, doc, getDoc, setDoc } from "@/lib/firebase";
import { UserProfile } from "@/@types/user.entity";
import { toast } from "sonner";
+import { useRouter } from "next/navigation";
export const useWallet = () => {
// Get wallet info from wallet context
const { setWalletInfo, clearWalletInfo } = useWalletContext();
+ const router = useRouter();
/**
* Connect to a wallet using the Stellar Wallet Kit and set the wallet info in the wallet context
@@ -75,6 +77,7 @@ export const useWallet = () => {
const handleDisconnect = async () => {
try {
await disconnectWallet();
+ router.push("/");
} catch (error) {
console.error("Error disconnecting wallet:", error);
}
From 5075bb4dfc432a24b15a62189fc2193e6ec35948 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Josu=C3=A9=20Brenes?=
<123853174+JosueBrenes@users.noreply.github.com>
Date: Fri, 4 Jul 2025 22:35:44 -0600
Subject: [PATCH 2/3] Switch Explore Dashboard button to Connect Wallet
---
.../components/modules/auth/ui/pages/Home.tsx | 25 ++++++++++---------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/frontend/src/components/modules/auth/ui/pages/Home.tsx b/frontend/src/components/modules/auth/ui/pages/Home.tsx
index 93d4163c..d3d32ac9 100644
--- a/frontend/src/components/modules/auth/ui/pages/Home.tsx
+++ b/frontend/src/components/modules/auth/ui/pages/Home.tsx
@@ -1,11 +1,13 @@
"use client";
-import { ArrowRight } from "lucide-react";
+import { LogIn } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
-import Link from "next/link";
+import { useWallet } from "@/components/modules/auth/hooks/wallet.hook";
export default function HomePage() {
+ const { handleConnect } = useWallet();
+
return (
@@ -37,16 +39,15 @@ export default function HomePage() {
-
-
-
+
From 58567b05b5188ab2aab368cbe03faa0a0a52d7a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Josu=C3=A9=20Brenes?=
Date: Fri, 4 Jul 2025 22:39:26 -0600
Subject: [PATCH 3/3] refactor: update HomePage layout and remove Connect
Wallet button
---
frontend/src/app/page.tsx | 4 ++--
.../src/components/modules/auth/ui/pages/Home.tsx | 12 ------------
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx
index 1f0a0bdc..4239cd70 100644
--- a/frontend/src/app/page.tsx
+++ b/frontend/src/app/page.tsx
@@ -17,9 +17,9 @@ export default function Page() {
}, [walletAddress, router]);
return (
- <>
+
- >
+
);
}
diff --git a/frontend/src/components/modules/auth/ui/pages/Home.tsx b/frontend/src/components/modules/auth/ui/pages/Home.tsx
index d3d32ac9..ddc6e37b 100644
--- a/frontend/src/components/modules/auth/ui/pages/Home.tsx
+++ b/frontend/src/components/modules/auth/ui/pages/Home.tsx
@@ -37,18 +37,6 @@ export default function HomePage() {
opportunity.
-
-
-
-