feat: add sheet block (#743)

Co-authored-by: Nicolas <nicolascamara29@gmail.com>
This commit is contained in:
Jeremy 2025-02-03 13:33:48 +05:30 committed by GitHub
parent 93b02a85e1
commit 76804269c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 419 additions and 6 deletions

View file

@ -19,6 +19,7 @@ import { DocumentToolCall, DocumentToolResult } from './document';
import { CodeEditor } from './code-editor';
import { useBlock } from '@/hooks/use-block';
import equal from 'fast-deep-equal';
import { SpreadsheetEditor } from './sheet-editor';
import { ImageEditor } from './image-editor';
interface DocumentPreviewProps {
@ -43,6 +44,7 @@ export function DocumentPreview({
useEffect(() => {
const boundingBox = hitboxRef.current?.getBoundingClientRect();
if (block.documentId && boundingBox) {
setBlock((block) => ({
...block,
@ -256,6 +258,12 @@ const DocumentContent = ({ document }: { document: Document }) => {
<CodeEditor {...commonProps} onSaveContent={() => {}} />
</div>
</div>
) : document.kind === 'sheet' ? (
<div className="flex flex-1 relative size-full p-4">
<div className="absolute inset-0">
<SpreadsheetEditor {...commonProps} />
</div>
</div>
) : document.kind === 'image' ? (
<ImageEditor
title={document.title}