@getontime/cli
Version:
Time keeping for live events
3 lines (2 loc) • 7.3 kB
JavaScript
import{a7 as w,r as h,y as _,z as k,j as e}from"./vendor-DFNUfA2K.js";import{P as T,g as m,z as O,A,b as g,i as n,w as x,f as C,C as E,a as f,D as P,u as M,c as I,d as V,L as D,h as F,O as L}from"./index-BNit4nUw.js";import{E as z}from"./EmptyPage-dVRQ987V.js";import{V as R}from"./ViewLogo-BhUYUzFU.js";import{O as p,i as H,V as W}from"./ViewParamsEditor-C6i_vUmm.js";import{u as B}from"./useWindowTitle-Bgl000Se.js";import{g as $}from"./common.options-CwGs4uxL.js";import{S as Q,a as U}from"./viewLoader.utils-CeLIIcNn.js";import{a as X,g as Y}from"./offset-DC4blUxG.js";import{g as q}from"./presentation.utils-C6tDFxNi.js";import{u as G}from"./useProjectData-BfKJevmX.js";import"./Empty-BLJKwoJq.js";import"./Select-Bp_h4xvR.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="75148b23-558d-4401-bff6-55b265a2bf91",s._sentryDebugIdIdentifier="sentry-dbid-75148b23-558d-4401-bff6-55b265a2bf91")}catch{}})();const J=s=>[{title:p.ClockOptions,collapsible:!0,options:[$(s)]},{title:p.ElementVisibility,collapsible:!0,options:[{id:"hideCards",title:"Hide cards section",description:"Hides the card section with the timers",type:"boolean",defaultValue:!1}]}];function K(s,t){return{hideCards:H((i=>(t==null?void 0:t.get(i))??s.get(i))("hideCards"))}}function Z(){const[s]=w(),t=h.use(T);return h.useMemo(()=>{const i=t?new URLSearchParams(t.search):void 0;return K(s,i)},[t,s])}function ee(){const{width:s}=_(),t=k();return h.useMemo(()=>(t==="ios"||t==="android")&&s<800,[s,t])}function se(s){const[t,a]=(()=>{const i=m(s);return i.endsWith("AM")?[i.slice(0,-2),"AM"]:i.endsWith("PM")?[i.slice(0,-2),"PM"]:[i,void 0]})();return{seconds:O(s),display:t,meridian:a}}const te=[...Array(12).keys()],ie=[...Array(60).keys()];function ae({hideCards:s}){const t=ee(),{clock:a,playback:i}=A(),d=i!==g.Stop;if(t&&!s)return e.jsx(re,{clock:a,onAir:d});const{seconds:r,display:o,meridian:l}=se(a);return e.jsx("div",{className:"studio__clock",children:e.jsxs("div",{className:"clock-container",children:[ie.map(c=>e.jsx("div",{className:n(["tick",c<=r&&"tick--active"]),style:{transform:`rotate(${180+c*6}deg) translateY(var(--half-size))`}},c)),te.map(c=>e.jsx("div",{className:"tick tick--active",style:{transform:`rotate(${180+c*30}deg) translateX(var(--smaller-half-size))`}},c)),e.jsx("div",{className:n(["ampm",!!l&&"ampm--active"]),children:l}),e.jsx("div",{className:"time time--large",children:o}),e.jsx("div",{className:n(["on-air",d&&"on-air--active"]),children:"ON AIR"})]})})}function re({clock:s,onAir:t}){const a=m(s);return e.jsxs("div",{className:"studio__clock studio__clock--small",children:[e.jsx(Q,{className:"time time--small",time:a}),e.jsx("div",{className:n(["on-air",t&&"on-air--active"]),children:"ON AIR"})]})}const v={format12:"h:mm a",format24:"HH:mm"};function de(s){return{actualStart:m(s.actualStart,v),expectedEnd:m(s.expectedEnd,v),offset:X(s.offset)}}function ce(s,t){return{title:(s==null?void 0:s.title)||"-",startedAt:m(t.startedAt,v),expectedEnd:m(t.expectedFinish,v),timer:x(t.current)}}function ne({viewSettings:s}){const{getLocalizedString:t}=C(),{eventNow:a,eventNext:i,message:d,time:r,offset:o,rundown:l}=E(),c=de({offset:o.absolute,actualStart:l.actualStart,expectedEnd:o.expectedRundownEnd}),u=ce(a,r),N=(i==null?void 0:i.title)||"-",b=d.timer.visible&&d.timer.text||"-",S=d.secondary||"-",y=q(s,void 0,r.phase===f.Warning,r.phase===f.Danger),j=Y(o.absolute);return e.jsxs("div",{className:"studio__timers",children:[e.jsx("div",{className:"card",id:"card-schedule",children:e.jsxs("div",{className:"card__row",children:[e.jsxs("div",{children:[e.jsx("div",{className:"label",children:t("common.started_at")}),e.jsx("div",{className:"runtime-timer",children:c.actualStart})]}),e.jsxs("div",{children:[e.jsx("div",{className:"label center",children:"Over / under"}),e.jsx("div",{className:n(["runtime-timer","center",!a&&"muted",j&&j]),children:c.offset})]}),e.jsxs("div",{children:[e.jsx("div",{className:"label right",children:t("common.expected_end")}),e.jsx("div",{className:"runtime-timer right",children:c.expectedEnd})]})]})}),e.jsxs("div",{className:"card",id:"card-event-now",children:[e.jsxs("div",{className:"card__row",children:[e.jsxs("div",{children:[e.jsx("div",{className:"label",children:t("common.now")}),e.jsx("div",{className:"title",children:u.title})]}),e.jsxs("div",{children:[e.jsx("div",{className:"label right",children:t("common.next")}),e.jsx("div",{className:"title right",children:N})]})]}),e.jsxs("div",{className:"card__row",children:[e.jsxs("div",{children:[e.jsx("div",{className:"label",children:t("common.started_at")}),e.jsx("div",{className:"runtime-timer",children:u.startedAt})]}),e.jsxs("div",{children:[e.jsx("div",{className:"label"}),e.jsx("div",{className:n(["event-timer",r.phase===f.Overtime&&"event-timer--finished",r.playback===g.Pause&&"event-timer--paused"]),style:{"--phase-color":y},"data-phase":r.phase,children:u.timer})]}),e.jsxs("div",{children:[e.jsx("div",{className:"label right",children:t("common.expected_end")}),e.jsx("div",{className:"runtime-timer right",children:u.expectedEnd})]})]})]}),e.jsx(oe,{}),e.jsx("div",{className:"card",id:"card-timer-message",children:e.jsxs("div",{children:[e.jsx("div",{className:"label",children:"Timer message"}),e.jsx("div",{className:n(["extra",!1]),children:b})]})}),e.jsx("div",{className:"card",id:"card-secondary-message",children:e.jsxs("div",{children:[e.jsx("div",{className:"label",children:"Secondary message"}),e.jsx("div",{className:n(["extra",!1]),children:S})]})})]})}function oe(){const s=P();return e.jsx("div",{className:"card",id:"card-aux",children:e.jsxs("div",{className:"card__row",children:[e.jsxs("div",{children:[e.jsx("div",{className:"label",children:"Aux 1"}),e.jsx("div",{className:"extra",children:x(s.aux1)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"label center",children:"Aux 2"}),e.jsx("div",{className:"extra center",children:x(s.aux2)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"label right",children:"Aux 3"}),e.jsx("div",{className:"extra right",children:x(s.aux3)})]})]})})}function le(){const s=M(l=>l.mirror),{data:t,status:a}=G(),{data:i,status:d}=I(),{data:r,status:o}=V();return{data:{projectData:t,isMirrored:s,settings:r,viewSettings:i},status:U([a,d,o])}}function _e(){const{data:s,status:t}=le();return B("Studio Clock"),t==="pending"?e.jsx(D,{}):t==="error"?e.jsx(z,{text:"There was an error fetching data, please refresh the page."}):e.jsx(me,{...s})}function me({projectData:s,isMirrored:t,settings:a,viewSettings:i}){const{hideCards:d}=Z(),r=F(a==null?void 0:a.timeFormat),o=h.useMemo(()=>J(r),[r]);return e.jsxs("div",{className:n(["studio",t&&"mirror"]),"data-testid":"studio-view",children:[e.jsx(W,{target:L.StudioClock,viewOptions:o}),e.jsxs("div",{className:"project-header",children:[(s==null?void 0:s.logo)&&e.jsx(R,{name:s.logo,className:"logo"}),e.jsx("div",{className:"title",children:s.title})]}),e.jsxs("div",{className:n(["studio-contents",d&&"studio-contents--onecol"]),children:[e.jsx(ae,{hideCards:d}),!d&&e.jsx(ne,{viewSettings:i})]})]})}export{_e as default};
//# sourceMappingURL=Studio-Cp0DLcHB.js.map