UNPKG

@getontime/cli

Version:
3 lines (2 loc) 5.91 kB
import{r as l,j as e,aL as A,x as B,bQ as P,bq as R,bR as D,bS as S,bT as w}from"./vendor-DFNUfA2K.js";import{C as I,S as V}from"./EditorUtils-QotOv0b5.js";import{i as _,af as F,bG as L,c as O,T as d,bj as q,a as y,av as k,bH as T,B as C,bI as o,bJ as H,ai as N,bK as $,bh as U,bu as z}from"./index-BNit4nUw.js";import{P as G}from"./ProtectRoute-CmcGN6gV.js";import{S as J}from"./Select-Bp_h4xvR.js";import{T as g}from"./Tooltip-CMnbeNS3.js";import{s as h}from"./Editor.module-DvV2efYs.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]="afd49619-ae84-42af-9a7e-1f60292a70c3",s._sentryDebugIdIdentifier="sentry-dbid-afd49619-ae84-42af-9a7e-1f60292a70c3")}catch{}})();const K="_label_o0qma_17",Q="_active_o0qma_21",W="_inputItems_o0qma_90",j={label:K,active:Q,inputItems:W};function E(s){const{label:t,placeholder:n,text:a,visible:u,changeHandler:b,children:c}=s,[m,x]=l.useState(a),i=l.useRef(null),p=l.useRef(0);l.useEffect(()=>{i.current&&i.current!==document.activeElement&&(i.current.selectionStart=p.current,i.current.selectionEnd=p.current)},[a]),l.useEffect(()=>{i.current!==document.activeElement&&x(a)},[a]);const v=f=>{p.current=f.target.selectionStart??0,x(f.target.value),b(f.target.value)};return e.jsxs("div",{className:j.inputRow,children:[e.jsx("label",{className:_([j.label,u??j.active]),htmlFor:t,children:t}),e.jsxs("div",{className:j.inputItems,children:[e.jsx(F,{id:t,ref:i,value:m,onChange:v,placeholder:n}),c]})]})}const X="_blink_18658_1",Y="_previewContainer_18658_25",Z="_preview_18658_25",ee="_options_18658_39",te="_eventStatus_18658_45",se="_mainContent_18658_54",ne="_secondaryContent_18658_70",ae="_blackout_18658_74",re="_statusIcon_18658_83",r={blink:X,previewContainer:Y,preview:Z,options:ee,eventStatus:te,mainContent:se,secondaryContent:ne,blackout:ae,statusIcon:re},oe={aux1:"Aux 1",aux2:"Aux 2",aux3:"Aux 3",secondary:"Secondary message"};function ie(){const{blink:s,blackout:t,countToEnd:n,phase:a,secondarySource:u,showTimerMessage:b,timerType:c}=L(),{data:m}=O(),x=b?"Message":c===d.None?q:a===y.Pending?"Standby to start":a===y.Overtime?"Timer Overtime":c===d.Clock?"Clock":n?"Count to End":"Timer",i=b||!u?null:oe[u],p=a===y.Warning?m.warningColor??"#ffa528":a===y.Danger?m.dangerColor??"#ff7300":m.normalColor??"#FFFC",v=x=="Timer",f=_([s&&r.blink,t&&r.blackout]);return e.jsxs("div",{className:r.preview,children:[e.jsx(I,{onClick:M=>k("timer",M)}),e.jsxs("div",{className:f,children:[e.jsx("div",{className:r.mainContent,"data-phase":v&&a,style:v?{"--override-colour":p}:{},children:x}),i!==null&&e.jsx("div",{className:r.secondaryContent,children:i})]}),e.jsxs("div",{className:r.eventStatus,children:[e.jsx(g,{text:"Time type: Count down",render:e.jsx("span",{}),className:r.statusIcon,"data-active":c===d.CountDown,children:e.jsx(A,{})}),e.jsx(g,{text:"Time type: Count up",render:e.jsx("span",{}),className:r.statusIcon,"data-active":c===d.CountUp,children:e.jsx(B,{})}),e.jsx(g,{text:"Time type: Clock",render:e.jsx("span",{}),className:r.statusIcon,"data-active":c===d.Clock,children:e.jsx(P,{})}),e.jsx(g,{text:"Time type: None",render:e.jsx("span",{}),className:r.statusIcon,"data-active":c===d.None,children:e.jsx(R,{})}),e.jsx(g,{text:n?"Count to end":"Count duration",render:e.jsx("span",{}),className:r.statusIcon,"data-active":n,children:e.jsx(D,{})})]})]})}function ce(){const{blackout:s,blink:t}=T();return e.jsxs("div",{className:r.previewContainer,children:[e.jsx(ie,{}),e.jsxs("div",{className:r.options,children:[e.jsx(le,{}),e.jsx(V,{orientation:"horizontal"}),e.jsx(C,{variant:t?"primary":"subtle",fluid:!0,onClick:()=>o.timerBlink(!t),"data-testid":"toggle timer blink",children:"Blink"}),e.jsx(C,{variant:s?"primary":"subtle",fluid:!0,onClick:()=>o.timerBlackout(!s),"data-testid":"toggle timer blackout",children:"Blackout screen"})]})]})}function le(){const{secondarySource:s}=T(),[t,n]=l.useState("aux1");l.useEffect(()=>{s!==null&&n(s)},[s]);const a=()=>{s===t?o.timerSecondarySource(null):o.timerSecondarySource(t)};return e.jsxs(e.Fragment,{children:[e.jsx(J,{value:t,options:[{value:"aux1",label:"Aux 1"},{value:"aux2",label:"Aux 2"},{value:"aux3",label:"Aux 3"},{value:"secondary",label:"Secondary message"}],onValueChange:u=>{s!==null&&o.timerSecondarySource(u),n(u)}}),e.jsx(C,{variant:s!==null?"primary":"subtle",fluid:!0,onClick:a,"data-testid":"toggle secondary",children:"Show secondary"})]})}function ue(){return e.jsxs(e.Fragment,{children:[e.jsx(ce,{}),e.jsx(de,{}),e.jsx(me,{})]})}function de(){const{text:s,visible:t}=H();return e.jsx(E,{label:"Timer Message",placeholder:"Message shown fullscreen in stage timer",text:s,visible:t,changeHandler:n=>o.timerText(n),children:e.jsx(N,{"aria-label":"Toggle timer message visibility",onClick:()=>o.timerVisible(!t),variant:t?"primary":"subtle",children:t?e.jsx(S,{}):e.jsx(w,{})})})}function me(){const{text:s,visible:t}=$(),n=()=>{t?o.timerSecondarySource(null):o.timerSecondarySource("secondary")};return e.jsx(E,{label:"Secondary Message",placeholder:"Message shown as secondary text in stage timer",text:s,visible:t,changeHandler:a=>o.secondaryMessage(a),children:e.jsx(N,{"aria-label":"Toggle secondary message visibility",onClick:n,variant:t?"primary":"subtle",children:t?e.jsx(S,{}):e.jsx(w,{})})})}const he=l.memo(xe);function xe(){const s=window.location.pathname.includes("/messagecontrol"),t=_([h.content,h.contentColumnLayout]);return e.jsx(G,{permission:"editor",children:e.jsxs("div",{className:h.messages,"data-testid":"panel-messages-control",children:[!s&&e.jsx(I,{onClick:n=>k("messagecontrol",n)}),s&&e.jsx(U,{suppressSettings:!0}),e.jsx("div",{className:t,children:e.jsx(z,{children:e.jsx(ue,{})})})]})})}export{he as default}; //# sourceMappingURL=MessageControlExport-PVFSIYCo.js.map