(e: MouseEvent)
| 1910 | // Global click listener for popup star buttons |
| 1911 | useEffect(() => { |
| 1912 | const handler = (e: MouseEvent) => { |
| 1913 | const target = e.target as HTMLElement; |
| 1914 | const btn = target.closest("[data-watch-market]") as HTMLElement | null; |
| 1915 | if (btn && onToggleWatch) { |
| 1916 | const marketId = btn.getAttribute("data-watch-market"); |
| 1917 | if (marketId) { |
| 1918 | onToggleWatch(marketId); |
| 1919 | // Update button visual immediately |
| 1920 | const watched = isWatched?.(marketId); |
| 1921 | btn.textContent = watched ? "☆" : "★"; |
| 1922 | btn.style.color = watched ? "#666" : "#f59e0b"; |
| 1923 | } |
| 1924 | } |
| 1925 | }; |
| 1926 | document.addEventListener("click", handler); |
| 1927 | return () => document.removeEventListener("click", handler); |
| 1928 | }, [onToggleWatch, isWatched]); |
nothing calls this directly
no outgoing calls
no test coverage detected