|
|
@ -1,16 +1,14 @@ |
|
|
|
import { useEffect, useState } from 'react'; |
|
|
|
import { useEffect, useState } from 'react'; |
|
|
|
import { Box, IconButton } from '@mui/material'; |
|
|
|
import { Box } from '@mui/material'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
Add as AddIcon, |
|
|
|
Add as AddIcon, |
|
|
|
Check as CheckIcon, |
|
|
|
Check as CheckIcon, |
|
|
|
Edit as EditIcon, |
|
|
|
Edit as EditIcon, |
|
|
|
} from '@mui/icons-material'; |
|
|
|
} from '@mui/icons-material'; |
|
|
|
import { styled } from '@mui/material/styles'; |
|
|
|
|
|
|
|
import EventEmitter from 'events'; |
|
|
|
import EventEmitter from 'events'; |
|
|
|
|
|
|
|
|
|
|
|
import API_BASE_URL from '../../lib/consts/API_BASE_URL'; |
|
|
|
import API_BASE_URL from '../../lib/consts/API_BASE_URL'; |
|
|
|
import { BLUE } from '../../lib/consts/DEFAULT_THEME'; |
|
|
|
import { BLUE } from '../../lib/consts/DEFAULT_THEME'; |
|
|
|
import ICON_BUTTON_STYLE from '../../lib/consts/ICON_BUTTON_STYLE'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import FileEditForm from './FileEditForm'; |
|
|
|
import FileEditForm from './FileEditForm'; |
|
|
|
import FileList from './FileList'; |
|
|
|
import FileList from './FileList'; |
|
|
@ -21,8 +19,7 @@ import Spinner from '../Spinner'; |
|
|
|
import { HeaderText } from '../Text'; |
|
|
|
import { HeaderText } from '../Text'; |
|
|
|
|
|
|
|
|
|
|
|
import fetchJSON from '../../lib/fetchers/fetchJSON'; |
|
|
|
import fetchJSON from '../../lib/fetchers/fetchJSON'; |
|
|
|
|
|
|
|
import IconButton from '../IconButton'; |
|
|
|
const StyledIconButton = styled(IconButton)(ICON_BUTTON_STYLE); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Files = (): JSX.Element => { |
|
|
|
const Files = (): JSX.Element => { |
|
|
|
const [rawFilesOverview, setRawFilesOverview] = useState<string[][]>([]); |
|
|
|
const [rawFilesOverview, setRawFilesOverview] = useState<string[][]>([]); |
|
|
@ -108,13 +105,13 @@ const Files = (): JSX.Element => { |
|
|
|
> |
|
|
|
> |
|
|
|
<HeaderText text="Files" /> |
|
|
|
<HeaderText text="Files" /> |
|
|
|
{!isEditMode && ( |
|
|
|
{!isEditMode && ( |
|
|
|
<StyledIconButton onClick={onAddFileButtonClick}> |
|
|
|
<IconButton onClick={onAddFileButtonClick}> |
|
|
|
<AddIcon /> |
|
|
|
<AddIcon /> |
|
|
|
</StyledIconButton> |
|
|
|
</IconButton> |
|
|
|
)} |
|
|
|
)} |
|
|
|
<StyledIconButton onClick={onEditFileButtonClick}> |
|
|
|
<IconButton onClick={onEditFileButtonClick}> |
|
|
|
{isEditMode ? <CheckIcon sx={{ color: BLUE }} /> : <EditIcon />} |
|
|
|
{isEditMode ? <CheckIcon sx={{ color: BLUE }} /> : <EditIcon />} |
|
|
|
</StyledIconButton> |
|
|
|
</IconButton> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
{fetchRawFilesError && ( |
|
|
|
{fetchRawFilesError && ( |
|
|
|
<MessageBox text={fetchRawFilesError} type="error" /> |
|
|
|
<MessageBox text={fetchRawFilesError} type="error" /> |
|
|
|