summaryrefslogtreecommitdiff
path: root/frontend/src/components/PluginView.tsx
diff options
context:
space:
mode:
authorJonas Dellinger <jonas@dellinger.dev>2022-05-26 13:30:14 +0200
committerJonas Dellinger <jonas@dellinger.dev>2022-05-26 13:30:14 +0200
commit71dd0ea449469ed38e784b9c73b673eece680446 (patch)
tree15914a2b7979296b8c04cac0e75191eb9f955919 /frontend/src/components/PluginView.tsx
parenta06efc08bc01a4a014d916ff1e219a0f17d0c480 (diff)
parent4b923c1dc70eaa4a3ca58d9e9f3218785b2fe919 (diff)
downloaddecky-loader-71dd0ea449469ed38e784b9c73b673eece680446.tar.gz
decky-loader-71dd0ea449469ed38e784b9c73b673eece680446.zip
Cleanup after merge
Diffstat (limited to 'frontend/src/components/PluginView.tsx')
-rw-r--r--frontend/src/components/PluginView.tsx39
1 files changed, 39 insertions, 0 deletions
diff --git a/frontend/src/components/PluginView.tsx b/frontend/src/components/PluginView.tsx
new file mode 100644
index 00000000..b3640395
--- /dev/null
+++ b/frontend/src/components/PluginView.tsx
@@ -0,0 +1,39 @@
+import { ButtonItem, DialogButton, PanelSection, PanelSectionRow } from 'decky-frontend-lib';
+import { VFC } from 'react';
+import { FaArrowLeft } from 'react-icons/fa';
+
+import { useDeckyState } from './DeckyState';
+
+const PluginView: VFC = () => {
+ const { plugins, activePlugin, setActivePlugin, closeActivePlugin } = useDeckyState();
+
+ if (activePlugin) {
+ return (
+ <div>
+ <div style={{ position: 'absolute', top: '3px', left: '16px', zIndex: 20 }}>
+ <DialogButton style={{ minWidth: 0, padding: '10px 12px' }} onClick={closeActivePlugin}>
+ <FaArrowLeft style={{ display: 'block' }} />
+ </DialogButton>
+ </div>
+ {activePlugin.content}
+ </div>
+ );
+ }
+
+ return (
+ <PanelSection>
+ {plugins.map(({ name, icon }) => (
+ <PanelSectionRow key={name}>
+ <ButtonItem layout="below" onClick={() => setActivePlugin(name)}>
+ <div style={{ display: 'flex', justifyContent: 'space-between' }}>
+ <div>{icon}</div>
+ <div>{name}</div>
+ </div>
+ </ButtonItem>
+ </PanelSectionRow>
+ ))}
+ </PanelSection>
+ );
+};
+
+export default PluginView;