mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-01 20:16:36 +08:00
refactor: split modules and harden scraping workflows
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { AlertTriangle } from 'lucide-react'
|
||||
|
||||
type ConfirmOptions = {
|
||||
export type ConfirmOptions = {
|
||||
title?: string
|
||||
message: string
|
||||
confirmText?: string
|
||||
@@ -9,21 +8,7 @@ type ConfirmOptions = {
|
||||
danger?: boolean
|
||||
}
|
||||
|
||||
export function confirmAction(options: ConfirmOptions): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
const host = document.createElement('div')
|
||||
document.body.appendChild(host)
|
||||
const root = createRoot(host)
|
||||
const close = (value: boolean) => {
|
||||
root.unmount()
|
||||
host.remove()
|
||||
resolve(value)
|
||||
}
|
||||
root.render(<ConfirmDialog options={options} onClose={close} />)
|
||||
})
|
||||
}
|
||||
|
||||
function ConfirmDialog({
|
||||
export function ConfirmDialog({
|
||||
options,
|
||||
onClose,
|
||||
}: {
|
||||
|
||||
Reference in New Issue
Block a user