Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.
Merged

main #203

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions frontend/src/app/dashboard/layout.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="min-h-screen flex flex-col w-full bg-neutral-900">
<Header />
<main className="flex-1 overflow-auto">
{children}
</main>
<main className="flex-1 overflow-auto">{children}</main>
</div>
);
}
4 changes: 2 additions & 2 deletions frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export default function Page() {
}, [walletAddress, router]);

return (
<>
<div className="min-h-screen flex flex-col w-full bg-neutral-900">
<HeaderHome />
<HomePage />
</>
</div>
);
}
3 changes: 3 additions & 0 deletions frontend/src/components/modules/auth/hooks/wallet.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -75,6 +77,7 @@ export const useWallet = () => {
const handleDisconnect = async () => {
try {
await disconnectWallet();
router.push("/");
} catch (error) {
console.error("Error disconnecting wallet:", error);
}
Expand Down
19 changes: 4 additions & 15 deletions frontend/src/components/modules/auth/ui/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="flex flex-col bg-neutral-900 text-neutral-200">
<main className="flex-grow">
Expand Down Expand Up @@ -35,19 +37,6 @@ export default function HomePage() {
opportunity.
</p>
</div>

<div className="flex flex-col sm:flex-row gap-3 items-center justify-center md:justify-start pt-4">
<Link href="/dashboard" className="w-full sm:w-auto">
<Button
size="lg"
variant="outline"
className="w-full border-emerald-600 text-emerald-300 hover:bg-emerald-700/30 hover:text-emerald-200 bg-transparent"
>
Explore Dashboard
<ArrowRight className="ml-2 h-5 w-5" />
</Button>
</Link>
</div>
</div>
</div>
</section>
Expand Down