diff --git a/src/app/globals.css b/src/app/globals.css index fdeb4647..eba89ea0 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -126,3 +126,22 @@ @apply bg-background text-foreground; } } + +@keyframes scrollUp { + 0% { + transform: translateY(0); + } + 100% { + transform: translateY(-33.33%); + } +} + +.loan-scroll-container { + display: flex; + flex-direction: column; + animation: scrollUp 30s linear infinite; +} + +.overflow-hidden { + overflow: hidden; +} diff --git a/src/components/layouts/header/Header.tsx b/src/components/layouts/header/Header.tsx index ceedd813..9586b584 100644 --- a/src/components/layouts/header/Header.tsx +++ b/src/components/layouts/header/Header.tsx @@ -1,28 +1,66 @@ "use client"; +import { useState } from "react"; import { Button } from "@/components/ui/button"; -import { SidebarTrigger } from "@/components/ui/sidebar"; import { LogOut } from "lucide-react"; -import ThemeToggle from "./ThemeToggle"; +import { useRouter } from "next/navigation"; +import { useEffect } from "react"; import { useWallet } from "@/components/modules/auth/wallet/hooks/wallet.hook"; export function Header() { - const { handleDisconnect } = useWallet(); + const router = useRouter(); + const [walletConnected, setWalletConnected] = useState(false); + const { handleConnect, handleDisconnect } = useWallet(); + + useEffect(() => { + const stellarWallet = localStorage.getItem("address-wallet"); + const metamaskWallet = localStorage.getItem("metamask-wallet"); + + if (stellarWallet || metamaskWallet) { + setWalletConnected(true); + } + }, []); + + const handleDisconnectWallet = () => { + handleDisconnect(); + localStorage.removeItem("address-wallet"); + localStorage.removeItem("@StellarWalletsKit/usedWalletsIds"); + setWalletConnected(false); + console.log("Wallet disconnected"); + router.push("/"); + }; + + const handleConnectWallet = () => { + handleConnect(); + setWalletConnected(true); + console.log("Wallet connected"); + }; return (
-
- -
-
- +
+
+ {walletConnected ? ( + + ) : ( + + )} +
); diff --git a/src/components/modules/auth/ui/pages/Home.tsx b/src/components/modules/auth/ui/pages/Home.tsx index 1ec571fe..e032c1be 100644 --- a/src/components/modules/auth/ui/pages/Home.tsx +++ b/src/components/modules/auth/ui/pages/Home.tsx @@ -1,5 +1,6 @@ "use client"; +import { useEffect, useState } from "react"; import { ArrowRight, Wallet, BadgeCheck } from "lucide-react"; import Image from "next/image"; import { Button } from "@/components/ui/button"; @@ -7,11 +8,25 @@ import { useGlobalAuthenticationStore } from "@/core/store/data"; import { Badge } from "@/components/ui/badge"; import Link from "next/link"; import { useWallet } from "../../wallet/hooks/wallet.hook"; -import { useEffect } from "react"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { format } from "date-fns"; +import { getApprovedLoanOffers } from "@/components/modules/dashboard/marketplace/server/marketplace.firebase"; export default function HomePage() { const { handleConnect, handleDisconnect } = useWallet(); const { address } = useGlobalAuthenticationStore(); + const [approvedLoans, setApprovedLoans] = useState([]); + + useEffect(() => { + const fetchApprovedLoans = async () => { + const res = await getApprovedLoanOffers(); + if (res.success && res.data) { + setApprovedLoans(res.data); + } + }; + + fetchApprovedLoans(); + }, []); useEffect(() => { document.body.style.overflow = "hidden"; @@ -21,8 +36,13 @@ export default function HomePage() { }; }, []); + const formatDate = (seconds: number) => { + if (!seconds) return "Unknown date"; + return format(new Date(seconds * 1000), "dd MMM yyyy"); + }; + return ( -
+
@@ -70,16 +90,7 @@ export default function HomePage() {
-
- TrustBridge Platform -
-
+
@@ -92,6 +103,33 @@ export default function HomePage() {
+ +
+
+
+ {[ + ...approvedLoans, + ...approvedLoans, + ...approvedLoans, + ].map((loan, index) => ( +
+

+ {loan.title} +

+

+ Loan Amount: ${loan.maxAmount} +

+

+ Fee: {loan.platformFee}% +

+
+ ))} +
+
+
diff --git a/src/components/modules/dashboard/ui/pages/DashboardPage.tsx b/src/components/modules/dashboard/ui/pages/DashboardPage.tsx index 6c69b6af..ee9b2d64 100644 --- a/src/components/modules/dashboard/ui/pages/DashboardPage.tsx +++ b/src/components/modules/dashboard/ui/pages/DashboardPage.tsx @@ -13,7 +13,6 @@ import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Skeleton } from "@/components/ui/skeleton"; import { Progress } from "@/components/ui/progress"; -import { cn } from "@/lib/utils"; import { TrendingUp, DollarSign, @@ -21,7 +20,6 @@ import { Clock, CheckCircle2, ArrowRight, - Calendar, Wallet, PiggyBank, Activity, @@ -42,10 +40,8 @@ export function DashboardOverview() { stats, recentActivity, loanTrends, - upcomingMilestones, formatCurrency, formatDate, - formatDueDate, } = useDashboard(); const getActivityIcon = (type: string) => { diff --git a/src/components/modules/dashboard/ui/pages/background/GradientBackground.tsx b/src/components/modules/dashboard/ui/pages/background/GradientBackground.tsx index da114169..e570bf1d 100644 --- a/src/components/modules/dashboard/ui/pages/background/GradientBackground.tsx +++ b/src/components/modules/dashboard/ui/pages/background/GradientBackground.tsx @@ -21,8 +21,8 @@ export function GradientBackground({ children, className, opacity = 30, - primaryColor = "bg-emerald-200", - secondaryColor = "bg-teal-200", + primaryColor = "bg-emerald-500", + secondaryColor = "bg-teal-700", primaryPosition = "-top-40 -right-40", secondaryPosition = "top-1/2 -left-40", primarySize = "w-80 h-80",