Prechádzať zdrojové kódy

Hide "Mark as read" button for visitors

Conditionally render the "Mark as read" button in `NewsCard.tsx` based on user authentication status, hiding it for visitors.
gpt-engineer-app[bot] 5 mesiacov pred
rodič
commit
8927f102a1
1 zmenil súbory, kde vykonal 2 pridanie a 3 odobranie
  1. 2 3
      src/components/NewsCard.tsx

+ 2 - 3
src/components/NewsCard.tsx

@@ -156,7 +156,7 @@ const NewsCard = ({
           </span>
           
           <div className="flex items-center gap-2">
-            {!news.isRead && (
+            {!news.isRead && user && (
               <Button
                 variant="outline"
                 size="sm"
@@ -164,8 +164,7 @@ const NewsCard = ({
                   e.stopPropagation();
                   onMarkAsRead(news.id);
                 }}
-                disabled={!user}
-                className={cn("gap-1", !user && "opacity-50 cursor-not-allowed")}
+                className="gap-1"
               >
                 <Eye className="h-3 w-3" />
                 Marquer lu