aabroukh's picture
Add files using upload-large-folder tool
b136cbe verified
Raw History Blame Contribute Delete
744 Bytes
import { useEffect } from "react";
// `redirectURL` is a fully-formed URL (e.g. a Prolific completion link)
// or null. When null, the app stays on the thank-you screen.
function ThankYouScreen({ message = "Thank you for your time!", redirectURL = null }) {
useEffect(() => {
if (redirectURL) {
const timer = setTimeout(() => {
window.location.href = redirectURL;
}, 3000);
return () => clearTimeout(timer);
}
}, [redirectURL]);
return (
<div style={{ padding: "2rem", textAlign: "center" }}>
<h2>{message}</h2>
{redirectURL ? (
<p>Redirecting in 3 seconds…</p>
) : (
<p>You may now close this tab.</p>
)}
</div>
);
}
export default ThankYouScreen;