mirror of
https://github.com/PhaseII-eAmusement-Network/PhaseWeb3-Vue.git
synced 2026-10-27 17:41:09 -05:00
2 lines
4.3 KiB
JavaScript
2 lines
4.3 KiB
JavaScript
import{B as D,G,a as c,i as p,g as n,b as i,ax as R,t as N,e as s,H as C,k as _,s as L,N as j,av as F,r as $,o as H,c as y,w as g,f as b,ay as M,az as T,at as q,X as z,aA as E,_ as X,l as O,n as U,p as J,q as K}from"./index.26ff47d4.js";import{_ as Q}from"./FormControl.e7078065.js";import{_ as W}from"./ProfileCard.5d6ea02b.js";import{_ as Y}from"./GeneralTable.939c2b56.js";import{A as Z,a as ee}from"./profile.01850f6f.js";import{g as te,a as se}from"./sources.d047f50b.js";import{d as ae}from"./userData.bcc92478.js";import{g as P}from"./danClass.233b0381.js";const oe={class:"pt-6 mb-6 flex items-center justify-between"},re={class:"flex items-center justify-start space-x-2"},le={class:"text-2xl md:text-3xl leading-tight"},ne={__name:"GameTitleLine",props:{path:{type:String,default:null},title:{type:String,required:!0}},setup(h){const v=D(()=>G().default);return(f,r)=>(c(),p("section",oe,[n("div",re,[i(R,{path:h.path,class:"w-12 h-12 p-1 drop-shadow-md"},null,8,["path"]),n("h1",le,N(h.title),1)]),s(v)?C(f.$slots,"default",{key:0}):_("",!0)]))}},ie=["src"],ce={class:"bg-white dark:bg-slate-900/90 rounded-2xl pt-6 p-3 card-content"},de={class:"w-full"},ue={class:"md:flex md:px-5 md:space-x-10 md:justify-between md:items-center"},fe={key:0,class:"md:w-1/3 md:text-right"},me=n("h2",{class:"text-md sm:text-lg md:text-xl font-bold p-2"}," Select Version ",-1),pe={key:0,class:"w-full pt-6 pb-10"},_e={key:1,class:"md:w-1/2 grid grid-cols-1 md:grid-cols-2 gap-3"},he={class:"bg-white dark:bg-slate-900/95 rounded-2xl lg:flex lg:justify-between"},ve={class:"w-full"},Se={__name:"GameView",setup(h){const v=J(),f=K();var r=null,a=null;const l=L({currentVersion:null});j(()=>l.currentVersion,()=>{w()}),r=v.params.id,a=F(r),a==null&&f.push({name:"ErrorPage",params:{catchAll:"404"}});const d=$(null),x=$([]);H(async()=>{try{const t=await Z(r);x.value=S(t)}catch(t){console.error("Failed to fetch profile data:",t)}w()}),a.versions||(l.currentVersion=1);async function w(){try{d.value=null;const t=await ee(r,l.currentVersion);d.value=t,t&&!l.currentVersion&&(l.currentVersion=t.versions[t.versions.length-1])}catch(t){console.error("Failed to fetch user profile data:",t)}}const u=[];if(u.push({text:"Player",value:"username",sortable:!0,width:120}),a.noRivals||u.push({text:"Rival ID",value:"extid",width:100}),u.push({text:"Last Play",value:"stats.last_play_timestamp",width:150},{text:"Last Arcade",value:"stats.last_play_arcade",width:150},{text:"Plays",value:"stats.total_plays",sortable:!0,width:50}),a.playerHeaders)for(var k of a.playerHeaders)u.push(k);function S(t){var o=[];for(var e of t){if(e.extid&&(e.extid=ae(e.extid)),e.stats){if(e.stats.last_play_timestamp){const m=new Date(e.stats.last_play_timestamp*1e3);e.stats.last_play_timestamp=m.toLocaleString()}e.sgrade&&(e.sgrade=P(e.sgrade).short),e.dgrade&&(e.dgrade=P(e.dgrade).short)}o.push(e)}return o.sort((m,V)=>{const B=m.stats&&m.stats.total_plays||0;return(V.stats&&V.stats.total_plays||0)-B}),o}function A(t){var o=[];for(const e of a.versions)t.includes(e.id)&&o.push(e);return o}const I=t=>{const o=t.userId;f.push(`/games/${r}/profiles/${o}`)};return(t,o)=>(c(),y(U,null,{default:g(()=>[i(O,null,{default:g(()=>[n("div",{style:q(s(se)(s(a),l.currentVersion)),class:"rounded-2xl mb-6 card-container"},[n("video",{autoplay:"",muted:"",loop:"",playsinline:"",src:s(te)(s(a),l.currentVersion),class:"background-video"},null,8,ie),n("div",ce,[n("div",de,[n("div",ue,[i(ne,{path:s(a).icon,title:s(a).name},null,8,["path","title"]),s(a).versions&&d.value?(c(),p("div",fe,[me,i(Q,{modelValue:l.currentVersion,"onUpdate:modelValue":o[0]||(o[0]=e=>l.currentVersion=e),options:A(d.value.versions)},null,8,["modelValue","options"])])):_("",!0)])]),d.value?(c(),p("div",pe,[i(W,{game:s(r),version:l.currentVersion,profile:d.value},null,8,["game","version","profile"])])):(c(),p("div",_e,[s(a).noScores?_("",!0):(c(),y(b,{key:0,href:`/#/games/${s(r)}/scores`,icon:s(M),outline:!1,color:"info",label:"Network Scores"},null,8,["href","icon"])),s(a).noRecords?_("",!0):(c(),y(b,{key:1,href:`/#/games/${s(r)}/records`,icon:s(T),outline:!1,color:"info",label:"Network Records"},null,8,["href","icon"]))]))])],4),i(z,{icon:s(E),title:"All Players",main:""},null,8,["icon"]),i(X,{"has-table":""},{default:g(()=>[n("div",he,[n("div",ve,[i(Y,{headers:u,items:x.value,path:`/#/${s(r)}/profiles/`,onRowClicked:I},null,8,["items","path"])])])]),_:1})]),_:1})]),_:1}))}};export{Se as default};
|