Files
MeBox/web/src/components/confirmAction.tsx
T
truewhile a79bbb80a8 Remove unused recycle bin and add optional local file delete (#26)
Soft-delete restore/purge/list and the recycle_purge job are gone.
Admin delete now removes library index rows, with an optional
delete_files query that also deletes local media + sidecar NFO.
UI copy is renamed from 移入回收站 to 删除, with a confirm checkbox.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: truewhile <truewhile@users.noreply.github.com>
2026-09-03 14:12:52 +08:00

22 lines
718 B
TypeScript

import { createRoot } from 'react-dom/client'
import { ConfirmDialog, type ConfirmOptions, type ConfirmResult } from './ConfirmDialog'
export function confirmAction(options: ConfirmOptions): Promise<boolean> {
return confirmActionResult(options).then((result) => result.confirmed)
}
export function confirmActionResult(options: ConfirmOptions): Promise<ConfirmResult> {
return new Promise((resolve) => {
const host = document.createElement('div')
document.body.appendChild(host)
const root = createRoot(host)
const close = (value: ConfirmResult) => {
root.unmount()
host.remove()
resolve(value)
}
root.render(<ConfirmDialog options={options} onClose={close} />)
})
}