From 8c80cef8d060224bb65131d4b48b3bbbc39633b5 Mon Sep 17 00:00:00 2001 From: grimhilt Date: Wed, 30 Aug 2023 09:44:18 +0200 Subject: [PATCH] change path of files --- src/components/select-item.jsx | 2 +- src/pages/files/add.jsx | 10 +--------- src/pages/files/file-view.jsx | 2 +- src/pages/playlist/content.jsx | 4 ++-- src/pages/playlists/index.jsx | 2 +- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/components/select-item.jsx b/src/components/select-item.jsx index a440716..e0b409f 100644 --- a/src/components/select-item.jsx +++ b/src/components/select-item.jsx @@ -13,7 +13,7 @@ const SelectorItem = ({ file, clickHandler }) => { {file.name} { const formData = new FormData(); const CHUNK_SIZE = 1 * 1024 * 1024; // 1MB chunks - files.forEach((file, index) => { - const totalChunks = Math.ceil(file.size / CHUNK_SIZE); + files.forEach((file) => formData.append(`${file.name}`, file, file.name)); - for (let chunkIndex = 0; chunkIndex < totalChunks; chunkIndex++) { - const start = chunkIndex * CHUNK_SIZE; - const end = Math.min(start + CHUNK_SIZE, file.size); - formData.append(`${files[index].name}`, file.slice(start, end), file.name); - } - }); - API.files .upload(formData) .then((res) => { diff --git a/src/pages/files/file-view.jsx b/src/pages/files/file-view.jsx index b235210..6a407a3 100644 --- a/src/pages/files/file-view.jsx +++ b/src/pages/files/file-view.jsx @@ -13,7 +13,7 @@ const FileView = ({ file, onSelect, onDelete, ...props }) => { return ( - {file?.name + {file?.name {file?.name ?? 'File Name'} diff --git a/src/pages/playlist/content.jsx b/src/pages/playlist/content.jsx index b645e88..c8550cb 100644 --- a/src/pages/playlist/content.jsx +++ b/src/pages/playlist/content.jsx @@ -150,7 +150,7 @@ const Content = ({ form, playlistId, playlist }) => { {form.getInputProps(`files.${index}.name`).value} - + { {form.getInputProps(`files.${index}.name`).value} - + Display time: {parseTime(form.getInputProps(`files.${index}.seconds`).value)} diff --git a/src/pages/playlists/index.jsx b/src/pages/playlists/index.jsx index 343c46f..50a837f 100644 --- a/src/pages/playlists/index.jsx +++ b/src/pages/playlists/index.jsx @@ -8,7 +8,7 @@ import { Button } from '@mantine/core'; import GrantAccess, { Perm } from '../../tools/grant-access'; const Playlists = () => { - const [showCreate, setShowCreate] = useState(true); + const [showCreate, setShowCreate] = useState(false); const [showUpdate, setShowUpdate] = useState(false); const [, setItem] = useState({}); const [page, setPage] = useState(0);