ocearo-ui
Version:
Ocean Robot UI: Sailing made smarter
1 lines • 1.26 kB
JavaScript
;(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[751],{95751:function(e,t,l){l.r(t);var a=l(57437),n=l(53082),c=l(2265);let o={SOG:"navigation.speedOverGround",VMG:"performance.velocityMadeGood",STW:"navigation.speedThroughWater",POL:"performance.polarSpeedRatio"};t.default=()=>{let{nightMode:e,getSignalKValue:t}=(0,n.yC)(),[l,r]=(0,c.useState)("SOG"),s=(0,c.useMemo)(()=>{let e={};for(let[l,a]of Object.entries(o)){let c=t(a);null!=c&&(e[l]=(0,n.$)(c))}return e},[t]),i=Object.keys(s),d=void 0!==s[l]?l:i[0],x=s[d],u=(0,c.useCallback)(()=>{if(0===i.length)return;let e=(i.indexOf(d)+1)%i.length;r(i[e])},[i,d]),h=e?"text-oNight":"text-oGray";return 0===i.length?(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("div",{className:"text-6xl font-bold text-gray-400",children:"--"}),(0,a.jsx)("div",{className:"text-lg ".concat(h),children:"NO DATA"})]}):(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("div",{className:"text-6xl font-bold cursor-pointer ".concat(e?"text-oNight":"text-white"),onClick:u,role:"button",tabIndex:0,"aria-label":"Current speed: ".concat(x," ").concat(d,". Click to change speed type."),children:(null==x?void 0:x.toFixed(1))||"--"}),(0,a.jsx)("div",{className:"text-lg ".concat(h),children:d})]})}}}]);