From 9619c52720c97ef74842b15aa732dd0a8d6fb26a Mon Sep 17 00:00:00 2001 From: AAGaming Date: Wed, 22 Jun 2022 23:22:27 -0400 Subject: add settings page with install from URL option --- frontend/src/components/store/PluginCard.tsx | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 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 7816d1bb..28989a88 100644 --- a/frontend/src/components/store/PluginCard.tsx +++ b/frontend/src/components/store/PluginCard.tsx @@ -2,6 +2,7 @@ import { DialogButton, Dropdown, Focusable, + QuickAccessTab, Router, SingleDropdownOption, SuspensefulImage, @@ -9,7 +10,7 @@ import { } from 'decky-frontend-lib'; import { FC, useRef, useState } from 'react'; -import { StorePlugin } from './Store'; +import { StorePlugin, requestPluginInstall } from './Store'; interface PluginCardProps { plugin: StorePlugin; @@ -19,17 +20,6 @@ const classNames = (...classes: string[]) => { return classes.join(' '); }; -async function requestPluginInstall(plugin: StorePlugin, selectedVer: string) { - const formData = new FormData(); - formData.append('artifact', plugin.artifact); - formData.append('version', selectedVer); - formData.append('hash', plugin.versions[selectedVer]); - await fetch('http://localhost:1337/browser/install_plugin', { - method: 'POST', - body: formData, - }); -} - const PluginCard: FC = ({ plugin }) => { const [selectedOption, setSelectedOption] = useState(0); const buttonRef = useRef(null); @@ -50,9 +40,12 @@ const PluginCard: FC = ({ plugin }) => { buttonRef.current!.focus(); }} onCancel={(e: CustomEvent) => { - containerRef.current!.querySelectorAll('* :focus').length === 0 - ? Router.NavigateBackOrOpenMenu() - : containerRef.current!.focus(); + if (containerRef.current!.querySelectorAll('* :focus').length === 0) { + Router.NavigateBackOrOpenMenu(); + setTimeout(() => Router.OpenQuickAccessMenu(QuickAccessTab.Decky), 1000); + } else { + containerRef.current!.focus(); + } }} style={{ display: 'flex', -- cgit v1.2.3