Clean up editor code and reorganize contents (#478)

This commit is contained in:
Jeremy 2024-11-01 15:31:54 +05:30 committed by GitHub
parent b3aa3cb18a
commit 5190b109c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 475 additions and 444 deletions

View file

@ -19,8 +19,8 @@ const getActionText = (type: 'create' | 'update' | 'request-suggestions') => {
interface DocumentToolResultProps {
type: 'create' | 'update' | 'request-suggestions';
result: any;
canvas: UICanvas | null;
setCanvas: (value: SetStateAction<UICanvas | null>) => void;
canvas: UICanvas;
setCanvas: (value: SetStateAction<UICanvas>) => void;
}
export function DocumentToolResult({
@ -42,27 +42,14 @@ export function DocumentToolResult({
height: rect.height,
};
if (!canvas) {
setCanvas({
documentId: result.id,
content: '',
title: result.title,
isVisible: true,
status: 'idle',
boundingBox,
});
} else {
if (canvas.documentId !== result.id) {
setCanvas({
documentId: result.id,
content: '',
title: result.title,
isVisible: true,
status: 'idle',
boundingBox,
});
}
}
setCanvas({
documentId: result.id,
content: '',
title: result.title,
isVisible: true,
status: 'idle',
boundingBox,
});
}}
>
<div className="text-muted-foreground mt-1">