Skip to content

Commit 24fc1d9

Browse files
authored
adds settings page (#10)
1 parent 2b79795 commit 24fc1d9

30 files changed

+637
-90
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Displays a track map with the current position of the cars on track and the trac
152152

153153
We welcome contributions to the IRDashies project! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.
154154

155-
Join our discord here: https://discord.gg/E3KKB6W4
155+
Join our discord here: https://discord.gg/YMAqduF2Ft
156156

157157
## License
158158

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
"productName": "irdashies",
44
"version": "0.0.7",
55
"description": "iRacing Dashboards & Overlays",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/tariknz/irdashies"
9+
},
610
"main": ".vite/build/main.js",
711
"scripts": {
812
"start": "electron-forge start --enable-logging",

src/app/bridge/dashboard/dashboardBridge.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ export async function publishDashboardUpdates(overlayManager: OverlayManager) {
1717
overlayManager.closeOrCreateWindows(dashboard);
1818
overlayManager.publishMessage('dashboardUpdated', dashboard);
1919
});
20+
21+
ipcMain.handle('toggleLockOverlays', () => {
22+
return overlayManager.toggleLockOverlays();
23+
});
2024
}

src/app/bridge/rendererExposeBridge.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@ export function exposeBridge() {
4545
saveDashboard: (value: DashboardLayout) => {
4646
ipcRenderer.send('saveDashboard', value);
4747
},
48+
toggleLockOverlays: () => {
49+
return ipcRenderer.invoke('toggleLockOverlays');
50+
},
4851
} as DashboardBridge);
4952
}

src/frontend/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const AppRoutes = () => {
4646
/>
4747
);
4848
})}
49-
<Route path="/settings" element={<Settings />} />
49+
<Route path="/settings/*" element={<Settings />} />
5050
</Routes>
5151
);
5252
};

src/frontend/components/EditMode/EditMode.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const mockBridge: (editMode: boolean) => DashboardBridge = (editMode) => ({
2525
onEditModeToggled: (callback) => {
2626
callback(editMode);
2727
},
28+
toggleLockOverlays: () => Promise.resolve(true),
2829
});
2930

3031
export const Primary = {
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useDashboard } from '@irdashies/context';
2-
import { SettingsForm } from './SettingsForm';
2+
import { SettingsLayout } from './SettingsLayout';
33

44
export const Settings = () => {
55
const { currentDashboard, onDashboardUpdated } = useDashboard();
@@ -8,9 +8,6 @@ export const Settings = () => {
88
}
99

1010
return (
11-
<SettingsForm
12-
currentDashboard={currentDashboard}
13-
onDashboardUpdated={onDashboardUpdated}
14-
/>
11+
<SettingsLayout />
1512
);
1613
};

src/frontend/components/Settings/SettingsForm.stories.tsx

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/frontend/components/Settings/SettingsForm.tsx

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { Meta, StoryObj } from '@storybook/react';
2+
import { MemoryRouter, Route, Routes } from 'react-router-dom';
3+
import { DashboardProvider } from '@irdashies/context';
4+
import { SettingsLayout } from './SettingsLayout';
5+
import { mockDashboardBridge } from './__mocks__/mockBridge';
6+
7+
interface StoryProps {
8+
initialPath: string;
9+
}
10+
11+
const meta: Meta<typeof SettingsLayout> = {
12+
component: SettingsLayout,
13+
decorators: [
14+
(Story, context) => {
15+
const { initialPath = 'standings' } =
16+
context.args as StoryProps;
17+
return (
18+
<DashboardProvider bridge={mockDashboardBridge}>
19+
<MemoryRouter initialEntries={[initialPath]}>
20+
<Routes>
21+
<Route
22+
path="/settings/*"
23+
element={
24+
<div style={{ height: '100vh' }}>
25+
<Story />
26+
</div>
27+
}
28+
/>
29+
</Routes>
30+
</MemoryRouter>
31+
</DashboardProvider>
32+
);
33+
},
34+
],
35+
};
36+
37+
export default meta;
38+
39+
type Story = StoryObj<typeof SettingsLayout>;
40+
41+
export const Default: Story = {
42+
args: {
43+
initialPath: '/settings/standings',
44+
},
45+
};
46+
47+
// Add more stories for different routes
48+
export const RelativeRoute: Story = {
49+
args: {
50+
initialPath: '/settings/relative',
51+
},
52+
};
53+
54+
export const WeatherRoute: Story = {
55+
args: {
56+
initialPath: '/settings/weather',
57+
},
58+
};

0 commit comments

Comments
 (0)