{"version":3,"file":"ReboundShots.rO-RmbZD.mjs","names":["useState","useMemo","Fragment"],"sources":["https:/framerusercontent.com/modules/sXdzmAVys9165BsbYeb7/rAI2cOZRdlbgWymnnUoG/ReboundShots.js"],"sourcesContent":["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState,useMemo,Fragment}from\"react\";const styleString=`\n    :root {\n        --rebound-skeleton-color: #F9F9FA;\n    }\n    \n    .rebounds-container {\n        font-family: \"Mona-Sans Medium\", sans-serif;\n        text-align: center;\n    }\n    \n    .rebounds-grid {\n        list-style: none;\n        margin: 0;\n        padding: 0;\n        display: grid;\n        grid-template-columns: repeat(var(--rebound-columns, 1), 1fr);\n        gap: 24px;\n    }\n    \n    @media (min-width: 500px) {\n        .rebounds-grid {\n            --rebound-columns: 2;\n        }\n    }\n    \n    @media (min-width: 850px) {\n        .rebounds-grid {\n            --rebound-columns: 3;\n            gap: 32px;\n        }\n    }\n    \n    @media (min-width: 1200px) {\n        .rebounds-grid {\n            --rebound-columns: 4;\n        }\n    }\n    \n    .rebounds-sort-options {\n        display: flex;\n        justify-content: center;\n        gap: 2px;\n        margin-bottom: 24px;\n    }\n    \n    @media (min-width: 500px) {\n        .rebounds-sort-options {\n            justify-content: flex-end;\n            gap: 8px;\n            margin-bottom: 32px;\n        }\n    }\n    \n    \n    .rebounds-sort-btn {\n        padding: 1px 9px 0 9px;\n        background: none;\n        border: none;\n        border-radius: 999999999px;\n        font-family: \"Mona-Sans Medium\", sans-serif;\n        font-weight: 400;\n        font-size: 11px;\n        line-height: 1;\n        height: 32px;\n        cursor: pointer;\n        transition: background-color 0.1s ease-in-out;\n        white-space: nowrap;\n    }\n    \n    .rebounds-sort-btn.active {\n        background-color: #F8F7F4;\n    }\n    \n    @media (min-width: 500px) {\n        .rebounds-sort-btn {\n            padding: 2px 16px 0 16px;\n            font-size: 14px;\n            height: 36px;\n        }\n    }\n    \n    .rebound {\n        display: flex;\n        flex-direction: column;\n        gap: 12px;\n    }\n    \n    .fetched .rebound.skeleton {\n        display: none;\n    }\n    \n    .fetched .rebound.skeleton:nth-child(1) {\n        display: flex;\n    }\n    \n     @media (min-width: 500px) {\n        .fetched .rebound.skeleton:nth-child(2) {\n            display: flex;\n        }\n    }\n    \n    @media (min-width: 850px) {\n        .fetched .rebound.skeleton:nth-child(3) {\n            display: flex;\n        }\n    }\n    \n    @media (min-width: 1200px) {\n        .fetched .rebound.skeleton:nth-child(4) {\n            display: flex;\n        }\n    }\n    \n    .rebound-image {\n        width: 100%;\n        border-radius: 8px;\n        display: flex;\n        aspect-ratio: 4 / 3;\n        object-fit: cover;\n        object-position: center;\n        background-color: var(--rebound-skeleton-color);\n    }\n    \n    .rebound-user-details {\n        display: flex;\n        align-items: center;\n        gap: 10px;\n    }\n    \n    .rebound-user-avatar {\n        width: 24px;\n        height: 24px;\n        border-radius: 50%;\n        object-fit: cover;\n        background-color: var(--rebound-skeleton-color);\n    }\n    \n    .rebound-user-name {\n        font-size: 14px;\n        line-height: 1;\n        margin-top: 1px;\n        text-align: left;\n    }\n    \n    .rebound.skeleton .rebound-user-name {\n        width: 82px;\n        height: 14px;\n        background-color: var(--rebound-skeleton-color);\n        border-radius: 4px;\n        display: inline-flex;\n        margin-top: 0;\n    }\n    \n    .rebound-link {\n        text-decoration: none;\n        color: inherit;\n    }\n    \n    .rebound-empty-container {\n        display: flex;\n        align-items: center;\n        gap: 24px;\n        font-size: 16px;\n        justify-content: center;\n        margin-top: 40px;\n        font-family: \"Mona-Sans Regular\", \"Mona-Sans Regular Placeholder\", sans-serif;\n        white-space: nowrap;\n    }\n    \n    @media (min-width: 500px) {\n        .rebound-empty-container {\n            font-size: 18px;\n        }\n    }\n    \n    .rebound-submit-btn {\n        display: inline-flex;\n        align-items: center;\n        font-size: 15px;\n        color: white;\n        padding: 16px 24px;\n        background: #060318;\n        border-radius: 999999px;\n        font-family: \"Mona-Sans Medium\", sans-serif;\n        text-decoration: none;\n        white-space: nowrap;\n    }\n    \n    .rebound-see-all-btn {\n        display: inline-flex;\n        align-items: center;\n        font-size: 15px;\n        color: #060318;\n        padding: 16px 24px;\n        background: white;\n        border-radius: 999999px;\n        font-family: \"Mona-Sans Medium\", sans-serif;\n        text-decoration: none;\n        white-space: nowrap;\n        border: 1px solid #060318;\n        margin: 40px auto 0;\n    }\n`;const invisiblePixel=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\";const placeholderRebound={isSkeleton:true};const sortModes={liked:{label:\"Most Liked\",value:\"popular\"},comments:{label:\"Most Comments\",value:\"comments\"},recent:{label:\"Most Recent\",value:\"\"}};/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */const fetchRebounds=async(screenshot_id,sortValue)=>{const response=await fetch(`/client_app/rebounds?screenshot_id=${screenshot_id}&s=${sortValue}`);if(response.ok){return(await response.json())?.data||[];}else{return[];}};export default function ReboundShots({screenshot_id,rebound_url,view_all_rebounds_url}){const[hasFetched,setHasFetched]=useState(false);const[activeSortMode,setActiveSortMode]=useState(Object.keys(sortModes)[0]);const[rebounds,setRebounds]=useState(Array(12).fill(placeholderRebound));useEffect(()=>{// fetch rebounds on intial load & when sort mode changes\nconst fetchAndSetRebounds=async()=>{const rebounds=await fetchRebounds(screenshot_id,sortModes[activeSortMode].value);setRebounds(rebounds);setHasFetched(true);};fetchAndSetRebounds();},[activeSortMode,screenshot_id]);const reboundsWithPlaceholders=useMemo(()=>Array(12).fill({}).map((_,index)=>rebounds[index]||placeholderRebound),[rebounds]);const ConditionalWrapper=({condition,wrapper,children})=>condition?wrapper(children):children;return /*#__PURE__*/_jsxs(Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:styleString}),/*#__PURE__*/_jsxs(\"div\",{className:`rebounds-container ${hasFetched&&\"fetched\"}`,children:[hasFetched&&!!rebounds.length&&/*#__PURE__*/_jsx(\"div\",{className:\"rebounds-sort-options\",children:Object.keys(sortModes).map(sortMode=>/*#__PURE__*/_jsx(\"button\",{className:`rebounds-sort-btn ${activeSortMode===sortMode?\"active\":\"\"}`,onClick:()=>setActiveSortMode(sortMode),children:sortModes[sortMode].label},sortMode))}),/*#__PURE__*/_jsx(\"ul\",{className:\"rebounds-grid\",children:reboundsWithPlaceholders.map((rebound,index)=>/*#__PURE__*/_jsxs(\"li\",{className:`rebound ${rebound.isSkeleton&&\"skeleton\"}`,children:[/*#__PURE__*/_jsx(ConditionalWrapper,{condition:!rebound.isSkeleton,wrapper:children=>/*#__PURE__*/_jsx(\"a\",{href:rebound.reboundUrl,className:\"rebound-link\",children:children}),children:/*#__PURE__*/_jsx(\"img\",{className:\"rebound-image\",src:rebound.isSkeleton?invisiblePixel:rebound.thumbnailImageUrl})}),/*#__PURE__*/_jsxs(\"div\",{className:\"rebound-user-details\",children:[/*#__PURE__*/_jsx(ConditionalWrapper,{condition:!rebound.isSkeleton,wrapper:children=>/*#__PURE__*/_jsx(\"a\",{href:rebound.userProfileUrl,className:\"rebound-link\",children:children}),children:/*#__PURE__*/_jsx(\"img\",{className:\"rebound-user-avatar\",src:rebound.isSkeleton?invisiblePixel:rebound.avatarImageUrl})}),/*#__PURE__*/_jsx(ConditionalWrapper,{condition:!rebound.isSkeleton,wrapper:children=>/*#__PURE__*/_jsx(\"a\",{href:rebound.userProfileUrl,className:\"rebound-link\",children:children}),children:/*#__PURE__*/_jsx(\"div\",{className:\"rebound-user-name\",children:rebound.isSkeleton?\"\":rebound.userDisplayName})})]})]},rebound.reboundUrl))}),hasFetched&&!rebounds.length&&/*#__PURE__*/_jsxs(\"div\",{className:\"rebound-empty-container\",children:[\"No entries yet\",/*#__PURE__*/_jsx(\"a\",{href:rebound_url,className:\"rebound-submit-btn\",\"data-show-if-player\":true,children:\"Submit yours!\"})]}),hasFetched&&!!rebounds.length&&/*#__PURE__*/_jsx(\"a\",{href:view_all_rebounds_url,className:\"rebound-see-all-btn\",children:\"See all entries\"})]})]});}addPropertyControls(ReboundShots,{screenshot_id:{title:\"Screenshot Id\",type:ControlType.String,defaultValue:\"\"},rebound_url:{title:\"Rebound URL\",type:ControlType.Link,defaultValue:\"\"},view_all_rebounds_url:{title:\"View all rebounds URL\",type:ControlType.Link,defaultValue:\"\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ReboundShots\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReboundShots.map"],"mappings":"uMAkNmO,SAAwB,EAAa,CAAC,gBAAc,cAAY,yBAAuB,CAAC,GAAK,CAAC,EAAW,GAAeA,EAAS,EAAK,EAAO,CAAC,EAAe,GAAmBA,EAAS,OAAO,KAAK,CAAS,CAAC,CAAC,EAAE,EAAO,CAAC,EAAS,GAAaA,EAAS,MAAM,EAAE,CAAC,CAAC,KAAK,CAAkB,CAAC,EAAE,MAAc,EAC5W,SAA/H,CAAC,IAAM,EAAS,MAAM,EAAc,EAAc,EAAU,EAAe,CAAC,KAAK,EAAE,EAAY,CAAQ,EAAE,EAAc,EAAI,CAAE,EAAE,CAAoB,CAAE,EAAE,CAAC,EAAe,CAAa,CAAC,EAAE,IAAM,EAAyBC,MAAY,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IAAQ,EAAS,IAAQ,CAAkB,EAAE,CAAC,CAAQ,CAAC,EAAQ,GAAoB,CAAC,YAAU,UAAQ,cAAY,EAAU,EAAQ,CAAQ,EAAE,EAAS,OAAoB,EAAMC,EAAS,CAAC,SAAS,CAAc,EAAK,QAAQ,CAAC,SAAS,CAAW,CAAC,EAAe,EAAM,MAAM,CAAC,UAAU,sBAAsB,GAAY,YAAY,SAAS,CAAC,GAAY,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