// Wall Street Watchdog AI - React Frontend // Uses TailwindCSS, TradingView widget, and fetches from backend every 5 min import React, { useEffect, useState } from 'react'; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { ReloadIcon } from "lucide-react"; import axios from 'axios'; const API_ENDPOINT = "/api/alerts"; // Your backend API route export default function WatchdogApp() { const [alerts, setAlerts] = useState([]); const [loading, setLoading] = useState(false); const [countdown, setCountdown] = useState(300); const fetchAlerts = async () => { setLoading(true); try { const res = await axios.get(API_ENDPOINT); setAlerts(res.data.alerts); } catch (err) { console.error("Error fetching alerts:", err); } setLoading(false); }; useEffect(() => { fetchAlerts(); const interval = setInterval(fetchAlerts, 300000); // Every 5 minutes const countdownInterval = setInterval(() => setCountdown((c) => (c > 0 ? c - 1 : 300)), 1000); return () => { clearInterval(interval); clearInterval(countdownInterval); }; }, []); return (

Wall Street Watchdog AI

Auto-refresh in {countdown}s

{alerts.map((alert, idx) => (

{alert.ticker} — {alert.action}

{alert.source}

{alert.summary}