File size: 2,580 Bytes
78d0e31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"use client"

import { useState, useEffect } from "react"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Heart, TrendingUp } from "lucide-react"

export default function DonationStats() {
  const [totalDonations, setTotalDonations] = useState(0)
  const [totalAmount, setTotalAmount] = useState(0)
  const [loading, setLoading] = useState(true)
  // const [error, setError] = useState(null) // Error state was declared but not used

  useEffect(() => {
    // Use mock data instead of fetching
    const mockData = {
      totalDonations: 12,
      totalAmount: 0.75,
    }

    // Simulate loading
    const timer = setTimeout(() => {
      setTotalDonations(mockData.totalDonations)
      setTotalAmount(mockData.totalAmount)
      setLoading(false)
    }, 1000)
    return () => clearTimeout(timer) // Cleanup timer on unmount
  }, [])

  return (
    <Card className="border-blue-500/30 bg-black/60 backdrop-blur-xl">
      <CardHeader>
        <CardTitle className="text-blue-300">Donation Stats</CardTitle>
      </CardHeader>
      <CardContent>
        <div className="grid grid-cols-2 gap-4">
          <div className="flex flex-col items-center justify-center p-4 rounded-lg border border-blue-500/20 bg-blue-950/20">
            <Heart className="h-8 w-8 text-pink-500 mb-2" />
            <p className="text-sm text-blue-100/70">Total Donations</p>
            {loading ? (
              <div className="h-6 w-16 animate-pulse bg-blue-900/30 rounded mt-1"></div>
            ) : (
              <p className="text-2xl font-bold text-blue-100">{totalDonations}</p>
            )}
          </div>

          <div className="flex flex-col items-center justify-center p-4 rounded-lg border border-blue-500/20 bg-blue-950/20">
            <TrendingUp className="h-8 w-8 text-green-500 mb-2" />
            <p className="text-sm text-blue-100/70">Total Amount</p>
            {loading ? (
              <div className="h-6 w-16 animate-pulse bg-blue-900/30 rounded mt-1"></div>
            ) : (
              <p className="text-2xl font-bold text-blue-100">{totalAmount} BNB</p>
            )}
          </div>
        </div>

        <div className="mt-4 p-4 rounded-lg border border-blue-500/20 bg-blue-950/20">
          <p className="text-center text-sm text-blue-100/70">Donations go directly to the BNB wallet:</p>
          <p className="text-center text-xs font-mono text-blue-300 mt-1 break-all">
            0xaa4202d69E6c9ddE7De2885B9DDe88c7baA240f8
          </p>
        </div>
      </CardContent>
    </Card>
  )
}