import { Download } from 'lucide-react'; import { isLoggedIn } from '../lib/jwt.ts'; import { useEffect, useState } from 'react'; import { showLoginPopup } from '../lib/popup.ts'; type DownloadRoadmapButtonProps = { roadmapId: string; }; export function DownloadRoadmapButton(props: DownloadRoadmapButtonProps) { const { roadmapId } = props; const [url, setUrl] = useState('#'); useEffect(() => { if (isLoggedIn()) { setUrl(`/pdfs/roadmaps/${roadmapId}.pdf`); } }, []); return ( { if (isLoggedIn()) { return; } e.preventDefault(); showLoginPopup(); }} > Download ); }