{"version":3,"file":"Github_code.DH30WZ8D.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/Non09f2UBmfcrTizg89c/8Y6lvKQOWOj2Mk6FsmNY/Github_code.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";const CACHE_KEY=\"github_prs_cache\";const CACHE_DURATION=1e3*60*60// 1 hour in milliseconds\n;export default function GitHubLatestPR(){const[prs,setPrs]=useState([]);const[loading,setLoading]=useState(true);const[error,setError]=useState(null);useEffect(()=>{const fetchLatestPRs=async()=>{try{setLoading(true);setError(null);// Check cache first\nconst cached=localStorage.getItem(CACHE_KEY);if(cached){const cachedData=JSON.parse(cached);const now=Date.now();// If cache is still valid, use it\nif(now-cachedData.timestamp<CACHE_DURATION){setPrs(cachedData.data);setLoading(false);return;}}// Fetch new data from GitHub API\nconst response=await fetch(\"https://api.github.com/repos/layerztec/layerzwallet/pulls?state=closed&sort=updated&direction=desc&per_page=6\",{headers:{Accept:\"application/vnd.github.v3+json\"}});if(!response.ok){throw new Error(`GitHub API error: ${response.status}`);}const pullRequests=await response.json();// Filter only merged PRs and take the first 5\nconst mergedPRs=pullRequests.filter(pr=>pr.merged_at).slice(0,5);// Cache the new data\nconst cacheData={data:mergedPRs,timestamp:Date.now()};localStorage.setItem(CACHE_KEY,JSON.stringify(cacheData));setPrs(mergedPRs);}catch(err){// If API fails, try to use cached data (even if expired)\nconst cached=localStorage.getItem(CACHE_KEY);if(cached){const cachedData=JSON.parse(cached);setPrs(cachedData.data);setError(\"Using cached data (API temporarily unavailable)\");}else{setError(\"There was an error loading the data\");}}finally{setLoading(false);}};fetchLatestPRs();},[]);const formatDate=dateString=>{return new Date(dateString).toLocaleDateString(\"en-US\",{month:\"short\",day:\"numeric\"});};if(loading){return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"20px\",textAlign:\"center\",color:\"#9ca3af\"},children:/*#__PURE__*/_jsx(\"div\",{children:\"Loading...\"})});}if(error&&prs.length===0){return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"20px\",textAlign:\"center\",color:\"#9ca3af\"},children:/*#__PURE__*/_jsx(\"div\",{children:error})});}if(prs.length===0){return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"20px\",textAlign:\"center\",color:\"#9ca3af\"},children:/*#__PURE__*/_jsx(\"div\",{children:\"0 pull requests found\"})});}return /*#__PURE__*/_jsxs(\"div\",{style:{color:\"rgba(255, 255, 255, 0.9)\",fontFamily:'-apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif',maxWidth:\"100%\"},children:[/*#__PURE__*/_jsx(\"div\",{children:prs.map(pr=>/*#__PURE__*/_jsxs(\"div\",{style:{fontSize:\"16px\",lineHeight:\"2.5\",color:\"rgba(255, 255, 255, 0.9)\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontWeight:\"600\",fontSize:\"12px\",backgroundColor:\"rgba(255, 255, 255, 0.1)\",padding:\"2px 6px\",borderRadius:\"4px\",marginRight:\"8px\"},children:formatDate(pr.merged_at)}),/*#__PURE__*/_jsxs(\"span\",{children:[pr.title,\" - by \",pr.user.login]})]},pr.id))}),error&&error.includes(\"cached data\")&&/*#__PURE__*/_jsx(\"div\",{style:{marginTop:\"12px\",fontSize:\"12px\",color:\"rgba(255, 255, 255, 0.9)\",textAlign:\"center\",fontStyle:\"italic\"},children:error})]});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GitHubLatestPR\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Github_code.map"],"mappings":"2HACC,SAAwB,GAAgB,CAAC,GAAK,CAAC,EAAI,GAAQA,EAAS,EAAE,CAAC,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAK,CAAM,CAAC,EAAM,GAAUA,EAAS,KAAK,CAAC,MAAc,EAAsB,SAAS,CAAC,GAAG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