- Add SonarQube configuration for code quality analysis - sonar-project.properties with TypeScript/Next.js settings - .sonarignore to exclude build artifacts and dependencies - npm run sonar script - Jenkins pipeline stages for SonarQube analysis and quality gate - Implement cookie consent banner - New CookieConsent component with matching site colors - localStorage persistence for user choice - Accept/Reject buttons with proper styling - Link to cookies policy page - Add strict authentication protection for game page - Redirect unauthenticated users to login from /jeux - Clean up redundant auth checks and UI elements - Preserve redirect parameter for post-login navigation - Implement smart navigation with auth-aware redirects - "Jouer maintenant" button redirects based on auth status - "Participer au jeu" footer link with conditional routing - Authenticated users go to /jeux, others to /register - UI improvements and cleanup - Remove "Voir les lots" button from homepage - Remove "Gestion des cookies" from footer - Remove "À propos" from footer navigation - Consistent design across components 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
66 lines
2.2 KiB
TypeScript
66 lines
2.2 KiB
TypeScript
'use client';
|
|
|
|
import { useState, useEffect } from 'react';
|
|
import Link from 'next/link';
|
|
|
|
export default function CookieConsent() {
|
|
const [showBanner, setShowBanner] = useState(false);
|
|
|
|
useEffect(() => {
|
|
// Vérifier si l'utilisateur a déjà donné son consentement
|
|
const consent = localStorage.getItem('cookieConsent');
|
|
if (!consent) {
|
|
setShowBanner(true);
|
|
}
|
|
}, []);
|
|
|
|
const handleAccept = () => {
|
|
localStorage.setItem('cookieConsent', 'accepted');
|
|
setShowBanner(false);
|
|
};
|
|
|
|
const handleReject = () => {
|
|
localStorage.setItem('cookieConsent', 'rejected');
|
|
setShowBanner(false);
|
|
};
|
|
|
|
if (!showBanner) return null;
|
|
|
|
return (
|
|
<div className="fixed bottom-0 left-0 right-0 z-50 bg-gradient-to-r from-[#f5f5f0] to-[#faf9f5] shadow-2xl border-t-4 border-[#d4a574]">
|
|
<div className="container mx-auto px-4 py-6">
|
|
<div className="flex flex-col md:flex-row items-center justify-between gap-4">
|
|
{/* Message */}
|
|
<div className="flex-1 text-center md:text-left">
|
|
<p className="text-sm md:text-base text-[#5a5a4e]">
|
|
🍪 Ce site utilise des cookies pour améliorer votre expérience de navigation et analyser notre trafic.{' '}
|
|
<Link
|
|
href="/cookies"
|
|
className="text-[#d4a574] hover:text-[#c4956a] underline transition-colors font-semibold"
|
|
>
|
|
En savoir plus
|
|
</Link>
|
|
</p>
|
|
</div>
|
|
|
|
{/* Buttons */}
|
|
<div className="flex gap-3 flex-shrink-0">
|
|
<button
|
|
onClick={handleReject}
|
|
className="px-6 py-2.5 bg-white border-2 border-[#e5e4dc] hover:border-[#d4a574] text-[#5a5a4e] hover:text-[#d4a574] rounded-lg transition-all duration-300 text-sm font-semibold"
|
|
>
|
|
Refuser
|
|
</button>
|
|
<button
|
|
onClick={handleAccept}
|
|
className="px-6 py-2.5 bg-gradient-to-r from-[#d4a574] to-[#c4956a] hover:from-[#e5b685] hover:to-[#d4a574] text-white rounded-lg transition-all duration-300 shadow-lg hover:shadow-xl text-sm font-semibold"
|
|
>
|
|
Accepter tous les cookies
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|