change path of files
This commit is contained in:
parent
35ff9e643d
commit
8c80cef8d0
@ -13,7 +13,7 @@ const SelectorItem = ({ file, clickHandler }) => {
|
|||||||
<Card shadow="sm">
|
<Card shadow="sm">
|
||||||
<Card.Section>
|
<Card.Section>
|
||||||
<Image
|
<Image
|
||||||
src={"/api/file/"+file.id}
|
src={"/api/files/"+file.id}
|
||||||
alt={file.name}
|
alt={file.name}
|
||||||
height={100}
|
height={100}
|
||||||
fit="cover"
|
fit="cover"
|
||||||
|
@ -27,15 +27,7 @@ const ModalAddFile = ({ opened, handler, addFiles }) => {
|
|||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
const CHUNK_SIZE = 1 * 1024 * 1024; // 1MB chunks
|
const CHUNK_SIZE = 1 * 1024 * 1024; // 1MB chunks
|
||||||
|
|
||||||
files.forEach((file, index) => {
|
files.forEach((file) => formData.append(`${file.name}`, file, file.name));
|
||||||
const totalChunks = Math.ceil(file.size / CHUNK_SIZE);
|
|
||||||
|
|
||||||
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
|
API.files
|
||||||
.upload(formData)
|
.upload(formData)
|
||||||
|
@ -13,7 +13,7 @@ const FileView = ({ file, onSelect, onDelete, ...props }) => {
|
|||||||
return (
|
return (
|
||||||
<Card shadow="sm" padding="md" withBorder>
|
<Card shadow="sm" padding="md" withBorder>
|
||||||
<Card.Section>
|
<Card.Section>
|
||||||
<Image src={'/api/file/' + file?.id ?? ''} alt={file?.name ?? ''} withPlaceholder fit="contain" />
|
<Image src={'/api/files/' + file?.id ?? ''} alt={file?.name ?? ''} withPlaceholder fit="contain" />
|
||||||
</Card.Section>
|
</Card.Section>
|
||||||
<Text>{file?.name ?? 'File Name'}</Text>
|
<Text>{file?.name ?? 'File Name'}</Text>
|
||||||
<Group position="center" grow>
|
<Group position="center" grow>
|
||||||
|
@ -150,7 +150,7 @@ const Content = ({ form, playlistId, playlist }) => {
|
|||||||
<Paper p="xs" radius="sm" shadow="sm" withBorder spacing="xs" style={{ width: '90%' }}>
|
<Paper p="xs" radius="sm" shadow="sm" withBorder spacing="xs" style={{ width: '90%' }}>
|
||||||
<Flex direction="row" align="center" gap="lg" justify="flex-end">
|
<Flex direction="row" align="center" gap="lg" justify="flex-end">
|
||||||
<Text>{form.getInputProps(`files.${index}.name`).value}</Text>
|
<Text>{form.getInputProps(`files.${index}.name`).value}</Text>
|
||||||
<Image width={150} src={'/api/file/' + form.getInputProps(`files.${index}.id`).value} />
|
<Image width={150} src={'/api/files/' + form.getInputProps(`files.${index}.id`).value} />
|
||||||
<NumberInput
|
<NumberInput
|
||||||
required
|
required
|
||||||
hideControls
|
hideControls
|
||||||
@ -177,7 +177,7 @@ const Content = ({ form, playlistId, playlist }) => {
|
|||||||
<Paper p="xs" radius="sm" shadow="sm" withBorder spacing="xs" style={{ width: '90%' }}>
|
<Paper p="xs" radius="sm" shadow="sm" withBorder spacing="xs" style={{ width: '90%' }}>
|
||||||
<Flex direction="row" align="center" gap="lg" justify="flex-end">
|
<Flex direction="row" align="center" gap="lg" justify="flex-end">
|
||||||
<Text>{form.getInputProps(`files.${index}.name`).value}</Text>
|
<Text>{form.getInputProps(`files.${index}.name`).value}</Text>
|
||||||
<Image width={150} src={'/api/file/' + form.getInputProps(`files.${index}.id`).value} />
|
<Image width={150} src={'/api/files/' + form.getInputProps(`files.${index}.id`).value} />
|
||||||
<Text>Display time: {parseTime(form.getInputProps(`files.${index}.seconds`).value)}</Text>
|
<Text>Display time: {parseTime(form.getInputProps(`files.${index}.seconds`).value)}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
@ -8,7 +8,7 @@ import { Button } from '@mantine/core';
|
|||||||
import GrantAccess, { Perm } from '../../tools/grant-access';
|
import GrantAccess, { Perm } from '../../tools/grant-access';
|
||||||
|
|
||||||
const Playlists = () => {
|
const Playlists = () => {
|
||||||
const [showCreate, setShowCreate] = useState(true);
|
const [showCreate, setShowCreate] = useState(false);
|
||||||
const [showUpdate, setShowUpdate] = useState(false);
|
const [showUpdate, setShowUpdate] = useState(false);
|
||||||
const [, setItem] = useState({});
|
const [, setItem] = useState({});
|
||||||
const [page, setPage] = useState(0);
|
const [page, setPage] = useState(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user