ocearo-ui
Version:
Ocean Robot UI: 3D visualization dashboard for signalk
1 lines • 2.47 kB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,98922,e=>{"use strict";var t=e.i(43476),a=e.i(71645),i=e.i(67561),s=e.i(85709);e.s(["default",0,()=>{let{nightMode:e}=(0,i.useOcearoContext)(),n=(0,s.useSignalKPath)("navigation.position"),[r,l]=(0,a.useState)(new Date);(0,a.useEffect)(()=>{let e=setInterval(()=>{l(new Date)},1e4);return()=>clearInterval(e)},[]);let c=(e,t)=>{if(null==e)return"--";let a=Math.abs(e),i=Math.floor(a),s=((a-i)*60).toFixed(3);return`${i}\xb0${s}'${t?e>=0?"N":"S":e>=0?"E":"W"}`},o=()=>{try{let e=navigator.language||"en-US";return r.toLocaleString(e,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}catch(e){return console.warn("Error formatting date with user locale, falling back to en-US",e),r.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}},d=e?"text-oNight":"text-hud-main";return n?(0,t.jsxs)("div",{className:"mt-6 ml-2 group p-4 transition-all duration-300 select-none",children:[(0,t.jsxs)("div",{className:`text-2xl font-black flex gap-4 ${d} tracking-tighter drop-shadow-lg mb-3`,children:[(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("span",{className:`text-xs font-black uppercase tracking-[0.2em] mb-1 ${e?"text-oNight/40":"text-hud-dim"}`,children:"LAT"}),(0,t.jsx)("span",{children:c(n.latitude,!0)})]}),(0,t.jsx)("div",{className:"w-[1px] bg-hud-border self-stretch my-1"}),(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("span",{className:`text-xs font-black uppercase tracking-[0.2em] mb-1 ${e?"text-oNight/40":"text-hud-dim"}`,children:"LON"}),(0,t.jsx)("span",{children:c(n.longitude,!1)})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"h-[2px] w-4 bg-oBlue/40 rounded-full"}),(0,t.jsx)("div",{className:`text-xs font-black uppercase tracking-[0.3em] ${e?"text-oNight/60":"text-hud-secondary"}`,children:o()})]})]}):(0,t.jsxs)("div",{className:"mt-6 ml-2 p-3 transition-all duration-300",children:[(0,t.jsxs)("div",{className:`text-2xl font-black flex gap-4 ${d} opacity-10 tracking-tighter mb-2`,children:[(0,t.jsx)("span",{children:"--°--'--"}),(0,t.jsx)("span",{children:"--°--'--"})]}),(0,t.jsx)("div",{className:`text-xs font-black uppercase tracking-[0.2em] opacity-40 ${e?"text-oNight":"text-hud-main"}`,children:o()})]})}])},39554,e=>{e.n(e.i(98922))}]);