react: Add Router hook & fix typescript issues (#68)

* add rollup watch command, add pnpm lockfile

* wait for react

* add WIP patcher, window hook, and webpack

* fix typescript, fix React, lint, add pnpm to gitignore

* actually fix react

* show frontend JS errors in console

* cleanup

* Add Router hook

* Remove console.log

* Expose routerHook in createPluginAPI

Co-authored-by: Jonas Dellinger <jonas@dellinger.dev>
This commit is contained in:
AAGaming
2022-05-30 14:26:54 -04:00
committed by GitHub
parent 44776b393e
commit 007860f8f7
9 changed files with 185 additions and 13 deletions
+11 -9
View File
@@ -1,23 +1,25 @@
import { staticClasses, DialogButton } from 'decky-frontend-lib';
import { DialogButton, staticClasses } from 'decky-frontend-lib';
import { VFC } from 'react';
import { FaShoppingBag } from "react-icons/fa";
import { FaShoppingBag } from 'react-icons/fa';
import { useDeckyState } from './DeckyState';
const TitleView: VFC = () => {
const { activePlugin } = useDeckyState();
const openPluginStore = () => fetch("http://127.0.0.1:1337/methods/open_plugin_store", {method: "POST"});
const openPluginStore = () => fetch('http://127.0.0.1:1337/methods/open_plugin_store', { method: 'POST' });
if (activePlugin === null) {
return <div className={staticClasses.Title}>
Decky
<div style={{ position: 'absolute', top: '3px', right: '16px', zIndex: 20 }}>
<DialogButton style={{ minWidth: 0, padding: '10px 12px' }} onClick={openPluginStore}>
return (
<div className={staticClasses.Title}>
Decky
<div style={{ position: 'absolute', top: '3px', right: '16px', zIndex: 20 }}>
<DialogButton style={{ minWidth: 0, padding: '10px 12px' }} onClick={openPluginStore}>
<FaShoppingBag style={{ display: 'block' }} />
</DialogButton>
</DialogButton>
</div>
</div>;
</div>
);
}
return (