import { Button } from '@/components/ui/button'; import { Download, Eye, Pencil } from 'lucide-react'; import { useState } from 'react'; import ResourceForm from './forms/resource-form'; interface Props { lesson: SectionLesson; isSubmit: boolean; setIsSubmit: (value: boolean) => void; setOpen: (value: boolean) => void; } const ResourceList = ({ lesson, isSubmit, setIsSubmit, setOpen }: Props) => { const [editId, setEditId] = useState(''); // Helper to handle file download const handleDownload = async (resource: LessonResource, e: React.MouseEvent) => { e.preventDefault(); try { // For non-link resources, use the download endpoint const url = route('resources.download', resource.id); window.open(url, '_blank'); } catch (error) { // Fallback to direct download if the endpoint fails window.open(resource.resource, '_blank'); } }; return (
No resources available