- Added a new task store in `src-react/stores/task.ts` to manage tasks and their statuses. - Implemented functions for creating, executing, and retrying tasks, along with handling task progress and completion. - Introduced persistence for tasks using IPC. - Created utility functions for normalizing room types and building subtasks. - Added a new CSS file for global styles in `src-react/styles.css`. - Created runtime types in `src-react/types/runtime.ts` and exported them. - Updated the main entry points for Vue and React applications to support dynamic framework loading. - Refactored chat model interfaces and utility functions into `src/shared/chat-model.ts`. - Updated TypeScript configuration to include paths for React components and types. - Enhanced Vite configuration to support both Vue and React frameworks.
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import type { ReactNode } from 'react';
|
|
|
|
type DialogSurfaceProps = {
|
|
open: boolean;
|
|
title: string;
|
|
widthClassName?: string;
|
|
onClose: () => void;
|
|
children: ReactNode;
|
|
};
|
|
|
|
export default function DialogSurface({
|
|
open,
|
|
title,
|
|
widthClassName = 'max-w-[560px]',
|
|
onClose,
|
|
children,
|
|
}: DialogSurfaceProps) {
|
|
if (!open) return null;
|
|
|
|
return (
|
|
<div
|
|
className="fixed inset-0 z-50 flex items-center justify-center bg-black/45 px-4 py-6 backdrop-blur-[2px]"
|
|
onClick={onClose}
|
|
>
|
|
<div
|
|
className={[
|
|
'w-full rounded-[20px] bg-[#F4F3EB] shadow-[0_25px_50px_-12px_rgba(0,0,0,0.2)] dark:bg-[#1f1f22]',
|
|
widthClassName,
|
|
].join(' ')}
|
|
onClick={(event) => event.stopPropagation()}
|
|
>
|
|
<div className="flex items-start justify-between border-b border-black/6 px-6 py-5 dark:border-white/6">
|
|
<h2
|
|
className="text-[20px] font-normal tracking-tight text-[#171717] dark:text-[#f3f4f6]"
|
|
style={{ fontFamily: "Georgia, Cambria, 'Times New Roman', Times, serif" }}
|
|
>
|
|
{title}
|
|
</h2>
|
|
|
|
<button
|
|
type="button"
|
|
className="mt-0.5 rounded-full p-1 text-[#99A0AE] transition-colors hover:text-[#171717] dark:hover:text-[#f3f4f6]"
|
|
onClick={onClose}
|
|
aria-label="关闭弹窗"
|
|
>
|
|
<svg viewBox="0 0 24 24" className="h-5 w-5 fill-none stroke-current" strokeWidth="1.8">
|
|
<path d="M6 6L18 18M18 6L6 18" strokeLinecap="round" />
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
|
|
<div className="px-6 pb-6 pt-5">{children}</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|