mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
7ba7d6bf25
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
752 B
TypeScript
26 lines
752 B
TypeScript
import { useConfirmModalStore } from '../store/confirmModalStore';
|
|
import ConfirmModal from './ConfirmModal';
|
|
|
|
/**
|
|
* App-level singleton renderer for the global confirm modal. Mount once
|
|
* in App.tsx; any code path can then call
|
|
* `useConfirmModalStore.getState().request(...)` and await the user's decision.
|
|
*/
|
|
export default function GlobalConfirmModal() {
|
|
const { isOpen, title, message, confirmLabel, cancelLabel, danger, confirm, cancel } =
|
|
useConfirmModalStore();
|
|
|
|
return (
|
|
<ConfirmModal
|
|
open={isOpen}
|
|
title={title}
|
|
message={message}
|
|
confirmLabel={confirmLabel}
|
|
cancelLabel={cancelLabel}
|
|
danger={danger}
|
|
onConfirm={confirm}
|
|
onCancel={cancelLabel ? cancel : undefined}
|
|
/>
|
|
);
|
|
}
|