fix : 2nd screen race changes accordingly

This commit is contained in:
karthik 2025-09-19 13:13:39 +05:30
parent 41c6adc1d4
commit f93bbe840f

View File

@ -249,6 +249,10 @@ export class NavbarComponent implements OnInit, OnDestroy {
this.sharedStateService.sharedData$.subscribe((data) => { this.sharedStateService.sharedData$.subscribe((data) => {
if (data.type === 'currentLegRace') { if (data.type === 'currentLegRace') {
this.selectedRace = data.value; this.selectedRace = data.value;
const electronAPI = (window as any).electronAPI;
if (electronAPI) {
electronAPI.syncSelectedRace(this.selectedRace);
}
if (this.currentPool) { if (this.currentPool) {
const leg = this.getLegIndexForRace(this.currentPool, data.value); const leg = this.getLegIndexForRace(this.currentPool, data.value);
this.currentLegRaceDisplay = `Leg ${leg + 1} (Race ${data.value}) for ${this.currentPool}`; this.currentLegRaceDisplay = `Leg ${leg + 1} (Race ${data.value}) for ${this.currentPool}`;
@ -263,6 +267,10 @@ export class NavbarComponent implements OnInit, OnDestroy {
this.currentPool = label; this.currentPool = label;
this.multiLegBaseRaceIdx = baseRaceIdx; this.multiLegBaseRaceIdx = baseRaceIdx;
this.selectedRace = this.getValidRaceForLeg(label, 0); this.selectedRace = this.getValidRaceForLeg(label, 0);
const electronAPI = (window as any).electronAPI;
if (electronAPI) {
electronAPI.syncSelectedRace(this.selectedRace);
}
this.currentLegRaceDisplay = `Starting at Race ${baseRaceIdx} for ${label}`; this.currentLegRaceDisplay = `Starting at Race ${baseRaceIdx} for ${label}`;
this.updateEnabledHorseNumbers(); this.updateEnabledHorseNumbers();
} }
@ -277,6 +285,10 @@ export class NavbarComponent implements OnInit, OnDestroy {
this.multiLegBaseRaceIdx = 0; this.multiLegBaseRaceIdx = 0;
this.currentLegRaceDisplay = ''; this.currentLegRaceDisplay = '';
this.selectedRace = data.value; this.selectedRace = data.value;
const electronAPI = (window as any).electronAPI;
if (electronAPI) {
electronAPI.syncSelectedRace(this.selectedRace);
}
this.updateEnabledHorseNumbers(); this.updateEnabledHorseNumbers();
} }
if (data.type === 'selectedVenue') { if (data.type === 'selectedVenue') {