Files
PhaseWeb3-Vue/assets/VideoView.0e8ae892.js

2 lines
3.0 KiB
JavaScript

import{r as b,o as B,a as d,c as F,w as c,b as i,W as N,e as o,i as u,X as w,a4 as P,_ as y,g as e,V as S,t as m,f as T,F as D,k as G,a5 as L,l as U,n as Y,a6 as j}from"./index.96d40b09.js";import{_ as A}from"./GeneralTable.e5071b55.js";import{j as I}from"./account.8babdda8.js";const O={key:0,class:"grid grid-cols-1 md:grid-cols-2 gap-4"},R={controls:"",class:"mt-3 rounded-xl w-[640px] xl:w-[1280px]"},W=["src"],E={class:"text-center md:text-left grid grid-cols-1 place-content-start gap-6"},M={class:"space-y-1"},X={class:"text-xl xl:text-2xl font-light"},q={key:1},z={class:"space-y-1 text-center"},H=e("h1",{class:"text-2xl xl:text-4xl font-bold"}," Your video is still uploading! ",-1),J=e("h2",{class:"text-xl xl:text-2xl font-light"}," Please wait for the upload to complete. ",-1),K={class:"text-xl xl:text-xl"},Q={class:"bg-white dark:bg-slate-900/95 rounded-2xl lg:flex lg:justify-between"},Z={class:"w-full"},lt={__name:"VideoView",setup(tt){var s=b([]);const V=b(!1),k=[{text:"Timestamp",value:"timestamp",sortable:!0,width:120},{text:"Game",value:"game",sortable:!0,width:120},{text:"Version",value:"version",sortable:!0,width:120},{text:"Status",value:"data.status",sortable:!0,width:120}];async function $(){s.value=null;try{const a=await I();s.value=C(a)}catch(a){console.error("Failed to fetch video data:",a)}V.value=!1}B(async()=>{await $()});function C(a){var l;a.sort(function(t,n){return n.timestamp-t.timestamp});for(const t of a){const n=j(t.game);if(t.game=n.name,t.version=(l=n.versions.find(r=>r.id==t.version).label)!=null?l:0,t.timestamp){const r=new Date(t.timestamp*1e3);t.timestamp=r.toLocaleString()}}return a}const _=a=>{var l,t;(l=a.data)!=null&&l.url&&(a=(t=a.data)==null?void 0:t.url),navigator.clipboard.writeText(a).then(()=>{alert("Copied URL to clipboard!")}).catch(()=>{alert("Failed to copy to clipboard!")})};return(a,l)=>(d(),F(Y,null,{default:c(()=>[i(U,null,{default:c(()=>[i(N,{class:"mb-6","use-small":"","even-smaller":""}),o(s)[0]?(d(),u(D,{key:0},[i(w,{icon:o(P),title:"Your Latest Upload",main:""},null,8,["icon"]),i(y,{class:"mb-6"},{default:c(()=>{var t,n,r,f,p,x,h;return[((n=(t=o(s)[0])==null?void 0:t.data)==null?void 0:n.status)=="uploaded"?(d(),u("div",O,[e("video",R,[e("source",{src:(f=(r=o(s)[0])==null?void 0:r.data)==null?void 0:f.url,type:"video/mp4"},null,8,W),S(" Your browser does not support the video tag. ")]),e("div",E,[e("div",M,[e("h2",X,m((p=o(s)[0])==null?void 0:p.game)+" "+m((x=o(s)[0])==null?void 0:x.version),1)]),e("div",null,[e("p",null,m((h=o(s)[0])==null?void 0:h.timestamp),1)]),e("div",null,[i(T,{color:"info",label:"Share",onClick:l[0]||(l[0]=et=>{var v,g;return _((g=(v=o(s)[0])==null?void 0:v.data)==null?void 0:g.url)})})])])])):(d(),u("div",q,[e("div",z,[H,J,e("h2",K," Upload started at "+m(o(s)[0].timestamp),1)])]))]}),_:1})],64)):G("",!0),i(w,{icon:o(L),title:"All Play Videos",main:""},null,8,["icon"]),i(y,{"has-table":""},{default:c(()=>[e("div",Q,[e("div",Z,[i(A,{headers:k,items:o(s),onRowClicked:_},null,8,["items"])])])]),_:1})]),_:1})]),_:1}))}};export{lt as default};