Files
PhaseWeb3-Vue/assets/PlayerView.716e2002.js

6 lines
11 KiB
JavaScript

import{u as le,r as q,o as X,a as l,i as y,j as T,c as u,w as m,g as s,b as d,Y as B,k as n,t as _,_ as L,F as g,av as se,s as re,N as ne,l as ie,e as r,m as oe,f as M,aE as ue,X as F,ay as ce,az as de,at as me,ab as f,z as _e,V as w,aF as be,aG as pe,aH as fe,n as ye,p as ve,q as ge}from"./index.dc5fb320.js";import{_ as he,g as E,a as J}from"./ProfileCard.4a827052.js";import{_ as ke}from"./FormControl.d6dcd737.js";import{a as we}from"./profile.cd3f5405.js";import{A as xe}from"./arcade.62e0006e.js";import{g as R}from"./danClass.233b0381.js";import"./userData.bcc92478.js";const Ve={class:"flex space-x-2 mb-2"},Se={class:"flex justify-between items-center"},$e={class:"grid"},De={class:"text-lg font-bold"},je={class:"text-md"},Pe={class:"text-lg"},Ne={class:"text-lg"},U={__name:"JubilityTable",props:{jubilityData:{type:Array,required:!0},version:{type:Number,required:!0}},setup(z){const x=z,G=le(),b=q(null),c={0:{label:"Basic",color:"info"},1:{label:"Advanced",color:"warning"},2:{label:"Extreme",color:"danger"}};return X(async()=>{try{b.value=null;const h=x.jubilityData.map(v=>v.song_id),o=await G.getMusicData("jubeat",x.version,h),e=x.jubilityData.map(v=>{const V=o.find(N=>N.id===v.song_id&&N.chart===v.chart);return{...v,...V?{songData:V}:{}}});e.sort((v,V)=>V.rate-v.rate),b.value=e}catch(h){console.error("Failed to fetch music data:",h)}}),(h,o)=>b.value?(l(!0),y(g,{key:0},T(b.value,e=>(l(),u(L,{key:e.id,"color-prop":"bg-slate-800 dark:bg-slate-800",class:"my-3 p-5","has-table":""},{default:m(()=>[s("div",Ve,[d(B,{label:c[e.chart].label,color:c[e.chart].color},null,8,["label","color"]),e.hard?(l(),u(B,{key:0,label:"Hard Mode",color:"danger"})):n("",!0)]),s("div",Se,[s("div",$e,[s("h1",De,_(e.songData.name),1),s("h2",je,_(e.songData.artist),1)]),s("div",null,[s("h2",Pe,"Jubility: "+_(e.value/10),1),s("h2",Ne,"Rate: "+_(e.rate/10),1)])])]),_:2},1024))),128)):n("",!0)}},Ce={class:"md:flex pb-6 md:justify-between md:items-center"},Ae={key:0,class:"mt-2 md:mt-0 md:w-1/3 md:text-right"},Ie=s("h2",{class:"text-md sm:text-lg md:text-xl font-bold p-2"}," Select Version ",-1),Fe=["src"],Je={class:"bg-white dark:bg-slate-900/90 rounded-2xl pt-6 p-3 card-content"},Te={class:"w-full"},Le={class:"md:w-1/3 grid grid-cols-1 md:grid-cols-2 gap-3"},Be={class:"my-6 grid grid-cols-1 md:grid-cols-4 gap-6"},Ge={class:"my-6 grid grid-cols-2 md:grid-cols-5 xl:grid-cols-6 gap-6"},Oe={class:"my-6 grid grid-cols-1 md:grid-cols-2 gap-6"},Me={class:"my-6"},Re={class:"border-s border-neutral-300 md:flex md:justify-start md:gap-10 md:border-s-0 md:border-t md:overflow-x-auto overflow-y-visible md:whitespace-nowrap scrollbar"},ze={class:"flex-start flex items-center pt-2 md:block md:pt-4"},Ee=s("div",{class:"-ms-[6px] me-3 h-[12px] w-[12px] md:w-0.5 md:h-4 rounded-full md:rounded-none bg-gray-300 md:-mt-6 md:me-0 md:ms-0"},null,-1),Ue={class:"mt-2 text-sm font-light"},qe={class:"ms-4 pb-6 md:ms-0"},Xe={class:"text-lg font-semibold"},aa={__name:"PlayerView",setup(z){const x=ve(),G=ge();var b=null,c=null,h=null;b=x.params.game,h=x.params.userId,c=se(b),c||G.push({name:"ErrorPage",params:{catchAll:"404"}});const o=re({currentVersion:null});ne(()=>o.currentVersion,()=>{v()});const e=q(null);X(async()=>{v()}),c.versions||(o.currentVersion=1);async function v(){try{e.value=null;var t=await we(b,o.currentVersion,h);t.timeline=await te(t),e.value=ee(t),t&&!o.currentVersion&&(o.currentVersion=t.versions[t.versions.length-1])}catch(a){console.error("Failed to fetch user profile data:",a)}}async function V(t){try{const a=await xe(t);return console.log(a),a}catch(a){console.error("Failed to fetch arcade data:",a)}}var N=[{label:"Register Date",type:String,span:"md:col-span-2",key:"first_play_timestamp"},{label:"Last Play",type:String,span:"md:col-span-2",key:"last_play_timestamp"},{label:"First Arcade",type:String,span:"md:col-span-2",key:"first_play_arcade"},{label:"Last Arcade",type:String,span:"md:col-span-2",key:"last_play_arcade"},{label:"Total Plays",type:Number,key:"total_plays"},{label:"EXP",type:Number,key:"exp"},{label:"SP Plays",type:Number,key:"single_plays"},{label:"DP Plays",type:Number,key:"double_plays"},{label:"SP DJPOINT",type:Number,key:"single_dj_points"},{label:"DP DJPOINT",type:Number,key:"double_dj_points"}];function H(){return o.currentVersion?`/assets/games/${c.id}/card/${o.currentVersion}.webp`:c.cardBG}function Y(){var t;return o.currentVersion&&((t=c.videoTable)==null?void 0:t.includes(o.currentVersion))?`https://web3.phaseii.network/gameassets/video/${c.id}/${o.currentVersion}.mp4`:null}function K(){var t;return(t=c.videoTable)!=null&&t.includes(o.currentVersion)?null:`
background-image: url('${H()}');
background-size: cover;
background-repeat: no-repeat;
`}function Q(t,a){if(a){if(t.isSkill&&a.jubility)return E(a.jubility);if(t.isJubility&&a.records.skill)return J(a.records.skill)}return""}function W(t){var a=[];for(const p of c.versions)t.includes(p.id)&&a.push(p);return a}function Z(t,a){return t.isSkill?a.stats[t.key]/100:t.isJubility?a.stats[t.key]/10:a.stats[t.key]}function ee(t){if(t.stats){if(t.stats.first_play_timestamp){const a=new Date(t.stats.first_play_timestamp*1e3);t.stats.first_play_timestamp=a.toLocaleString()}if(t.stats.last_play_timestamp){const a=new Date(t.stats.last_play_timestamp*1e3);t.stats.last_play_timestamp=a.toLocaleString()}t.dp&&t.dp.dan!==void 0&&(t.dp.dan=R(t.dp.dan).short)}return t}function ae(t){var p;const a=(p=t.stats)==null?void 0:p.count;return a?[a.mfc!=null?{label:"MFCs",value:a.mfc}:0,a.pfc!=null?{label:"PFCs",value:a.pfc}:0,a.fc!=null?{label:"GFCs",value:a.fc}:0,a.gfc!=null?{label:"FCs",value:a.gfc}:0,a.life4!=null?{label:"Life-4 Clears",value:a.life4}:0]:[]}async function te(t){const a=t==null?void 0:t.stats,p=a==null?void 0:a.first_play_timestamp,S=a==null?void 0:a.last_play_timestamp,j=a==null?void 0:a.arcade_history,k=[];if(p&&k.push({timestamp:new Date(p*1e3).toLocaleString(),arcade:a==null?void 0:a.first_play_arcade,first_play:!0}),j)for(const[$,D]of Object.entries(j)){const C=await V($);for(const[A,I]of Object.entries(D))for(const P of I){const i=new Date(P*1e3);[p,S].includes(P)||k.push({timestamp:i.toLocaleString(),arcade:C.name,machineId:A,first_play:!1})}}return S&&k.push({timestamp:new Date(S*1e3).toLocaleString(),arcade:a==null?void 0:a.last_play_arcade,first_play:!1}),k.sort(($,D)=>$.timestamp-D.timestamp)}return(t,a)=>(l(),u(ye,null,{default:m(()=>[e.value?(l(),u(ie,{key:0},{default:m(()=>{var p,S,j,k,$,D,C,A,I,P;return[s("div",Ce,[d(M,{icon:r(oe),href:`/#/games/${r(b)}`,class:"w-full md:w-auto",color:"info",label:`${r(c).shortName?r(c).shortName:r(c).name} Home`},null,8,["icon","href","label"]),r(c).versions&&e.value?(l(),y("div",Ae,[Ie,d(ke,{modelValue:o.currentVersion,"onUpdate:modelValue":a[0]||(a[0]=i=>o.currentVersion=i),options:W(e.value.versions)},null,8,["modelValue","options"])])):n("",!0)]),d(F,{icon:r(ue),title:"View Profile",main:""},null,8,["icon"]),o.currentVersion&&e.value?(l(),y("div",{key:0,style:me(K()),class:"rounded-2xl mb-6 card-container"},[s("video",{autoplay:"",muted:"",loop:"",playsinline:"",src:Y(),class:"background-video"},null,8,Fe),s("div",Je,[s("div",Te,[d(he,{"use-small":"",game:r(b),version:o.currentVersion,profile:e.value},{default:m(()=>[s("div",Le,[d(M,{href:`/#/games/${r(b)}/scores/${e.value.userId}`,icon:r(ce),class:"w-full md:w-auto",color:"info",label:"View Scores"},null,8,["href","icon"]),d(M,{href:`/#/games/${r(b)}/records/${e.value.userId}`,icon:r(de),class:"w-full md:w-auto",color:"info",label:"View Records"},null,8,["href","icon"])])]),_:1},8,["game","version","profile"])])])],4)):n("",!0),s("div",Be,[(l(!0),y(g,null,T(r(N),i=>(l(),y(g,{key:i},[e.value.stats[i.key]?(l(),u(f,{key:0,class:_e(i.span),label:i.label,number:i.type==Number?Z(i,e.value):null,"num-color":Q(i)},{default:m(()=>[w(_(i.type==String?e.value.stats[i.key]:null)+" ",1)]),_:2},1032,["class","label","number","num-color"])):n("",!0)],64))),128)),(S=(p=e.value.stats)==null?void 0:p.count)!=null&&S.records?(l(),u(f,{key:0,label:"Records",number:(k=(j=e.value.stats)==null?void 0:j.count)==null?void 0:k.records},null,8,["number"])):n("",!0),(D=($=e.value.stats)==null?void 0:$.count)!=null&&D.attempts?(l(),u(f,{key:1,label:"Attempts",number:(A=(C=e.value.stats)==null?void 0:C.count)==null?void 0:A.attempts},null,8,["number"])):n("",!0),e.value.skill?(l(),u(f,{key:2,label:"Skill Points",number:e.value.skill/100,"num-color":r(E)(e.value.skill)},null,8,["number","num-color"])):n("",!0),e.value.profile_skill?(l(),u(f,{key:3,label:"Skill Level"},{default:m(()=>[w(_(e.value.profile_skill/100),1)]),_:1})):n("",!0),e.value.jubility?(l(),u(f,{key:4,label:"Jubility","num-color":r(J)(e.value.jubility)},{default:m(()=>[w(_(e.value.jubility/10),1)]),_:1},8,["num-color"])):n("",!0),e.value.pick_up_jubility?(l(),u(f,{key:5,label:"Pick-Up Jubility","num-color":r(J)(e.value.pick_up_jubility)},{default:m(()=>[w(_(e.value.pick_up_jubility/10),1)]),_:1},8,["num-color"])):n("",!0),e.value.common_jubility?(l(),u(f,{key:6,label:"Common Jubility","num-color":r(J)(e.value.common_jubility)},{default:m(()=>[w(_(e.value.common_jubility/10),1)]),_:1},8,["num-color"])):n("",!0),e.value.deller?(l(),u(f,{key:7,label:"Deller",number:e.value.deller},null,8,["number"])):n("",!0),e.value.sgrade?(l(),u(f,{key:8,label:"SP DAN"},{default:m(()=>[w(_(r(R)(e.value.sgrade).label),1)]),_:1})):n("",!0),e.value.dgrade?(l(),u(f,{key:9,label:"DP DAN"},{default:m(()=>[w(_(r(R)(e.value.dgrade).label),1)]),_:1})):n("",!0)]),(I=e.value.stats)!=null&&I.count?(l(),y(g,{key:1},[d(F,{icon:r(be),title:"Stats",main:""},null,8,["icon"]),s("div",Ge,[(l(!0),y(g,null,T(ae(e.value),i=>(l(),y(g,{key:i},[i.value?(l(),u(f,{key:0,label:i.label,number:i.value},null,8,["label","number"])):n("",!0)],64))),128))])],64)):n("",!0),e.value.jubility?(l(),y(g,{key:2},[d(F,{icon:r(pe),title:"Jubility Breakdown",main:""},null,8,["icon"]),s("div",Oe,[e.value.pick_up_breakdown?(l(),u(L,{key:0},{default:m(()=>[d(B,{label:"Pick-Up",color:"info"}),d(U,{"jubility-data":e.value.pick_up_breakdown,",":"",version:o.currentVersion},null,8,["jubility-data","version"])]),_:1})):n("",!0),e.value.other_breakdown?(l(),u(L,{key:1},{default:m(()=>[d(B,{label:"Common",color:"info"}),d(U,{"jubility-data":e.value.other_breakdown,",":"",version:o.currentVersion},null,8,["jubility-data","version"])]),_:1})):n("",!0)])],64)):n("",!0),(P=e.value)!=null&&P.timeline?(l(),y(g,{key:3},[d(F,{icon:r(fe),title:"Timeline",main:""},null,8,["icon"]),s("div",Me,[d(L,null,{default:m(()=>{var i;return[s("ol",Re,[(l(!0),y(g,null,T(JSON.parse(JSON.stringify((i=e.value)==null?void 0:i.timeline)).reverse(),O=>(l(),y("li",{key:O.timestamp,class:"md:inline-block flex-shrink-0"},[s("div",ze,[Ee,s("p",Ue,_(O.timestamp),1)]),s("div",qe,[s("h4",Xe,_(O.arcade),1)])]))),128))])]}),_:1})])],64)):n("",!0)]}),_:1})):n("",!0)]),_:1}))}};export{aa as default};