Skip to content

Commit 3df5ffd

Browse files
authored
Merge branch 'main' into iratings
2 parents 5ce5cbe + dbf940c commit 3df5ffd

File tree

21 files changed

+9164
-42
lines changed

21 files changed

+9164
-42
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ typings/
9292
out/
9393

9494
*storybook.log
95-
test-data/*.png
95+
test-data/**/*.png
9696
test-data/unused
9797
src/**/tracks/*.svg
9898
asset-data

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/bridge/iracingSdk/dumpTelemetry.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ export async function dumpCurrentTelemetry() {
2424
await writeFile(`${dirPath}/session.json`, session, 'utf-8'),
2525
]);
2626
console.log(`Saved to: ${dirPath}`);
27+
return { dirPath };
2728
} else {
2829
console.warn('No telemetry data received');
2930
}
3031
}
32+
33+
return { dirPath: null };
3134
}

src/app/bridge/iracingSdk/mock-data/session.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3426,7 +3426,7 @@
34263426
"CarClassPowerAdjust": "0.000 %",
34273427
"CarClassDryTireSetLimit": "0 %",
34283428
"CarClassColor": 16767577,
3429-
"CarClassEstLapTime": 113.6302,
3429+
"CarClassEstLapTime": 126.6302,
34303430
"IRating": 1367,
34313431
"LicLevel": 15,
34323432
"LicSubLevel": 375,

src/app/irsdk/node/utils/mock-data/session.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3426,7 +3426,7 @@
34263426
"CarClassPowerAdjust": "0.000 %",
34273427
"CarClassDryTireSetLimit": "0 %",
34283428
"CarClassColor": 16767577,
3429-
"CarClassEstLapTime": 113.6302,
3429+
"CarClassEstLapTime": 126.6302,
34303430
"IRating": 1367,
34313431
"LicLevel": 15,
34323432
"LicSubLevel": 375,

src/app/overlayManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class OverlayManager {
6363
title: `iRacing Dashies - ${title}`,
6464
transparent: true,
6565
frame: false,
66-
focusable: false,
66+
focusable: true, //for OpenKneeeboard/VR
6767
resizable: false,
6868
movable: false,
6969
roundedCorners: false,

src/app/setupTaskbar.ts

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { nativeImage, Tray, Menu, app, globalShortcut } from 'electron';
1+
import { nativeImage, Tray, Menu, app, globalShortcut, desktopCapturer } from 'electron';
22
import { TelemetrySink } from './bridge/iracingSdk/telemetrySink';
33
import { OverlayManager } from './overlayManager';
4+
import { writeFile } from 'node:fs/promises';
5+
import path from 'node:path';
46

57
class Taskbar {
68
private tray: Tray;
@@ -65,11 +67,34 @@ class Taskbar {
6567
this.overlayManager.toggleLockOverlays();
6668
}
6769

68-
private saveTelemetry(): void {
69-
if (process.platform === 'darwin') return;
70-
import('./bridge/iracingSdk/dumpTelemetry').then(
71-
async ({ dumpCurrentTelemetry }) => await dumpCurrentTelemetry()
72-
);
70+
private async saveTelemetry(): Promise<void> {
71+
try {
72+
// First, import and call dumpTelemetry to get the directory path
73+
const { dumpCurrentTelemetry } = await import('./bridge/iracingSdk/dumpTelemetry');
74+
const telemetryResult = await dumpCurrentTelemetry();
75+
76+
// Check if dirPath exists and is not null
77+
const dirPath = telemetryResult && 'dirPath' in telemetryResult ? telemetryResult.dirPath : null;
78+
if (dirPath) {
79+
// Capture all screens
80+
const sources = await desktopCapturer.getSources({
81+
types: ['screen'],
82+
thumbnailSize: { width: 1920, height: 1080 } // Use a standard resolution
83+
});
84+
85+
// Save each screen as a separate file
86+
await Promise.all(sources.map(async (source, index) => {
87+
if (source.thumbnail) {
88+
const screenshotPath = path.join(dirPath, `screenshot_${index + 1}.png`);
89+
const pngData = source.thumbnail.toPNG();
90+
await writeFile(screenshotPath, pngData);
91+
console.log(`Screenshot ${index + 1} saved to: ${screenshotPath}`);
92+
}
93+
}));
94+
}
95+
} catch (error) {
96+
console.error('Error capturing screenshots:', error);
97+
}
7398
}
7499

75100
private registerShortcuts(): void {

src/app/storage/defaultDashboard.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,15 @@ export const defaultDashboard: DashboardLayout = {
6969
height: 330,
7070
},
7171
},
72+
{
73+
id: 'fastercarsfrombehind',
74+
enabled: false,
75+
layout: {
76+
x: 700,
77+
y: 200,
78+
width: 400,
79+
height: 40,
80+
},
81+
}
7282
],
7383
};

src/frontend/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Settings } from './components/Settings/Settings';
1414
import { Relative } from './components/Standings/Relative';
1515
import { Weather } from './components/Weather';
1616
import { TrackMap } from './components/TrackMap/TrackMap';
17+
import { FasterCarsFromBehind } from './components/FasterCarsFromBehind/FasterCarsFromBehind';
1718
import { EditMode } from './components/EditMode/EditMode';
1819

1920
// TODO: type this better, right now the config comes from settings
@@ -25,6 +26,7 @@ const WIDGET_MAP: Record<string, (config: any) => React.JSX.Element> = {
2526
settings: Settings,
2627
map: TrackMap,
2728
weather: Weather,
29+
fastercarsfrombehind: FasterCarsFromBehind,
2830
};
2931

3032
const AppRoutes = () => {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Meta, StoryObj } from '@storybook/react';
2+
import { FasterCarsFromBehind } from './FasterCarsFromBehind';
3+
import { TelemetryDecorator } from '../../../../.storybook/telemetryDecorator';
4+
5+
export default {
6+
component: FasterCarsFromBehind,
7+
parameters: {
8+
controls: {
9+
exclude: ['telemetryPath'],
10+
}
11+
}
12+
} as Meta<typeof FasterCarsFromBehind>;
13+
14+
type Story = StoryObj<typeof FasterCarsFromBehind>;
15+
16+
export const Primary: Story = {
17+
decorators: [TelemetryDecorator('/test-data/1747384033336')],
18+
};

0 commit comments

Comments
 (0)