Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/evolution-frontend/src/apps/participant/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 } });

Expand Down Expand Up @@ -51,6 +52,7 @@ const App = (settings?: AppSettings) => {
<Provider store={store}>
<I18nextProvider i18n={i18n}>
<BrowserRouter>
<CookieBanner/>
<SurveyRouter />
</BrowserRouter>
</I18nextProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React, { useState, useEffect } from 'react';

const CookieBanner: React.FC = () => {
const [showBanner, setShowBanner] = useState(false);

Check failure on line 5 in packages/evolution-frontend/src/components/pageParts/CookieBanner.tsx

View workflow job for this annotation

GitHub Actions / code-lint

Trailing spaces not allowed
useEffect(() => {
// Check if user already accepted cookies
const cookiesAccepted = localStorage.getItem('cookiesAccepted');
if (!cookiesAccepted) {
setShowBanner(true);
}
}, []);

Check failure on line 13 in packages/evolution-frontend/src/components/pageParts/CookieBanner.tsx

View workflow job for this annotation

GitHub Actions / code-lint

Trailing spaces not allowed
const acceptCookies = () => {
localStorage.setItem('cookiesAccepted', 'true');
setShowBanner(false);
};

Check failure on line 18 in packages/evolution-frontend/src/components/pageParts/CookieBanner.tsx

View workflow job for this annotation

GitHub Actions / code-lint

Trailing spaces not allowed
if (!showBanner) return null;

Check failure on line 20 in packages/evolution-frontend/src/components/pageParts/CookieBanner.tsx

View workflow job for this annotation

GitHub Actions / code-lint

Trailing spaces not allowed
return (
<div className="cookie-banner">
<p>We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.</p>
<button onClick={acceptCookies}>Accept</button>
</div>
);
};

export default CookieBanner;

Check failure on line 29 in packages/evolution-frontend/src/components/pageParts/CookieBanner.tsx

View workflow job for this annotation

GitHub Actions / code-lint

Newline required at end of file but not found
Loading