MCPcopy Create free account
hub / github.com/AmazingAng/PolyWorld / handler

Function handler

src/components/WorldMap.tsx:1912–1925  ·  view source on GitHub ↗
(e: MouseEvent)

Source from the content-addressed store, hash-verified

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]);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected