diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 5a0c1df..df7f325 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -523,27 +523,69 @@ function FolderModal({ folder, onClose }) { } function QuickLinks({ toast, mobile }) { - const [links, setLinks] = useState([]); + const [links, setLinks] = useState([]); const [folderModal, setFolderModal] = useState(null); + const [editMode, setEditMode] = useState(false); useEffect(() => { api('/dashboard/links').then(setLinks).catch(() => {}); }, []); - // Links die kein Ordner sind - const regularLinks = links.filter(l => l.item_type !== 'folder'); - // Ordner-Items - const folderItems = links.filter(l => l.item_type === 'folder'); - // Alles zusammen für Carousel/Grid + const legacyItems = links.filter(l => l.item_type === 'quicklink' || !l.item_type); + const hasLegacy = legacyItems.length > 0; + + const deleteLegacy = async id => { + try { + await api(`/dashboard/links/${id}`, { method:'DELETE' }); + setLinks(p => p.filter(l => l.id !== id)); + toast('Entfernt'); + } catch(e) { toast(e.message,'error'); } + }; + const allItems = links.map(l => l.item_type === 'folder' - ? { ...l, id: `folder-${l.id}`, isFolder: true, icon: l.icon||'📁', title: l.name } + ? { ...l, id:`folder-${l.id}`, isFolder:true, icon:l.icon||'📁', title:l.name } : l ); return (