Rollback frontend and config changes to commit a9a7e98 state.
Publish Docker image / build-and-push (push) Successful in 2m12s
Publish Docker image / build-and-push (push) Successful in 2m12s
Restore project files to match the requested baseline before subsequent updates. Made-with: Cursor
This commit is contained in:
@@ -1,11 +1,3 @@
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
/**
|
||||
* FormModal - модальное окно с формой
|
||||
* Простой подход со встроенным backdrop (как в HistoryModal)
|
||||
@@ -26,6 +18,8 @@ function FormModal({
|
||||
size = 'md',
|
||||
centered = false
|
||||
}) {
|
||||
if (!show) return null;
|
||||
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
onSubmit?.(e);
|
||||
@@ -42,34 +36,67 @@ function FormModal({
|
||||
}
|
||||
};
|
||||
|
||||
const sizeClass = size === 'sm' ? 'sm:max-w-md' : size === 'lg' ? 'sm:max-w-2xl' : size === 'xl' ? 'sm:max-w-4xl' : 'sm:max-w-lg';
|
||||
const handleBackdropClick = (e) => {
|
||||
if (e.target === e.currentTarget) {
|
||||
onClose?.();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={show} onOpenChange={(next) => !next && onClose?.()}>
|
||||
<DialogContent className={sizeClass} onEscapeKeyDown={handleKeyDown}>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="py-4">{children}</div>
|
||||
<DialogFooter className={centered ? 'justify-center' : ''}>
|
||||
<Button type="button" variant="outline" onClick={onClose} disabled={loading}>
|
||||
{CancelIcon && <CancelIcon className="mr-2 size-4" />}
|
||||
{cancelLabel}
|
||||
</Button>
|
||||
<Button
|
||||
type="submit"
|
||||
variant={submitVariant === 'danger' ? 'destructive' : 'default'}
|
||||
disabled={loading || disabled}
|
||||
>
|
||||
{loading && <span className="mr-2 size-4 animate-spin rounded-full border-2 border-current border-t-transparent" />}
|
||||
{!loading && SubmitIcon && <SubmitIcon className="mr-2 size-4" />}
|
||||
{submitLabel}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
<>
|
||||
{/* Modal Backdrop */}
|
||||
<div className="modal-backdrop show" onClick={handleBackdropClick} />
|
||||
|
||||
{/* Modal */}
|
||||
<div
|
||||
className="modal show d-block"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
tabIndex={-1}
|
||||
onKeyDown={handleKeyDown}
|
||||
>
|
||||
<div
|
||||
className={`modal-dialog${size !== 'md' ? ` modal-${size}` : ''}${centered ? ' modal-dialog-centered' : ''}`}
|
||||
role="document"
|
||||
>
|
||||
<div className="modal-content" tabIndex={-1}>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="modal-header">
|
||||
<h5 className="modal-title">{title}</h5>
|
||||
<button type="button" className="btn-close" onClick={onClose} aria-label="Закрыть" />
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
{children}
|
||||
</div>
|
||||
|
||||
<div className="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
onClick={onClose}
|
||||
disabled={loading}
|
||||
>
|
||||
{CancelIcon && <CancelIcon className="me-2" size={16} />}
|
||||
{cancelLabel}
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className={`btn btn-${submitVariant}`}
|
||||
disabled={loading || disabled}
|
||||
>
|
||||
{loading && (
|
||||
<span className="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true" />
|
||||
)}
|
||||
{!loading && SubmitIcon && <SubmitIcon className="me-2" size={16} />}
|
||||
{submitLabel}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user