"use client"; import { useState, useMemo } from "react"; import { Plus, Search, TrendingUp, TrendingDown, DollarSign, CreditCard, ArrowUpRight, ArrowDownRight, MoreHorizontal, Calendar, FileText, Download, PieChart as PieChartIcon, Wallet, Brain, ArrowRight, X, Check, Activity, Briefcase, Landmark, Receipt, Percent, Target } from "lucide-react"; import { Area, AreaChart, Bar, BarChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis, Cell, Pie, PieChart } from "recharts"; import { motion, AnimatePresence } from "framer-motion"; // Mock Data const cashflowData = [ { month: "Jan", income: 12500, expense: 8400, predicted: 13000 }, { month: "Feb", income: 14200, expense: 9100, predicted: 14500 }, { month: "Mar", income: 13800, expense: 8800, predicted: 14000 }, { month: "Apr", income: 15600, expense: 10200, predicted: 16000 }, { month: "May", income: 18400, expense: 11500, predicted: 19500 }, { month: "Jun", income: 21000, expense: 12000, predicted: 22000 }, ]; const expensesByCategory = [ { name: "Software", value: 3400, color: "#6C5BB0" }, { name: "Rent", value: 2500, color: "#a798e8" }, { name: "Marketing", value: 1800, color: "#10b981" }, { name: "Taxes", value: 4200, color: "#3b82f6" }, { name: "Travel", value: 1200, color: "#f59e0b" }, ]; const transactions = [ { id: 1, name: "Stripe Subscription", date: "May 15", amount: "+$4,200", status: "Success", type: "Income", category: "Direct Sales", project: "Cognis Mobile" }, { id: 2, name: "Amazon Web Services", date: "May 12", amount: "-$840", status: "Pending", type: "Expense", category: "Cloud Infra", project: "Infrastructure" }, { id: 3, name: "Office Rent Q3", date: "May 10", amount: "-$2,500", status: "Success", type: "Expense", category: "Overhead", project: "General" }, { id: 4, name: "Client: Marketing Site", date: "May 08", amount: "+$2,800", status: "Success", type: "Income", category: "Freelance", project: "Marketing Site" }, { id: 5, name: "GitHub Enterprise", date: "May 05", amount: "-$120", status: "Success", type: "Expense", category: "Software", project: "Infrastructure" }, ]; export default function FinancePage() { const [showInvoiceModal, setShowInvoiceModal] = useState(false); const [selectedTransaction, setSelectedTransaction] = useState(null); return (
{/* Top Header */}

Business / Financials

ALL SYSTEMS HEALTHY
{/* KPI Row */}
{/* Main Analysis Area */}
{/* Cashflow Chart */}

Intelligent Cashflow AI Forecasting

Real-time revenue monitoring compared with deep-learning projections for the next quarter.

Income
Expense
Forecast
{/* Expense Breakdown & AI Insights */}

Category Allocation

{expensesByCategory.map((entry, index) => ( ))}
{expensesByCategory.slice(0, 3).map(ex => (
{ex.name}
${ex.value.toLocaleString()}
))}

Strategic Advantage

"Your project-specific ROI is 18% higher when tasks are completed in the morning focus block. Strategic reinvestment of $5k suggested for Q4."

{/* Transactions Ledger */}

Strategic Ledger

Showing last 24 transactions across 5 projects

FILTER
{transactions.map(t => (
setSelectedTransaction(t)} className="grid grid-cols-12 gap-4 p-6 items-center hover:bg-white/[0.02] transition-all group cursor-pointer border-l-2 border-transparent hover:border-primary">
{t.type === 'Income' ? : }
{t.name}
{t.category} {t.project}
{t.date}
{t.amount}
))}
{/* Invoice Editor Modal */} {showInvoiceModal && ( <> setShowInvoiceModal(false)} className="fixed inset-0 bg-black/90 backdrop-blur-xl z-[100]" />

Strategic Invoice

AI-Optimized Billing Engine

Billable Items

AI SUGGESTION: ADD "QA & TESTING" (8H)
Subtotal $4,680.00
Tax (18%) $842.40
Grand Total $5,522.40
)} {/* Transaction Detail Sheet */} {selectedTransaction && ( <> setSelectedTransaction(null)} className="fixed inset-0 bg-black/80 backdrop-blur-md z-[100]" />
{selectedTransaction.type === 'Income' ? : }

{selectedTransaction.name}

{selectedTransaction.amount} {selectedTransaction.status}

Financial Insight

This {selectedTransaction.type.toLowerCase()} was processed via Stripe and linked to your **{selectedTransaction.project}** deliverables. Tax obligations have been pre-calculated.

)}
); } function InvoiceLineItem({ title, rate, hours, total }: any) { return (
{title} Strategic Development Block
{rate}
{hours}
{total}
); } function DetailMeta({ label, value, isPrimary = false }: any) { return (
{label} {value}
); } function FinanceKpiCard({ label, value, change, trend, icon: Icon, color = "default" }: any) { const isUp = trend === "up"; const trendColor = isUp ? "text-emerald-500" : "text-rose-500"; return (
{label}
{value}
{isUp ? : } {change}
); }