);
}
function App() {
const [selected, setSelected] = useState(null);
const [joinOpen, setJoinOpen] = useState(false);
const [toast, setToast] = useState(null);
const onJoin = useCallback(() => setJoinOpen(true), []);
// Show a success toast after the Strava OAuth redirect, then clean the URL.
useEffect(() => {
const p = new URLSearchParams(window.location.search);
if (!p.has("connected")) return;
const synced = p.get("synced");
setToast(synced && synced !== "0"
? `You're on the board — ${synced} runs synced. Go run!`
: "You're on the board! Your next runs will appear after the next sync.");
window.history.replaceState({}, "", window.location.pathname);
const t = setTimeout(() => setToast(null), 7000);
return () => clearTimeout(t);
}, []);
return (
{toast && (