Skip to content

Instantly share code, notes, and snippets.

@ZenulAbidin
Created April 2, 2025 11:17
Show Gist options
  • Select an option

  • Save ZenulAbidin/dafe3e853db1dc03b3ccffba1b9bb1ea to your computer and use it in GitHub Desktop.

Select an option

Save ZenulAbidin/dafe3e853db1dc03b3ccffba1b9bb1ea to your computer and use it in GitHub Desktop.
# https://website-3lr.pages.dev/_next/static/chunks/app/page-a18ed3e9b438f4ea.js
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{36927:function(e,t,r){Promise.resolve().then(r.bind(r,15303))},15303:function(e,t,r){"use strict";r.d(t,{default:function(){return u}});var l=r(57437),s=r(2265),n=r(98094),a=r(66648);function i(e){let{size:t=100,color:r="black"}=e;return(0,l.jsx)("svg",{width:t,style:{display:"inline-block"},height:1.0225*t,viewBox:"0 0 1200 1227",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,l.jsx)("path",{d:"M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z",fill:r})})}let c=(e,t)=>{if(!e)return null;let r=(e=e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")).split("\n"),n=e.trimEnd().endsWith("…"),a=e=>e.split(/(\s+)/).map((e,t)=>e.startsWith("#")?(0,l.jsx)("a",{href:"https://x.com/hashtag/".concat(e.slice(1)),target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:underline break-words",children:e},"".concat(t,"-hashtag")):e.startsWith("@")?(0,l.jsx)("a",{href:"https://x.com/".concat(e.slice(1)),target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:underline break-words",children:e},"".concat(t,"-mention")):e.startsWith("http://")||e.startsWith("https://")?(0,l.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:underline break-all",children:e},"".concat(t,"-link")):e),i=r.map((e,t)=>(0,l.jsxs)(s.Fragment,{children:[a(e),t<r.length-1&&(0,l.jsx)("br",{})]},"line-".concat(t)));return(0,l.jsx)("div",{className:"mb-2",children:(0,l.jsxs)("div",{className:"break-words text-sm",children:[i,n&&(0,l.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:underline focus:outline-none",children:"Read more"})]})})},o=e=>{if(!e)return"";let t=new Date(e),r=new Date,l=t.toDateString()===r.toDateString(),s=t.toDateString()===new Date(r.setDate(r.getDate()-1)).toDateString();return l?"Today at ".concat(t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})):s?"Yesterday at ".concat(t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})):"".concat(t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})," \xb7 ").concat(t.toLocaleDateString([],{year:"numeric",month:"short",day:"numeric"}))},d=e=>{var t,r,s,n;let{tweet:a}=e;a.text&&(a.text=a.text.replaceAll(/https:\/\/t\.co\/\S+/g,"").replaceAll("&gt;",">"));let i="https://x.com/doge/status/".concat(a.id);return(0,l.jsx)("div",{className:"p-4 flex flex-col justify-center text-white bg-ampac-blue border border-gray-700 rounded-md relative md:text-base text-sm",children:(0,l.jsx)("div",{className:"flex flex-col",children:(0,l.jsx)("div",{className:"flex items-start justify-between",children:(0,l.jsxs)("div",{className:"flex flex-col items-start",children:[(0,l.jsxs)("div",{className:"flex flex-row mb-2 items-center",children:[(0,l.jsx)("img",{src:null===(t=a.user)||void 0===t?void 0:t.profile_image_url,alt:"DOGE",width:40,height:40,className:"w-7 h-7 mr-2.5 rounded-full flex-shrink-0"}),(0,l.jsxs)("div",{className:"leading-tight md:flex items-center",children:[(0,l.jsx)("a",{href:"https://x.com/".concat(null===(r=a.user)||void 0===r?void 0:r.username),target:"_blank",rel:"noopener noreferrer",className:"font-bold hover:underline flex items-center mr-1.5",children:null===(s=a.user)||void 0===s?void 0:s.name}),(0,l.jsxs)("span",{className:"text-gray-400 text-sm",children:["@",null===(n=a.user)||void 0===n?void 0:n.username]})]})]}),(0,l.jsx)("div",{className:"min-w-0",children:(0,l.jsx)("div",{className:"break-words text-sm",children:c(a.text,i)})})]})})})})};var u=e=>{var t,r,u,m;let{tweet:h,isQuoted:x=!1,showDate:f=!0,isActive:v=!0,resetVideo:g=0}=e;console.log("xx",h);let[p,b]=(0,s.useState)(!1),[j,w]=(0,s.useState)(!1),N=(0,s.useRef)(null),[y,k]=(0,s.useState)(!1),[_,L]=(0,s.useState)({width:0,height:0}),S=(0,s.useRef)(null),[D,E]=(0,s.useState)(!1),[C,W]=(0,s.useState)(""),z="https://x.com/doge/status/".concat(h.id);h.text&&(h.text=h.text.replaceAll(/https:\/\/t\.co\/\S+/g,"").replaceAll("&gt;",">")),(0,s.useEffect)(()=>{!v&&N.current&&(N.current.pause(),b(!1),w(!1))},[v]),(0,s.useEffect)(()=>{N.current&&(N.current.pause(),b(!1),w(!1))},[g]),(0,s.useEffect)(()=>{S.current&&S.current.complete&&H()},[]);let H=()=>{if(S.current){let{naturalWidth:e,naturalHeight:t}=S.current,r=e/t,l=e,s=t;s>300&&(l=(s=300)*r),L({width:l,height:s}),k(!0)}},G=()=>{N.current&&(p?N.current.pause():(N.current.play(),w(!0)),b(!p))};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"p-4 flex flex-col justify-center text-white bg-ampac-blue ".concat(x?"border":""," border-gray-700 relative md:text-base text-sm"),children:(0,l.jsx)("div",{className:"flex flex-col mb-2",children:(0,l.jsxs)("div",{className:"flex items-start justify-between",children:[(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("img",{src:"https://imagedelivery.net/Eq3GW7G6_BQgeWvh9nuCig/194f0beb-51d5-4623-64c3-462cbf5a5800/public",alt:"DOGE",width:40,height:40,className:"w-10 h-10 mr-3 rounded-full flex-shrink-0"}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"flex items-center w-full justify-center mb-2",children:(0,l.jsxs)("div",{className:"items-center flex-grow min-w-0",children:[(0,l.jsx)("a",{href:z,target:"_blank",rel:"noopener noreferrer",className:"font-bold hover:underline",children:"Department of Government Efficiency"}),(0,l.jsx)("br",{}),(0,l.jsx)("a",{href:z,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-400",children:"@DOGE"})]})}),c(h.text,z),(0,l.jsx)("div",{className:"flex flex-row mt-5 gap-2",children:null===(t=h.attachments)||void 0===t?void 0:t.slice(0,2).map((e,t)=>{if("video"===e.type){var r,s;return(0,l.jsxs)("div",{className:"relative w-full h-0 pb-[56.25%] rounded-lg overflow-hidden rounded-sm",children:[(0,l.jsx)("div",{className:"absolute inset-0 z-0",style:{backgroundImage:"url(".concat(e.url,")"),backgroundSize:"cover",backgroundPosition:"center",filter:"blur(10px)",transform:"scale(1.1)"}}),(0,l.jsx)("div",{className:"absolute inset-0 z-10",children:(0,l.jsxs)("video",{ref:N,className:"w-full h-full object-contain",onPlay:()=>{b(!0),w(!0)},onPause:()=>b(!1),controls:j,poster:e.preview_image_url,children:[(0,l.jsx)("source",{src:null===(s=e.variants)||void 0===s?void 0:null===(r=s.find(e=>"video/mp4"===e.content_type&&832e3===e.bit_rate))||void 0===r?void 0:r.url,type:"video/mp4"}),"Your browser does not support the video tag."]})}),!p&&(0,l.jsx)("div",{className:"absolute inset-0 z-20 flex items-center justify-center cursor-pointer",onClick:G,children:(0,l.jsx)("div",{className:"w-12 h-12 bg-[#349cf0] rounded-full flex items-center justify-center border-[3px] border-white",children:(0,l.jsx)(n.Z,{size:24,className:"text-white ml-1",fill:"currentColor",strokeWidth:1.5})})})]},t)}return"photo"===e.type&&void 0!==e.url?(0,l.jsx)("div",{className:"relative w-full h-0 pb-[56.25%] overflow-hidden rounded-sm",onClick:()=>{void 0!==e.url&&(E(!0),W(e.url))},children:(0,l.jsx)(a.default,{src:e.url,alt:"Tweet image",layout:"fill",objectFit:"cover",className:"absolute inset-0 w-full h-full",style:{opacity:y?1:0,transition:"opacity 0.3s ease-in-out"},onLoadingComplete:()=>k(!0)})},t):null})}),(null===(r=h.referenced_tweets)||void 0===r?void 0:r.length)&&(null===(u=h.referenced_tweets)||void 0===u?void 0:u.length)>0&&(0,l.jsx)("div",{className:"".concat((null===(m=h.attachments)||void 0===m?void 0:m.length)?"mt-5":"mt-1"),children:(0,l.jsx)(d,{tweet:h.referenced_tweets[0]})}),f&&(0,l.jsx)("div",{className:"flex items-center w-full mt-3",children:(0,l.jsx)("span",{className:"text-gray-400 mt-2 text-sm -mb-1",children:o(h.created_at)})})]})]}),(0,l.jsx)("div",{className:"hidden md:block flex mt-2 mr-2 ml-2",children:(0,l.jsx)("a",{href:z,target:"_blank",rel:"noopener noreferrer",children:(0,l.jsx)(i,{size:20,color:"white"})})})]})})}),D&&(0,l.jsx)("div",{className:"hidden md:block ",children:(0,l.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-75",children:[(0,l.jsx)("div",{className:"absolute inset-0",onClick:()=>E(!1)}),(0,l.jsx)("img",{src:C,alt:"Enlarged Image",className:"max-w-full max-h-full rounded-lg shadow-lg"})]})})]})}}},function(e){e.O(0,[922,971,526,744],function(){return e(e.s=36927)}),_N_E=e.O()}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment