PageSourceSearch

https://flightsim.to/assets/WhatsNewPage-DBx7-bik.js

js flightsim.to collected 2026-10-01 10:19:52 UTC 11,855 bytes, 1 lines download raw bytes

1import{n as ce,a8 as me,h as ue,aX as xe,ac as pe,r,cU as ge,cV as D,j as e,ad as G,$ as H,V as he,ar as U,aM as fe,bX as be,e as d,ag as we,_ as je,cW as ve,cX as Ne,B as g,aq as ye,bs as B,cY as Ce,b2 as W,W as X,O as C,bM as ke,Q as Y}from"./index-BUR_l9d0.js";import{u as _e}from"./useCategories-BeO0ZWdz.js";import{u as Se}from"./useGridAdCount-D67Xer4F.js";import{C as Pe}from"./calendar-CCwiRygs.js";import{P as De}from"./Pagination-DWdgSlxL.js";import{A as Me}from"./AddonGrid-BPIh9TCO.js";import{S as Ae}from"./save-CDQR9ggd.js";import{G as Le}from"./grid-3x3-yEiaG_Z2.js";import{L as Te}from"./list-BeYbbxeC.js";import"./addMonths-DydxCsTQ.js";import"./useUserDownloads-BCVUzpkG.js";const q=31,Ve=2,$=t=>{if(!t)return D(new Date,Ve);const h=new Date(t*1e3),u=D(new Date,q);return h<u?u:h},Ye=()=>{const{user:t,isAuthenticated:h,isLoading:u,refreshUser:J}=ce(),M=me(),{t:a}=ue("whatsNew"),[f,v]=xe();pe({title:a("seo_title"),description:a("seo_description")});const N=f.get("cat")||"all",y=f.get("sim")||"all",w=f.get("view")||"grid",c=f.get("mode")||"new",A=f.get("followed")==="1",j=Number(f.get("page"))||1,[o,k]=r.useState(()=>(t==null?void 0:t.lastVisit)!==void 0?$(t==null?void 0:t.lastVisit):null),Q=o!==null,[L,K]=r.useState(()=>localStorage.getItem("whatsNew_openInNewTab")==="1"),[T,V]=r.useState(!1),I=16-Se(),i=r.useCallback(s=>{v(l=>{const n=new URLSearchParams(l);for(const[m,p]of Object.entries(s))p===null||p===""||p==="all"||p==="0"?n.delete(m):n.set(m,p);return n},{replace:!0})},[v]),Z=r.useCallback(s=>{const l=typeof s=="function"?s(j):s;i({page:l>1?String(l):null})},[j,i]),O=r.useCallback(s=>{i({cat:s,page:null})},[i]),ee=r.useCallback(s=>{i({sim:s,page:null})},[i]),F=r.useCallback(s=>{i({view:s==="grid"?null:s})},[i]),_=r.useCallback(s=>{v(l=>{const n=new URLSearchParams(l);return s==="new"?n.delete("mode"):n.set("mode",s),n.delete("updates"),n.delete("updates_only"),n.delete("page"),n},{replace:!0})},[v]),se=r.useCallback(s=>{i({followed:s?"1":null,page:null})},[i]);r.useEffect(()=>{t&&k($(t.lastVisit))},[t==null?void 0:t.lastVisit]);const R=r.useMemo(()=>t!=null&&t.lastVisit?new Date(t.lastVisit*1e3):null,[t==null?void 0:t.lastVisit]),{data:S}=_e(),te=r.useMemo(()=>o?Math.floor(o.getTime()/1e3):0,[o]),ae=c==="updates"?"updated_only":c==="all"?"updated":"new_only",{data:b,isLoading:le}=ge({page:j,limit:I,sort:ae,cat:N!=="all"?N:void 0,sim:y!=="all"?y:void 0,sinceTimestamp:te,includeUpdates:c==="all",followedCategories:A||void 0},{enabled:!u&&Q});r.useEffect(()=>{!u&&!h&&M("/login",{replace:!0})},[u,h,M]);const P=r.useRef(null),z=r.useRef(!0);r.useEffect(()=>{if(z.current){z.current=!1;return}if(P.current){const s=P.current.getBoundingClientRect().top+window.scrollY-80;window.scrollTo({top:s,behavior:"smooth"})}},[j]);const E=(b==null?void 0:b.addons)??[],x=b==null?void 0:b.meta,re=(x==null?void 0:x.total)??0,oe=D(new Date,q),ne=new Date,ie=async()=>{V(!0);try{const s=await fetch("https://flightsim.to/backend/user/save-last-visit",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({timestamp:Math.floor(Date.now()/1e3)})}),l=await s.json();if(!s.ok||!l.success)throw new Error(l.error||l.message||"Failed to save");Y.success(a("save_success")),await J()}catch(s){Y.error(s.message||a("save_error"))}finally{V(!1)}};return u?e.jsx(G,{children:e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(H,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsxs(G,{children:[e.jsxs("section",{className:"relative overflow-hidden bg-gradient-to-br from-primary/10 via-background to-accent/10",children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-1 bg-gradient-to-r from-primary via-accent to-primary z-10"}),e.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[e.jsx("div",{className:"absolute -top-1/2 -right-1/4 w-96 h-96 bg-primary/5 rounded-full blur-3xl animate-pulse"}),e.jsx("div",{className:"absolute -bottom-1/2 -left-1/4 w-96 h-96 bg-accent/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),e.jsx("div",{className:"absolute inset-0 opacity-[0.02]",style:{backgroundImage:"linear-gradient(hsl(var(--foreground)) 1px, transparent 1px), linear-gradient(90deg, hsl(var(--foreground)) 1px, transparent 1px)",backgroundSize:"50px 50px"}})]}),e.jsxs("div",{className:"relative max-w-[1920px] mx-auto px-4 sm:px-6 py-16 lg:py-20 text-center",children:[e.jsxs("h1",{className:"text-4xl font-extrabold tracking-tight md:text-5xl mb-4",children:[e.jsx("span",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:a("title_start")})," ",e.jsx("span",{className:"text-gradient",children:a("title_highlight")})]}),e.jsx("p",{className:"text-xl font-medium text-muted-foreground max-w-2xl mx-auto text-center mb-8",children:a("subtitle")}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-full bg-secondary/80 backdrop-blur-sm border border-border/50",children:[e.jsx(he,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:a("stat_new_content")}),e.jsx("span",{className:"text-sm font-bold text-foreground",children:re})]}),R&&e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-full bg-secondary/80 backdrop-blur-sm border border-border/50",children:[e.jsx(U,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:a("stat_last_visit")}),e.jsx("span",{className:"text-sm font-bold text-foreground",children:fe(R,{addSuffix:!0})})]}),e.jsxs("button",{onClick:ie,disabled:T,className:"flex items-center gap-2 px-4 py-2 rounded-full bg-secondary/80 backdrop-blur-sm border border-border/50 hover:bg-primary hover:text-primary-foreground transition-colors text-sm cursor-pointer disabled:opacity-50",children:[T?e.jsx(H,{className:"h-4 w-4 animate-spin"}):e.jsx(Ae,{className:"h-4 w-4"}),a("save_last_visit")]})]})]})]}),e.jsx("section",{ref:P,className:"py-12 bg-muted/30",children:e.jsxs("div",{className:"max-w-[1920px] mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsx("div",{className:"mb-6 w-full",children:e.jsxs("div",{className:"flex w-full items-center gap-1.5 overflow-x-auto pb-2 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden xl:overflow-visible",children:[e.jsxs("button",{onClick:()=>O("all"),className:d("flex items-center justify-center gap-1.5 px-3.5 h-9 rounded-full border text-xs sm:text-sm font-medium whitespace-nowrap transition-all shrink-0 xl:flex-1",N==="all"?"bg-primary text-primary-foreground border-primary shadow-md":"bg-secondary/60 border-border hover:bg-secondary text-foreground"),children:[e.jsx(be,{className:"h-3.5 w-3.5"}),a("all_categories")]}),S==null?void 0:S.map(s=>{const l=we(s.name),n=l.icon,m=N===s.slug,p=l.pill.split(" ").find(de=>de.startsWith("text-"));return e.jsxs("button",{onClick:()=>O(s.slug),className:d("flex items-center justify-center gap-1.5 px-3.5 h-9 rounded-full border text-xs sm:text-sm font-medium whitespace-nowrap transition-all shrink-0 xl:flex-1",m?d(l.accent,"text-white border-transparent shadow-md"):"bg-secondary/60 border-border hover:bg-secondary text-foreground"),children:[e.jsx(n,{className:d("h-3.5 w-3.5",m?"text-white":p)}),s.name]},s.id)})]})}),!(t!=null&&t.isPremium)&&e.jsx("div",{className:"mb-8 flex justify-center bg-muted/70 dark:bg-muted/40 px-3 py-3 sm:px-6 sm:py-5 rounded-xl",children:e.jsx(je,{slotId:"flightsim_atf_leaderboard",className:"w-full max-w-[1200px] border-0 shadow-none bg-transparent"})}),e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-4 mb-8",children:[e.jsxs(ve,{children:[e.jsx(Ne,{asChild:!0,children:e.jsxs(g,{variant:"outline",className:d("w-full md:w-[280px] justify-start text-left font-normal",!o&&"text-muted-foreground"),children:[e.jsx(ye,{className:"mr-2 h-4 w-4"}),a("since")," ",o?B(o,"MMM d, yyyy HH:mm"):"—"]})}),e.jsxs(Ce,{className:"w-auto p-0",align:"start",children:[e.jsx(Pe,{mode:"single",selected:o??void 0,onSelect:s=>{s&&(o&&s.setHours(o.getHours(),o.getMinutes()),k(s),i({page:null}))},disabled:s=>s>ne||s<oe,initialFocus:!0,className:d("p-3 pointer-events-auto")}),e.jsxs("div",{className:"border-t border-border px-4 py-3 flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("input",{type:"time",value:o?B(o,"HH:mm"):"00:00",onChange:s=>{const[l,n]=s.target.value.split(":").map(Number),m=new Date(o??new Date);m.setHours(l,n),k(m),i({page:null})},className:"bg-secondary border border-border rounded-md px-2 py-1 text-sm text-foreground"})]})]})]}),e.jsx("div",{className:"flex items-center gap-1 p-1 bg-secondary rounded-lg h-10",children:[{value:"all",label:a("all_simulators")},{value:"msfs2024",label:"MSFS 2024"},{value:"msfs2020",label:"MSFS 2020"}].map(s=>e.jsx(g,{variant:y===s.value?"default":"ghost",size:"sm",onClick:()=>
1ee(s.value),className:d("h-8 text-xs px-3 my-0",y===s.value&&"shadow-sm"),children:s.label},s.value))}),e.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto md:ml-auto",children:[e.jsxs("div",{className:"flex items-center gap-2 px-[10px]",children:[e.jsx(W,{id:"open-new-tab",checked:L,onCheckedChange:s=>{K(s),localStorage.setItem("whatsNew_openInNewTab",s?"1":"0")}}),e.jsx(X,{htmlFor:"open-new-tab",className:"text-sm cursor-pointer whitespace-nowrap",children:a("open_in_new_tab")})]}),e.jsxs("div",{className:"flex items-center gap-2 px-[10px]",children:[e.jsx(W,{id:"followed-only",checked:A,onCheckedChange:se}),e.jsx(X,{htmlFor:"followed-only",className:"text-sm cursor-pointer whitespace-nowrap",children:a("followed_only")})]}),e.jsxs("div",{className:"flex items-center gap-1 p-1 bg-secondary rounded-lg",children:[e.jsx(g,{variant:c==="new"?"default":"ghost",size:"sm",onClick:()=>_("new"),className:d("text-xs h-7 px-2.5",c==="new"&&"shadow-sm"),children:a("mode_new")}),e.jsx(g,{variant:c==="all"?"default":"ghost",size:"sm",onClick:()=>_("all"),className:d("text-xs h-7 px-2.5",c==="all"&&"shadow-sm"),children:a("mode_all")}),e.jsx(g,{variant:c==="updates"?"default":"ghost",size:"sm",onClick:()=>_("updates"),className:d("text-xs h-7 px-2.5",c==="updates"&&"shadow-sm"),children:a("mode_updates")})]}),e.jsxs("div",{className:"flex items-center gap-1 p-1 bg-secondary rounded-lg",children:[e.jsx(g,{variant:w==="grid"?"default":"ghost",size:"icon-sm",onClick:()=>F("grid"),className:d("h-7 w-7",w==="grid"&&"shadow-sm"),children:e.jsx(Le,{className:"h-4 w-4"})}),e.jsx(g,{variant:w==="list"?"default":"ghost",size:"icon-sm",onClick:()=>F("list"),className:d("h-7 w-7",w==="list"&&"shadow-sm"),children:e.jsx(Te,{className:"h-4 w-4"})})]})]})]}),le?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:Array.from({length:8}).map((s,l)=>e.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[e.jsx(C,{className:"aspect-video w-full"}),e.jsxs("div",{className:"p-4",children:[e.jsx(C,{className:"h-5 w-3/4 mb-2"}),e.jsx(C,{className:"h-4 w-full mb-3"}),e.jsx(C,{className:"h-4 w-1/2"})]})]},l))}):E.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[e.jsx(ke,{className:"h-16 w-16 text-muted-foreground/40 mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-1",children:a("empty_title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("empty_description")})]}):e.jsx(Me,{addons:E,viewMode:w,openInNewTab:L}),x&&x.totalPages>1&&e.jsx("div",{className:"mt-8",children:e.jsx(De,{currentPage:j,totalPages:x.totalPages,totalItems:x.total,itemsPerPage:I,onPageChange:Z,showPerPage:!1})})]})})]}):null};export{Ye as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.