Dateien nach "frontend/src/tools" hochladen
This commit is contained in:
@@ -66,8 +66,8 @@ function ShareModal({ item, type, onClose, toast }) {
|
||||
|
||||
// ── Datei-Manager ─────────────────────────────────────────────────────────────
|
||||
export default function Dateien({ toast, mobile }) {
|
||||
const [data, setData] = useState({own:[],shared:[]});
|
||||
const [folders, setFolders] = useState({own:[],shared:[]});
|
||||
const [data, setData] = useState({own:[],shared:[],sharedByMe:[]});
|
||||
const [folders, setFolders] = useState({own:[],shared:[],sharedByMe:[]});
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [currentFolderId, setCurrentFolderId] = useState(null);
|
||||
const [folderPath, setFolderPath] = useState([]); // [{id, name}]
|
||||
@@ -88,7 +88,10 @@ export default function Dateien({ toast, mobile }) {
|
||||
Promise.all([
|
||||
api(`/tools/dateien${fq}`),
|
||||
api(`/tools/dateien/folders${pq}`),
|
||||
]).then(([d, f]) => { setData(d); setFolders(f); })
|
||||
]).then(([d, f]) => {
|
||||
setData({ own:d.own||[], shared:d.shared||[], sharedByMe:d.sharedByMe||[] });
|
||||
setFolders({ own:f.own||[], shared:f.shared||[], sharedByMe:f.sharedByMe||[] });
|
||||
})
|
||||
.catch(e => toast(e.message,'error'))
|
||||
.finally(() => setLoading(false));
|
||||
}, [currentFolderId]);
|
||||
@@ -142,7 +145,9 @@ export default function Dateien({ toast, mobile }) {
|
||||
const createFolder = async () => {
|
||||
if (!folderName.trim()) return;
|
||||
try {
|
||||
await api('/tools/dateien/folders',{body:{name:folderName.trim(),parent_id:currentFolderId}});
|
||||
const body = { name: folderName.trim() };
|
||||
if (currentFolderId) body.parent_id = currentFolderId;
|
||||
await api('/tools/dateien/folders', { body });
|
||||
toast('Ordner erstellt'); setFolderName(''); setNewFolder(false); load();
|
||||
} catch(e) { toast(e.message,'error'); }
|
||||
};
|
||||
@@ -242,7 +247,7 @@ export default function Dateien({ toast, mobile }) {
|
||||
)}
|
||||
|
||||
{/* Neuer Ordner Button (in Unterordnern) */}
|
||||
{tab==='own' && currentFolderId && !newFolder && (
|
||||
{tab==='own' && currentFolderId && !newFolder && !inSharedFolder && (
|
||||
<button onClick={()=>setNewFolder(true)} style={{
|
||||
display:'flex', alignItems:'center', gap:8, marginBottom:8,
|
||||
background:'rgba(255,255,255,0.03)', border:'1px dashed rgba(255,255,255,0.15)',
|
||||
|
||||
Reference in New Issue
Block a user