"use client"; import React, { useMemo, useState } from "react"; const WatchlistButton = ({ symbol, company, isInWatchlist, showTrashIcon = false, type = "button", onWatchlistChange, }: WatchlistButtonProps) => { const [added, setAdded] = useState(!!isInWatchlist); const label = useMemo(() => { if (type === "icon") return added ? "" : ""; return added ? "Remove from Watchlist" : "Add to Watchlist"; }, [added, type]); const handleClick = () => { const next = !added; setAdded(next); onWatchlistChange?.(symbol, next); }; if (type === "icon") { return ( ); } return ( ); }; export default WatchlistButton;