-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathApp.titlebar.stories.tsx
More file actions
55 lines (50 loc) · 1.28 KB
/
Copy pathApp.titlebar.stories.tsx
File metadata and controls
55 lines (50 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* Title bar stories - demonstrates title bar layout variants
*/
import React from "react";
import { appMeta, AppWithMocks, type AppStory } from "./meta.js";
import { createMockORPCClient } from "@/browser/stories/mocks/orpc";
export default {
...appMeta,
title: "App/TitleBar",
};
/**
* macOS desktop mode with traffic lights inset.
* Logo is stacked above version to fit in constrained space.
*/
export const MacOSDesktop: AppStory = {
decorators: [
(Story) => {
// Save and restore window.api to prevent leaking to other stories
const originalApiRef = React.useRef(window.api);
window.api = {
platform: "darwin",
versions: {
node: "20.0.0",
chrome: "120.0.0",
electron: "28.0.0",
},
// This function's presence triggers isDesktopMode() → true
getIsRosetta: () => Promise.resolve(false),
};
// Cleanup on unmount
React.useEffect(() => {
const savedApi = originalApiRef.current;
return () => {
window.api = savedApi;
};
}, []);
return <Story />;
},
],
render: () => (
<AppWithMocks
setup={() =>
createMockORPCClient({
projects: new Map(),
workspaces: [],
})
}
/>
),
};