diff --git a/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/Components/ComponentPanel.tsx b/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/Components/ComponentPanel.tsx index c8ba9afad..abf81c924 100644 --- a/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/Components/ComponentPanel.tsx +++ b/apps/ai-game-creator-shell/src/view/ui-editor/components/Inspector/Components/ComponentPanel.tsx @@ -1,5 +1,5 @@ import { ChevronDown, ChevronRight, Plus, Trash2 } from 'lucide-react'; -import { useEffect, useRef, useState } from 'react'; +import { type ReactNode, useEffect, useRef, useState } from 'react'; import { ThemedModal } from '../../../../../components/modal/ThemedModal'; import type { Component } from '../../../../../features/ui-editor/types/Component'; @@ -139,64 +139,78 @@ export function ComponentPanel(props: ComponentPanelProps) {

)} {error &&

{error}

} - setReplaceConfirmationOpen(false)} - panelClassName="w-full max-w-sm rounded-2xl p-5" - > -

确认替换组件?

-

- 当前组件的配置将被新的默认组件覆盖。 -

-
- - -
-
- + setRemoveConfirmationOpen(false)} - panelClassName="w-full max-w-sm rounded-2xl p-5" - > -

确认移除组件?

-

- 当前组件配置将被移除。 -

-
- - -
-
+ onConfirm={removeComponent} + /> ); } +function ConfirmationModal({ + open, + ariaLabel, + title, + description, + confirmLabel, + confirmClassName, + onClose, + onConfirm, +}: { + open: boolean; + ariaLabel: string; + title: string; + description: ReactNode; + confirmLabel: string; + confirmClassName: string; + onClose: () => void; + onConfirm: () => void; +}) { + return ( + +

{title}

+

{description}

+
+ + +
+
+ ); +} + function componentKind(component: Component): string { if ('Image' in component) return '图片'; if ('Text' in component) return '文本';