"use client"; import React from "react"; import { Trash2, TrendingUp, Bell } from "lucide-react"; import { formatCurrency } from "@/lib/utils"; import { deleteAlert } from "@/lib/actions/alert.actions"; interface AlertsPanelProps { alerts: any[]; onRefresh?: () => void; } export default function AlertsPanel({ alerts, onRefresh }: AlertsPanelProps) { const handleDelete = async (id: string) => { if (confirm("Are you sure you want to delete this alert?")) { await deleteAlert(id); if (onRefresh) onRefresh(); } }; return (

Alerts

{/* */}
{alerts.length === 0 ? (
No active alerts. Add one from the watchlist.
) : ( alerts.map((alert) => (
{alert.symbol[0]}
{alert.symbol}
Target: {formatCurrency(alert.targetPrice)}
Condition: Price {alert.condition.toLowerCase()} {formatCurrency(alert.targetPrice)}
Active until {new Date(new Date(alert.createdAt).getTime() + 90 * 24 * 60 * 60 * 1000).toLocaleDateString()}
)) )}
); }