v1.3.0: Refactoring Phase 3+4, Symbol-Verwaltung Redesign, Schlauch-Labels Fix

- Refactoring: Error Boundaries, apiFetch Wrapper, Socket Status-Tracking
- Refactoring: UI Kontrast (theme-aware colors), unused imports bereinigt
- Symbol-Verwaltung: Neues Split-Panel (Meine Symbole + Bibliothek)
- Symbol-Verwaltung: Umbenennen (TLF rot/blau), Duplikate erlaubt
- Symbol-Verwaltung: Karten-Sidebar zeigt eigene Symbole bevorzugt
- Schlauch-Labels: Groessere Schrift (13px/10px), verschiebbar (Drag)
- Schema: TenantSymbol customName, sortOrder, unique constraint entfernt
- Open Source Referenz entfernt (kostenloses Projekt)
This commit is contained in:
Pepe Ziberi
2026-02-25 00:06:39 +01:00
parent 8ddeb7b377
commit 5917fa88ad
30 changed files with 3110 additions and 2120 deletions

View File

@@ -5,6 +5,31 @@ import { io, Socket } from 'socket.io-client'
let socket: Socket | null = null
let currentRoom: string | null = null
export type SocketStatus = 'connected' | 'disconnected' | 'reconnecting'
type StatusListener = (status: SocketStatus) => void
let currentStatus: SocketStatus = 'disconnected'
const statusListeners = new Set<StatusListener>()
function setStatus(status: SocketStatus) {
if (status === currentStatus) return
currentStatus = status
statusListeners.forEach(fn => fn(status))
}
/** Subscribe to socket connection status changes. Returns an unsubscribe function. */
export function onSocketStatus(listener: StatusListener): () => void {
statusListeners.add(listener)
// Immediately notify current status
listener(currentStatus)
return () => { statusListeners.delete(listener) }
}
/** Get current socket connection status */
export function getSocketStatus(): SocketStatus {
return currentStatus
}
export function getSocket(): Socket {
if (!socket) {
socket = io({
@@ -20,6 +45,7 @@ export function getSocket(): Socket {
})
socket.on('connect', () => {
console.log('[Socket.io] Connected:', socket?.id)
setStatus('connected')
// Re-join project room after reconnect
if (currentRoom) {
console.log('[Socket.io] Re-joining room:', currentRoom)
@@ -28,6 +54,7 @@ export function getSocket(): Socket {
})
socket.on('disconnect', (reason) => {
console.warn('[Socket.io] Disconnected:', reason)
setStatus('disconnected')
if (reason === 'io server disconnect') {
// Server disconnected us, need to manually reconnect
socket?.connect()
@@ -38,9 +65,11 @@ export function getSocket(): Socket {
})
socket.io.on('reconnect', (attempt) => {
console.log('[Socket.io] Reconnected after', attempt, 'attempts')
setStatus('connected')
})
socket.io.on('reconnect_attempt', (attempt) => {
console.log('[Socket.io] Reconnect attempt', attempt)
setStatus('reconnecting')
})
}
return socket