| 1 | "use client"; |
| 2 | |
| 3 | import { useParams } from "next/navigation"; |
| 4 | import { useEffect } from "react"; |
| 5 | |
| 6 | export default function BuildsRedirect() { |
| 7 | const { owner, repo } = useParams<{ owner: string; repo: string }>(); |
| 8 | |
| 9 | useEffect(() => { |
| 10 | const host = window.location.host; |
| 11 | const protocol = window.location.protocol; |
| 12 | const canopyHost = host.startsWith("canopy.") ? host : `canopy.${host}`; |
| 13 | const search = window.location.search; |
| 14 | const hash = window.location.hash; |
| 15 | window.location.replace(`${protocol}//${canopyHost}/${owner}/${repo}/builds${search}${hash}`); |
| 16 | }, [owner, repo]); |
| 17 | |
| 18 | return ( |
| 19 | <p className="text-sm py-8 text-center" style={{ color: "var(--text-faint)" }}> |
| 20 | Redirecting to Canopy... |
| 21 | </p> |
| 22 | ); |
| 23 | } |
| 24 | |