-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ruiyi.jiang <[email protected]>
- Loading branch information
1 parent
7763c98
commit 2fb4f2b
Showing
9 changed files
with
121 additions
and
8 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,5 @@ export type IconsType = | |
| 'source' | ||
| 'edit' | ||
| 'database' | ||
| 'uploadFile'; | ||
| 'uploadFile' | ||
| 'compact'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { FC, useContext } from 'react'; | ||
import { Typography, makeStyles, Theme } from '@material-ui/core'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { rootContext } from '@/context'; | ||
import DialogTemplate from '@/components/customDialog/DialogTemplate'; | ||
import { CompactDialogProps } from './Types'; | ||
import { CollectionHttp } from '@/http'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
desc: { | ||
margin: '8px 0 16px 0', | ||
maxWidth: '500px' | ||
}, | ||
dialog: {}, | ||
})); | ||
|
||
const CompactDialog: FC<CompactDialogProps> = props => { | ||
const { cb, collectionName } = props; | ||
|
||
const classes = useStyles(); | ||
|
||
const { handleCloseDialog } = useContext(rootContext); | ||
const { t: dialogTrans } = useTranslation('dialog'); | ||
const { t: warningTrans } = useTranslation('warning'); | ||
const { t: collectionTrans } = useTranslation('collection'); | ||
const { t: btnTrans } = useTranslation('btn'); | ||
|
||
const handleConfirm = async () => { | ||
const res = await CollectionHttp.compact(collectionName); | ||
console.log('compact', res); | ||
|
||
handleCloseDialog(); | ||
cb && cb(); | ||
}; | ||
|
||
const disabled = false; | ||
|
||
return ( | ||
<DialogTemplate | ||
dialogClass={classes.dialog} | ||
title={dialogTrans('compact', { | ||
type: collectionName, | ||
})} | ||
handleClose={handleCloseDialog} | ||
children={ | ||
<> | ||
<Typography variant="body1" component="p" className={classes.desc} dangerouslySetInnerHTML={{ | ||
__html: collectionTrans('compactDialogInfo'), | ||
}}> | ||
</Typography> | ||
</> | ||
} | ||
confirmLabel={btnTrans('confirm')} | ||
handleConfirm={handleConfirm} | ||
confirmDisabled={disabled} | ||
/> | ||
); | ||
}; | ||
|
||
export default CompactDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters