Improve graph/map UX and move contact editing to dedicated pages.

Add viewport controls, collapsible panels with persisted state, filters modal, and refined context menus; preserve map layout on navigation and let contacts be edited with relations on /contacts/:id instead of list modals.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gitrusprus
2026-07-06 15:15:45 +03:00
co-authored by Cursor
parent 10e7d65a00
commit 986d36ff51
22 changed files with 1638 additions and 623 deletions
+53
View File
@@ -0,0 +1,53 @@
const STORAGE_KEY = 'sg-map-layout-v1'
const EMPTY = { positions: {}, scale: 1, view: null }
let memoryByMapId = null
function readAll() {
if (memoryByMapId) return memoryByMapId
try {
const raw = sessionStorage.getItem(STORAGE_KEY)
memoryByMapId = raw ? JSON.parse(raw) : {}
} catch {
memoryByMapId = {}
}
return memoryByMapId
}
export function readMapLayoutCache(mapId) {
if (!mapId) return { ...EMPTY }
const all = readAll()
const entry = all[String(mapId)]
return entry ? { ...EMPTY, ...entry } : { ...EMPTY }
}
export function writeMapLayoutCache(mapId, { positions, scale, view }) {
if (!mapId) return
const key = String(mapId)
const all = readAll()
const prev = all[key] || { ...EMPTY }
all[key] = {
positions: positions ?? prev.positions,
scale: scale ?? prev.scale,
view: view ?? prev.view,
}
memoryByMapId = all
try {
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(all))
} catch {
/* sessionStorage quota */
}
}
export function clearMapLayoutCache(mapId) {
if (!mapId) return
const all = readAll()
delete all[String(mapId)]
memoryByMapId = all
try {
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(all))
} catch {
/* ignore */
}
}