matiniktaff / feed.html
Sjokode's picture
there are errors
a8cdf21 verified
Raw History Blame Contribute Delete
39.4 kB
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Promotions & Actualités | MatinikTaff</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body { font-family: 'Poppins', sans-serif; }
.promo-card { border-left: 4px solid #c2410c; }
.news-card { border-left: 4px solid #64748b; }
.filter-btn.active { background-color: #c2410c; color: white; }
.filter-btn { transition: all 0.2s ease; }
.filter-btn:hover { transform: translateY(-1px); }
.card-hover { transition: all 0.3s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
</style>
</head>
<body class="bg-stone-50">
<!-- Navigation -->
<nav class="bg-white shadow-sm border-b border-gray-100 sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16">
<div class="flex items-center">
<div class="flex-shrink-0">
<h1 class="text-2xl font-bold bg-gradient-to-r from-orange-600 to-orange-800 bg-clip-text text-transparent">MatinikTaff</h1>
</div>
<div class="hidden md:block ml-10">
<div class="flex items-center space-x-4">
<a href="index.html" class="text-gray-700 hover:text-orange-600 px-3 py-2 rounded-md text-sm font-medium">Accueil</a>
<a href="feed.html" class="text-orange-600 px-3 py-2 rounded-md text-sm font-medium border-b-2 border-orange-600">Fil</a>
<a href="messages.html" class="text-gray-700 hover:text-orange-600 px-3 py-2 rounded-md text-sm font-medium">Messages</a>
<a href="search.html" class="text-gray-700 hover:text-orange-600 px-3 py-2 rounded-md text-sm font-medium">Services</a>
</div>
</div>
</div>
<div class="flex items-center space-x-4">
<div class="relative">
<input type="text" placeholder="Rechercher..." class="w-64 pl-10 pr-4 py-2 border border-gray-300 rounded-full text-sm focus:outline-none focus:ring-2 focus:ring-orange-500">
<i data-feather="search" class="absolute left-3 top-2.5 h-5 w-5 text-gray-400"></i>
</div>
<div class="relative">
<img src="http://static.photos/people/200x200/1" alt="Profile" class="h-8 w-8 rounded-full cursor-pointer hover:opacity-80" id="profile-icon">
<div id="profile-popup" class="absolute top-full right-0 mt-2 w-80 bg-white rounded-lg shadow-xl border border-gray-200 z-50 opacity-0 transform -translate-y-2 transition-all duration-300 pointer-events-none">
<div class="p-6">
<h3 class="text-lg font-semibold text-gray-900 mb-4">Connexion</h3>
<form class="space-y-4">
<div>
<label for="email" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input type="email" id="email" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-orange-500" placeholder="votre@email.com">
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700 mb-1">Mot de passe</label>
<input type="password" id="password" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-orange-500" placeholder="••••••••">
</div>
<button type="submit" class="w-full bg-orange-600 text-white py-2 rounded-md font-semibold hover:bg-orange-700 transition">
Se connecter
</button>
<div class="text-center mt-4">
<p class="text-sm text-gray-600">Pas de compte ?</p>
<button type="button" class="text-orange-600 hover:text-orange-700 font-medium text-sm">
Créer un compte
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</nav>
<!-- Header Section -->
<div class="bg-gradient-to-r from-orange-50 to-amber-50 py-12">
<div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
<h1 class="text-4xl font-bold text-gray-900 mb-4">Promotions & Actualités</h1>
<p class="text-lg text-gray-600 max-w-2xl mx-auto">Découvrez les offres et nouveautés de nos artisans locaux</p>
</div>
</div>
<!-- Filter Bar -->
<div class="bg-white border-b border-gray-200 sticky top-16 z-40">
<div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
<div class="flex flex-wrap gap-3 items-center">
<button class="filter-btn active px-4 py-2 rounded-full text-sm font-medium border border-gray-300" data-category="all">
Tous
</button>
<button class="filter-btn px-4 py-2 rounded-full text-sm font-medium border border-gray-300 bg-gray-100 text-gray-700" data-category="construction">
Bâtiment
</button>
<button class="filter-btn px-4 py-2 rounded-full text-sm font-medium border border-gray-300 bg-gray-100 text-gray-700" data-category="beauty">
Beauté
</button>
<button class="filter-btn px-4 py-2 rounded-full text-sm font-medium border border-gray-300 bg-gray-100 text-gray-700" data-category="gardening">
Jardinage
</button>
<button class="filter-btn px-4 py-2 rounded-full text-sm font-medium border border-gray-300 bg-gray-100 text-gray-700" data-category="coaching">
Coaching
</button>
<button class="filter-btn px-4 py-2 rounded-full text-sm font-medium border border-gray-300 bg-gray-100 text-gray-700" data-category="tech">
Tech
</button>
<button class="filter-btn px-4 py-2 rounded-full text-sm font-medium border border-gray-300 bg-gray-100 text-gray-700" data-category="wellness">
Wellness
</button>
<button class="filter-btn px-4 py-2 rounded-full text-sm font-medium border border-gray-300 bg-gray-100 text-gray-700" data-category="education">
Éducation
</button>
</div>
</div>
</div>
<!-- Main Content -->
<div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
<!-- Sidebar -->
<div class="lg:col-span-1">
<div class="bg-white rounded-xl shadow-sm p-6 sticky top-32">
<h3 class="text-lg font-semibold text-gray-900 mb-4">Filtrer par type</h3>
<div class="space-y-3">
<button class="sidebar-filter-btn active w-full text-left px-4 py-3 rounded-lg bg-orange-50 text-orange-700 font-medium flex items-center justify-between" data-type="all">
<span>Tous les contenus</span>
<i data-feather="grid" class="h-4 w-4"></i>
</button>
<button class="sidebar-filter-btn w-full text-left px-4 py-3 rounded-lg text-gray-700 hover:bg-gray-50 font-medium flex items-center justify-between" data-type="promotion">
<span>Promotions</span>
<i data-feather="percent" class="h-4 w-4"></i>
</button>
<button class="sidebar-filter-btn w-full text-left px-4 py-3 rounded-lg text-gray-700 hover:bg-gray-50 font-medium flex items-center justify-between" data-type="actualite">
<span>Actualités</span>
<i data-feather="edit-3" class="h-4 w-4"></i>
</button>
<button class="sidebar-filter-btn w-full text-left px-4 py-3 rounded-lg text-gray-700 hover:bg-gray-50 font-medium flex items-center justify-between" data-type="mission">
<span>Missions</span>
<i data-feather="briefcase" class="h-4 w-4"></i>
</button>
</div>
<div class="border-t border-gray-200 mt-6 pt-6">
<h3 class="text-lg font-semibold text-gray-900 mb-4">Catégories</h3>
<div class="space-y-2">
<button class="category-filter-btn w-full text-left px-3 py-2 rounded-lg text-gray-600 hover:bg-gray-50 text-sm flex items-center" data-category="construction">
<i data-feather="home" class="h-4 w-4 mr-2"></i>
Construction
</button>
<button class="category-filter-btn w-full text-left px-3 py-2 rounded-lg text-gray-600 hover:bg-gray-50 text-sm flex items-center" data-category="beauty">
<i data-feather="scissors" class="h-4 w-4 mr-2"></i>
Beauté
</button>
<button class="category-filter-btn w-full text-left px-3 py-2 rounded-lg text-gray-600 hover:bg-gray-50 text-sm flex items-center" data-category="tech">
<i data-feather="monitor" class="h-4 w-4 mr-2"></i>
Tech
</button>
<button class="category-filter-btn w-full text-left px-3 py-2 rounded-lg text-gray-600 hover:bg-gray-50 text-sm flex items-center" data-category="wellness">
<i data-feather="heart" class="h-4 w-4 mr-2"></i>
Wellness
</button>
<button class="category-filter-btn w-full text-left px-3 py-2 rounded-lg text-gray-600 hover:bg-gray-50 text-sm flex items-center" data-category="education">
<i data-feather="book" class="h-4 w-4 mr-2"></i>
Éducation
</button>
</div>
</div>
</div>
</div>
<!-- Main Content -->
<div class="lg:col-span-3">
<!-- Floating News Composer -->
<div class="bg-white rounded-xl shadow-lg border border-gray-100 mb-8 sticky top-24 z-30 transition-all duration-300 hover:shadow-xl">
<div class="p-4">
<!-- Composer Header -->
<div class="flex items-center mb-3">
<img src="http://static.photos/people/200x200/1" alt="Profile" class="h-10 w-10 rounded-full">
<div class="ml-3 flex-1">
<div class="relative">
<input type="text"
placeholder="Titre de votre actualité..."
class="w-full pl-10 pr-4 py-2 border-0 bg-gray-50 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-orange-500 transition-all duration-200"
id="composer-title">
<i data-feather="type" class="absolute left-3 top-2.5 h-4 w-4 text-gray-400"></i>
</div>
</div>
</div>
<!-- Message Field -->
<div class="relative mb-3">
<textarea
placeholder="Partagez votre actualité..."
rows="2"
class="w-full pl-10 pr-4 py-2 border-0 bg-gray-50 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-orange-500 resize-none transition-all duration-200"
id="composer-message"></textarea>
<i data-feather="message-square" class="absolute left-3 top-2.5 h-4 w-4 text-gray-400"></i>
</div>
<!-- Image Upload & Actions -->
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<!-- Image Upload Button -->
<label for="image-upload" class="cursor-pointer p-2 text-gray-500 hover:text-orange-600 transition-colors duration-200">
<i data-feather="image" class="h-5 w-5"></i>
<input type="file" id="image-upload" class="hidden" accept="image/*">
</label>
<!-- Location Picker -->
<button class="p-2 text-gray-500 hover:text-orange-600 transition-colors duration-200">
<i data-feather="map-pin" class="h-5 w-5"></i>
</button>
<!-- Category Selector -->
<button class="p-2 text-gray-500 hover:text-orange-600 transition-colors duration-200">
<i data-feather="tag" class="h-5 w-5"></i>
</button>
</div>
<!-- Publish Button -->
<button class="bg-orange-500 text-white px-4 py-2 rounded-full text-sm font-medium hover:bg-orange-600 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed"
id="publish-button"
disabled>
<i data-feather="send" class="h-4 w-4 inline mr-1"></i>
Publier
</button>
</div>
<!-- Image Preview (hidden by default) -->
<div class="mt-3 hidden" id="image-preview">
<div class="relative">
<img id="preview-image" class="w-full h-48 object-cover rounded-lg" src="" alt="Aperçu image">
<button class="absolute top-2 right-2 bg-white rounded-full p-1 shadow-md hover:bg-gray-100 transition-colors duration-200"
id="remove-image">
<i data-feather="x" class="h-4 w-4 text-gray-600"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Feed Posts -->
<div class="space-y-6" id="feed-container">
<!-- Promotion Card 1 -->
<div class="promo-card bg-white rounded-xl shadow-sm card-hover" data-category="construction">
<div class="p-6">
<div class="flex items-center mb-4">
<img src="http://static.photos/people/200x200/2" alt="Marcus Johnson" class="h-12 w-12 rounded-full cursor-pointer hover:opacity-80">
<div class="ml-3">
<h4 class="font-semibold text-gray-900 cursor-pointer hover:text-orange-600">Marcus Johnson</h4>
<p class="text-sm text-gray-500">Expert en Construction • il y a 3 heures</p>
</div>
<div class="ml-auto">
<span class="bg-orange-100 text-orange-700 px-3 py-1 rounded-full text-xs font-semibold">PROMOTION</span>
</div>
</div>
<img src="http://static.photos/construction/640x360/15" alt="Promotion construction" class="w-full h-64 object-cover rounded-lg mb-4">
<h3 class="text-xl font-bold text-gray-900 mb-2">🎯 Rénovation de cuisine - 20% de réduction !</h3>
<p class="text-gray-600 mb-4">
Profitez de notre offre spéciale automne : 20% de réduction sur toutes les rénovations de cuisine.
Offre valable jusqu'au 30 novembre. Matériaux inclus, finitions haut de gamme.
</p>
<div class="flex items-center justify-between">
<div class="text-sm text-gray-500">
<i data-feather="map-pin" class="inline h-4 w-4 mr-1"></i>
Bridgetown, Barbade
</div>
<button class="bg-orange-600 text-white px-6 py-2 rounded-full font-semibold hover:bg-orange-700 transition">
Voir le service
</button>
</div>
</div>
</div>
<!-- News Card 1 -->
<div class="news-card bg-white rounded-xl shadow-sm card-hover" data-category="beauty">
<div class="p-6">
<div class="flex items-center mb-4">
<img src="http://static.photos/people/200x200/3" alt="Sophia Laurent" class="h-12 w-12 rounded-full cursor-pointer hover:opacity-80">
<div class="ml-3">
<h4 class="font-semibold text-gray-900 cursor-pointer hover:text-orange-600">Sophia Laurent</h4>
<p class="text-sm text-gray-500">Spécialiste Beauté • il y a 5 heures</p>
</div>
<div class="ml-auto">
<span class="bg-gray-100 text-gray-700 px-3 py-1 rounded-full text-xs font-semibold">ACTUALITÉ</span>
</div>
</div>
<h3 class="text-lg font-semibold text-gray-900 mb-2">Nouveau service : Soins du visage bio</h3>
<p class="text-gray-600 mb-4">
Je suis heureuse d'annoncer l'ajout de soins du visage entièrement bios à ma carte de services.
Utilisant des produits locaux et naturels, parfait pour les peaux sensibles.
</p>
<div class="flex items-center justify-between text-sm text-gray-500">
<span><i data-feather="clock" class="inline h-4 w-4 mr-1"></i>Disponible sur rendez-vous</span>
<span>Fort-de-France, Martinique</span>
</div>
</div>
</div>
<!-- Promotion Card 2 -->
<div class="promo-card bg-white rounded-xl shadow-sm card-hover" data-category="gardening">
<div class="p-6">
<div class="flex items-center mb-4">
<img src="http://static.photos/people/200x200/7" alt="Carlos Mendez" class="h-12 w-12 rounded-full cursor-pointer hover:opacity-80">
<div class="ml-3">
<h4 class="font-semibold text-gray-900 cursor-pointer hover:text-orange-600">Carlos Mendez</h4>
<p class="text-sm text-gray-500">Paysagiste • il y a 1 jour</p>
</div>
<div class="ml-auto">
<span class="bg-orange-100 text-orange-700 px-3 py-1 rounded-full text-xs font-semibold">PROMOTION</span>
</div>
</div>
<img src="http://static.photos/nature/640x360/16" alt="Jardinage promotion" class="w-full h-64 object-cover rounded-lg mb-4">
<h3 class="text-xl font-bold text-gray-900 mb-2">🌿 Création de jardin tropical - Offre spéciale</h3>
<p class="text-gray-600 mb-4">
Transformez votre extérieur en paradis tropical ! Forfait complet incluant conception, plantation
et système d'arrosage automatique. 15% de réduction pour les commandes avant décembre.
</p>
<div class="flex items-center justify-between">
<div class="text-sm text-gray-500">
<i data-feather="map-pin" class="inline h-4 w-4 mr-1"></i>
Kingston, Jamaïque
</div>
<button class="bg-orange-600 text-white px-6 py-2 rounded-full font-semibold hover:bg-orange-700 transition">
Contactez l'artisan
</button>
</div>
</div>
</div>
<!-- News Card 2 -->
<div class="news-card bg-white rounded-xl shadow-sm card-hover" data-category="coaching">
<div class="p-6">
<div class="flex items-center mb-4">
<img src="http://static.photos/people/200x200/8" alt="Isabelle Dubois" class="h-12 w-12 rounded-full cursor-pointer hover:opacity-80">
<div class="ml-3">
<h4 class="font-semibold text-gray-900 cursor-pointer hover:text-orange-600">Isabelle Dubois</h4>
<p class="text-sm text-gray-500">Coach Professionnel • il y a 2 jours</p>
</div>
<div class="ml-auto">
<span class="bg-gray-100 text-gray-700 px-3 py-1 rounded-full text-xs font-semibold">ACTUALITÉ</span>
</div>
</div>
<h3 class="text-lg font-semibold text-gray-900 mb-2">Atelier gratuit : Gestion du stress au travail</h3>
<p class="text-gray-600 mb-4">
Rejoignez-moi pour un atelier interactif de 2 heures sur la gestion du stress en milieu professionnel.
Places limitées, inscription obligatoire.
</p>
<div class="flex items-center justify-between text-sm text-gray-500">
<span><i data-feather="calendar" class="inline h-4 w-4 mr-1"></i>Samedi 25 novembre, 14h-16h</span>
<span>Pointe-à-Pitre, Guadeloupe</span>
</div>
</div>
</div>
<!-- Promotion Card 3 -->
<div class="promo-card bg-white rounded-xl shadow-sm card-hover" data-category="tech">
<div class="p-6">
<div class="flex items-center mb-4">
<img src="http://static.photos/people/200x200/4" alt="David Chen" class="h-12 w-12 rounded-full cursor-pointer hover:opacity-80">
<div class="ml-3">
<h4 class="font-semibold text-gray-900 cursor-pointer hover:text-orange-600">David Chen</h4>
<p class="text-sm text-gray-500">Développeur • il y a 3 jours</p>
</div>
<div class="ml-auto">
<span class="bg-orange-100 text-orange-700 px-3 py-1 rounded-full text-xs font-semibold">PROMOTION</span>
</div>
</div>
<img src="http://static.photos/technology/640x360/17" alt="Tech promotion" class="w-full h-64 object-cover rounded-lg mb-4">
<h3 class="text-xl font-bold text-gray-900 mb-2">💻 Site web e-commerce - Package complet à prix réduit</h3>
<p class="text-gray-600 mb-4">
Lancez votre boutique en ligne avec notre package tout-compris : design, développement, hébergement 1 an.
25% de réduction pour les artisans locaux. Offre limitée aux 5 premiers clients.
</p>
<div class="flex items-center justify-between">
<div class="text-sm text-gray-500">
<i data-feather="map-pin" class="inline h-4 w-4 mr-1"></i>
Port of Spain, Trinité-et-Tobago
</div>
<button class="bg-orange-600 text-white px-6 py-2 rounded-full font-semibold hover:bg-orange-700 transition">
Voir le service
</button>
</div>
</div>
</div>
<!-- News Card 3 -->
<div class="news-card bg-white rounded-xl shadow-sm card-hover" data-category="wellness">
<div class="p-6">
<div class="flex items-center mb-4">
<img src="http://static.photos/people/200x200/9" alt="Elena Martinez" class="h-12 w-12 rounded-full cursor-pointer hover:opacity-80">
<div class="ml-3">
<h4 class="font-semibold text-gray-900 cursor-pointer hover:text-orange-600">Elena Martinez</h4>
<p class="text-sm text-gray-500">Massothérapeute • il y a 4 jours</p>
</div>
<div class="ml-auto">
<span class="bg-gray-100 text-gray-700 px-3 py-1 rounded-full text-xs font-semibold">ACTUALITÉ</span>
</div>
</div>
<h3 class="text-lg font-semibold text-gray-900 mb-2">Formation continue en massage thaïlandais</h3>
<p class="text-gray-600 mb-4">
Je viens de terminer une formation intensive de 50 heures en massage thaïlandais traditionnel.
Nouveau service disponible dès la semaine prochaine !
</p>
<div class="flex items-center justify-between text-sm text-gray-500">
<span><i data-feather="award" class="inline h-4 w-4 mr-1"></i>Certification internationale</span>
<span>Saint-Georges, Grenade</span>
</div>
</div>
</div>
<!-- Promotion Card 4 -->
<div class="promo-card bg-white rounded-xl shadow-sm card-hover" data-category="education">
<div class="p-6">
<div class="flex items-center mb-4">
<img src="http://static.photos/people/200x200/10" alt="Robert Taylor" class="h-12 w-12 rounded-full cursor-pointer hover:opacity-80">
<div class="ml-3">
<h4 class="font-semibold text-gray-900 cursor-pointer hover:text-orange-600">Robert Taylor</h4>
<p class="text-sm text-gray-500">Tuteur Math/Physique • il y a 5 jours</p>
</div>
<div class="ml-auto">
<span class="bg-orange-100 text-orange-700 px-3 py-1 rounded-full text-xs font-semibold">PROMOTION</span>
</div>
</div>
<img src="http://static.photos/education/640x360/18" alt="Education promotion" class="w-full h-64 object-cover rounded-lg mb-4">
<h3 class="text-xl font-bold text-gray-900 mb-2">📚 Cours intensifs de révision - 30% de réduction</h3>
<p class="text-gray-600 mb-4">
Préparez vos examens avec nos cours intensifs de révision en mathématiques et physique.
Groupes de 3-5 élèves, sessions de 2 heures. Réduction valable jusqu'à fin décembre.
</p>
<div class="flex items-center justify-between">
<div class="text-sm text-gray-500">
<i data-feather="map-pin" class="inline h-4 w-4 mr-1"></i>
Castries, Sainte-Lucie
</div>
<button class="bg-orange-600 text-white px-6 py-2 rounded-full font-semibold hover:bg-orange-700 transition">
Contactez l'artisan
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<footer class="bg-gray-900 text-white mt-16">
<div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
<div>
<h3 class="text-lg font-semibold mb-4">MatinikTaff</h3>
<p class="text-gray-300 text-sm">La plateforme de référence pour découvrir les meilleurs artisans et promotions aux Caraïbes.</p>
</div>
<div>
<h4 class="font-semibold mb-4">Navigation</h4>
<ul class="space-y-2 text-sm text-gray-300">
<li><a href="index.html" class="hover:text-orange-400">Accueil</a></li>
<li><a href="feed.html" class="hover:text-orange-400">Fil d'actualité</a></li>
<li><a href="search.html" class="hover:text-orange-400">Services</a></li>
</ul>
</div>
<div>
<h4 class="font-semibold mb-4">Contact</h4>
<div class="space-y-2 text-sm text-gray-300">
<p><i data-feather="mail" class="inline h-4 w-4 mr-2"></i>contact@matiniktaff.com</p>
<p><i data-feather="phone" class="inline h-4 w-4 mr-2"></i>+1 (555) 123-4567</p>
</div>
</div>
</div>
<div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-400 text-sm">
<p>&copy; 2024 MatinikTaff. Tous droits réservés.</p>
</div>
</div>
</footer>
<script src="components/news-composer.js"></script>
<script>
// Initialize Feather Icons
feather.replace();
// Sidebar filter functionality
const sidebarFilterBtns = document.querySelectorAll('.sidebar-filter-btn');
const categoryFilterBtns = document.querySelectorAll('.category-filter-btn');
const cards = document.querySelectorAll('.promo-card, .news-card');
sidebarFilterBtns.forEach(btn => {
btn.addEventListener('click', () => {
const type = btn.getAttribute('data-type');
// Toggle active state
const isActive = btn.classList.contains('active');
if (!isActive) {
// Remove active class from all sidebar buttons
sidebarFilterBtns.forEach(b => {
b.classList.remove('active', 'bg-orange-50', 'text-orange-700');
b.classList.add('text-gray-700', 'hover:bg-gray-50');
});
// Add active class to clicked button
btn.classList.add('active', 'bg-orange-50', 'text-orange-700');
btn.classList.remove('text-gray-700', 'hover:bg-gray-50');
// Filter cards by type
cards.forEach(card => {
const cardType = card.classList.contains('promo-card') ? 'promotion' : 'actualite';
if (type === 'all' || cardType === type) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
} else {
// If already active, deselect and show all
btn.classList.remove('active', 'bg-orange-50', 'text-orange-700');
btn.classList.add('text-gray-700', 'hover:bg-gray-50');
// Show all cards
cards.forEach(card => {
card.style.display = 'block';
});
}
});
});
categoryFilterBtns.forEach(btn => {
btn.addEventListener('click', () => {
const category = btn.getAttribute('data-category');
// Toggle active state
btn.classList.toggle('bg-orange-50');
btn.classList.toggle('text-orange-700');
// Filter cards by category
const activeCategories = Array.from(document.querySelectorAll('.category-filter-btn.bg-orange-50'))
.map(b => b.getAttribute('data-category'));
if (activeCategories.length === 0) {
// Show all cards
cards.forEach(card => {
card.style.display = 'block';
});
} else {
// Filter by active categories
cards.forEach(card => {
const cardCategory = card.getAttribute('data-category');
if (activeCategories.includes(cardCategory)) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
}
});
});
// Profile popup functionality
const profileIcon = document.getElementById('profile-icon');
const profilePopup = document.getElementById('profile-popup');
let isPopupOpen = false;
function togglePopup() {
isPopupOpen = !isPopupOpen;
if (isPopupOpen) {
profilePopup.classList.remove('opacity-0', 'pointer-events-none', '-translate-y-2');
profilePopup.classList.add('opacity-100', 'pointer-events-auto', 'translate-y-0');
} else {
profilePopup.classList.remove('opacity-100', 'pointer-events-auto', 'translate-y-0');
profilePopup.classList.add('opacity-0', 'pointer-events-none', '-translate-y-2');
}
}
function closePopup() {
isPopupOpen = false;
profilePopup.classList.remove('opacity-100', 'pointer-events-auto', 'translate-y-0');
profilePopup.classList.add('opacity-0', 'pointer-events-none', '-translate-y-2');
}
profileIcon.addEventListener('click', (e) => {
e.stopPropagation();
togglePopup();
});
// Close popup when clicking outside
document.addEventListener('click', (e) => {
if (isPopupOpen && !profilePopup.contains(e.target) && !profileIcon.contains(e.target)) {
closePopup();
}
});
// Close popup on escape key
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && isPopupOpen) {
closePopup();
}
});
// Filter functionality
const filterBtns = document.querySelectorAll('.filter-btn');
const feedContainer = document.getElementById('feed-container');
const cards = feedContainer.querySelectorAll('.promo-card, .news-card');
filterBtns.forEach(btn => {
btn.addEventListener('click', () => {
const category = btn.getAttribute('data-category');
// Toggle active state
if (category === 'all') {
// Reset all filters
filterBtns.forEach(b => {
b.classList.remove('active');
b.classList.add('bg-gray-100', 'text-gray-700');
});
btn.classList.add('active');
btn.classList.remove('bg-gray-100', 'text-gray-700');
// Show all cards
cards.forEach(card => {
card.style.display = 'block';
card.style.animation = 'fadeIn 0.3s ease-in';
});
} else {
// Toggle individual filter
btn.classList.toggle('active');
btn.classList.toggle('bg-gray-100');
btn.classList.toggle('text-gray-700');
// Check if any filters are active
const activeFilters = document.querySelectorAll('.filter-btn.active:not([data-category="all"])');
if (activeFilters.length === 0) {
// No filters active, show all
document.querySelector('[data-category="all"]').click();
} else {
// Filter by active categories
const activeCategories = Array.from(activeFilters).map(f => f.getAttribute('data-category'));
cards.forEach(card => {
const cardCategory = card.getAttribute('data-category');
if (activeCategories.includes(cardCategory)) {
card.style.display = 'block';
card.style.animation = 'fadeIn 0.3s ease-in';
} else {
card.style.display = 'none';
}
});
}
}
});
});
// Add fade-in animation
const style = document.createElement('style');
style.textContent = `
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
`;
document.head.appendChild(style);
// Smooth scroll for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
</script>
</body>
</html>