fix : 2nd screen message fixed
This commit is contained in:
parent
8bdd2e0b74
commit
71367b596d
@ -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;
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user