Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | import { useParams } from 'react-router-dom'; import { useQuery } from '@tanstack/react-query'; import { Loader2, AlertTriangle } from 'lucide-react'; import { api } from '../api/client'; import { useTheme } from '../contexts/ThemeContext'; export function ExternalLinkPage() { const { id } = useParams<{ id: string }>(); const { theme } = useTheme(); const { data: link, isLoading, error } = useQuery({ queryKey: ['external-link', id], queryFn: () => api.getExternalLink(Number(id)), enabled: !!id, }); if (isLoading) { return ( <div className="flex items-center justify-center h-full"> <Loader2 className="w-8 h-8 text-bambu-green animate-spin" /> </div> ); } if (error || !link) { return ( <div className="flex flex-col items-center justify-center h-full gap-4 text-bambu-gray"> <AlertTriangle className="w-12 h-12" /> <p>Link not found</p> </div> ); } return ( <iframe src={link.url} className="h-full w-full border-0" style={{ colorScheme: theme }} title={link.name} sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox" /> ); } |