diff --git a/client/src/pages/dashboard/components/CheckerPagePreview.tsx b/client/src/pages/dashboard/components/CheckerPagePreview.tsx index f997a2f..01d969b 100644 --- a/client/src/pages/dashboard/components/CheckerPagePreview.tsx +++ b/client/src/pages/dashboard/components/CheckerPagePreview.tsx @@ -4,17 +4,20 @@ import React, { Dispatch, SetStateAction, useContext, -} from 'react'; -import styles from './CheckerPagePreview.module.css'; -import ClubCheckerPage from '../../club-checker-page/ClubCheckerPage'; -import Textfield from '../../../components/Textfield'; -import copyIcon from '../../../assets/CopyIcon2.svg'; -import ClickNextArrow from '../../../assets/ClickNextArrow.svg'; -import ClickPrevArrow from '../../../assets/ClickPreviousArrow.svg'; -import { DashboardContextProvider } from '../Dashboard'; -import IDashboardContext from '../../../types/IDashboardContext'; +} from "react"; +import styles from "./CheckerPagePreview.module.css"; +import ClubCheckerPage from "../../club-checker-page/ClubCheckerPage"; +import Textfield from "../../../components/Textfield"; +import copyIcon from "../../../assets/CopyIcon2.svg"; +import ClickNextArrow from "../../../assets/ClickNextArrow.svg"; +import ClickPrevArrow from "../../../assets/ClickPreviousArrow.svg"; +import { DashboardContextProvider } from "../Dashboard"; +import IDashboardContext from "../../../types/IDashboardContext"; +import { useNavigate } from "react-router"; +import { IClubDetails } from "../../club-detail-page/ClubDetailPage"; const CheckerPagePreview = () => { + const navigate = useNavigate(); const [dashboard, setDashboard] = useContext(DashboardContextProvider) as [ IDashboardContext, Dispatch> @@ -51,16 +54,38 @@ const CheckerPagePreview = () => { const value = textFieldRef.current?.placeholder; try { await navigator.clipboard.writeText(value); - console.log('Copy succeeded'); + console.log("Copy succeeded"); } catch (error) { - console.log('Copy failed: ', error); + console.log("Copy failed: ", error); } } }; + const clubDetails: IClubDetails | undefined = dashboard.selectedClub + ? { + clubAcronym: + dashboard.dashboardPage?.club.acronym || dashboard.selectedClub.name, + clubName: dashboard.selectedClub?.name, + } + : undefined; + + const onCreateNewCheckerPage = () => { + navigate("/create-page", { state: clubDetails }); + }; + return (
-

Checker Pages

+
+

Checker Pages

+

+ onCreateNewCheckerPage()} + > + Create Page + +

+
{currentPageIndex === undefined || currentPageData === undefined ? (
No checker pages created for this club!
) : ( @@ -79,11 +104,7 @@ const CheckerPagePreview = () => { className={styles.copyButton} onClick={handleCopyButtonClick} > - Copy + Copy
@@ -146,7 +167,7 @@ const CheckerPagePreview = () => { key={index} className={`${ index === currentPageIndex - ? styles.activeDot + ' ' + styles.clicked + ? styles.activeDot + " " + styles.clicked : styles.dot }`} onClick={() =>