MCPcopy Create free account
hub / github.com/SuboptimalEng/coding-tutorials / App

Function App

_templates/04-electron-build/src/renderer/App.tsx:16–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14}
15
16function App() {
17 useEffect(() => {
18 applyTheme(baseTheme);
19 }, []);
20
21 const { value } = useAppSelector((state) => state.counter);
22 const dispatch = useAppDispatch();
23
24 window.ipc.on('test', (payload: any) => console.log({ payload }));
25
26 const ipcTest = () => {
27 window.ipc.send('test', { from: 'app.tsx' });
28 };
29
30 return (
31 <div className="App">
32 <header className="App-header ">
33 {/* TODO: Figure out bg opacity. */}
34 <div className="bg-secondary bg-opacity-50 text-text-base flex flex-col place-items-center">
35 <div className="flex">
36 <div
37 onClick={() => applyTheme(baseTheme)}
38 className="border rounded p-2 m-2"
39 >
40 Base theme
41 </div>
42 <div
43 onClick={() => applyTheme(darkTheme)}
44 className="border rounded p-2 m-2"
45 >
46 Dark theme
47 </div>
48 <div onClick={() => ipcTest()} className="border rounded p-2 m-2">
49 IPC
50 </div>
51 </div>
52 <img src={logo} className="App-logo w-60" alt="logo" />
53 <img
54 src="file-protocol://getMediaFile/Users/suboptimaleng/Desktop/abc.jpg"
55 alt="logo"
56 className="w-80"
57 ></img>
58 <video
59 src="file-protocol://getMediaFile/Users/suboptimaleng/Desktop/steve_jobs_demo.mp4"
60 className="w-80"
61 controls
62 ></video>
63 <div className="border rounded p-2 mb-4">Learn React</div>
64 <div className="flex w-full place-items-center justify-center space-x-2 mb-2">
65 <div
66 className="border p-2 rounded"
67 onClick={() => dispatch(decrement())}
68 >
69 -
70 </div>
71 <div>{value}</div>
72 <div
73 className="border p-2 rounded"

Callers

nothing calls this directly

Calls 3

applyThemeFunction · 0.90
useAppDispatchFunction · 0.90
ipcTestFunction · 0.85

Tested by

no test coverage detected