import { useState } from "react"; import { useNavigate } from "react-router-dom"; import { Pin, ArrowLeft } from "lucide-react"; import { useRealArticles } from "@/hooks/useRealArticles"; import { useAuth } from "@/hooks/useAuth"; import NewsCard from "@/components/NewsCard"; import ArticleModal from "@/components/ArticleModal"; import { NewsItem } from "@/types/news"; import { Button } from "@/components/ui/button"; const Pinned = () => { const navigate = useNavigate(); const { user } = useAuth(); const { articles, loading, togglePin, markAsRead, deleteArticle } = useRealArticles(); const [selectedArticle, setSelectedArticle] = useState(null); // Redirect if not authenticated if (!user) { navigate("/auth"); return null; } // Filter only pinned articles const pinnedArticles = articles.filter(article => article.isPinned); if (loading) { return (
); } return (
{/* Header */}

Articles épinglés

{pinnedArticles.length > 0 && ( {pinnedArticles.length} )}
{/* Content */}
{pinnedArticles.length === 0 ? (

Aucun article épinglé

Vous n'avez pas encore épinglé d'articles. Épinglez vos articles préférés depuis la page principale pour les retrouver facilement ici.

) : (
{pinnedArticles.map((article) => ( ))}
)}
{/* Article Modal */} {selectedArticle && ( setSelectedArticle(null)} /> )}
); }; export default Pinned;