add konva js to project + create some components with ai

This commit is contained in:
hamid zarghami
2025-11-16 16:33:54 +03:30
parent c1c6b0ebf7
commit 1a0c869101
38 changed files with 1855 additions and 42 deletions
@@ -0,0 +1,51 @@
import { DocumentUpload } from "iconsax-react";
import { useEditorStore, type ToolType } from "../../../store/editorStore";
import Button from "@/components/Button";
const DocumentUploadComponent = () => {
return (
<div className="space-y-4">
<div>
<label className="block text-sm mb-2">آپلود سند</label>
<input
type="file"
accept=".pdf,.doc,.docx"
onChange={(e) => {
const file = e.target.files?.[0];
if (file) {
const reader = new FileReader();
reader.onload = (event) => {
const fileUrl = event.target?.result as string;
const newDocument = {
id: `document-${Date.now()}`,
type: "document" as ToolType,
x: 100,
y: 100,
width: 200,
height: 250,
imageUrl: fileUrl,
};
const { addObject } = useEditorStore.getState();
addObject(newDocument);
};
reader.readAsDataURL(file);
}
}}
className="hidden"
id="document-upload"
/>
<Button
variant="outline"
onClick={() => document.getElementById("document-upload")?.click()}
className="w-full"
>
<DocumentUpload size={20} />
انتخاب سند
</Button>
</div>
</div>
);
};
export default DocumentUploadComponent;