mirror of
https://github.com/FranP-code/Reflecto.git
synced 2025-10-13 00:43:31 +00:00
feat: add AI shape utils to spaces grid preview component
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { Plus, Search } from "lucide-react";
|
import { Plus, Search } from "lucide-react";
|
||||||
import { useEffect, useMemo, useRef, useState } from "react";
|
import { useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { Tldraw } from "tldraw";
|
import { defaultShapeUtils, Tldraw } from "tldraw";
|
||||||
import { NewSpaceDialog } from "@/components/new-space-dialog";
|
import { NewSpaceDialog } from "@/components/new-space-dialog";
|
||||||
import { SpaceActions } from "@/components/space-actions";
|
import { SpaceActions } from "@/components/space-actions";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { listUserSpaceSnapshots } from "@/lib/appwrite-db";
|
import { listUserSpaceSnapshots } from "@/lib/appwrite-db";
|
||||||
import { authClient } from "@/lib/auth-client";
|
import { authClient } from "@/lib/auth-client";
|
||||||
|
import { AIImageShapeUtil, AITextResultShapeUtil } from "@/lib/tldraw/ai-shapes";
|
||||||
|
|
||||||
type SpaceCard = {
|
type SpaceCard = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -43,9 +44,9 @@ export function SpacesGrid() {
|
|||||||
try {
|
try {
|
||||||
const doc = snapshot?.document as unknown as
|
const doc = snapshot?.document as unknown as
|
||||||
| {
|
| {
|
||||||
store?: { records?: Record<string, unknown> };
|
store?: { records?: Record<string, unknown> };
|
||||||
records?: Record<string, unknown>;
|
records?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
| undefined;
|
| undefined;
|
||||||
const recs = doc?.store?.records ?? doc?.records;
|
const recs = doc?.store?.records ?? doc?.records;
|
||||||
return recs ? Object.keys(recs).length : 0;
|
return recs ? Object.keys(recs).length : 0;
|
||||||
@@ -210,6 +211,7 @@ export function SpacesGrid() {
|
|||||||
editor.updateInstanceState({ isReadonly: true });
|
editor.updateInstanceState({ isReadonly: true });
|
||||||
}}
|
}}
|
||||||
snapshot={snapshot}
|
snapshot={snapshot}
|
||||||
|
shapeUtils={[...defaultShapeUtils, AIImageShapeUtil, AITextResultShapeUtil]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user