u
This commit is contained in:
@@ -113,8 +113,9 @@ class CategoryNameDialog extends Component {
|
||||
const { open, mode = 'create' } = this.props;
|
||||
const { mode: formMode, name, bulkText, busy, error } = this.state;
|
||||
const isBulk = formMode === BULK_MODE;
|
||||
const canBulk = mode === 'create';
|
||||
const canSubmitSingle = name.trim() !== '';
|
||||
const canSubmitSingle =
|
||||
name.trim() !== '' &&
|
||||
(mode !== 'edit' || name.trim() !== (this.props.initialName ?? '').trim());
|
||||
const bulkNames = parseBulkNames(bulkText);
|
||||
const canSubmitBulk = bulkNames.length > 0;
|
||||
|
||||
@@ -157,7 +158,13 @@ class CategoryNameDialog extends Component {
|
||||
<Button
|
||||
type="submit"
|
||||
variant="contained"
|
||||
color={canSubmitSingle ? 'success' : 'inherit'}
|
||||
disabled={busy || !canSubmitSingle}
|
||||
sx={
|
||||
canSubmitSingle
|
||||
? { bgcolor: 'success.main', color: '#fff', '&:hover': { bgcolor: 'success.dark' } }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{SUBMIT_LABELS[mode]}
|
||||
</Button>
|
||||
|
||||
@@ -749,13 +749,27 @@ export default class CategoryTree extends PureComponent {
|
||||
>
|
||||
Abbrechen
|
||||
</Button>
|
||||
<Button
|
||||
onClick={this.handleConfirmRename}
|
||||
variant="contained"
|
||||
disabled={!renameValue.trim() || isSubmitting}
|
||||
>
|
||||
Speichern
|
||||
</Button>
|
||||
{(() => {
|
||||
const canSave =
|
||||
Boolean(renameValue.trim()) &&
|
||||
!isSubmitting &&
|
||||
renameValue.trim() !== (renameTarget?.name ?? '').trim();
|
||||
return (
|
||||
<Button
|
||||
onClick={this.handleConfirmRename}
|
||||
variant="contained"
|
||||
color={canSave ? 'success' : 'inherit'}
|
||||
disabled={!canSave}
|
||||
sx={
|
||||
canSave
|
||||
? { bgcolor: 'success.main', color: '#fff', '&:hover': { bgcolor: 'success.dark' } }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
Speichern
|
||||
</Button>
|
||||
);
|
||||
})()}
|
||||
</DialogActions>
|
||||
</AppDialog>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user