diff --git a/client/src/pages/candidateInfo/index.tsx b/client/src/pages/candidateInfo/index.tsx index ac3b64d6..112ba048 100644 --- a/client/src/pages/candidateInfo/index.tsx +++ b/client/src/pages/candidateInfo/index.tsx @@ -1,6 +1,7 @@ 'use client'; import React, { useEffect, useState } from 'react'; import { useRouter } from 'next/router'; +import SubscribePopup from '../../components/subscribePopup/SubscribePopup'; interface Candidate { id: number; @@ -27,6 +28,7 @@ export default function CandidateInfo() { const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); const [filteredCandidates, setFilteredCandidates] = useState([]); + const [showPopup, setShowPopup] = useState(false); const [filters, setFilters] = useState({ party: '', electionType: '', @@ -71,8 +73,22 @@ export default function CandidateInfo() { }; fetchCandidateData(); + + + // Show popup after a delay (e.g., 10 seconds) + const popupTimer = setTimeout(() => { + setShowPopup(true); + }, 10000); + + // Cleanup timer when component unmounts + return () => clearTimeout(popupTimer); }, []); + const handleClosePopup = () => { + setShowPopup(false); + }; + + const handleCandidateClick = (name: string) => { const formattedName = name.replace(/\s+/g, '').toLowerCase(); // Ensure it matches profile URL structure router.push(`/candidateInfo/${formattedName}`); // Navigate to the candidate's profile page @@ -110,73 +126,73 @@ export default function CandidateInfo() { return (
{/* Sidebar for Filters */} -
-

Filter Candidates

+
+

Filter Candidates

- - + +
- +
- - + {electionTypes.map(type => ( ))}
- +
- - + {districts.map(district => ( ))}
- + {/* Reset Filters Button */} -
- + {/* Main Content */}
{filteredCandidates.length > 0 ? ( filteredCandidates.map(candidate => ( -
{candidate.attributes.PhotoURL && ( - {candidate.attributes.Name} )} @@ -198,7 +214,7 @@ export default function CandidateInfo() {
-
+ + + {/* Subscribe Popup */} + {showPopup && } + +
); } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ea9ae991..6cc68957 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "@mui/material": "^5.16.1" }, "devDependencies": { - "@playwright/test": "^1.49.0", + "@playwright/test": "^1.49.1", "@types/node": "^22.10.1" } }, @@ -626,12 +626,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.49.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.49.0.tgz", - "integrity": "sha512-DMulbwQURa8rNIQrf94+jPJQ4FmOVdpE5ZppRNvWVjvhC+6sOeo28r8MgIpQRYouXRtt/FCCXU7zn20jnHR4Qw==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.49.1.tgz", + "integrity": "sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "playwright": "1.49.0" + "playwright": "1.49.1" }, "bin": { "playwright": "cli.js" @@ -840,6 +841,7 @@ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1027,12 +1029,13 @@ "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" }, "node_modules/playwright": { - "version": "1.49.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.49.0.tgz", - "integrity": "sha512-eKpmys0UFDnfNb3vfsf8Vx2LEOtflgRebl0Im2eQQnYMA4Aqd+Zw8bEOB+7ZKvN76901mRnqdsiOGKxzVTbi7A==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.49.1.tgz", + "integrity": "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.49.0" + "playwright-core": "1.49.1" }, "bin": { "playwright": "cli.js" @@ -1045,10 +1048,11 @@ } }, "node_modules/playwright-core": { - "version": "1.49.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.49.0.tgz", - "integrity": "sha512-R+3KKTQF3npy5GTiKH/T+kdhoJfJojjHESR1YEWhYuEKRVfVaxH3+4+GvXE5xyCngCxhxnykk0Vlah9v8fs3jA==", + "version": "1.49.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.49.1.tgz", + "integrity": "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==", "dev": true, + "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, diff --git a/package.json b/package.json index 7cb6ba89..988f4454 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "@mui/material": "^5.16.1" }, "devDependencies": { - "@playwright/test": "^1.49.0", + "@playwright/test": "^1.49.1", "@types/node": "^22.10.1" }, "scripts": {}