summaryrefslogtreecommitdiff
path: root/frontend/src/components/store/Store.tsx
diff options
context:
space:
mode:
authorAAGaming <aagaming00@protonmail.com>2022-06-17 18:43:53 -0400
committerGitHub <noreply@github.com>2022-06-17 18:43:53 -0400
commit99b4b939bdd2140aecf19ddb09a59b44e9cd117d (patch)
treed1a4c154101cb43b34c782a310e9c0699c9cf005 /frontend/src/components/store/Store.tsx
parenta95bf94d878f61869895bb22cbff1b4f524c5dca (diff)
downloaddecky-loader-99b4b939bdd2140aecf19ddb09a59b44e9cd117d.tar.gz
decky-loader-99b4b939bdd2140aecf19ddb09a59b44e9cd117d.zip
Implement React-based plugin store (#81)
Co-authored-by: TrainDoctor <11465594+TrainDoctor@users.noreply.github.com> Co-authored-by: WerWolv <werwolv98@gmail.com>
Diffstat (limited to 'frontend/src/components/store/Store.tsx')
-rw-r--r--frontend/src/components/store/Store.tsx55
1 files changed, 55 insertions, 0 deletions
diff --git a/frontend/src/components/store/Store.tsx b/frontend/src/components/store/Store.tsx
new file mode 100644
index 00000000..ebb2bb8e
--- /dev/null
+++ b/frontend/src/components/store/Store.tsx
@@ -0,0 +1,55 @@
+import { SteamSpinner } from 'decky-frontend-lib';
+import { FC, useEffect, useState } from 'react';
+
+import PluginCard from './PluginCard';
+
+export interface StorePlugin {
+ artifact: string;
+ versions: {
+ [version: string]: string;
+ };
+ author: string;
+ description: string;
+ tags: string[];
+}
+
+const StorePage: FC<{}> = () => {
+ const [data, setData] = useState<StorePlugin[] | null>(null);
+
+ useEffect(() => {
+ (async () => {
+ const res = await fetch('https://beta.deckbrew.xyz/get_plugins', { method: 'GET' }).then((r) => r.json());
+ console.log(res);
+ setData(res);
+ })();
+ }, []);
+
+ return (
+ <div
+ style={{
+ marginTop: '40px',
+ height: 'calc( 100% - 40px )',
+ overflowY: 'scroll',
+ }}
+ >
+ <div
+ style={{
+ display: 'flex',
+ flexWrap: 'nowrap',
+ flexDirection: 'column',
+ height: '100%',
+ }}
+ >
+ {data === null ? (
+ <div style={{ height: '100%' }}>
+ <SteamSpinner />
+ </div>
+ ) : (
+ data.map((plugin: StorePlugin) => <PluginCard plugin={plugin} />)
+ )}
+ </div>
+ </div>
+ );
+};
+
+export default StorePage;