Replace webpack with only esbuild, replace react with preact
reduce node_modules size to only 18M reduce js file bundle to 20%
This commit is contained in:
46
web/src/component/FileEntry.jsx
Normal file
46
web/src/component/FileEntry.jsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import * as React from 'react';
|
||||
import { useState } from "react";
|
||||
import { useNavigate } from "react-router";
|
||||
import { CalcReadableFilesize } from "./Common";
|
||||
import FileDialog from "./FileDialog";
|
||||
|
||||
function FileEntry(props) {
|
||||
const [showStatus, setShowStatus] = useState(false);
|
||||
let navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<td
|
||||
className="clickable"
|
||||
onClick={() => {
|
||||
// double click to play file and close dialog
|
||||
if (showStatus) {
|
||||
props.setPlayingFile(props.file);
|
||||
setShowStatus(false);
|
||||
return;
|
||||
}
|
||||
setShowStatus(true);
|
||||
}}
|
||||
>
|
||||
{props.file.filename}
|
||||
</td>
|
||||
<td
|
||||
className="clickable"
|
||||
onClick={() => navigate(`/folders/${props.file.folder_id}`)}
|
||||
>
|
||||
{props.file.foldername}
|
||||
</td>
|
||||
<td>
|
||||
{CalcReadableFilesize(props.file.filesize)}
|
||||
<FileDialog
|
||||
setPlayingFile={props.setPlayingFile}
|
||||
showStatus={showStatus}
|
||||
setShowStatus={setShowStatus}
|
||||
file={props.file}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
|
||||
export default FileEntry;
|
||||
Reference in New Issue
Block a user