diff --git a/next.config.ts b/next.config.ts index 969b7994..2160d996 100644 --- a/next.config.ts +++ b/next.config.ts @@ -4,6 +4,7 @@ const nextConfig: NextConfig = { reactStrictMode: true, output: "standalone", experimental: { + proxyClientMaxBodySize: "32mb", serverActions: { bodySizeLimit: "100mb", // Increased for large media files }, diff --git a/src/app/api/popi/media/upload/route.ts b/src/app/api/popi/media/upload/route.ts index fe6f30c4..fe92ca14 100644 --- a/src/app/api/popi/media/upload/route.ts +++ b/src/app/api/popi/media/upload/route.ts @@ -189,7 +189,6 @@ export async function POST(request: NextRequest) { ? body.fileName.trim() : `canvas-media-${Date.now()}.${extension}`; const fileName = rawFileName.includes(".") ? rawFileName : `${rawFileName}.${extension}`; - const upstream = await fetch(getPopiBaseUrl(request) + POPI_MEDIA_UPLOAD_BASE64_PATH, { method: "POST", headers: { diff --git a/src/components/GroupsOverlay.tsx b/src/components/GroupsOverlay.tsx index 43cee3e2..bd31db96 100644 --- a/src/components/GroupsOverlay.tsx +++ b/src/components/GroupsOverlay.tsx @@ -30,8 +30,58 @@ interface GroupBackgroundProps { // Renders just the group background - displayed below nodes (z-index 1) function GroupBackground({ groupId }: GroupBackgroundProps) { - const { groups } = useWorkflowStore(); + const { groups, updateGroup, moveGroupNodes } = useWorkflowStore(); const group = groups[groupId]; + const { zoom } = useViewport(); + const [isDragging, setIsDragging] = useState(false); + const dragStartRef = useRef<{ x: number; y: number } | null>(null); + + const handleBackgroundMouseDown = useCallback( + (e: React.MouseEvent) => { + if (e.button !== 0) return; + + e.stopPropagation(); + e.preventDefault(); + setIsDragging(true); + dragStartRef.current = { x: e.clientX, y: e.clientY }; + }, + [] + ); + + useEffect(() => { + if (!isDragging || !group) return; + + const handleMouseMove = (e: MouseEvent) => { + if (!dragStartRef.current) return; + + const deltaX = (e.clientX - dragStartRef.current.x) / zoom; + const deltaY = (e.clientY - dragStartRef.current.y) / zoom; + + if (Math.abs(deltaX) > 2 || Math.abs(deltaY) > 2) { + updateGroup(groupId, { + position: { + x: group.position.x + deltaX, + y: group.position.y + deltaY, + }, + }); + moveGroupNodes(groupId, { x: deltaX, y: deltaY }); + dragStartRef.current = { x: e.clientX, y: e.clientY }; + } + }; + + const handleMouseUp = () => { + setIsDragging(false); + dragStartRef.current = null; + }; + + window.addEventListener("mousemove", handleMouseMove); + window.addEventListener("mouseup", handleMouseUp); + + return () => { + window.removeEventListener("mousemove", handleMouseMove); + window.removeEventListener("mouseup", handleMouseUp); + }; + }, [isDragging, group, groupId, moveGroupNodes, updateGroup, zoom]); if (!group) return null; @@ -39,7 +89,8 @@ function GroupBackground({ groupId }: GroupBackgroundProps) { return (
); @@ -531,7 +582,7 @@ export function GroupBackgroundsPortal() { return (