Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change message when deleting a file #366

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/components/Application/Dialogs/DeleteFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export default function DeleteFileDialog() {
<ConfirmDialog
open={true}
title="Delete File"
label="Delete"
label="OK"
Icon={DeleteIcon}
description={`You are deleting "${path}". Are you sure?`}
description={'Are you sure you want to delete this file?'}
onCancel={() => updateState({ dialog: undefined })}
onConfirm={async () => {
await deleteFile(path)
Expand Down
26 changes: 26 additions & 0 deletions client/components/Parts/Buttons/SimpleButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Typography from '@mui/material/Typography'
import Button, { ButtonProps } from '@mui/material/Button'

interface SimpleButtonProps extends ButtonProps {
label?: string
small?: boolean
}

export default function SimpleButton(props: SimpleButtonProps) {
const { label, small, ...others } = props
return (
<Button
fullWidth={!props.small}
color={props.color}
{...others}
>
{small ? (
<Typography sx={{ fontWeight: 300, textTransform: 'capitalize' }}>
{label}
</Typography>
) : (
label
)}
</Button>
)
}
14 changes: 5 additions & 9 deletions client/components/Parts/Dialogs/Confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import Box from '@mui/material/Box'
import Dialog from '@mui/material/Dialog'
import DialogTitle from '@mui/material/DialogTitle'
import DialogContent from '@mui/material/DialogContent'
import Cancel from '@mui/icons-material/Cancel'
import CheckCircleIcon from '@mui/icons-material/CheckCircle'
import IconButton from '..//Buttons/Icon'
import SimpleButton from '../Buttons/SimpleButton'
import Columns from '../Grids/Columns'

export interface ConfirmDialogProps {
Expand Down Expand Up @@ -57,20 +55,18 @@ export default function ConfirmDialog(props: ConfirmDialogProps) {
</DialogContent>
<Box sx={{ paddingX: 3, paddingY: 1 }}>
<Columns spacing={2}>
<IconButton
<SimpleButton
fullWidth
label={`${props.cancelLabel || 'Cancel'} [Esc]`}
label={`${props.cancelLabel || 'Cancel'}`}
sx={{ my: 0.5 }}
onClick={handleCancel}
aria-label="cancel"
color="warning"
variant="contained"
Icon={Cancel}
/>
<IconButton
<SimpleButton
fullWidth
label={`${props.label || 'Confirm'} [${props.ctrlEnter ? 'Ctrl+' : ''}Enter]`}
Icon={props.Icon || CheckCircleIcon}
label={`${props.label || 'Confirm'}`}
sx={{ my: 0.5 }}
onClick={handleConfirm}
aria-label="accept"
Expand Down
Loading