Browse Source

Add copy link functionality

gpt-engineer-app[bot] 2 tháng trước cách đây
mục cha
commit
e6214f465f
1 tập tin đã thay đổi với 19 bổ sung2 xóa
  1. 19 2
      src/components/ArticleModal.tsx

+ 19 - 2
src/components/ArticleModal.tsx

@@ -9,10 +9,12 @@ import {
 import { Badge } from '@/components/ui/badge';
 import { Button } from '@/components/ui/button';
 import { NewsItem } from '@/types/news';
+import { toast } from 'sonner';
 import { 
   Clock, 
   ExternalLink,
-  Calendar
+  Calendar,
+  Copy
 } from 'lucide-react';
 
 interface ArticleModalProps {
@@ -132,7 +134,22 @@ const ArticleModal = ({ isOpen, onClose, article }: ArticleModalProps) => {
 
           {/* External Link Button */}
           {article.url && (
-            <div className="flex justify-end pt-4 border-t">
+            <div className="flex justify-end gap-2 pt-4 border-t">
+              <Button
+                variant="outline"
+                className="gap-2"
+                onClick={async () => {
+                  try {
+                    await navigator.clipboard.writeText(article.url!);
+                    toast.success("Lien copié dans le presse-papier");
+                  } catch (error) {
+                    toast.error("Erreur lors de la copie du lien");
+                  }
+                }}
+              >
+                <Copy className="h-4 w-4" />
+                Copier le lien
+              </Button>
               <Button 
                 variant="outline" 
                 className="gap-2"