import BackIcon from '@mui/icons-material/ArrowBack'; import NavigateNextIcon from '@mui/icons-material/NavigateNext'; import ReplayIcon from '@mui/icons-material/Replay'; import { AppBar, Backdrop, Box, Button, Grid, Stack, Toolbar, Typography } from '@mui/material'; import { FC, useState } from 'react'; import { useData } from '../../contexts/DataContext'; import { useRouter } from '../../routers/Router'; const ListPage: FC = () => { const { navigate, getProps } = useRouter(); const { list, isLoading, refresh } = useData(); const { path: _path } = getProps() as { path: string }; const [path, setPath] = useState(_path ?? '/'); return ( {path != '/' ? ( <> {path.split('/').slice(-2, -1)} ) : ( Files )} {isLoading ? ( theme.zIndex.drawer + 1 }} open> Loading... ) : ( {list.map((entry) => ( { if (entry.type === 'directory') { setPath(`${path}${entry.name}/`); refresh(`${path}${entry.name}/`); } if (entry.type === 'file') navigate('/file', { path, entry }); }} container padding={1} height={73} > {entry.type === 'file' && ( )} {entry.name} {entry.type === 'directory' && ( )} ))} )} ); }; export default ListPage;