// import type { UserProfileResponse } from "../types/user.types"; import { Activity, BadgeCheck, Coins, DollarSign, TrendingUp, Users, } from "lucide-react" import { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, Pie, PieChart, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts" import { StatCard } from "../components/dashboard/StatCard" import { Button } from "../components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" import { cn } from "../lib/utils" import { getTeamMemberById } from "../api/team.api" import { useEffect, useState } from "react" const userGrowth = [ { month: "Jan", users: 2400 }, { month: "Feb", users: 2700 }, { month: "Mar", users: 3100 }, { month: "Apr", users: 1900 }, { month: "May", users: 1900 }, { month: "Jun", users: 2100 }, { month: "Jul", users: 2050 }, { month: "Aug", users: 2900 }, { month: "Sep", users: 2000 }, { month: "Oct", users: 2050 }, { month: "Nov", users: 1850 }, { month: "Dec", users: 1900 }, ] const subscriptionStatus = [ { name: "Free Plan", value: 3125, color: "#9E2891" }, { name: "Monthly Plan", value: 5901, color: "#FFD23F" }, { name: "3-Month Plan", value: 1203, color: "#1DE9B6" }, { name: "6-Monthly Plan", value: 825, color: "#C26FC0" }, ] const revenueTrend = [ { month: "Jan", value: 52000 }, { month: "Feb", value: 30000 }, { month: "Mar", value: 50000 }, { month: "Apr", value: 28000 }, { month: "May", value: 70000 }, { month: "Jun", value: 76000 }, ] const ranges = ["1D", "1W", "1M", "3M", "6M", "1Y"] as const export function DashboardPage() { const [userFirstName, setUserFirstName] = useState("") const activeRange = "1Y" useEffect(() => { const fetchUser = async () => { try { const memberId = Number(localStorage.getItem("member_id")) const res = await getTeamMemberById(memberId) const member = res.data.data setUserFirstName(member.first_name) localStorage.setItem("user_first_name", member.first_name) localStorage.setItem("user_last_name", member.last_name) window.dispatchEvent(new Event("user-profile-updated")) } catch (err) { console.error(err) } } fetchUser() }, []) return (
Dashboard
Welcome, {userFirstName || localStorage.getItem("user_first_name")}
User Growth
5,730
Last 12 Months +15.2%
{ranges.map((r) => ( ))}
Subscription Status
Weekly
{subscriptionStatus.map((entry) => ( ))}
{subscriptionStatus.map((s) => (
{s.name}
{s.value.toLocaleString()} Users
))}
Revenue Trend
ETB 923,417
Last 6 Months (ETB)
[`${Number(v).toLocaleString()}`, "ETB"]} contentStyle={{ borderRadius: 12, border: "1px solid #E0E0E0", boxShadow: "0 10px 30px rgba(0,0,0,0.08)", }} />
) }