From 3ebaac6752cb2b13ee5bfb6274cd7ae60b0d6bcb Mon Sep 17 00:00:00 2001 From: EMERALD Date: Thu, 19 Jan 2023 20:00:42 -0600 Subject: Store and plugin installation visual improvements (#343) * Redesign store, add comments for filtering * Improve installation/uninstallation modals * Fix store comment to be easier to fix * Add source code info to about page --- frontend/src/components/store/PluginCard.tsx | 277 +++++++++++++-------------- 1 file changed, 132 insertions(+), 145 deletions(-) (limited to 'frontend/src/components/store/PluginCard.tsx') diff --git a/frontend/src/components/store/PluginCard.tsx b/frontend/src/components/store/PluginCard.tsx index aa5fd1d6..828d3ae9 100644 --- a/frontend/src/components/store/PluginCard.tsx +++ b/frontend/src/components/store/PluginCard.tsx @@ -1,15 +1,12 @@ import { - DialogButton, + ButtonItem, Dropdown, Focusable, - Navigation, - QuickAccessTab, + PanelSectionRow, SingleDropdownOption, SuspensefulImage, - joinClassNames, - staticClasses, } from 'decky-frontend-lib'; -import { FC, useRef, useState } from 'react'; +import { FC, useState } from 'react'; import { StorePlugin, StorePluginVersion, requestPluginInstall } from '../../store'; @@ -19,172 +16,162 @@ interface PluginCardProps { const PluginCard: FC = ({ plugin }) => { const [selectedOption, setSelectedOption] = useState(0); - const buttonRef = useRef(null); - const containerRef = useRef(null); + const root: boolean = plugin.tags.some((tag) => tag === 'root'); + return (
- {/* TODO: abstract this messy focus hackiness into a custom component in lib */} - { - buttonRef.current!.focus(); - }} - onCancel={(_: CustomEvent) => { - if (containerRef.current!.querySelectorAll('* :focus').length === 0) { - Navigation.NavigateBack(); - setTimeout(() => Navigation.OpenQuickAccessMenu(QuickAccessTab.Decky), 1000); - } else { - containerRef.current!.focus(); - } +
+ +
+
-
-
Router.NavigateToExternalWeb('https://github.com/' + plugin.artifact)} - > - {plugin.name} -
-
-
- -
+ + {plugin.author} + + + {plugin.description ? ( + plugin.description + ) : ( + + No description provided. + + )} + + {root && ( + -

- Author: {plugin.author} -

-

This plugin has full access to your Steam Deck.{' '} + - {plugin.description} -

-

- Tags: - {plugin.tags.map((tag: string) => ( - - {tag == 'root' ? 'Requires root' : tag} - - ))} -

-
-
+ deckbrew.xyz/root + + + )}
- -
- requestPluginInstall(plugin.name, plugin.versions[selectedOption])} + + +
- Install - -
-
- ({ - data: index, - label: version.name, - })) as SingleDropdownOption[] - } - strDefaultLabel={'Select a version'} - selectedOption={selectedOption} - onChange={({ data }) => setSelectedOption(data)} - /> -
-
+ requestPluginInstall(plugin.name, plugin.versions[selectedOption])} + > + Install + +
+
+ ({ + data: index, + label: version.name, + })) as SingleDropdownOption[] + } + menuLabel="Plugin Version" + selectedOption={selectedOption} + onChange={({ data }) => setSelectedOption(data)} + /> +
+
+
- +
); }; -- cgit v1.2.3