diff --git a/packages/evolution-frontend/src/apps/participant/index.tsx b/packages/evolution-frontend/src/apps/participant/index.tsx index 0779d4ef1..c34d1078e 100644 --- a/packages/evolution-frontend/src/apps/participant/index.tsx +++ b/packages/evolution-frontend/src/apps/participant/index.tsx @@ -22,6 +22,7 @@ import appConfig, { setApplicationConfiguration } from 'chaire-lib-frontend/lib/ import '../../styles/survey/styles-participant-survey.scss'; import verifyAuthentication from 'chaire-lib-frontend/lib/services/auth/verifyAuthentication'; import SegmentsSection from '../../components/survey/sectionTemplates/TripsAndSegmentsSection'; +import CookieBanner from '../../components/pageParts/CookieBanner'; setApplicationConfiguration({ homePage: '/survey', templateMapping: { tripsAndSegmentsWithMap: SegmentsSection } }); @@ -51,6 +52,7 @@ const App = (settings?: AppSettings) => { + diff --git a/packages/evolution-frontend/src/components/pageParts/CookieBanner.tsx b/packages/evolution-frontend/src/components/pageParts/CookieBanner.tsx new file mode 100644 index 000000000..451c9826a --- /dev/null +++ b/packages/evolution-frontend/src/components/pageParts/CookieBanner.tsx @@ -0,0 +1,29 @@ +import React, { useState, useEffect } from 'react'; + +const CookieBanner: React.FC = () => { + const [showBanner, setShowBanner] = useState(false); + + useEffect(() => { + // Check if user already accepted cookies + const cookiesAccepted = localStorage.getItem('cookiesAccepted'); + if (!cookiesAccepted) { + setShowBanner(true); + } + }, []); + + const acceptCookies = () => { + localStorage.setItem('cookiesAccepted', 'true'); + setShowBanner(false); + }; + + if (!showBanner) return null; + + return ( +
+

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.

+ +
+ ); +}; + +export default CookieBanner; \ No newline at end of file