import * as React from 'react'; import { A, P } from '~/ui/components/Text'; const PossibleRedirectNotification = ({ newUrl }: React.PropsWithChildren<{ newUrl: string }>) => { const [targetId, setTargetId] = React.useState(null); // We could add a listener on `window.onhashchange` but // I don't think this is actually needed. React.useEffect(() => { const hash = window.location.hash; const id = hash ? hash.replace('#', '') : null; if (hash && !document.getElementById(id as string)) { setTargetId(id); } }, []); if (targetId) { return (

⚠️ The information you are looking for (addressed by "{targetId}") has moved.{' '} Continue to the new location.

); } else { return null; } }; export default PossibleRedirectNotification;