Spaces:
Running
Running
Download frontend/src/app/components/ModalManager.js from davebulaval/cole: direct link, hf CLI and curl.
- Browser
- Download file 573 Bytes
-
https://huggingface.co/spaces/davebulaval/cole/resolve/main/frontend/src/app/components/ModalManager.js
- Command line
-
hf download hf://spaces/davebulaval/cole/frontend/src/app/components/ModalManager.js
-
curl -L -o ModalManager.js https://huggingface.co/spaces/davebulaval/cole/resolve/main/frontend/src/app/components/ModalManager.js
573 Bytes
| 'use client'; | |
| import { useSearchParams, useRouter } from 'next/navigation'; | |
| import Modal from './Modal'; | |
| import SubmitForm from './SubmitForm'; | |
| export default function ModalManager() { | |
| const searchParams = useSearchParams(); | |
| const submitModal = searchParams.get("show") === "submit"; | |
| const router = useRouter(); | |
| const handleClose = () => { | |
| const newUrl = window.location.pathname; | |
| router.push(newUrl); | |
| }; | |
| return ( | |
| <> | |
| {submitModal && ( | |
| <Modal onClose={handleClose}> | |
| <SubmitForm /> | |
| </Modal> | |
| )} | |
| </> | |
| ); | |
| } | |