diff --git a/btc-UI/src/app/components/navbar/navbar.component.ts b/btc-UI/src/app/components/navbar/navbar.component.ts index fd4e886..d3355ff 100755 --- a/btc-UI/src/app/components/navbar/navbar.component.ts +++ b/btc-UI/src/app/components/navbar/navbar.component.ts @@ -163,7 +163,7 @@ export class NavbarComponent implements OnInit, OnDestroy { const newStatuses = new Map(statuses); const newStops: number[] = []; - // Detect newly stopped races + // Detect newly stopped races (same logic as before) newStatuses.forEach((value, key) => { const prev = this.stopbetStatuses.get(key); if (prev === 'N' || prev === undefined) { @@ -175,11 +175,13 @@ export class NavbarComponent implements OnInit, OnDestroy { this.stopbetStatuses = newStatuses; - // If there are new stops, display the message for 30 seconds + // If there are new stops, display only the latest one (most recent) if (newStops.length > 0) { - newStops.sort((a, b) => a - b); - this.stopMessage = newStops.map(r => `Race ${r} Stopped`).join(' - '); - // Sync new stop message to electron main if available + newStops.sort((a, b) => a - b); // sort ascending + const latestStop = newStops[newStops.length - 1]; // pick the highest (latest) race number detected + this.stopMessage = `Race ${latestStop} Stopped`; + + // Sync new single stop message to electron main if available if ((window as any).electronAPI) { try { (window as any).electronAPI.syncStopMessage(this.stopMessage); @@ -188,9 +190,11 @@ export class NavbarComponent implements OnInit, OnDestroy { } } + // Clear any existing timeout so message stays visible full duration if (this.stopMessageTimeout) { clearTimeout(this.stopMessageTimeout); } + // Keep message visible for 50 seconds (50000 ms) then clear this.stopMessageTimeout = window.setTimeout(() => { this.stopMessage = ''; this.stopMessageTimeout = null; diff --git a/btc-UI/src/app/components/shared-table/shared-table.component.css b/btc-UI/src/app/components/shared-table/shared-table.component.css index e865f9e..c712b95 100644 --- a/btc-UI/src/app/components/shared-table/shared-table.component.css +++ b/btc-UI/src/app/components/shared-table/shared-table.component.css @@ -168,7 +168,7 @@ div[style*="background-color: black"] .custom-cell { overflow: hidden; box-sizing: border-box; animation: scroll 20s linear infinite; /* Adjust duration for speed */ - width: 100%; /* Ensure it takes full width */ + width: 40%; /* Ensure it takes full width */ } @keyframes scroll { diff --git a/btc-UI/src/app/components/shared-table/shared-table.component.ts b/btc-UI/src/app/components/shared-table/shared-table.component.ts index 8c4e9b0..d46397b 100644 --- a/btc-UI/src/app/components/shared-table/shared-table.component.ts +++ b/btc-UI/src/app/components/shared-table/shared-table.component.ts @@ -24,6 +24,7 @@ export class SharedTableComponent implements OnInit { constructor(private websocketService: WebsocketService) {} ngOnInit() { + // (Websocket subscriptions are commented out by you — kept as-is) // this.websocketService.message$.subscribe((msg) => { // this.message = msg; // console.log('[SHARED TABLE] WebSocket message:', msg); @@ -34,12 +35,14 @@ export class SharedTableComponent implements OnInit { // console.log('[SHARED TABLE] WebSocket connection status:', status); // }); - // Add this: Listen for stop message updates - if (window.electronAPI) { - window.electronAPI.onUpdateStopMessage((message: string) => { - this.stopMessage = message; + // Listen for stop message updates from electron main (only latest single message expected) + if ((window as any).electronAPI && typeof (window as any).electronAPI.onUpdateStopMessage === 'function') { + (window as any).electronAPI.onUpdateStopMessage((message: string) => { + this.stopMessage = message || ''; console.log('[SHARED TABLE] Received stop message:', message); }); + } else { + console.warn('[SHARED TABLE] electronAPI.onUpdateStopMessage not available'); } } } \ No newline at end of file