adaptorex
Version:
Connect all your live interactive storytelling devices and software
2 lines (1 loc) • 4.63 kB
JavaScript
import{u as $,r as I,c as u,a as q,o as d,b as r,d as s,t as c,i as f,f as v,k as S,F as p,e as b,w as L,h as w,m as T}from"./index-BijsIkza.js";import{_ as B}from"./FoldOut-riUX07ZO.js";const D={class:"title is-5"},F={class:"tabs"},V=s("a",null,"FAVORITES",-1),A=[V],N=s("a",null,"LATEST",-1),U=[N],M={class:"tab-container is-scroll-container"},G={key:0,class:"notification is-warning is-light"},O={id:"tab-favorites",class:"tab-content dashboard is-hidden"},R={class:"tile is-ancestor mx-0"},j={class:"tile is-child box"},z={class:"level mb-2"},H={class:"level-left"},J={class:"level-item"},K={class:"has-text-is-live has-text-weight-semibold"},P={class:"level-right"},Q={class:"content"},W={id:"tab-latest",class:"tab-content dashboard"},X={class:"level p-1 is-interactive"},Y={class:"level-left"},Z={class:"level-item"},ss={class:"has-text-is-live has-text-weight-semibold"},es={class:"level-item"},ts={class:"level-right"},ns={__name:"GameDashboard",setup(os){const i=$(),h=I(null);i.dispatch("live/getItems",{query:{"dashboard.favorite":!0,_sort_by:"modified_at",_sort_direction:-1}}).then(()=>i.dispatch("live/getItems",{query:{_limit:50,_sort_by:"modified_at",_sort_direction:-1}}));const m=u(()=>i.state.game.selected),_=u(()=>i.state.live.isLive),g=I(!0),y=u(()=>i.state.live.items),E=u(()=>{const t=y.value.filter(o=>{var l;return(l=o==null?void 0:o.dashboard)==null?void 0:l.favorite});return T.chunk(t,2)});function k(t,o){const l=h.value.getElementsByClassName("tab-link"),e=h.value.getElementsByClassName("tab-content");Array.from(l).forEach(n=>n.classList.remove("is-active")),Array.from(e).forEach(n=>n.classList.add("is-hidden")),h.value.querySelector(o).classList.remove("is-hidden"),t.currentTarget.classList.add("is-active"),!_.value&&o==="#tab-favorites"?i.dispatch("live/getItems",{query:{"dashboard.favorite":!0,_sort_by:"modified_at",_sort_direction:-1}}):!_.value&&o==="#tab-latest"&&i.dispatch("live/getItems",{query:{_limit:50,_sort_by:"modified_at",_sort_direction:-1}})}function x(t){var l,e;const o={dashboard:{favorite:!((l=t==null?void 0:t.dashboard)!=null&&l.favorite),hidden_properties:(e=t==null?void 0:t.dashboard)==null?void 0:e.hidden_properties}};t.type=="plugin"?i.dispatch("plugins/editItem",{plugin:t.plugin,collection:t.collection,item:t._id,data:o}).then(()=>{_.value||i.dispatch("live/getItems",{query:{_limit:50,_sort_by:"modified_at",_sort_direction:-1}})}):t.type=="data"?i.dispatch("collections/editDocument",{collection:t.collection,id:t._id,data:o}).then(()=>{_.value||i.dispatch("live/getItems",{query:{_limit:50,_sort_by:"modified_at",_sort_direction:-1}})}):console.error(`Dashboard: Unknown Item Type ${t.type}. Unable to set favorite.`)}return(t,o)=>{const l=q("Icon");return d(),r("div",{ref_key:"container",ref:h,class:"is-clipped-container is-flex is-flex-direction-column has-background-purple-5 px-2"},[s("h1",D,"Dashboard "+c(m.value),1),s("div",F,[s("ul",null,[s("li",{class:"tab-link dashboard",onClick:o[0]||(o[0]=e=>k(e,"#tab-favorites"))},A),s("li",{class:"tab-link dashboard is-active",onClick:o[1]||(o[1]=e=>k(e,"#tab-latest"))},U)])]),s("div",M,[!_.value&&g.value?(d(),r("div",G,[s("span",null,[f(" Switch to "),s("a",{onClick:o[2]||(o[2]=e=>t.$store.dispatch("live/setIsLive",!0))},[f(" Live Mode "),v(l,{class:"is-small",icon:"play-circle"})]),f(" to continuously get the latest Item data! ")]),v(l,{class:"is-pulled-right m-1",icon:"x-circle",onClick:o[3]||(o[3]=e=>g.value=!1)})])):S("",!0),s("div",O,[(d(!0),r(p,null,b(E.value,(e,n)=>(d(),r("div",{key:`itemrow_${n}`},[s("div",R,[(d(!0),r(p,null,b(e,a=>{var C;return d(),r("div",{key:a._id,class:"tile is-parent"},[s("article",j,[s("nav",z,[s("div",H,[s("div",J,[s("p",K,c((a==null?void 0:a.name)||(a==null?void 0:a._id)),1)])]),s("div",P,[v(l,{class:"m-1",icon:"star",fill:(C=a==null?void 0:a.dashboard)!=null&&C.favorite?"#796ae5":"none",onClick:L(as=>x(a),["stop"])},null,8,["fill","onClick"])])]),s("div",Q,[s("p",null,[f(" Latest Update "),s("strong",null,c(a.modified_at),1)]),s("p",null,c(a),1)])])])}),128))])]))),128))]),s("div",W,[(d(!0),r(p,null,b(y.value,e=>(d(),r("div",{key:e._id,class:"has-background-white has-border m-2"},[v(B,null,{header:w(()=>{var n;return[s("nav",X,[s("div",Y,[s("div",Z,[s("p",ss,c((e==null?void 0:e.name)||(e==null?void 0:e._id)),1)]),s("div",es,[s("p",null,"Latest Update "+c(e.modified_at),1)])]),s("div",ts,[v(l,{class:"m-1",icon:"star",fill:(n=e==null?void 0:e.dashboard)!=null&&n.favorite?"#796ae5":"none",onClick:L(a=>x(e),["stop"])},null,8,["fill","onClick"])])])]}),default:w(()=>[s("pre",null,c(e),1)]),_:2},1024)]))),128))])])],512)}}};export{ns as default};