UNPKG

@getontime/cli

Version:
3 lines (2 loc) 7.33 kB
import{l as k,h as j,j as e}from"./vendor-q6fv0YT2.js";import{P as w,f as m,C as T,D as O,E as C,h as N,e as d,m as x,d as E,G as A,y as f,H as P,u as I,a as M,b as F,L as V,g as D,O as L}from"./index-B81u4hxi.js";import{E as H}from"./EmptyPage-Bc358YpE.js";import{V as R}from"./ViewLogo-G7EosFIr.js";import{O as g,V as W}from"./ViewParamsEditor-C2-TRP6e.js";import{u as z}from"./useWindowTitle-Bpmo_HzW.js";import{g as B,a as $}from"./viewLoader.utils-b42scp-I.js";import{i as G}from"./viewUtils-B8Dr4GHH.js";import{S as Q}from"./SuperscriptTime-CA6S2R55.js";import{a as U,g as X}from"./offset-R98EXhWK.js";import{g as Y}from"./presentation.utils-Cl-L3pHN.js";import{u as q}from"./useProjectData-DdgKoYzk.js";import"./Empty-CJbZxh45.js";import"./Select-BGGVCKqU.js";import"./SwatchPicker-Cm5Eicvv.js";/* empty css */(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]="933e1c46-968a-40b2-86dc-5094c62646a9",s._sentryDebugIdIdentifier="sentry-dbid-933e1c46-968a-40b2-86dc-5094c62646a9")}catch{}})();const J=s=>[{title:g.ClockOptions,collapsible:!0,options:[B(s)]},{title:g.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:G((a=>(t==null?void 0:t.get(a))??s.get(a))("hideCards"))}}function Z(){const[s]=k(),t=j.use(w);return j.useMemo(()=>{const a=t?new URLSearchParams(t.search):void 0;return K(s,a)},[t,s])}function ee(s){const[t,i]=(()=>{const a=m(s);return a.endsWith("AM")?[a.slice(0,-2),"AM"]:a.endsWith("PM")?[a.slice(0,-2),"PM"]:[a,void 0]})();return{seconds:T(s),display:t,meridian:i}}const se=[...Array(12).keys()],te=[...Array(60).keys()];function ae({hideCards:s}){const t=O(),{clock:i,playback:a}=C(),r=a!==N.Stop;if(t&&!s)return e.jsx(ie,{clock:i,onAir:r});const{seconds:c,display:n,meridian:l}=ee(i);return e.jsx("div",{className:"studio__clock",children:e.jsxs("div",{className:"clock-container",children:[te.map(o=>e.jsx("div",{className:d(["tick",o<=c&&"tick--active"]),style:{transform:`rotate(${180+o*6}deg) translateY(var(--half-size))`}},o)),se.map(o=>e.jsx("div",{className:"tick tick--active",style:{transform:`rotate(${180+o*30}deg) translateX(var(--smaller-half-size))`}},o)),e.jsx("div",{className:d(["ampm",!!l&&"ampm--active"]),children:l}),e.jsx("div",{className:"time time--large",children:n}),e.jsx("div",{className:d(["on-air",r&&"on-air--active"]),children:"ON AIR"})]})})}function ie({clock:s,onAir:t}){const i=m(s);return e.jsxs("div",{className:"studio__clock studio__clock--small",children:[e.jsx(Q,{className:"time time--small",time:i}),e.jsx("div",{className:d(["on-air",t&&"on-air--active"]),children:"ON AIR"})]})}const h={format12:"h:mm a",format24:"HH:mm"};function re(s){return{actualStart:m(s.actualStart,h),expectedEnd:m(s.expectedEnd,h),offset:U(s.offset)}}function ce(s,t){return{title:(s==null?void 0:s.title)||"-",startedAt:m(t.startedAt,h),expectedEnd:m(t.expectedFinish,h),timer:x(t.current)}}function de({viewSettings:s}){const{getLocalizedString:t}=E(),{eventNow:i,eventNext:a,message:r,time:c,offset:n,rundown:l,expectedRundownEnd:o}=A(),v=re({offset:n,actualStart:l.actualStart,expectedEnd:o}),u=ce(i,c),S=(a==null?void 0:a.title)||"-",b=r.timer.visible&&r.timer.text||"-",p=r.timer.secondarySource==="secondary"&&r.secondary||"-",y=Y(s,void 0,c.phase===f.Warning,c.phase===f.Danger),_=X(n);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:v.actualStart})]}),e.jsxs("div",{children:[e.jsx("div",{className:"label center",children:"Over / under"}),e.jsx("div",{className:d(["runtime-timer","center",!i&&"muted",_]),children:v.offset})]}),e.jsxs("div",{children:[e.jsx("div",{className:"label right",children:t("common.expected_end")}),e.jsx("div",{className:"runtime-timer right",children:v.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:S})]})]}),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:d(["event-timer",c.phase===f.Overtime&&"event-timer--finished",c.playback===N.Pause&&"event-timer--paused"]),style:{"--phase-color":y},"data-phase":c.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(ne,{}),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:d(["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:d(["extra",!p&&"muted"]),children:p})]})})]})}function ne(){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 oe(){const s=I(l=>l.mirror),{data:t,status:i}=q(),{data:a,status:r}=M(),{data:c,status:n}=F();return{data:{projectData:t,isMirrored:s,settings:c,viewSettings:a},status:$([i,r,n])}}function Te(){const{data:s,status:t}=oe();return z("Studio Clock"),t==="pending"?e.jsx(V,{}):t==="error"?e.jsx(H,{text:"There was an error fetching data, please refresh the page."}):e.jsx(le,{...s})}function le({projectData:s,isMirrored:t,settings:i,viewSettings:a}){const{hideCards:r}=Z(),c=D(i==null?void 0:i.timeFormat),n=j.useMemo(()=>J(c),[c]);return e.jsxs("div",{className:d(["studio",t&&"mirror"]),"data-testid":"studio-view",children:[e.jsx(W,{target:L.StudioClock,viewOptions:n}),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:d(["studio-contents",r&&"studio-contents--onecol"]),children:[e.jsx(ae,{hideCards:r}),!r&&e.jsx(de,{viewSettings:a})]})]})}export{Te as default}; //# sourceMappingURL=Studio-BjNZ4l-W.js.map