UNPKG

adaptorex

Version:

Connect all your live interactive storytelling devices and software

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