mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-22 16:58:28 +02:00
Tweak workspace settings and a bunch of small things
This commit is contained in:
@@ -6,28 +6,29 @@ import { showDialog } from './dialog';
|
||||
type ConfirmArgs = {
|
||||
id: string;
|
||||
} & Pick<DialogProps, 'title' | 'description'> &
|
||||
Pick<ConfirmProps, 'color' | 'confirmText'>;
|
||||
Pick<ConfirmProps, 'color' | 'confirmText' | 'requireTyping'>;
|
||||
|
||||
export async function showConfirm({ id, title, description, color, confirmText }: ConfirmArgs) {
|
||||
export async function showConfirm({
|
||||
color,
|
||||
confirmText,
|
||||
requireTyping,
|
||||
...extraProps
|
||||
}: ConfirmArgs) {
|
||||
return new Promise((onResult: ConfirmProps['onResult']) => {
|
||||
showDialog({
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
...extraProps,
|
||||
hideX: true,
|
||||
size: 'sm',
|
||||
disableBackdropClose: true, // Prevent accidental dismisses
|
||||
render: ({ hide }) => Confirm({ onHide: hide, color, onResult, confirmText }),
|
||||
render: ({ hide }) => Confirm({ onHide: hide, color, onResult, confirmText, requireTyping }),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export async function showConfirmDelete({ id, title, description }: ConfirmArgs) {
|
||||
export async function showConfirmDelete({ confirmText, color, ...extraProps }: ConfirmArgs) {
|
||||
return showConfirm({
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
color: 'danger',
|
||||
confirmText: 'Delete',
|
||||
color: color ?? 'danger',
|
||||
confirmText: confirmText ?? 'Delete',
|
||||
...extraProps,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user