mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 16:59:50 +03:00
v3.7.2
This commit is contained in:
@@ -10,7 +10,7 @@ import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
import './dragNdrop.css';
|
||||
|
||||
const DragNdrop = ({ onFileSelected }) => {
|
||||
const DragNdrop = ({ text, onFileSelected }) => {
|
||||
const [file, setFile] = useState<File>();
|
||||
const [dragged, setDragged] = useState(false);
|
||||
const inputRef = useRef<HTMLInputElement | null>(null);
|
||||
@@ -73,7 +73,7 @@ const DragNdrop = ({ onFileSelected }) => {
|
||||
>
|
||||
<div className="upload-info">
|
||||
<CloudUploadIcon sx={{ marginRight: 4 }} color="primary" fontSize="large" />
|
||||
<p>{LL.UPLOAD_DRAG()}</p>
|
||||
<p>{text}</p>
|
||||
</div>
|
||||
|
||||
<input
|
||||
|
||||
23
interface/src/components/upload/LinearProgressWithLabel.tsx
Normal file
23
interface/src/components/upload/LinearProgressWithLabel.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import {
|
||||
Box,
|
||||
LinearProgress,
|
||||
type LinearProgressProps,
|
||||
Typography
|
||||
} from '@mui/material';
|
||||
|
||||
export function LinearProgressWithLabel(
|
||||
props: LinearProgressProps & { value: number }
|
||||
) {
|
||||
return (
|
||||
<Box sx={{ display: 'flex', alignItems: 'center' }}>
|
||||
<Box sx={{ width: '100%', mr: 1 }}>
|
||||
<LinearProgress variant="determinate" {...props} />
|
||||
</Box>
|
||||
<Box sx={{ minWidth: 35 }}>
|
||||
<Typography variant="body2" color="text.secondary">{`${Math.round(
|
||||
props.value
|
||||
)}%`}</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -2,13 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
LinearProgress,
|
||||
type LinearProgressProps,
|
||||
Typography
|
||||
} from '@mui/material';
|
||||
import { Box, Button, Typography } from '@mui/material';
|
||||
|
||||
import * as SystemApi from 'api/system';
|
||||
|
||||
@@ -16,23 +10,9 @@ import { useRequest } from 'alova/client';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
import DragNdrop from './DragNdrop';
|
||||
import { LinearProgressWithLabel } from './LinearProgressWithLabel';
|
||||
|
||||
function LinearProgressWithLabel(props: LinearProgressProps & { value: number }) {
|
||||
return (
|
||||
<Box sx={{ display: 'flex', alignItems: 'center' }}>
|
||||
<Box sx={{ width: '100%', mr: 1 }}>
|
||||
<LinearProgress variant="determinate" {...props} />
|
||||
</Box>
|
||||
<Box sx={{ minWidth: 35 }}>
|
||||
<Typography variant="body2" color="text.secondary">{`${Math.round(
|
||||
props.value
|
||||
)}%`}</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
const SingleUpload = ({ doRestart }) => {
|
||||
const SingleUpload = ({ text, doRestart }) => {
|
||||
const [md5, setMd5] = useState<string>();
|
||||
const [file, setFile] = useState<File>();
|
||||
const { LL } = useI18nContext();
|
||||
@@ -93,7 +73,7 @@ const SingleUpload = ({ doRestart }) => {
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<DragNdrop onFileSelected={setFile} />
|
||||
<DragNdrop text={text} onFileSelected={setFile} />
|
||||
)}
|
||||
|
||||
{md5 && (
|
||||
|
||||
Reference in New Issue
Block a user