import { useState } from "react"; import { cn } from "~/lib/utils"; import { TrendingUp, TrendingDown, Target, AlertCircle, Info, DollarSign, Percent, Clock, } from "lucide-react"; import { Button } from "@/routes/ui/button"; import { ChainIcon } from "../components/shared/ChainIcon"; export interface TradingSuggestion { tokenAddress: string; tokenSymbol: string; tokenName: string; chain: string; currentPrice: number; timestamp: Date; entry: { min: number; max: number; reasoning: string; }; targets: { level: number; price: number; percentGain: number; confidence: number; }[]; stopLoss: { price: number; percentLoss: number; reasoning: string; }; riskReward: number; overallConfidence: number; technicalLevels: { support: number[]; resistance: number[]; }; reasoning: string[]; invalidationConditions: string[]; } export interface TradingSuggestionPanelProps { /** Trading suggestion data */ suggestion: TradingSuggestion; /** Callback when "Set Alerts" is clicked */ onSetAlerts?: () => void; /** Callback when "View Chart" is clicked */ onViewChart?: () => void; /** Additional class names */ className?: string; } /** * TradingSuggestionPanel - AI-powered entry/exit suggestions * * Features: * - Entry zone recommendations * - Multiple take-profit targets * - Stop-loss suggestions * - Risk/reward ratio calculation * - Technical analysis levels * - AI reasoning and invalidation conditions */ export function TradingSuggestionPanel({ suggestion, onSetAlerts, onViewChart, className, }: TradingSuggestionPanelProps) { const [showDetails, setShowDetails] = useState(false); const formatPrice = (price: number) => { if (price < 0.01) return `$${price.toFixed(8)}`; if (price < 1) return `$${price.toFixed(6)}`; return `$${price.toFixed(4)}`; }; const getRiskRewardColor = (ratio: number) => { if (ratio >= 3) return "text-green-600 dark:text-green-400"; if (ratio >= 2) return "text-yellow-600 dark:text-yellow-400"; return "text-red-600 dark:text-red-400"; }; const getRiskRewardLabel = (ratio: number) => { if (ratio >= 3) return "Excellent"; if (ratio >= 2) return "Good"; if (ratio >= 1.5) return "Fair"; return "Poor"; }; return (
{/* Header */}

Trading Suggestion

{suggestion.tokenSymbol} •

Confidence
{suggestion.overallConfidence}%
{/* Content */}
{/* Current Price */}
Current Price
{formatPrice(suggestion.currentPrice)}
{/* Entry Zone */}

Entry Zone

{formatPrice(suggestion.entry.min)} - {formatPrice(suggestion.entry.max)}

{suggestion.entry.reasoning}

{/* Targets */}

Take Profit Targets

{suggestion.targets.map((target) => (
🎯 Target {target.level} Confidence: {target.confidence}%
{formatPrice(target.price)} +{target.percentGain.toFixed(1)}%
))}
{/* Stop Loss */}

Stop Loss

{formatPrice(suggestion.stopLoss.price)} {suggestion.stopLoss.percentLoss.toFixed(1)}%

{suggestion.stopLoss.reasoning}

{/* Risk/Reward */}
Risk/Reward Ratio 1:{suggestion.riskReward.toFixed(1)}
= 3 ? "bg-green-500/20 text-green-600 dark:text-green-400" : suggestion.riskReward >= 2 ? "bg-yellow-500/20 text-yellow-600 dark:text-yellow-400" : "bg-red-500/20 text-red-600 dark:text-red-400" )}> {getRiskRewardLabel(suggestion.riskReward)}
{/* Why? Section */}
{showDetails && (

Reasoning:

    {suggestion.reasoning.map((reason, i) => (
  • {reason}
  • ))}

Invalidation Conditions:

    {suggestion.invalidationConditions.map((condition, i) => (
  • {condition}
  • ))}
)}
{/* Footer Actions */}
); }