fix build error
This commit is contained in:
@@ -24,6 +24,25 @@ interface DrawingElement {
|
|||||||
strokeWidth?: number;
|
strokeWidth?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Project {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
user_id: string;
|
||||||
|
created_at: string;
|
||||||
|
updated_at?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Wireframe {
|
||||||
|
id: number;
|
||||||
|
project_id: number;
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
canvas_data?: DrawingElement[];
|
||||||
|
created_at: string;
|
||||||
|
updated_at?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export default function CanvasPage() {
|
export default function CanvasPage() {
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const canvasRef = useRef<HTMLCanvasElement>(null);
|
const canvasRef = useRef<HTMLCanvasElement>(null);
|
||||||
@@ -34,9 +53,9 @@ export default function CanvasPage() {
|
|||||||
const [generatedImageUrl, setGeneratedImageUrl] = useState<string | null>(null);
|
const [generatedImageUrl, setGeneratedImageUrl] = useState<string | null>(null);
|
||||||
const [isGenerating, setIsGenerating] = useState(false);
|
const [isGenerating, setIsGenerating] = useState(false);
|
||||||
const [elements, setElements] = useState<DrawingElement[]>([]);
|
const [elements, setElements] = useState<DrawingElement[]>([]);
|
||||||
const [currentProject, setCurrentProject] = useState<any>(null);
|
const [currentProject, setCurrentProject] = useState<Project | null>(null);
|
||||||
const [currentWireframe, setCurrentWireframe] = useState<any>(null);
|
const [currentWireframe, setCurrentWireframe] = useState<Wireframe | null>(null);
|
||||||
const [projects, setProjects] = useState<any[]>([]);
|
const [projects, setProjects] = useState<Project[]>([]);
|
||||||
const [wireframeName, setWireframeName] = useState("Untitled Wireframe");
|
const [wireframeName, setWireframeName] = useState("Untitled Wireframe");
|
||||||
const [isSaving, setIsSaving] = useState(false);
|
const [isSaving, setIsSaving] = useState(false);
|
||||||
|
|
||||||
@@ -211,9 +230,9 @@ export default function CanvasPage() {
|
|||||||
if (userProjects && userProjects.length > 0) {
|
if (userProjects && userProjects.length > 0) {
|
||||||
setProjects(userProjects);
|
setProjects(userProjects);
|
||||||
// Use specified project or first one
|
// Use specified project or first one
|
||||||
let project;
|
let project: Project | undefined;
|
||||||
if (projectIdFromUrl) {
|
if (projectIdFromUrl) {
|
||||||
project = userProjects.find(p => p.id === parseInt(projectIdFromUrl));
|
project = userProjects.find((p: Project) => p.id === parseInt(projectIdFromUrl));
|
||||||
}
|
}
|
||||||
if (!project) {
|
if (!project) {
|
||||||
project = userProjects[0];
|
project = userProjects[0];
|
||||||
|
|||||||
@@ -9,8 +9,17 @@ import { Label } from "@/components/ui/label";
|
|||||||
import { Plus, Folder } from "lucide-react";
|
import { Plus, Folder } from "lucide-react";
|
||||||
import { entities, auth } from "@/lib/nvwa";
|
import { entities, auth } from "@/lib/nvwa";
|
||||||
|
|
||||||
|
interface Project {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
user_id: string;
|
||||||
|
created_at: string;
|
||||||
|
updated_at?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
const [projects, setProjects] = useState([]);
|
const [projects, setProjects] = useState<Project[]>([]);
|
||||||
const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false);
|
const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false);
|
||||||
const [newProjectName, setNewProjectName] = useState("");
|
const [newProjectName, setNewProjectName] = useState("");
|
||||||
const [newProjectDescription, setNewProjectDescription] = useState("");
|
const [newProjectDescription, setNewProjectDescription] = useState("");
|
||||||
@@ -62,7 +71,7 @@ export default function HomePage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const openProject = (projectId) => {
|
const openProject = (projectId: number) => {
|
||||||
navigate(`/canvas?projectId=${projectId}`);
|
navigate(`/canvas?projectId=${projectId}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user