yoda-sailing 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -1
- package/public/dashboard.js +351 -42
- package/public/index.html +42 -11
- package/public/style.css +24 -0
package/package.json
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "yoda-sailing",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Signal K webapp for vessel navigation, Ruuvi trends and read-only relay status.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"signalk-webapp",
|
|
7
|
+
"signalk-category-instruments",
|
|
8
|
+
"ruuvi"
|
|
9
|
+
],
|
|
10
|
+
"files": [
|
|
11
|
+
"public"
|
|
12
|
+
],
|
|
13
|
+
"signalk": {
|
|
14
|
+
"displayName": "YODA Dashboard"
|
|
15
|
+
},
|
|
16
|
+
"license": "UNLICENSED"
|
|
17
|
+
}
|
package/public/dashboard.js
CHANGED
|
@@ -73,12 +73,14 @@ function record(data, now) {
|
|
|
73
73
|
for (const [key] of metrics) {
|
|
74
74
|
const points = history[i][key];
|
|
75
75
|
while (points.length && points[0].time < now - hour) points.shift();
|
|
76
|
-
if (key !== 'reachable' && repeated) continue;
|
|
77
76
|
const reading = sample(data,key,sensor);
|
|
78
77
|
const time = Date.parse(reading?.timestamp);
|
|
79
78
|
if (!Number.isFinite(time) || time < now - hour || time > now + 60000) continue;
|
|
80
79
|
if (points.length && time <= points.at(-1).time) continue;
|
|
81
|
-
|
|
80
|
+
const value = numeric(key,reading.value);
|
|
81
|
+
// A repeated sensor frame can still carry new receiver-side RSSI or status.
|
|
82
|
+
if (repeated && key !== 'reachable' && key !== 'rssi' && points.at(-1)?.value === value) continue;
|
|
83
|
+
points.push({time,value});
|
|
82
84
|
}
|
|
83
85
|
});
|
|
84
86
|
}
|
|
@@ -123,21 +125,69 @@ function draw(canvas, output, metric, allPoints, cursor) {
|
|
|
123
125
|
series.forEach((values,i) => {
|
|
124
126
|
if (!selected.has(i)) return;
|
|
125
127
|
ctx.strokeStyle = sensors[i].color;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
function slope(before, after) {
|
|
129
|
+
return (after.value-before.value)/(after.time-before.time);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function tangent(left, right) {
|
|
133
|
+
return left * right > 0 ? 2 * left * right / (left + right) : 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
ctx.setLineDash([]);
|
|
137
|
+
ctx.lineWidth = 1.5;
|
|
128
138
|
ctx.beginPath();
|
|
129
|
-
let
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
ctx.
|
|
135
|
-
|
|
136
|
-
if (mode === 'step') ctx.lineTo(x(time),y(previous.value));
|
|
137
|
-
ctx.lineTo(x(time),y(value));
|
|
139
|
+
for (let index = 0; index < values.length; index++) {
|
|
140
|
+
const current = values[index];
|
|
141
|
+
const previous = values[index - 1];
|
|
142
|
+
if (current.value === null) continue;
|
|
143
|
+
if (previous?.value == null) {
|
|
144
|
+
ctx.moveTo(x(current.time),y(current.value));
|
|
145
|
+
continue;
|
|
138
146
|
}
|
|
139
|
-
|
|
140
|
-
|
|
147
|
+
if (mode === 'step') {
|
|
148
|
+
ctx.lineTo(x(current.time),y(previous.value));
|
|
149
|
+
ctx.lineTo(x(current.time),y(current.value));
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const before = values[index - 2], after = values[index + 1];
|
|
153
|
+
const interval = current.time - previous.time;
|
|
154
|
+
const secant = slope(previous,current);
|
|
155
|
+
const initial = before?.value != null ? tangent(slope(before,previous),secant) : secant;
|
|
156
|
+
const final = after?.value != null ? tangent(secant,slope(current,after)) : secant;
|
|
157
|
+
// Ordered control values keep each segment inside the range of its endpoints.
|
|
158
|
+
const offset = derivative => Math.sign(secant) * Math.min(Math.abs(derivative),1.5*Math.abs(secant)) * interval/3;
|
|
159
|
+
ctx.bezierCurveTo(
|
|
160
|
+
x(previous.time+interval/3), y(previous.value+offset(initial)),
|
|
161
|
+
x(current.time-interval/3), y(current.value-offset(final)),
|
|
162
|
+
x(current.time),y(current.value)
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
ctx.stroke();
|
|
166
|
+
|
|
167
|
+
if (mode !== 'step') {
|
|
168
|
+
const first = values[0], last = values.at(-1);
|
|
169
|
+
ctx.globalAlpha = .4;
|
|
170
|
+
ctx.beginPath();
|
|
171
|
+
if (first?.value != null && first.time > start) {
|
|
172
|
+
ctx.moveTo(x(start),y(first.value));
|
|
173
|
+
ctx.lineTo(x(first.time),y(first.value));
|
|
174
|
+
}
|
|
175
|
+
if (last?.value != null && last.time < end) {
|
|
176
|
+
ctx.moveTo(x(last.time),y(last.value));
|
|
177
|
+
ctx.lineTo(x(end),y(last.value));
|
|
178
|
+
}
|
|
179
|
+
ctx.stroke();
|
|
180
|
+
ctx.globalAlpha = 1;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
ctx.lineWidth = 1.4;
|
|
184
|
+
ctx.beginPath();
|
|
185
|
+
for (const {time,value} of values) {
|
|
186
|
+
if (value === null) continue;
|
|
187
|
+
const centerX=x(time), centerY=y(value);
|
|
188
|
+
ctx.moveTo(centerX-3,centerY-3);ctx.lineTo(centerX+3,centerY+3);
|
|
189
|
+
ctx.moveTo(centerX-3,centerY+3);ctx.lineTo(centerX+3,centerY-3);
|
|
190
|
+
}
|
|
141
191
|
ctx.stroke();
|
|
142
192
|
});
|
|
143
193
|
const point = cursor === null ? end : start + cursor * hour;
|
|
@@ -152,7 +202,8 @@ function draw(canvas, output, metric, allPoints, cursor) {
|
|
|
152
202
|
const label = value === null ? 'indisponible'
|
|
153
203
|
: key === 'reachable' ? (value ? 'joignable' : 'non joignable')
|
|
154
204
|
: format.format(value)+(unit?' '+unit:'');
|
|
155
|
-
|
|
205
|
+
const count = series[i].filter(sample => sample.value !== null).length;
|
|
206
|
+
return [sensor.name+' '+label+(reading ? ' à '+clock(reading.time) : '')+' ('+count+' pts)'];
|
|
156
207
|
});
|
|
157
208
|
output.textContent = summaries.length ? clock(point)+' · '+summaries.join(' · ') : 'Sélectionne un capteur.';
|
|
158
209
|
}
|
|
@@ -209,23 +260,10 @@ sensors.forEach((sensor,i)=>{
|
|
|
209
260
|
window.addEventListener('resize',()=>painters.forEach(paint=>paint()));
|
|
210
261
|
render();
|
|
211
262
|
|
|
212
|
-
const ruuvi = document.querySelector('#ruuvi');
|
|
263
|
+
const ruuvi = document.querySelector('#ruuvi-view');
|
|
213
264
|
const relays = document.querySelector('#relays');
|
|
214
|
-
const openRuuvi = document.querySelector('#open-ruuvi');
|
|
215
|
-
const openRelays = document.querySelector('#open-relays');
|
|
216
|
-
const status = document.querySelector('#connection');
|
|
217
265
|
const relayCards = document.querySelector('#relay-cards');
|
|
218
266
|
|
|
219
|
-
function showRelays(enabled) {
|
|
220
|
-
ruuvi.hidden = enabled;
|
|
221
|
-
relays.hidden = !enabled;
|
|
222
|
-
openRuuvi.setAttribute('aria-pressed',String(!enabled));
|
|
223
|
-
openRelays.setAttribute('aria-pressed',String(enabled));
|
|
224
|
-
if (!enabled) painters.forEach(paint=>paint());
|
|
225
|
-
}
|
|
226
|
-
openRuuvi.addEventListener('click',()=>showRelays(false));
|
|
227
|
-
openRelays.addEventListener('click',()=>showRelays(true));
|
|
228
|
-
|
|
229
267
|
function updateRelays(data) {
|
|
230
268
|
relayCards.replaceChildren();
|
|
231
269
|
for (let number=1; number<=6; number++) {
|
|
@@ -243,24 +281,295 @@ function updateRelays(data) {
|
|
|
243
281
|
}
|
|
244
282
|
}
|
|
245
283
|
|
|
246
|
-
|
|
284
|
+
|
|
285
|
+
const pages = {"Vessel": {"Vessel": [["ui_button", "Map YODA"], ["ui_text", "name"], ["ui_text", "mmsi"], ["ui_text", "callsignVHF"]], "Design": [["ui_text", "length"], ["ui_text", "beam"], ["ui_text", "draft"], ["ui_text", "airHeight"], ["ui_text", "aisShipType"], ["ui_text", "aisClass"]], "Sensors": [["ui_text", "gps.fromBow"], ["ui_text", "gps.fromCenter"]]}, "Navigation": {"Global": [["ui_text", "DateTime"], ["ui_text", "LogNM"], ["ui_text", "Engine Rev.YD"], ["ui_text", "WaterTemp"], ["ui_text", "Lat"], ["ui_text", "Lon"]], "Navigation": [["ui_text", "Depth"], ["ui_text", "SOG"], ["ui_text", "STW"], ["ui_text", "HDT"], ["ui_text", "HDM"], ["ui_text", "Autopilot Target HDT"], ["ui_text", "RudderAng"], ["ui_text", "RateOfTurn"], ["ui_gauge", "HDT Compass"], ["ui_gauge", "HDM Compass"]], "Wind": [["ui_text", "SpeedTrue"], ["ui_text", "SpeedApp"], ["ui_text", "SpeedOvG"], ["ui_text", "AngleTrue"], ["ui_text", "AngleApp"], ["ui_gauge", "WDT Compass"], ["ui_gauge", "WDA Compass"]]}, "Propulsion": {"Engine": [["ui_text", "DateTime"], ["ui_text", "Engine runTime"], ["ui_text", "Engine Rev.YD"], ["ui_text", "Engine Rev.56"], ["ui_text", "Engine Rev.86"], ["ui_led", "Engine On/Off"], ["ui_text", "Engine Temperature"], ["ui_text", "Alternator Voltage"], ["ui_text", "Batterie Voltage"]], "Notifications": [["ui_text", "checkEngine"], ["ui_text", "shuttingDown"], ["ui_text", "emergencyStopMode"], ["ui_text", "maintenanceNeeded"], ["ui_text", "revLimitExceeded"], ["ui_text", "highBoostPressure"], ["ui_text", "overTemperature"], ["ui_text", "eGRSystem"], ["ui_text", "powerReduction"], ["ui_text", "preheatIndicator"], ["ui_text", "commError"], ["ui_text", "chargeIndicator"], ["ui_text", "lowCoolantLevel"], ["ui_text", "lowFuelPressure"], ["ui_text", "lowOilLevel"], ["ui_text", "lowOilPressure"], ["ui_text", "lowSystemVoltage"], ["ui_text", "neutralStartProtect"], ["ui_text", "waterFlow"], ["ui_text", "waterInFuel"], ["ui_text", "throttlePositionSensor"], ["ui_text", "subOrSecondaryThrottle"], ["ui_text", "warningLevel1"], ["ui_text", "warningLevel2"]]}, "Ruuvi": {"Cockpit": [["ui_text", "Temp"], ["ui_text", "Humidity"], ["ui_text", "Pressure"], ["ui_chart", "Temp Chart"], ["ui_chart", "Humidity Chart"], ["ui_chart", "Pressure Chart"]], "Inside": [["ui_text", "Temp"], ["ui_text", "Humidity"], ["ui_chart", "Temp Chart"], ["ui_chart", "Humidity Chart"]], "Fridge": [["ui_text", "Temp"], ["ui_text", "Humidity"], ["ui_chart", "Temp Chart"], ["ui_chart", "Humidity Chart"]], "Motor": [["ui_text", "Temp"], ["ui_text", "Humidity"], ["ui_chart", "Temp Chart"], ["ui_chart", "Humidity Chart"]]}, "Batteries": {"Service Battery": [["ui_text", "Voltage"], ["ui_text", "Current"], ["ui_text", "Power"], ["ui_text", "Temperature"], ["ui_chart", "Voltage"], ["ui_chart", "Current"], ["ui_chart", "Power"], ["ui_chart", "Temp"]], "Charges": [["ui_text", "stateOfCharge"], ["ui_text", "lifetimeDischarge"], ["ui_text", "consumedCharge"], ["ui_text", "dischargeSinceFull"], ["ui_text", "dischargedEnergy"], ["ui_text", "timeRemaining"]], "Motor Battery": [["ui_text", "Voltage"], ["ui_chart", "Voltage"]]}, "Switches": {"Switches": [["ui_switch", "Raspi4 IO#11"]], "Audio Alarms": [["ui_led", "sw1"], ["ui_led", "sw0"]]}};
|
|
286
|
+
const nodeRed = document.querySelector('#navigation-view');
|
|
287
|
+
const oldNav = document.querySelector('#old-nav');
|
|
288
|
+
const oldPanels = document.querySelector('#old-panels');
|
|
289
|
+
const mapPanel = document.querySelector('#map-panel');
|
|
290
|
+
const bindings = {"Vessel|Vessel|name": ["name", null], "Vessel|Vessel|mmsi": ["mmsi", null], "Vessel|Vessel|callsignVHF": ["communication", null], "Vessel|Design|length": ["design.length", null], "Vessel|Design|beam": ["design.beam", null], "Vessel|Design|draft": ["design.draft", null], "Vessel|Design|airHeight": ["design.airHeight", null], "Vessel|Design|aisShipType": ["design.aisShipType", null], "Vessel|Sensors|gps.fromBow": ["sensors.gps.fromBow", null], "Vessel|Sensors|gps.fromCenter": ["sensors.gps.fromCenter", null], "Vessel|Design|aisClass": ["sensors.ais.class", null], "Propulsion|Engine|Engine Rev.56": ["propulsion.port.revolutions", "YDNU-02RM.56"], "Propulsion|Engine|Alternator Voltage": ["propulsion.port.alternatorVoltage", null], "Propulsion|Engine|Engine runTime": ["propulsion.port.runTime", null], "Propulsion|Engine|Engine Temperature": ["propulsion.port.temperature", null], "Propulsion|Notifications|chargeIndicator": ["notifications.propulsion.port.chargeIndicator", null], "Propulsion|Notifications|checkEngine": ["notifications.propulsion.port.checkEngine", null], "Propulsion|Notifications|commError": ["notifications.propulsion.port.commError", null], "Propulsion|Notifications|eGRSystem": ["notifications.propulsion.port.eGRSystem", null], "Propulsion|Notifications|emergencyStopMode": ["notifications.propulsion.port.emergencyStopMode", null], "Propulsion|Notifications|highBoostPressure": ["notifications.propulsion.port.highBoostPressure", null], "Propulsion|Notifications|lowCoolantLevel": ["notifications.propulsion.port.lowCoolantLevel", null], "Propulsion|Notifications|lowFuelPressure": ["notifications.propulsion.port.lowFuelPressure", null], "Propulsion|Notifications|lowOilLevel": ["notifications.propulsion.port.lowOilLevel", null], "Propulsion|Notifications|lowOilPressure": ["notifications.propulsion.port.lowOilPressure", null], "Propulsion|Notifications|lowSystemVoltage": ["notifications.propulsion.port.lowSystemVoltage", null], "Propulsion|Notifications|maintenanceNeeded": ["notifications.propulsion.port.maintenanceNeeded", null], "Propulsion|Notifications|neutralStartProtect": ["notifications.propulsion.port.neutralStartProtect", null], "Propulsion|Notifications|overTemperature": ["notifications.propulsion.port.overTemperature", null], "Propulsion|Notifications|powerReduction": ["notifications.propulsion.port.powerReduction", null], "Propulsion|Notifications|preheatIndicator": ["notifications.propulsion.port.preheatIndicator", null], "Propulsion|Notifications|revLimitExceeded": ["notifications.propulsion.port.revLimitExceeded", null], "Propulsion|Notifications|shuttingDown": ["notifications.propulsion.port.shuttingDown", null], "Propulsion|Notifications|subOrSecondaryThrottle": ["notifications.propulsion.port.subOrSecondaryThrottle", null], "Propulsion|Notifications|throttlePositionSensor": ["notifications.propulsion.port.throttlePositionSensor", null], "Propulsion|Notifications|warningLevel1": ["notifications.propulsion.port.warningLevel1", null], "Propulsion|Notifications|warningLevel2": ["notifications.propulsion.port.warningLevel2", null], "Propulsion|Notifications|waterFlow": ["notifications.propulsion.port.waterFlow", null], "Propulsion|Notifications|waterInFuel": ["notifications.propulsion.port.waterInFuel", null], "Propulsion|Engine|Batterie Voltage": ["electrical.batteries.0.voltage", null], "Propulsion|Engine|Engine Rev.YD": ["propulsion.engine_0.revolutions", null], "Propulsion|Engine|DateTime": ["navigation.datetime", null], "Propulsion|Engine|Engine Rev.86": ["propulsion.port.revolutions", "YDNU-02RM.86"], "Propulsion|Engine|Engine On/Off": ["propulsion.engine_0.revolutions", null], "Navigation|Global|Engine Rev.YD": ["propulsion.engine_0.revolutions", null], "Navigation|Global|DateTime": ["navigation.datetime", null], "Navigation|Global|LogNM": ["navigation.log", null], "Navigation|Global|Lat": ["navigation.position", null], "Navigation|Global|Lon": ["navigation.position", null], "Navigation|Navigation|SOG": ["navigation.speedOverGround", null], "Navigation|Navigation|STW": ["navigation.speedThroughWater", null], "Navigation|Navigation|Depth": ["environment.depth.belowSurface", null], "Navigation|Global|WaterTemp": ["environment.water.temperature", null], "Navigation|Wind|SpeedTrue": ["environment.wind.speedTrue", null], "Navigation|Wind|SpeedApp": ["environment.wind.speedApparent", null], "Navigation|Wind|SpeedOvG": ["environment.wind.speedOverGround", null], "Navigation|Wind|AngleTrue": ["environment.wind.directionTrue", null], "Navigation|Wind|AngleApp": ["environment.wind.angleApparent", null], "Navigation|Navigation|HDT": ["navigation.headingTrue", null], "Navigation|Navigation|HDM": ["navigation.headingMagnetic", null], "Navigation|Navigation|RateOfTurn": ["navigation.rateOfTurn", null], "Navigation|Navigation|RudderAng": ["steering.rudderAngle", null], "Navigation|Navigation|HDM Compass": ["navigation.headingMagnetic", null], "Navigation|Navigation|HDT Compass": ["navigation.headingTrue", null], "Navigation|Wind|WDT Compass": ["environment.wind.directionTrue", null], "Navigation|Wind|WDA Compass": ["environment.wind.angleApparent", null], "Navigation|Navigation|Autopilot Target HDT": ["steering.autopilot.target.headingTrue", null], "Ruuvi|Inside|Temp Chart": ["environment.venus.22.temperature", null], "Ruuvi|Inside|Temp": ["environment.venus.22.temperature", null], "Ruuvi|Fridge|Temp Chart": ["environment.inside.refrigerator.temperature", null], "Ruuvi|Fridge|Temp": ["environment.inside.refrigerator.temperature", null], "Ruuvi|Motor|Temp Chart": ["environment.venus.20.temperature", null], "Ruuvi|Motor|Temp": ["environment.venus.20.temperature", null], "Ruuvi|Inside|Humidity Chart": ["environment.venus.22.humidity", null], "Ruuvi|Inside|Humidity": ["environment.venus.22.humidity", null], "Ruuvi|Fridge|Humidity Chart": ["environment.inside.refrigerator.humidity", null], "Ruuvi|Fridge|Humidity": ["environment.inside.refrigerator.humidity", null], "Ruuvi|Motor|Humidity Chart": ["environment.venus.20.humidity", null], "Ruuvi|Motor|Humidity": ["environment.venus.20.humidity", null], "Ruuvi|Cockpit|Temp Chart": ["environment.venus.23.temperature", null], "Ruuvi|Cockpit|Temp": ["environment.venus.23.temperature", null], "Ruuvi|Cockpit|Humidity Chart": ["environment.venus.23.humidity", null], "Ruuvi|Cockpit|Humidity": ["environment.venus.23.humidity", null], "Ruuvi|Cockpit|Pressure Chart": ["environment.venus.23.pressure", null], "Ruuvi|Cockpit|Pressure": ["environment.venus.23.pressure", null], "Batteries|Service Battery|Voltage": ["electrical.batteries.288.voltage", null], "Batteries|Service Battery|Current": ["electrical.batteries.288.current", null], "Batteries|Service Battery|Power": ["electrical.batteries.288.power", null], "Batteries|Service Battery|Temperature": ["electrical.batteries.288.temperature", null], "Batteries|Service Battery|Temp": ["electrical.batteries.288.temperature", null], "Batteries|Motor Battery|Voltage": ["electrical.batteries.288-second.voltage", null], "Batteries|Charges|stateOfCharge": ["electrical.batteries.288.capacity.stateOfCharge", null], "Batteries|Charges|lifetimeDischarge": ["electrical.batteries.288.lifetimeDischarge", null], "Batteries|Charges|consumedCharge": ["electrical.batteries.288.capacity.consumedCharge", null], "Batteries|Charges|dischargeSinceFull": ["electrical.batteries.288.capacity.dischargeSinceFull", null], "Batteries|Charges|dischargedEnergy": ["electrical.batteries.288.capacity.dischargedEnergy", null], "Batteries|Charges|timeRemaining": ["electrical.batteries.288.capacity.timeRemaining", null], "Switches|Switches|Raspi4 IO#11": ["electrical.switches.pin-11.state", null], "Switches|Audio Alarms|sw0": ["electrical.switches.venus-0.state", null], "Switches|Audio Alarms|sw1": ["electrical.switches.venus-1.state", null]};
|
|
291
|
+
function element(tag,text) {
|
|
292
|
+
const item=document.createElement(tag);
|
|
293
|
+
item.textContent=text;
|
|
294
|
+
return item;
|
|
295
|
+
}
|
|
296
|
+
let track = [], map, layer, imported = false;
|
|
297
|
+
const mapStatus=document.querySelector('#map-status');
|
|
298
|
+
function focusTrack() {
|
|
299
|
+
if(map && layer?.getBounds().isValid()) map.fitBounds(layer.getBounds(),{padding:[35,35],maxZoom:17});
|
|
300
|
+
}
|
|
301
|
+
function redrawTrack(recenter = true) {
|
|
302
|
+
if(!map) return;
|
|
303
|
+
if(layer) layer.remove();
|
|
304
|
+
layer=L.featureGroup().addTo(map);
|
|
305
|
+
if (!track.length) {
|
|
306
|
+
mapStatus.textContent = 'En attente d’une position GPS Signal K.';
|
|
307
|
+
map.invalidateSize();
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
if(track.length>1) L.polyline(track.map(p=>[p.lat,p.lon]),{color:'#007f99',weight:4}).addTo(layer);
|
|
311
|
+
track.forEach((point,index)=>{
|
|
312
|
+
const last=index===track.length-1;
|
|
313
|
+
const caption=element('span',
|
|
314
|
+
(last?'Dernier point':'Point '+(index+1))+' · '+point.lat.toFixed(5)+'°, '+point.lon.toFixed(5)+'°'
|
|
315
|
+
+(point.time?' · '+new Date(point.time).toLocaleString('fr-FR'):''));
|
|
316
|
+
L.circleMarker([point.lat,point.lon],{radius:last?8:4,color:last?'#e04829':'#05667c',fillOpacity:.9})
|
|
317
|
+
.bindPopup(caption).addTo(layer);
|
|
318
|
+
});
|
|
319
|
+
const point=track.at(-1);
|
|
320
|
+
document.querySelector('#fix').textContent='Dernier point affiché · '+point.lat.toFixed(5)+'°, '+point.lon.toFixed(5)+'°'
|
|
321
|
+
+(point.time?' · '+new Date(point.time).toLocaleString('fr-FR'):'');
|
|
322
|
+
mapStatus.textContent=track.length+' points · '+(imported?'trace locale':'Signal K');
|
|
323
|
+
map.invalidateSize();
|
|
324
|
+
if (recenter) focusTrack();
|
|
325
|
+
}
|
|
326
|
+
function openMap() {
|
|
327
|
+
mapPanel.hidden=false;
|
|
328
|
+
if(!window.L) {
|
|
329
|
+
mapStatus.textContent='Carte indisponible : vérifie la connexion Internet.';
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if(!map) {
|
|
333
|
+
map=L.map('gps-map',{scrollWheelZoom:false}).setView([0,0],2);
|
|
334
|
+
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png',{
|
|
335
|
+
maxZoom:19, attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
|
336
|
+
}).addTo(map).on('tileerror',()=>{
|
|
337
|
+
mapStatus.textContent='Fond cartographique indisponible · trace GPS toujours affichée.';
|
|
338
|
+
});
|
|
339
|
+
L.control.scale({imperial:false}).addTo(map);
|
|
340
|
+
}
|
|
341
|
+
redrawTrack();
|
|
342
|
+
mapPanel.scrollIntoView({block:'start'});
|
|
343
|
+
}
|
|
344
|
+
document.querySelector('#fit-map').addEventListener('click',focusTrack);
|
|
345
|
+
document.querySelector('#track-file').addEventListener('change',async event=>{
|
|
346
|
+
const file=event.target.files?.[0];
|
|
347
|
+
if(!file) return;
|
|
247
348
|
try {
|
|
248
|
-
const
|
|
249
|
-
|
|
349
|
+
const data=JSON.parse(await file.text());
|
|
350
|
+
const geometry=data.type==='Feature' ? data.geometry : data;
|
|
351
|
+
if(geometry?.type!=='LineString' || !Array.isArray(geometry.coordinates)
|
|
352
|
+
|| geometry.coordinates.length<2 || geometry.coordinates.length>5000)
|
|
353
|
+
throw new Error('Choisis une trace GeoJSON LineString de 2 à 5 000 points.');
|
|
354
|
+
const points=geometry.coordinates.map(item=>{
|
|
355
|
+
if(!Array.isArray(item)) throw new Error('Coordonnées GPS invalides.');
|
|
356
|
+
const [lon,lat]=item;
|
|
357
|
+
if(!Number.isFinite(lat)||!Number.isFinite(lon)||Math.abs(lat)>90||Math.abs(lon)>180)
|
|
358
|
+
throw new Error('Coordonnées GPS invalides.');
|
|
359
|
+
return {lat,lon};
|
|
250
360
|
});
|
|
361
|
+
track=points;imported=true;
|
|
362
|
+
document.querySelector('#map-mode').textContent='Trace GeoJSON importée · fond OpenStreetMap';
|
|
363
|
+
openMap();
|
|
364
|
+
} catch(error) {
|
|
365
|
+
mapStatus.textContent=error instanceof SyntaxError?'GeoJSON illisible.':error.message;
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
let currentSubpage;
|
|
369
|
+
const liveWidgets = [];
|
|
370
|
+
function showPage(name) {
|
|
371
|
+
currentSubpage = name;
|
|
372
|
+
liveWidgets.length = 0;
|
|
373
|
+
for(const button of oldNav.children) button.setAttribute('aria-pressed',String(button.textContent===name));
|
|
374
|
+
oldPanels.replaceChildren();
|
|
375
|
+
mapPanel.hidden=true;
|
|
376
|
+
for(const [group,widgets] of Object.entries(pages[name])) {
|
|
377
|
+
const card=element('article','');
|
|
378
|
+
card.append(element('h2',group));
|
|
379
|
+
for(const [type,label] of widgets) {
|
|
380
|
+
if(type==='ui_button') continue;
|
|
381
|
+
if(type==='ui_chart'||type==='ui_gauge') {
|
|
382
|
+
card.append(element('h3',label));
|
|
383
|
+
const canvas = document.createElement('canvas');
|
|
384
|
+
const caption = element('small','En attente de données');
|
|
385
|
+
canvas.setAttribute('role','img');
|
|
386
|
+
canvas.setAttribute('aria-label',label);
|
|
387
|
+
card.append(canvas,caption);
|
|
388
|
+
liveWidgets.push({label, binding:bindings[[name,group,label].join('|')],canvas,caption,compass:type==='ui_gauge'});
|
|
389
|
+
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
const row=element('p','');row.className='reading';
|
|
393
|
+
const value = element('strong','Indisponible');
|
|
394
|
+
row.append(element('span',label),value);
|
|
395
|
+
liveWidgets.push({label,binding:bindings[[name,group,label].join('|')],value});
|
|
396
|
+
card.append(row);
|
|
397
|
+
}
|
|
398
|
+
if(name==='Vessel'&&group==='Vessel'||name==='Navigation'&&group==='Global') {
|
|
399
|
+
const button=element('button','MAP YODA');
|
|
400
|
+
button.type='button';button.addEventListener('click',openMap);card.append(button);
|
|
401
|
+
}
|
|
402
|
+
oldPanels.append(card);
|
|
403
|
+
}
|
|
404
|
+
if(name==='Switches') {
|
|
405
|
+
const p=element('p','GPIO et alarmes affichés en lecture seule.');
|
|
406
|
+
oldPanels.append(p);
|
|
407
|
+
}
|
|
408
|
+
updateWidgets();
|
|
409
|
+
}
|
|
410
|
+
Object.keys(pages).forEach(name=>{
|
|
411
|
+
const button=element('button',name);
|
|
412
|
+
button.type='button';button.addEventListener('click',()=>showPage(name));
|
|
413
|
+
oldNav.append(button);
|
|
414
|
+
});
|
|
415
|
+
const home = document.querySelector('#home');
|
|
416
|
+
const header = document.querySelector('#page-header');
|
|
417
|
+
const pageLinks = header.querySelectorAll('[data-page]');
|
|
418
|
+
const views = { accueil: home, navigation: nodeRed, ruuvi, relais: relays };
|
|
419
|
+
let currentPage;
|
|
420
|
+
|
|
421
|
+
function route() {
|
|
422
|
+
const page = window.location.hash.slice(1) || 'accueil';
|
|
423
|
+
if (!Object.hasOwn(views, page) || page === currentPage) return;
|
|
424
|
+
currentPage = page;
|
|
425
|
+
for (const [name, view] of Object.entries(views)) view.hidden = name !== page;
|
|
426
|
+
header.hidden = page === 'accueil';
|
|
427
|
+
for (const link of pageLinks) {
|
|
428
|
+
if (link.dataset.page === page) link.setAttribute('aria-current', 'page');
|
|
429
|
+
else link.removeAttribute('aria-current');
|
|
430
|
+
}
|
|
431
|
+
if (page === 'navigation' && !oldPanels.hasChildNodes()) showPage('Vessel');
|
|
432
|
+
if (page === 'navigation' && map && !mapPanel.hidden) map.invalidateSize();
|
|
433
|
+
if (page === 'ruuvi') painters.forEach(paint => paint());
|
|
434
|
+
window.scrollTo(0, 0);
|
|
435
|
+
}
|
|
436
|
+
window.addEventListener('hashchange', route);
|
|
437
|
+
let snapshot;
|
|
438
|
+
const trend = new Map();
|
|
439
|
+
const bindingsByPath = [...new Set(Object.values(bindings).filter(([,source])=>!source).map(([path])=>path))];
|
|
440
|
+
const num = new Intl.NumberFormat('fr-FR',{maximumFractionDigits:2});
|
|
441
|
+
|
|
442
|
+
function selectedReading(binding) {
|
|
443
|
+
if (!binding) return undefined;
|
|
444
|
+
const [path,source]=binding;
|
|
445
|
+
const node=at(snapshot,path);
|
|
446
|
+
if (!source) return node;
|
|
447
|
+
return node?.values?.[source] ?? (node?.$source === source ? node : undefined);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function display(label, value, path, units) {
|
|
451
|
+
if (value == null) return 'Indisponible';
|
|
452
|
+
if (label === 'callsignVHF') return value.callsignVhf ?? value.callsignVHF ?? 'Indisponible';
|
|
453
|
+
if (label === 'Lat' || label === 'Lon') {
|
|
454
|
+
const coordinate=label==='Lat'?value.latitude:value.longitude;
|
|
455
|
+
return Number.isFinite(coordinate) ? coordinate.toFixed(5)+'°' : 'Indisponible';
|
|
456
|
+
}
|
|
457
|
+
if (label === 'Engine On/Off' && typeof value === 'number') return value > 0 ? 'En marche' : 'Arrêté';
|
|
458
|
+
if (typeof value === 'boolean') return value ? 'On' : 'Off';
|
|
459
|
+
if (typeof value === 'object') {
|
|
460
|
+
const detail=value.overall ?? value.max ?? value.name ?? value.message ?? value.state;
|
|
461
|
+
const dimension=path?.startsWith('design.') && label!=='aisShipType';
|
|
462
|
+
return typeof detail === 'number' && dimension ? num.format(detail)+' m' : String(detail ?? 'Indisponible');
|
|
463
|
+
}
|
|
464
|
+
if (typeof value !== 'number') return String(value);
|
|
465
|
+
let multiplier=1, offset=0, unit=units ?? '';
|
|
466
|
+
if (path?.endsWith('.temperature')) [offset,unit]=[-273.15,'°C'];
|
|
467
|
+
else if (path?.endsWith('.humidity') || path?.endsWith('.stateOfCharge')) [multiplier,unit]=[100,'%'];
|
|
468
|
+
else if (path?.endsWith('.pressure')) [multiplier,unit]=[.01,'hPa'];
|
|
469
|
+
else if (path?.endsWith('.revolutions')) [multiplier,unit]=[60,'tr/min'];
|
|
470
|
+
else if (label==='LogNM') [multiplier,unit]=[1/1852,'NM'];
|
|
471
|
+
else if (['SOG','STW','SpeedTrue','SpeedApp','SpeedOvG'].includes(label)) [multiplier,unit]=[3600/1852,'nd'];
|
|
472
|
+
else if (['HDT','HDM','Autopilot Target HDT','RudderAng','AngleTrue','AngleApp'].includes(label)) [multiplier,unit]=[180/Math.PI,'°'];
|
|
473
|
+
else if (label==='RateOfTurn') [multiplier,unit]=[180/Math.PI,'°/s'];
|
|
474
|
+
else if (label==='Engine runTime'||label==='timeRemaining') [multiplier,unit]=[1/3600,'h'];
|
|
475
|
+
else if (label==='lifetimeDischarge'||label==='consumedCharge'||label==='dischargeSinceFull') [multiplier,unit]=[1/3600,'Ah'];
|
|
476
|
+
else if (label==='dischargedEnergy' && units==='J') [multiplier,unit]=[1/3600,'Wh'];
|
|
477
|
+
else if (path?.endsWith('.voltage')||path?.endsWith('.alternatorVoltage')) unit='V';
|
|
478
|
+
else if (path?.endsWith('.current')) unit='A';
|
|
479
|
+
else if (path?.endsWith('.power')) unit='W';
|
|
480
|
+
else if (['length','beam','draft','airHeight','gps.fromBow','gps.fromCenter','Depth'].includes(label)) unit='m';
|
|
481
|
+
return num.format(value*multiplier+offset)+(unit?' '+unit:'');
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function drawWidget(widget, reading, raw) {
|
|
485
|
+
const {canvas,caption,compass,label,binding}=widget;
|
|
486
|
+
canvas.width=300;canvas.height=110;
|
|
487
|
+
const ctx=canvas.getContext('2d');
|
|
488
|
+
ctx.strokeStyle='#62ddd0';ctx.fillStyle='#c3d6df';ctx.font='13px system-ui';
|
|
489
|
+
if (compass) {
|
|
490
|
+
ctx.beginPath();ctx.arc(150,56,36,0,Math.PI*2);ctx.stroke();ctx.fillText('N',145,14);
|
|
491
|
+
if (Number.isFinite(raw)) {
|
|
492
|
+
ctx.beginPath();ctx.moveTo(150,56);ctx.lineTo(150+30*Math.sin(raw),56-30*Math.cos(raw));ctx.stroke();
|
|
493
|
+
}
|
|
494
|
+
caption.textContent=Number.isFinite(raw)?num.format(raw*180/Math.PI)+'°':'Indisponible';
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
const points=trend.get(binding?.[0]) ?? [];
|
|
498
|
+
caption.textContent=points.length ? display(label,points.at(-1).value,binding[0],reading?.meta?.units)+' · '+points.length+' pts':'Indisponible';
|
|
499
|
+
if (!points.length) return;
|
|
500
|
+
const values=points.map(point=>point.value);
|
|
501
|
+
const low=Math.min(...values), high=Math.max(...values);
|
|
502
|
+
const start=Date.now()-hour;
|
|
503
|
+
ctx.beginPath();
|
|
504
|
+
points.forEach(({time,value},i)=>{
|
|
505
|
+
const x=12+276*(time-start)/hour;
|
|
506
|
+
const y=high===low?48:78-(value-low)*58/(high-low);
|
|
507
|
+
if(i===0)ctx.moveTo(x,y);else ctx.lineTo(x,y);
|
|
508
|
+
});
|
|
509
|
+
ctx.stroke();
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
function updateWidgets() {
|
|
513
|
+
for (const widget of liveWidgets) {
|
|
514
|
+
const reading=selectedReading(widget.binding);
|
|
515
|
+
const raw=reading && Object.hasOwn(reading,'value') ? reading.value : reading;
|
|
516
|
+
const label=display(widget.label,raw,widget.binding?.[0],reading?.meta?.units);
|
|
517
|
+
if (widget.canvas) drawWidget(widget,reading,raw);
|
|
518
|
+
else {
|
|
519
|
+
widget.value.textContent=label;
|
|
520
|
+
const timestamp=Date.parse(reading?.timestamp);
|
|
521
|
+
widget.value.title=Number.isFinite(timestamp)?'Reçu à '+clock(timestamp):'';
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function collectNavigation(now) {
|
|
527
|
+
for (const path of bindingsByPath) {
|
|
528
|
+
const reading=at(snapshot,path);
|
|
529
|
+
const points=trend.get(path) ?? [];
|
|
530
|
+
while(points.length && points[0].time<now-hour)points.shift();
|
|
531
|
+
const time=Date.parse(reading?.timestamp);
|
|
532
|
+
if (Number.isFinite(reading?.value) && Number.isFinite(time) && time>=now-hour && time<=now
|
|
533
|
+
&& (!points.length || time>points.at(-1).time)) points.push({time,value:reading.value});
|
|
534
|
+
if (points.length) trend.set(path,points);
|
|
535
|
+
}
|
|
536
|
+
if (imported) return;
|
|
537
|
+
const reading=at(snapshot,'navigation.position');
|
|
538
|
+
const lat=reading?.value?.latitude, lon=reading?.value?.longitude, time=Date.parse(reading?.timestamp);
|
|
539
|
+
if (!Number.isFinite(lat) || Math.abs(lat)>90 || !Number.isFinite(lon) || Math.abs(lon)>180 || !Number.isFinite(time)) return;
|
|
540
|
+
const last=track.at(-1);
|
|
541
|
+
if (last && time<=Date.parse(last.time)) return;
|
|
542
|
+
const first=!track.length;
|
|
543
|
+
track.push({lat,lon,time:new Date(time).toISOString()});
|
|
544
|
+
while(track.length>5000 || (track.length>1 && Date.parse(track[0].time)<now-hour))track.shift();
|
|
545
|
+
if (map && !mapPanel.hidden) redrawTrack(first);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const connection = document.createElement('p');
|
|
549
|
+
connection.setAttribute('role','status');
|
|
550
|
+
connection.hidden=true;
|
|
551
|
+
header.after(connection);
|
|
552
|
+
|
|
553
|
+
async function refresh() {
|
|
554
|
+
try {
|
|
555
|
+
const response=await fetch('/signalk/v1/api/vessels/self',{cache:'no-store',signal:AbortSignal.timeout(10000)});
|
|
251
556
|
if (!response.ok) throw new Error('HTTP '+response.status);
|
|
252
|
-
|
|
253
|
-
const now
|
|
254
|
-
record(
|
|
255
|
-
|
|
256
|
-
|
|
557
|
+
snapshot=await response.json();
|
|
558
|
+
const now=Date.now();
|
|
559
|
+
record(snapshot,now);
|
|
560
|
+
collectNavigation(now);
|
|
561
|
+
updateRelays(snapshot);
|
|
562
|
+
connection.hidden=true;
|
|
257
563
|
} catch {
|
|
258
|
-
|
|
564
|
+
snapshot=undefined;
|
|
259
565
|
updateRelays(null);
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
setTimeout(refresh,5000);
|
|
566
|
+
connection.textContent='Signal K indisponible · nouvelle tentative dans 5 s';
|
|
567
|
+
connection.hidden=false;
|
|
263
568
|
}
|
|
569
|
+
updateWidgets();
|
|
570
|
+
if (!ruuvi.hidden) painters.forEach(paint=>paint());
|
|
571
|
+
setTimeout(refresh,5000);
|
|
264
572
|
}
|
|
573
|
+
route();
|
|
265
574
|
updateRelays(null);
|
|
266
575
|
refresh();
|
package/public/index.html
CHANGED
|
@@ -2,17 +2,31 @@
|
|
|
2
2
|
<html lang="fr">
|
|
3
3
|
<meta charset="utf-8">
|
|
4
4
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5
|
-
<title>
|
|
6
|
-
<link rel="stylesheet" href="./style.css">
|
|
7
|
-
<header
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
</
|
|
5
|
+
<title>YODA · Dufour 390 GL</title>
|
|
6
|
+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"><link rel="stylesheet" href="./style.css">
|
|
7
|
+
<header id="page-header" hidden>
|
|
8
|
+
<a class="brand" href="#accueil" aria-label="Retour à l’accueil YODA">YODA</a>
|
|
9
|
+
<nav aria-label="Pages">
|
|
10
|
+
<a href="#navigation" data-page="navigation">Navigation</a>
|
|
11
|
+
<a href="#ruuvi" data-page="ruuvi">Ruuvi</a>
|
|
12
|
+
<a href="#relais" data-page="relais">Relais</a>
|
|
13
|
+
</nav>
|
|
14
|
+
</header>
|
|
11
15
|
<main>
|
|
12
|
-
<
|
|
13
|
-
<div
|
|
16
|
+
<section id="home" aria-labelledby="home-title">
|
|
17
|
+
<div class="home-content">
|
|
18
|
+
<h1 id="home-title">YODA</h1>
|
|
19
|
+
<p class="boat-model">Dufour 390 GL</p>
|
|
20
|
+
<nav class="home-menu" aria-label="Accès aux pages">
|
|
21
|
+
<a href="#navigation">Navigation</a>
|
|
22
|
+
<a href="#ruuvi">Ruuvi</a>
|
|
23
|
+
<a href="#relais">Relais</a>
|
|
24
|
+
</nav>
|
|
25
|
+
</div>
|
|
26
|
+
</section>
|
|
27
|
+
<div id="ruuvi-view" hidden>
|
|
14
28
|
<h1>Ruuvi Cookpit-Inside-Motor (last hour)</h1>
|
|
15
|
-
|
|
29
|
+
|
|
16
30
|
<div class="controls">
|
|
17
31
|
<fieldset aria-label="Capteurs visibles"></fieldset>
|
|
18
32
|
</div>
|
|
@@ -27,9 +41,26 @@
|
|
|
27
41
|
</div>
|
|
28
42
|
<section id="relays" hidden>
|
|
29
43
|
<h1>Relais</h1>
|
|
30
|
-
|
|
44
|
+
|
|
31
45
|
<div class="grid" id="relay-cards"></div>
|
|
32
46
|
</section>
|
|
47
|
+
<section id="navigation-view" hidden>
|
|
48
|
+
<h1>YODA Navigation</h1>
|
|
49
|
+
|
|
50
|
+
<div class="layout"><aside><nav id="old-nav" aria-label="Sous-menus Navigation"></nav></aside>
|
|
51
|
+
<div>
|
|
52
|
+
<div id="old-panels" class="grid"></div>
|
|
53
|
+
<section id="map-panel" hidden>
|
|
54
|
+
<h2>Carte GPS</h2>
|
|
55
|
+
<p id="map-mode">Positions GPS reçues pendant l’ouverture de la page · fond OpenStreetMap</p>
|
|
56
|
+
<button type="button" id="fit-map">Centrer sur la trace</button>
|
|
57
|
+
<label>Ouvrir une trace GeoJSON <input id="track-file" type="file" accept=".json,.geojson"></label>
|
|
58
|
+
<p id="map-status" role="status"></p>
|
|
59
|
+
<div id="gps-map" aria-label="Carte et trace GPS"></div>
|
|
60
|
+
<p id="fix"></p>
|
|
61
|
+
</section>
|
|
62
|
+
</div></div>
|
|
63
|
+
</section>
|
|
33
64
|
</main>
|
|
34
|
-
<script src="./dashboard.js" defer></script>
|
|
65
|
+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" defer></script><script src="./dashboard.js" defer></script>
|
|
35
66
|
</html>
|
package/public/style.css
CHANGED
|
@@ -24,3 +24,27 @@ article h3{margin:.1rem 0 .4rem;font-size:1.15rem}
|
|
|
24
24
|
@media(max-width:1050px){.grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
|
25
25
|
@media(max-width:740px){.grid{grid-template-columns:minmax(0,1fr)}}
|
|
26
26
|
@media(max-width:500px){.layout{grid-template-columns:5.7rem minmax(0,1fr)}aside nav{font-size:.77rem}article{padding:.5rem}}
|
|
27
|
+
|
|
28
|
+
#old-nav button{text-align:left;padding:.45rem .35rem;overflow-wrap:anywhere}
|
|
29
|
+
#old-panels article{align-self:start}
|
|
30
|
+
#old-panels .reading{display:flex;justify-content:space-between;align-items:baseline;gap:.55rem;border-bottom:1px solid #304554;padding:.48rem 0;margin:0;font-size:.92rem}
|
|
31
|
+
#old-panels .reading strong{text-align:right;white-space:nowrap;color:#eaf3f6}
|
|
32
|
+
#old-panels canvas{height:110px}
|
|
33
|
+
#old-panels button{margin-top:.8rem}
|
|
34
|
+
#gps-map{height:clamp(290px,55vh,580px);border:1px solid #405a6b;border-radius:.75rem;background:#283b48}
|
|
35
|
+
#map-panel{margin-top:1rem}
|
|
36
|
+
#map-panel label{display:inline-block;margin:.35rem 0}
|
|
37
|
+
#track-file{max-width:100%}
|
|
38
|
+
|
|
39
|
+
#home{min-height:calc(100vh - 2.4rem);display:grid;place-items:center}
|
|
40
|
+
.home-content{width:min(100%,58rem);text-align:center}
|
|
41
|
+
#home-title{font-size:clamp(4.5rem,15vw,9rem);line-height:1;letter-spacing:.07em;margin:0}
|
|
42
|
+
.boat-model{font-size:clamp(1.35rem,4vw,2.4rem);margin:.65rem 0 2.6rem}
|
|
43
|
+
.home-menu{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(.65rem,2vw,1.3rem)}
|
|
44
|
+
.home-menu a,#page-header a{color:inherit;text-decoration:none}
|
|
45
|
+
.home-menu a{min-height:7rem;display:grid;place-items:center;background:#182f3d;border:1px solid #446273;border-radius:.85rem;font-size:clamp(1.2rem,3vw,1.85rem);font-weight:650}
|
|
46
|
+
.home-menu a:hover,.home-menu a:focus-visible{background:#a5e3d6;color:#102631}
|
|
47
|
+
#page-header a{padding:.5rem .65rem;border-radius:.4rem}
|
|
48
|
+
#page-header a[aria-current=page]{background:#a5e3d6;color:#102631}
|
|
49
|
+
.brand{font-weight:750;letter-spacing:.12em}
|
|
50
|
+
@media(max-width:540px){.home-menu{grid-template-columns:1fr}.home-menu a{min-height:4rem}#page-header{gap:.3rem}}
|