mirror of
https://github.com/exogen/t2-model-skinner.git
synced 2026-01-19 19:24:44 +00:00
2 lines
3.8 KiB
JavaScript
2 lines
3.8 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[214],{4080:function(e,l,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/gallery",function(){return n(1560)}])},1560:function(e,l,n){"use strict";n.r(l),n.d(l,{default:function(){return GalleryPage}});var a=n(5893),i=n(7294),r=n(3181),s=n(2091),t=n(1163),o=n(5316),c=n.n(o);let u={customSkins:{},newSkins:{}};var m=n(9746),d=n.n(m),h=n(9008),_=n.n(h),x=n(1664),f=n.n(x);let g=[];function GalleryPage(){var e,l;let n=(0,t.useRouter)(),[o,m]=function(){let[e,l]=(0,i.useState)(u);(0,i.useEffect)(()=>{let e=new AbortController,n=e.signal,a=!1,loadCustomSkins=async()=>{let e;try{if(e=await fetch("".concat("https://exogen.github.io/t2-skins","/skins.json"),{signal:n}),!a){let n=await e.json();a||l(n)}}catch(e){console.error(e)}};return loadCustomSkins(),()=>{a=!0,e.abort()}},[]);let n=e!==u;return[e,n]}(),[h,x]=(0,i.useState)("lmale"),y="hfemale"===h?"hmale":h,p=null!==(l=null===(e=o.customSkins)||void 0===e?void 0:e[y])&&void 0!==l?l:g,v=(0,i.useMemo)(()=>{if(null==o||!o.newSkins||"new"!==h)return[];{let e=new Map;Object.entries(o.newSkins).forEach(l=>{let[n,a]=l;a.forEach(l=>{var a;let i=null!==(a=e.get(l))&&void 0!==a?a:[];i.push(n),e.set(l,i)})});let l=c()(Array.from(e.keys()),[e=>e.toLowerCase()],["asc"]),n=[];return l.forEach(l=>{var a;let i=null!==(a=e.get(l))&&void 0!==a?a:[];n.push(...i.map(e=>({name:l,model:e})))}),n}},[h,o]),b="new"===h?v:p,j=n.query.filter&&"string"==typeof n.query.filter?n.query.filter:"lmale";return(0,i.useEffect)(()=>{x(j)},[j]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(_(),{children:(0,a.jsx)("title",{children:"Tribes 2 Skin Gallery"})}),(0,a.jsxs)("main",{className:d().GalleryPage,children:[(0,a.jsxs)("div",{className:d().Tools,children:[(0,a.jsxs)(f(),{className:d().Back,href:"../",children:[(0,a.jsx)(s.bUI,{size:12,className:d().Icon})," ",(0,a.jsx)("span",{className:d().Label,children:"Back to Editor"})]}),(0,a.jsxs)("select",{tabIndex:0,id:"ModelSelect","aria-label":"Player model",onChange:e=>{n.push("?filter=".concat(e.target.value))},value:h,children:[(0,a.jsx)("option",{value:"new",children:"All new skins ✨"}),(0,a.jsx)("option",{value:"lmale",children:"Human Male \xb7 Light"}),(0,a.jsx)("option",{value:"mmale",children:"Human Male \xb7 Medium"}),(0,a.jsx)("option",{value:"hmale",children:"Human Male \xb7 Heavy"}),(0,a.jsx)("option",{value:"lfemale",children:"Human Female \xb7 Light"}),(0,a.jsx)("option",{value:"mfemale",children:"Human Female \xb7 Medium"}),(0,a.jsx)("option",{value:"hfemale",children:"Human Female \xb7 Heavy"}),(0,a.jsx)("option",{value:"lbioderm",children:"Bioderm \xb7 Light"}),(0,a.jsx)("option",{value:"mbioderm",children:"Bioderm \xb7 Medium"}),(0,a.jsx)("option",{value:"hbioderm",children:"Bioderm \xb7 Heavy"})]}),(0,a.jsx)("a",{href:"https://github.com/exogen/t2-model-skinner",className:d().IconLink,children:(0,a.jsx)(s.hJX,{size:32})})]}),m?(0,a.jsx)("div",{className:d().Gallery,children:b.map(e=>{let l,n;"string"==typeof e?(l=e,n=y):(l=e.name,n=e.model);let i="".concat("https://exogen.github.io/t2-skins","/gallery/").concat(encodeURIComponent(l),".").concat(n,".webp");return(0,a.jsxs)("div",{className:d().Skin,children:[(0,a.jsx)("img",{className:d().Preview,loading:"lazy",src:i,width:680,height:800,alt:l}),(0,a.jsx)("div",{className:d().Name,children:l})]},"".concat(l,":").concat(n))})}):(0,a.jsx)(r.xHo,{className:d().Spinner})]})]})}},9746:function(e){e.exports={GalleryPage:"gallery_GalleryPage__QyCLn",Tools:"gallery_Tools__COicv",Back:"gallery_Back__xvbOe",IconLink:"gallery_IconLink__7NlBA",Gallery:"gallery_Gallery__ZMJE_",Skin:"gallery_Skin__Ep_rb",Preview:"gallery_Preview__JGf2f",Name:"gallery_Name__W9Aoc",Spinner:"gallery_Spinner__9jTLL",spin:"gallery_spin__EVmH5",Label:"gallery_Label__kJfDw"}}},function(e){e.O(0,[774,365,648,918,888,179],function(){return e(e.s=4080)}),_N_E=e.O()}]);
|
|
//# sourceMappingURL=gallery-d26bf35c2ee9c5b4.js.map
|