feat: enhance sidebar functionality and styling

- Updated sidebar component to support dynamic width based on collapsed state.
- Improved sidebar icon rendering and added user account management features.
- Introduced new trend chart settings component for better user interaction.
- Added utility functions for engineering units and trend chart settings.
- Implemented color assignment logic for trend series to enhance visual representation.
- Enhanced CSS styles for better responsiveness and usability across different screen sizes.
- Introduced new configuration for Vite server to allow shared directory access.
- Added .dockerignore file to optimize Docker build context.
This commit is contained in:
jhartworks committed 2026-11-19 13:51:04 +01:00
1 parent 2f5f86452f
commit 3203577a9d
28 files changed
+1508 -758

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
export const AUTO_UNIT = "__auto__";
export const DEFAULT_ANALOG_UNIT = "\u00B0C";
export const DIGITAL_UNIT = "Digital";
export const DEFAULT_UNITS = [
[DEFAULT_ANALOG_UNIT, "Grad Celsius"],
["%", "Prozent"],
["K", "Kelvin"],
["V", "Volt"],
["A", "Ampere"],
["Pa", "Pascal"],
[DIGITAL_UNIT, "Digital"],
["ppm", "Parts per million"],
["%RH", "Relative Feuchte"],
["COV", "COV"],
["mBar", "Millibar"],
["Bar", "Bar"],
["kW", "Kilowatt"],
["kWh", "Kilowattstunden"],
["Liter", "Liter"],
["m\u00B3", "Kubikmeter"],
].map(([symbol, label]) => ({ symbol, label, isSystem: true }));
export function normalizeUnitSymbol(value) {
const symbol = String(value ?? "").trim();
if (/^(?:bool|boolean|digital)$/i.test(symbol)) return DIGITAL_UNIT;
if (/^(?:\?C|\u00C2*\u00B0\s*C)$/i.test(symbol)) return DEFAULT_ANALOG_UNIT;
if (/^%\s*rh$/i.test(symbol)) return "%RH";
if (/^m(?:\^?3|\u00B3)$/i.test(symbol)) return "m\u00B3";
return DEFAULT_UNITS.find((unit) => unit.symbol.toLowerCase() === symbol.toLowerCase())?.symbol ?? symbol;
}
export function detectEngineeringUnit(name, kind) {
if (kind === "digital") return DIGITAL_UNIT;
const label = String(name ?? "").toLowerCase();
if (/co[2\u2082]/.test(label)) return "ppm";
if (/feucht|humidity/.test(label)) return "%RH";
if (/energie|energy|kwh/.test(label)) return "kWh";
if (/leistung|power/.test(label)) return "kW";
if (/druck|pressure/.test(label)) return /m\s*bar|millibar/.test(label) ? "mBar" : "Pa";
if (/temp|f(?:\u00FC|ue)hler/.test(label)) return DEFAULT_ANALOG_UNIT;
return "";
}
export function resolveEngineeringUnit(value, kind, name) {
const unit = normalizeUnitSymbol(value);
if (unit && unit !== AUTO_UNIT) return unit;
return detectEngineeringUnit(name, kind) || DEFAULT_ANALOG_UNIT;
}