feat: floor plan map, LQI edge coloring, zigbee path highlighting, eslint/test fixes, vite audit fix
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
applyEdgeChanges,
|
||||
addEdge,
|
||||
} from '@xyflow/react'
|
||||
import type { NodeData, EdgeData, NodeType, EdgeType, NodeTypeStyle, EdgeTypeStyle, CustomStyleDef, ServiceStatus } from '@/types'
|
||||
import type { NodeData, EdgeData, NodeType, EdgeType, NodeTypeStyle, EdgeTypeStyle, CustomStyleDef, ServiceStatus, FloorMapConfig } from '@/types'
|
||||
import { generateUUID } from '@/utils/uuid'
|
||||
import { normalizeHandle, removedBottomHandleIds } from '@/utils/handleUtils'
|
||||
import { applyOpacity } from '@/utils/colorUtils'
|
||||
@@ -35,6 +35,12 @@ interface CanvasState {
|
||||
// Live per-service status overlay (not persisted), keyed via serviceStatusKey.
|
||||
serviceStatuses: Record<string, ServiceStatus>
|
||||
|
||||
floorMap: FloorMapConfig | null
|
||||
setFloorMap: (config: FloorMapConfig | null) => void
|
||||
updateFloorMap: (patch: Partial<FloorMapConfig>) => void
|
||||
highlightedPath: string[]
|
||||
setHighlightedPath: (edgeIds: string[]) => void
|
||||
|
||||
// History
|
||||
past: HistoryEntry[]
|
||||
future: HistoryEntry[]
|
||||
@@ -98,6 +104,8 @@ export const useCanvasStore = create<CanvasState>((set) => ({
|
||||
hideIp: readHideIp(),
|
||||
scanEventTs: 0,
|
||||
serviceStatuses: {},
|
||||
floorMap: null,
|
||||
highlightedPath: [],
|
||||
fitViewPending: false,
|
||||
|
||||
past: [],
|
||||
@@ -747,6 +755,16 @@ export const useCanvasStore = create<CanvasState>((set) => ({
|
||||
set({ hideIp: value })
|
||||
},
|
||||
|
||||
setFloorMap: (config) => set({ floorMap: config, hasUnsavedChanges: true }),
|
||||
|
||||
updateFloorMap: (patch) =>
|
||||
set((state) => ({
|
||||
floorMap: state.floorMap ? { ...state.floorMap, ...patch } : null,
|
||||
hasUnsavedChanges: true,
|
||||
})),
|
||||
|
||||
setHighlightedPath: (edgeIds) => set({ highlightedPath: edgeIds }),
|
||||
|
||||
loadCanvas: (nodes, edges) => {
|
||||
// React Flow requires parents before children in the array
|
||||
const parents = nodes.filter((n) => !n.parentId)
|
||||
|
||||
Reference in New Issue
Block a user