@getontime/cli
Version:
Time keeping for live events
2 lines • 2.74 kB
JavaScript
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`f14ad0099eab1969fdd065b56af5fdd3cf530de6`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`61a5b9df-7df1-44a4-8027-8c5439f230c7`,e._sentryDebugIdIdentifier=`sentry-dbid-61a5b9df-7df1-44a4-8027-8c5439f230c7`)}catch{}})();import{a as e,n as t,t as n}from"./jsx-runtime-BNC90REB.js";import{J as r,Ot as i}from"./useSocket-B9-0Z7zf.js";import{t as a}from"./Button-CsttsbOH.js";import"./constants-8b9Q9Bj6.js";import"./useSettings-CeUw01Bu.js";import{t as o}from"./Input-D-3bhaHU.js";import"./assets-DU19UGw8.js";import{S as s,T as c,b as l,g as u,h as d,t as f,x as p}from"./index-qU8RbaVt.js";import{i as m,t as h}from"./Info-QUjDr4I8.js";import{t as g}from"./Modal-Cvhkq0Va.js";var _=e(t(),1),v={blink:`_blink_hgpju_1`,fourtyfive:`_fourtyfive_hgpju_13`,footer:`_footer_hgpju_17`},y=n();function b({isOpen:e,onClose:t}){let{userTranslation:n,postUserTranslation:b}=f(),w=(0,_.useMemo)(()=>x(n),[n]),{handleSubmit:T,register:E,reset:D,formState:{isSubmitting:O,isDirty:k,errors:A,isValid:j},setError:M}=m({defaultValues:w,mode:`onChange`});return(0,_.useEffect)(()=>{e&&D(w)},[w,e,D]),(0,y.jsx)(g,{title:`Edit custom translations`,isOpen:e,onClose:t,showCloseButton:!0,showBackdrop:!0,bodyElements:(0,y.jsxs)(c,{as:`form`,onSubmit:T(async e=>{try{let t={};Object.keys(e).forEach(n=>{t[C(n)]=e[n]}),await b(t),D(e)}catch(e){M(`root`,{message:r(e)})}}),id:`custom-translations-form`,children:[(0,y.jsxs)(h,{children:[`Provide custom translations for the public views of Ontime. `,(0,y.jsx)(`br`,{}),`You will need to activate this in the settings by selecting "Custom" as the views language.`]}),(0,y.jsx)(p,{children:Object.entries(i).map(([e,t])=>(0,y.jsxs)(s,{children:[(0,y.jsx)(u,{title:t,description:``,error:A[S(e)]?.message}),(0,y.jsx)(o,{maxLength:150,...E(S(e),{required:`This field is required`}),placeholder:t})]},e))})]}),footerElements:(0,y.jsxs)(`div`,{className:v.footer,children:[A?.root&&(0,y.jsx)(d,{children:A.root.message}),(0,y.jsxs)(l,{align:`apart`,children:[(0,y.jsx)(a,{variant:`ghosted`,onClick:()=>{D(x(i),{keepDefaultValues:!0})},disabled:O,children:`Reset to English`}),(0,y.jsxs)(l,{children:[(0,y.jsx)(a,{onClick:t,children:`Cancel`}),(0,y.jsx)(a,{variant:`primary`,type:`submit`,form:`custom-translations-form`,disabled:O||!k||!j,loading:O,children:`Save changes`})]})]})]})})}function x(e){let t={};return Object.keys(i).forEach(n=>{t[S(n)]=e[n]||``}),t}function S(e){return e.replace(`.`,`_`)}function C(e){return e.replace(`_`,`.`)}export{b as default};
//# sourceMappingURL=CustomTranslationModal-DB3zaP4N.js.map