refactor(offline): make both export types as optional
This commit is contained in:
parent
b6a84dedbe
commit
b7410c7d33
@ -2,7 +2,7 @@ import { PropsWithChildren } from 'react'
|
|||||||
import styles from './style.module.scss'
|
import styles from './style.module.scss'
|
||||||
|
|
||||||
interface ButtonUnderlineProps {
|
interface ButtonUnderlineProps {
|
||||||
onClick: () => void
|
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void
|
||||||
disabled?: boolean | undefined
|
disabled?: boolean | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import { CurrentUserFile } from '../../types/file.ts'
|
import React from 'react'
|
||||||
import styles from './style.module.scss'
|
|
||||||
import { Button, Menu, MenuItem } from '@mui/material'
|
import { Button, Menu, MenuItem } from '@mui/material'
|
||||||
|
import PopupState, { bindTrigger, bindMenu } from 'material-ui-popup-state'
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||||
import { faCheck } from '@fortawesome/free-solid-svg-icons'
|
import { faCheck } from '@fortawesome/free-solid-svg-icons'
|
||||||
import PopupState, { bindTrigger, bindMenu } from 'material-ui-popup-state'
|
import { CurrentUserFile } from '../../types/file.ts'
|
||||||
import React from 'react'
|
import styles from './style.module.scss'
|
||||||
|
|
||||||
interface FileListProps {
|
interface FileListProps {
|
||||||
files: CurrentUserFile[]
|
files: CurrentUserFile[]
|
||||||
currentFile: CurrentUserFile
|
currentFile: CurrentUserFile
|
||||||
setCurrentFile: (file: CurrentUserFile) => void
|
setCurrentFile: (file: CurrentUserFile) => void
|
||||||
handleExport: () => void
|
handleExport?: () => void
|
||||||
handleEncryptedExport?: () => void
|
handleEncryptedExport?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,34 +45,40 @@ const FileList = ({
|
|||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<PopupState variant="popover" popupId="download-popup-menu">
|
{(typeof handleExport === 'function' ||
|
||||||
{(popupState) => (
|
typeof handleEncryptedExport === 'function') && (
|
||||||
<React.Fragment>
|
<PopupState variant="popover" popupId="download-popup-menu">
|
||||||
<Button variant="contained" {...bindTrigger(popupState)}>
|
{(popupState) => (
|
||||||
Export files
|
<React.Fragment>
|
||||||
</Button>
|
<Button variant="contained" {...bindTrigger(popupState)}>
|
||||||
<Menu {...bindMenu(popupState)}>
|
Export files
|
||||||
<MenuItem
|
</Button>
|
||||||
onClick={() => {
|
<Menu {...bindMenu(popupState)}>
|
||||||
popupState.close
|
{typeof handleExport === 'function' && (
|
||||||
handleExport()
|
<MenuItem
|
||||||
}}
|
onClick={() => {
|
||||||
>
|
popupState.close
|
||||||
Export Files
|
handleExport()
|
||||||
</MenuItem>
|
}}
|
||||||
<MenuItem
|
>
|
||||||
onClick={() => {
|
Export Files
|
||||||
popupState.close
|
</MenuItem>
|
||||||
typeof handleEncryptedExport === 'function' &&
|
)}
|
||||||
handleEncryptedExport()
|
{typeof handleEncryptedExport === 'function' && (
|
||||||
}}
|
<MenuItem
|
||||||
>
|
onClick={() => {
|
||||||
Export Encrypted Files
|
popupState.close
|
||||||
</MenuItem>
|
handleEncryptedExport()
|
||||||
</Menu>
|
}}
|
||||||
</React.Fragment>
|
>
|
||||||
)}
|
Export Encrypted Files
|
||||||
</PopupState>
|
</MenuItem>
|
||||||
|
)}
|
||||||
|
</Menu>
|
||||||
|
</React.Fragment>
|
||||||
|
)}
|
||||||
|
</PopupState>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user