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:
1 parent
2f5f86452f
commit
3203577a9d
28 files changed
+1508
-758
No files matched your search
@@ -0,0 +1,51 @@
|
||||
export const CHART_DIVISIONS = [3, 4, 6, 8, 10];
|
||||
|
||||
export const DEFAULT_CHART_SETTINGS = {
|
||||
divisions: 6,
|
||||
grid: "both",
|
||||
gridStyle: "dashed",
|
||||
shadedBands: false,
|
||||
opacity: 100,
|
||||
highContrast: false,
|
||||
axes: {},
|
||||
assignments: {},
|
||||
};
|
||||
|
||||
function entries(value) {
|
||||
return value && typeof value === "object" && !Array.isArray(value) ? Object.entries(value) : [];
|
||||
}
|
||||
|
||||
function numericBound(value) {
|
||||
if (typeof value === "number" && Number.isFinite(value)) return value;
|
||||
if (typeof value === "string" && value.trim() && Number.isFinite(Number(value))) return Number(value);
|
||||
return "";
|
||||
}
|
||||
|
||||
export function normalizeTrendChartSettings(input, points) {
|
||||
const settings = input || {};
|
||||
const pointKeys = points && new Set(points.map((point) => `${point.isp}:${point.pointIndex}`));
|
||||
const axes = Object.fromEntries(entries(settings.axes)
|
||||
.filter(([id, axis]) => axis && typeof axis === "object" && (
|
||||
(id.startsWith("unit:") && id.length <= 261)
|
||||
|| (id.startsWith("point:") && (!pointKeys || pointKeys.has(id.slice(6))))
|
||||
))
|
||||
.map(([id, axis]) => [id, {
|
||||
...(axis.side === "left" || axis.side === "right" ? { side: axis.side } : {}),
|
||||
mode: axis.mode === "manual" ? "manual" : "auto",
|
||||
min: numericBound(axis.min),
|
||||
max: numericBound(axis.max),
|
||||
}]));
|
||||
const assignments = Object.fromEntries(entries(settings.assignments)
|
||||
.filter(([key, value]) => value === "own" && (!pointKeys || pointKeys.has(key))));
|
||||
|
||||
return {
|
||||
divisions: CHART_DIVISIONS.includes(settings.divisions) ? settings.divisions : DEFAULT_CHART_SETTINGS.divisions,
|
||||
grid: ["both", "horizontal", "vertical", "none"].includes(settings.grid) ? settings.grid : DEFAULT_CHART_SETTINGS.grid,
|
||||
gridStyle: settings.gridStyle === "solid" ? "solid" : DEFAULT_CHART_SETTINGS.gridStyle,
|
||||
shadedBands: settings.shadedBands === true,
|
||||
opacity: Number.isFinite(settings.opacity) ? Math.max(20, Math.min(100, settings.opacity)) : DEFAULT_CHART_SETTINGS.opacity,
|
||||
highContrast: settings.highContrast === true,
|
||||
axes,
|
||||
assignments,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user