"use client" import { useState } from "react" import { motion } from "framer-motion" import { FrameComponent } from "./FrameComponent" import { Slider } from "@/components/ui/slider" import { Button } from "@/components/ui/button" import { Switch } from "@/components/ui/switch" const GRID_SIZE = 12 const CELL_SIZE = 60 // pixels per grid cell interface Frame { id: number video: string defaultPos: { x: number; y: number; w: number; h: number } corner: string edgeHorizontal: string edgeVertical: string mediaSize: number borderThickness: number borderSize: number autoplayMode: "all" | "hover" isHovered: boolean } const initialFrames: Frame[] = [ { id: 1, video: "https://static.cdn-luma.com/files/981e483f71aa764b/Company%20Thing%20Exported.mp4", defaultPos: { x: 0, y: 0, w: 4, h: 4 }, corner: "https://static.cdn-luma.com/files/bcf576df9c38b05f/1_corner_update.png", edgeHorizontal: "https://static.cdn-luma.com/files/bcf576df9c38b05f/1_vert_update.png", edgeVertical: "https://static.cdn-luma.com/files/bcf576df9c38b05f/1_hori_update.png", mediaSize: 1, borderThickness: 0, borderSize: 80, autoplayMode: "all", isHovered: false, }, { id: 2, video: "https://static.cdn-luma.com/files/58ab7363888153e3/WebGL%20Exported%20(1).mp4", defaultPos: { x: 4, y: 0, w: 4, h: 4 }, corner: "https://static.cdn-luma.com/files/bcf576df9c38b05f/2_corner_update.png", edgeHorizontal: "https://static.cdn-luma.com/files/bcf576df9c38b05f/2_vert_update.png", edgeVertical: "https://static.cdn-luma.com/files/bcf576df9c38b05f/2_hori_update.png", mediaSize: 1, borderThickness: 0, borderSize: 80, autoplayMode: "all", isHovered: false, }, { id: 3, video: "https://static.cdn-luma.com/files/58ab7363888153e3/Jitter%20Exported%20Poster.mp4", defaultPos: { x: 8, y: 0, w: 4, h: 4 }, corner: "https://static.cdn-luma.com/files/3d36d1e0dba2476c/3_Corner_update.png", edgeHorizontal: "https://static.cdn-luma.com/files/3d36d1e0dba2476c/3_hori_update.png", edgeVertical: "https://static.cdn-luma.com/files/3d36d1e0dba2476c/3_Vert_update.png", mediaSize: 1, borderThickness: 0, borderSize: 80, autoplayMode: "all", isHovered: false, }, { id: 4, video: "https://static.cdn-luma.com/files/58ab7363888153e3/Exported%20Web%20Video.mp4", defaultPos: { x: 0, y: 4, w: 4, h: 4 }, corner: "https://static.cdn-luma.com/files/9e67e05f37e52522/4_corner_update.png", edgeHorizontal: "https://static.cdn-luma.com/files/9e67e05f37e52522/4_hori_update.png", edgeVertical: "https://static.cdn-luma.com/files/9e67e05f37e52522/4_vert_update.png", mediaSize: 1, borderThickness: 0, borderSize: 80, autoplayMode: "all", isHovered: false, }, { id: 5, video: "https://static.cdn-luma.com/files/58ab7363888153e3/Logo%20Exported.mp4", defaultPos: { x: 4, y: 4, w: 4, h: 4 }, corner: "https://static.cdn-luma.com/files/9e67e05f37e52522/5_corner_update.png", edgeHorizontal: "https://static.cdn-luma.com/files/9e67e05f37e52522/5_hori_update.png", edgeVertical: "https://static.cdn-luma.com/files/9e67e05f37e52522/5_verti_update.png", mediaSize: 1, borderThickness: 0, borderSize: 80, autoplayMode: "all", isHovered: false, }, { id: 6, video: "https://static.cdn-luma.com/files/58ab7363888153e3/Animation%20Exported%20(4).mp4", defaultPos: { x: 8, y: 4, w: 4, h: 4 }, corner: "https://static.cdn-luma.com/files/1199340587e8da1d/6_corner.png", edgeHorizontal: "https://static.cdn-luma.com/files/1199340587e8da1d/6_corner-1.png", edgeVertical: "https://static.cdn-luma.com/files/1199340587e8da1d/6_vert.png", mediaSize: 1, borderThickness: 0, borderSize: 80, autoplayMode: "all", isHovered: false, }, { id: 7, video: "https://static.cdn-luma.com/files/58ab7363888153e3/Illustration%20Exported%20(1).mp4", defaultPos: { x: 0, y: 8, w: 4, h: 4 }, corner: "https://static.cdn-luma.com/files/b80b5aa00ccc33bd/7_corner.png", edgeHorizontal: "https://static.cdn-luma.com/files/b80b5aa00ccc33bd/7_hori.png", edgeVertical: "https://static.cdn-luma.com/files/b80b5aa00ccc33bd/7_vert.png", mediaSize: 1, borderThickness: 0, borderSize: 80, autoplayMode: "all", isHovered: false, }, { id: 8, video: "https://static.cdn-luma.com/files/58ab7363888153e3/Art%20Direction%20Exported.mp4", defaultPos: { x: 4, y: 8, w: 4, h: 4 }, corner: "https://static.cdn-luma.com/files/981e483f71aa764b/8_corner.png", edgeHorizontal: "https://static.cdn-luma.com/files/981e483f71aa764b/8_hori.png", edgeVertical: "https://static.cdn-luma.com/files/981e483f71aa764b/8_verticle.png", mediaSize: 1, borderThickness: 0, borderSize: 80, autoplayMode: "all", isHovered: false, }, { id: 9, video: "https://static.cdn-luma.com/files/58ab7363888153e3/Product%20Video.mp4", defaultPos: { x: 8, y: 8, w: 4, h: 4 }, corner: "https://static.cdn-luma.com/files/981e483f71aa764b/9_corner.png", edgeHorizontal: "https://static.cdn-luma.com/files/981e483f71aa764b/9_hori.png", edgeVertical: "https://static.cdn-luma.com/files/981e483f71aa764b/9_vert.png", mediaSize: 1, borderThickness: 0, borderSize: 80, autoplayMode: "all", isHovered: false, }, ] export default function DynamicFrameLayout() { const [frames, setFrames] = useState(initialFrames) const [hovered, setHovered] = useState<{ row: number; col: number } | null>(null) const [hoverSize, setHoverSize] = useState(6) const [gapSize, setGapSize] = useState(4) const [showControls, setShowControls] = useState(false) const [cleanInterface, setCleanInterface] = useState(true) const [showFrames, setShowFrames] = useState(false) // Update: showFrames starts as false const [autoplayMode, setAutoplayMode] = useState<"all" | "hover">("all") const getRowSizes = () => { if (hovered === null) { return "4fr 4fr 4fr" } const { row } = hovered const nonHoveredSize = (12 - hoverSize) / 2 return [0, 1, 2].map((r) => (r === row ? `${hoverSize}fr` : `${nonHoveredSize}fr`)).join(" ") } const getColSizes = () => { if (hovered === null) { return "4fr 4fr 4fr" } const { col } = hovered const nonHoveredSize = (12 - hoverSize) / 2 return [0, 1, 2].map((c) => (c === col ? `${hoverSize}fr` : `${nonHoveredSize}fr`)).join(" ") } const getTransformOrigin = (x: number, y: number) => { const vertical = y === 0 ? "top" : y === 4 ? "center" : "bottom" const horizontal = x === 0 ? "left" : x === 4 ? "center" : "right" return `${vertical} ${horizontal}` } const updateFrameProperty = (id: number, property: keyof Frame, value: number) => { setFrames(frames.map((frame) => (frame.id === id ? { ...frame, [property]: value } : frame))) } const toggleControls = () => { setShowControls(!showControls) } const toggleCleanInterface = () => { setCleanInterface(!cleanInterface) if (!cleanInterface) { setShowControls(false) } } const updateCodebase = () => { console.log("Updating codebase with current values:") console.log("Hover Size:", hoverSize) console.log("Gap Size:", gapSize) console.log("Frames:", frames) // Here you would typically make an API call to update the codebase // For now, we'll just log the values } return (