{"version":3,"file":"TestSlate.BSVCsdk6.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/cJkPn529BZVuxb8l4ZCw/PXIlIMpxtvBzX1V2oa4T/TestSlate.js"],"sourcesContent":["// Get Started: https://www.framer.com/developers\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";/*\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */import{useState,useEffect}from\"react\";export default function SlateGrid(props){const[clips,setClips]=useState([]);const[loading,setLoading]=useState(true);const[error,setError]=useState(null);const[showreelData,setShowreelData]=useState(null);const[windowWidth,setWindowWidth]=useState(typeof window!==\"undefined\"?window.innerWidth:1024);useEffect(()=>{const handleResize=()=>setWindowWidth(window.innerWidth);window.addEventListener(\"resize\",handleResize);return()=>window.removeEventListener(\"resize\",handleResize);},[]);const getGridColumns=()=>{if(windowWidth>768)return\"repeat(3, 1fr)\";if(windowWidth>480)return\"repeat(2, 1fr)\";return\"1fr\";};const fetchShowreelData=async()=>{const apiUrl=`https://morganandnick.slateapp.com/api/v1/showreel/${props.showreelId}?access_token=316887a6a3ee48cd902ab509baab2310`;try{setLoading(true);setError(null);const response=await fetch(apiUrl);console.log(response);if(!response.ok){throw new Error(`HTTP error! status: ${response.status}`);}const data=await response.json();if(data.code!==200){throw new Error(`API error: ${data.message}`);}setShowreelData(data.response);// Store clips that have embedded_url\nconst clipsWithUrls=data.response.clips?.filter(clip=>clip.embedded_url)||[];setClips(clipsWithUrls);}catch(err){setError(err instanceof Error?err.message:\"An unknown error occurred\");}finally{setLoading(false);}};useEffect(()=>{fetchShowreelData();},[]);const handleRefresh=()=>{fetchShowreelData();};if(loading){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",margin:\"0 auto\"},children:/*#__PURE__*/_jsx(\"div\",{style:{boxShadow:\"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\"},children:/*#__PURE__*/_jsx(\"div\",{style:{},children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"grid\",gridTemplateColumns:getGridColumns(),gap:\"0px\"},children:[1,2,3,4,5,6].map(index=>/*#__PURE__*/_jsx(\"div\",{style:{},children:/*#__PURE__*/_jsx(\"div\",{style:{aspectRatio:\"16/9\",backgroundColor:\"transparent\",overflow:\"hidden\",border:\"solid\",borderColor:\"rgba(255,255,255,0.1)\",borderWidth:\"2px\",position:\"relative\"}})},index))})})})});}if(error){return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"24px\",maxWidth:\"1024px\",margin:\"0 auto\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{backgroundColor:\"#fef2f2\",border:\"1px solid #fecaca\",padding:\"16px\"},children:[/*#__PURE__*/_jsx(\"h2\",{style:{color:\"#991b1b\",fontWeight:\"600\",marginBottom:\"8px\"},children:\"Error\"}),/*#__PURE__*/_jsx(\"p\",{style:{color:\"#dc2626\",marginBottom:\"16px\"},children:error}),/*#__PURE__*/_jsx(\"button\",{onClick:handleRefresh,style:{padding:\"8px 16px\",backgroundColor:\"#dc2626\",color:\"white\",border:\"none\",cursor:\"pointer\",transition:\"background-color 0.2s\"},onMouseOver:e=>{e.currentTarget.style.backgroundColor=\"#b91c1c\";},onMouseOut:e=>{e.currentTarget.style.backgroundColor=\"#dc2626\";},children:\"Try Again\"})]})});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",margin:\"0 auto\"},children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"grid\",gridTemplateColumns:getGridColumns(),gap:\"0px\"},children:clips.map((clip,index)=>{const totalColumns=windowWidth>768?3:windowWidth>480?2:1;const currentRow=Math.floor(index/totalColumns);const currentCol=index%totalColumns;const totalRows=Math.ceil(clips.length/totalColumns);// Determine which borders this item needs\nconst needsTopBorder=currentRow===0// First row\n;const needsLeftBorder=currentCol===0// First column\n;const needsRightBorder=true// Always need right border\n;const needsBottomBorder=true// Always need bottom border\n;return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",borderTop:needsTopBorder?\"1px solid rgba(255,255,255,0.1)\":\"none\",borderLeft:needsLeftBorder?\"1px solid rgba(255,255,255,0.1)\":\"none\",borderRight:\"1px solid rgba(255,255,255,0.1)\",borderBottom:\"1px solid rgba(255,255,255,0.1)\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"0px\",left:\"0px\",right:\"0px\",height:\"60px\",background:\"linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.3) 70%, transparent 100%)\",zIndex:5,pointerEvents:\"none\"}}),/*#__PURE__*/_jsx(\"p\",{style:{position:\"absolute\",top:\"12px\",left:\"12px\",width:\"80%\",color:\"white\",fontFamily:\"Montserrat, sans-serif\",zIndex:10,margin:\"0\",fontSize:\"14px\",fontWeight:\"500\",textShadow:\"0 1px 2px rgba(0,0,0,0.8)\"},children:clip.title}),/*#__PURE__*/_jsx(\"div\",{style:{aspectRatio:\"16/9\",backgroundColor:\"transparent\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"iframe\",{width:\"100%\",height:\"100%\",src:clip.embedded_url,frameBorder:\"0\",webkitallowfullscreen:\"true\",mozallowfullscreen:\"true\",allowFullScreen:true,scrolling:\"no\",style:{width:\"100%\",height:\"100%\"}})})]},index);})})});}SlateGrid.defaultProps={showreelId:\"482\"};addPropertyControls(SlateGrid,{showreelId:{type:ControlType.String,title:\"Showreel ID\",description:\"ID for the showreel on slateapp.com\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SlateGrid\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TestSlate.map"],"mappings":"sMAIyC,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,EAAE,CAAC,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAK,CAAM,C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