"use client" import { useState } from "react" import { initialActs } from "@/lib/mock-data" import { FlowVisual } from "./flow-visual" import { Slider } from "@/components/ui/slider" import { Button } from "@/components/ui/button" import { ArrowUpRight, Droplets, TrendingUp, Award } from "lucide-react" import { cn } from "@/lib/utils" const categoryColors: Record = { Environment: "var(--chart-3)", // Lime Education: "var(--chart-5)", // Orange Community: "var(--chart-1)", // Cyan Health: "var(--chart-2)", // Magenta Other: "var(--chart-4)", // Purple } const categoryHex: Record = { Environment: "#84cc16", // Lime-500 Education: "#f97316", // Orange-500 Community: "#06b6d4", // Cyan-500 Health: "#ec4899", // Pink-500 Other: "#a855f7", // Purple-500 } export function AllocationDashboard() { const [acts, setActs] = useState(initialActs) const [userKindnessScore] = useState(3) // Number of acts done by current user const [userAllocationPower] = useState(Math.min(100, userKindnessScore * 25)) // % of pool they can allocate const [totalFlow, setTotalFlow] = useState(acts.reduce((acc, act) => acc + act.allocation, 0)) const handleAllocationChange = (id: string, newValue: number[]) => { const value = newValue[0] setActs((prev) => prev.map((act) => (act.id === id ? { ...act, allocation: value } : act))) // Recalculate total (in a real app, this might be capped) setTotalFlow(acts.reduce((acc, act) => acc + (act.id === id ? value : act.allocation), 0)) } return (
{/* Header / Source */}

Kind Acts Pool

Total Active Flow:{" "} ${totalFlow.toLocaleString()} / hr

Your Allocation Power

{userAllocationPower}%

Based on {userKindnessScore} acts of kindness

Do more kindness to increase your influence

{/* Main Content Area with Visuals */}
{/* Visual Layer */}
({ id: act.id, amount: act.allocation, color: categoryHex[act.category] || "#ffffff", }))} containerHeight={300} // Visual height of the flow area />
{/* Spacing for the visual flow lines */}

Flow Direction

{/* Acts Grid (Destinations) */}
{acts.map((act) => (
{/* Connection Point (Top) */}
{/* Card Header */}
{act.category}
{/* Content */}

{act.title}

{act.description}

{/* Allocation Control */}
Flow Rate ${act.allocation}/hr
handleAllocationChange(act.id, val)} className="[&>.range]:bg-primary" />
))}
) }