UNPKG

ocearo-ui

Version:

Ocean Robot UI: 3D visualization dashboard for signalk

1 lines 11.6 kB
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17617,e=>{"use strict";var a=e.i(43476),t=e.i(71645);e.i(85269);var n=e.i(22831),i=e.i(83402),s=e.i(67561),l=e.i(85709),r=e.i(46991);let d=e=>e*Math.PI/180,c=({label:e,value:t,accent:n="text-hud-main"})=>(0,a.jsxs)("div",{className:"flex flex-col bg-hud-bg p-2 rounded-lg border border-hud",children:[(0,a.jsx)("span",{className:"text-xs font-black uppercase tracking-widest text-hud-muted leading-none mb-1",children:e}),(0,a.jsx)("span",{className:`text-xs font-mono font-bold ${n}`,children:t})]});e.s(["default",0,()=>{let{t:e}=(0,n.useTranslation)(),{updateSignalKData:o}=(0,s.useOcearoContext)(),[x,g]=(0,t.useState)(()=>i.default.get("debugWindOverride")||!1),[u,p]=(0,t.useState)(()=>i.default.get("debugWindSpeed")??10),[m,b]=(0,t.useState)(()=>i.default.get("debugWindDirection")??0),[h,v]=(0,t.useState)(()=>i.default.get("debugShowAxes")||!1),f=(0,t.useCallback)((e,a)=>{let t=e*r.KNOTS_TO_MPS,n=a*Math.PI/180;o({"environment.wind.speedTrue":t,"environment.wind.speedApparent":t,"environment.wind.angleTrueWater":n,"environment.wind.angleApparent":n,"environment.wind.directionTrue":n})},[o]);(0,t.useEffect)(()=>{if(!x)return;f(u,m);let e=setInterval(()=>{f(u,m)},1e3);return()=>clearInterval(e)},[x,u,m,f]);let j=(0,t.useMemo)(()=>["environment.wind.angleTrueWater","environment.wind.speedTrue","environment.wind.angleApparent","environment.wind.speedApparent","performance.beatAngle","performance.gybeAngle","performance.beatAngleVelocityMadeGood","performance.gybeAngleVelocityMadeGood","performance.targetAngle","performance.polarSpeed","performance.polarSpeedRatio","performance.velocityMadeGood","navigation.speedThroughWater","performance.polarVelocityMadeGood","performance.polarVelocityMadeGoodRatio","navigation.headingTrue","navigation.courseOverGroundTrue","navigation.courseGreatCircle.nextPoint.bearingTrue","performance.laylineAngle","navigation.racing.lailine","navigation.racing.layline.distance","navigation.racing.layline.time","navigation.racing.oppositeLayline","navigation.racing.oppositeLayline.distance","navigation.racing.oppositeLayline.time","navigation.racing.startLineStb","navigation.racing.startLinePort","navigation.racing.distanceStartline","navigation.racing.timeToStart","navigation.racing.timePortDown","navigation.racing.timePortUp","navigation.racing.timeStbdDown","navigation.racing.timeStbdUp"],[]),w=(0,l.useSignalKPaths)(j),y=(e,a)=>w[e]??a,N=y("environment.wind.angleTrueWater",d(25)),k=y("environment.wind.speedTrue",20),S=y("environment.wind.angleApparent",d(23)),T=y("environment.wind.speedApparent",25),A=y("performance.beatAngle",d(45)),M=y("performance.gybeAngle",d(135)),P=y("performance.beatAngleVelocityMadeGood",6),$=y("performance.gybeAngleVelocityMadeGood",5),W=y("performance.targetAngle",A),F=y("performance.polarSpeed",8),G=y("performance.polarSpeedRatio",.95),D=y("performance.velocityMadeGood",5),O=y("navigation.speedThroughWater",7),I=y("performance.polarVelocityMadeGood",6),V=y("performance.polarVelocityMadeGoodRatio",.9),C=y("navigation.headingTrue",d(0)),Y=y("navigation.courseOverGroundTrue",d(20)),R=y("navigation.courseGreatCircle.nextPoint.bearingTrue",d(30)),L=y("performance.laylineAngle",d(10)),U=y("navigation.racing.layline.distance",100),B=y("navigation.racing.layline.time",180),K=y("navigation.racing.oppositeLayline.distance",80),_=y("navigation.racing.oppositeLayline.time",180),E=y("navigation.racing.distanceStartline",50),H=y("navigation.racing.timeToStart",120),q=y("navigation.racing.timePortDown",60),z=y("navigation.racing.timePortUp",70),J=y("navigation.racing.timeStbdDown",65),Q=y("navigation.racing.timeStbdUp",75),X=({label:e,description:t,checked:n,onChange:i})=>(0,a.jsx)("div",{className:"p-4 rounded-xl bg-hud-bg tesla-hover border border-hud",children:(0,a.jsxs)("label",{className:"flex items-center justify-between cursor-pointer",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("span",{className:"text-sm font-bold uppercase tracking-widest text-hud-secondary",children:e}),t&&(0,a.jsx)("p",{className:"text-xs text-hud-muted font-medium uppercase tracking-wider",children:t})]}),(0,a.jsx)("input",{type:"checkbox",className:"sr-only peer",checked:n,onChange:e=>i(e.target.checked)}),(0,a.jsx)("div",{className:"relative w-11 h-6 bg-hud-bg-elevated peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-hud-main after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-hud-main after:border-hud-main after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-oYellow"})]})});return(0,a.jsxs)("div",{className:"p-8 text-hud-main w-full overflow-y-auto h-full",children:[(0,a.jsxs)("header",{className:"mb-8",children:[(0,a.jsx)("h1",{className:"text-3xl font-black uppercase tracking-tighter mb-1",children:e("menu.debug")}),(0,a.jsx)("p",{className:"text-hud-secondary text-sm font-medium uppercase tracking-widest",children:e("debug.systemDebug")})]}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("section",{className:"tesla-card p-6 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h2",{className:"text-lg font-black uppercase tracking-widest text-hud-main/90",children:"3D"}),(0,a.jsx)("div",{className:"h-[1px] flex-grow bg-hud-border mx-4"})]}),(0,a.jsx)(X,{label:e("settings.debugShowAxes"),description:e("settings.debugShowAxesDesc"),checked:h,onChange:e=>{v(e),i.default.set("debugShowAxes",e)}})]}),(0,a.jsxs)("section",{className:"tesla-card p-6 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h2",{className:"text-lg font-black uppercase tracking-widest text-hud-main/90",children:e("settings.debugWindOverride")}),(0,a.jsx)("div",{className:"h-[1px] flex-grow bg-hud-border mx-4"})]}),(0,a.jsx)(X,{label:e("settings.debugWindOverride"),description:e("settings.debugWindOverrideDesc"),checked:x,onChange:e=>{g(e),i.default.set("debugWindOverride",e)}}),x&&(0,a.jsxs)("div",{className:"space-y-4 p-4 rounded-xl bg-oYellow/5 border border-oYellow/20",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-xs font-black uppercase tracking-widest text-hud-secondary",children:e("settings.debugWindSpeed")}),(0,a.jsxs)("span",{className:"text-lg font-black text-oYellow bg-oYellow/10 px-3 py-1 rounded-lg",children:[u," kn"]})]}),(0,a.jsx)("input",{type:"range",className:"w-full h-1.5 bg-hud-bg-elevated rounded-lg appearance-none cursor-pointer accent-oYellow",min:"0",max:"60",step:"0.5",value:u,onChange:e=>{var a;p(a=parseFloat(e.target.value)),i.default.set("debugWindSpeed",a)}})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-xs font-black uppercase tracking-widest text-hud-secondary",children:e("settings.debugWindDirection")}),(0,a.jsxs)("span",{className:"text-lg font-black text-oYellow bg-oYellow/10 px-3 py-1 rounded-lg",children:[m,"°"]})]}),(0,a.jsx)("input",{type:"range",className:"w-full h-1.5 bg-hud-bg-elevated rounded-lg appearance-none cursor-pointer accent-oYellow",min:"0",max:"359",step:"1",value:m,onChange:e=>{var a;b(a=parseInt(e.target.value,10)),i.default.set("debugWindDirection",a)}})]})]})]}),(0,a.jsxs)("section",{className:"tesla-card p-6 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h2",{className:"text-lg font-black uppercase tracking-widest text-hud-main/90",children:e("debug.windDynamics")}),(0,a.jsx)("div",{className:"h-[1px] flex-grow bg-hud-border mx-4"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsx)(c,{label:"TWA",value:`${(180/Math.PI*N).toFixed(1)}\xb0`}),(0,a.jsx)(c,{label:"TWS",value:`${k.toFixed(1)} kn`}),(0,a.jsx)(c,{label:"AWA",value:`${(180/Math.PI*S).toFixed(1)}\xb0`}),(0,a.jsx)(c,{label:"AWS",value:`${T.toFixed(1)} kn`})]})]}),(0,a.jsxs)("section",{className:"tesla-card p-6 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h2",{className:"text-lg font-black uppercase tracking-widest text-hud-main/90",children:e("debug.performanceMetrics")}),(0,a.jsx)("div",{className:"h-[1px] flex-grow bg-hud-border mx-4"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsx)(c,{label:"Beat ∠",value:`${(180/Math.PI*A).toFixed(1)}\xb0`}),(0,a.jsx)(c,{label:"Gybe ∠",value:`${(180/Math.PI*M).toFixed(1)}\xb0`}),(0,a.jsx)(c,{label:"VMG Beat",value:`${P.toFixed(1)} kn`}),(0,a.jsx)(c,{label:"VMG Gybe",value:`${$.toFixed(1)} kn`}),(0,a.jsx)(c,{label:"Target TWA",value:`${(180/Math.PI*W).toFixed(1)}\xb0`}),(0,a.jsx)(c,{label:"Opt ∠",value:`${(180/Math.PI*(W-N)).toFixed(1)}\xb0`}),(0,a.jsx)(c,{label:"Polar Spd",value:`${F.toFixed(1)} kn`}),(0,a.jsx)(c,{label:"Pol Ratio",value:G.toFixed(2)}),(0,a.jsx)(c,{label:"VMG",value:`${D.toFixed(1)} kn`,accent:"text-oBlue"}),(0,a.jsx)(c,{label:"STW",value:`${O.toFixed(1)} kn`}),(0,a.jsx)(c,{label:"Pol VMG",value:`${I.toFixed(1)} kn`}),(0,a.jsx)(c,{label:"Pol VMG %",value:`${(100*V).toFixed(1)}%`})]})]}),(0,a.jsxs)("section",{className:"tesla-card p-6 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h2",{className:"text-lg font-black uppercase tracking-widest text-hud-main/90",children:e("debug.navigation")}),(0,a.jsx)("div",{className:"h-[1px] flex-grow bg-hud-border mx-4"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsx)(c,{label:"Heading",value:`${(180/Math.PI*C).toFixed(1)}\xb0`}),(0,a.jsx)(c,{label:"COG",value:`${(180/Math.PI*Y).toFixed(1)}\xb0`}),(0,a.jsx)(c,{label:"WPT Brg",value:`${(180/Math.PI*R).toFixed(1)}\xb0`,accent:"text-oYellow"}),(0,a.jsx)(c,{label:"Layline ∠",value:`${(180/Math.PI*L).toFixed(1)}\xb0`,accent:"text-oGreen"})]})]}),(0,a.jsxs)("section",{className:"tesla-card p-6 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h2",{className:"text-lg font-black uppercase tracking-widest text-hud-main/90",children:e("debug.laylineAnalysis")}),(0,a.jsx)("div",{className:"h-[1px] flex-grow bg-hud-border mx-4"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsx)(c,{label:"Dist",value:`${U.toFixed(0)}m`}),(0,a.jsx)(c,{label:"Time",value:`${B}s`}),(0,a.jsx)(c,{label:"Opp Dist",value:`${K.toFixed(0)}m`}),(0,a.jsx)(c,{label:"Opp Time",value:`${_}s`})]})]}),(0,a.jsxs)("section",{className:"tesla-card p-6 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h2",{className:"text-lg font-black uppercase tracking-widest text-hud-main/90",children:e("debug.regattaStart")}),(0,a.jsx)("div",{className:"h-[1px] flex-grow bg-hud-border mx-4"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsx)(c,{label:"Start Dist",value:`${E.toFixed(1)}m`,accent:"text-oRed"}),(0,a.jsx)(c,{label:"TT Start",value:`${H}s`,accent:"text-oRed"}),(0,a.jsx)(c,{label:"Port DW",value:`${q}s`}),(0,a.jsx)(c,{label:"Port UW",value:`${z}s`}),(0,a.jsx)(c,{label:"Stbd DW",value:`${J}s`}),(0,a.jsx)(c,{label:"Stbd UW",value:`${Q}s`})]})]})]})]})}])},58652,e=>{e.n(e.i(17617))}]);