From 48f23fd7ece857b904b44203bd3b643c6210c9f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Cuesta?= <1827495+alvaro-cuesta@users.noreply.github.com> Date: Fri, 3 Jan 2025 00:24:46 +0100 Subject: [PATCH 1/5] refactor: remove unused classnames --- frontend/src/components/store/PluginCard.tsx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/frontend/src/components/store/PluginCard.tsx b/frontend/src/components/store/PluginCard.tsx index f64abd09..68257b5e 100644 --- a/frontend/src/components/store/PluginCard.tsx +++ b/frontend/src/components/store/PluginCard.tsx @@ -32,7 +32,6 @@ const PluginCard: FC = ({ storePlugin, installedPlugin }) => { return (
= ({ storePlugin, installedPlugin }) => { }} >
= ({ storePlugin, installedPlugin }) => { }} > = ({ storePlugin, installedPlugin }) => { />
= ({ storePlugin, installedPlugin }) => { >
= ({ storePlugin, installedPlugin }) => { {storePlugin.name} = ({ storePlugin, installedPlugin }) => { {storePlugin.author} = ({ storePlugin, installedPlugin }) => { {root && (
= ({ storePlugin, installedPlugin }) => { > {t('PluginCard.plugin_full_access')}{' '} = ({ storePlugin, installedPlugin }) => {
)}
-
+
= ({ storePlugin, installedPlugin }) => { } > {installType === InstallType.UPDATE ? ( @@ -187,7 +177,7 @@ const PluginCard: FC = ({ storePlugin, installedPlugin }) => {
-
+
({ From ebc2f52e3fbbe6e7abe7d8d67e68311df01a6881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Cuesta?= <1827495+alvaro-cuesta@users.noreply.github.com> Date: Fri, 3 Jan 2025 00:43:01 +0100 Subject: [PATCH 2/5] feat: add uninstall button to store --- frontend/src/components/store/PluginCard.tsx | 150 ++++++++++--------- frontend/src/components/store/Store.tsx | 5 - 2 files changed, 78 insertions(+), 77 deletions(-) diff --git a/frontend/src/components/store/PluginCard.tsx b/frontend/src/components/store/PluginCard.tsx index 68257b5e..9fb3c2a1 100644 --- a/frontend/src/components/store/PluginCard.tsx +++ b/frontend/src/components/store/PluginCard.tsx @@ -1,7 +1,7 @@ -import { ButtonItem, Dropdown, Focusable, PanelSectionRow, SingleDropdownOption, SuspensefulImage } from '@decky/ui'; -import { CSSProperties, FC, useState } from 'react'; +import { DialogButton, Dropdown, Focusable, PanelSectionRow, SingleDropdownOption, SuspensefulImage } from '@decky/ui'; +import { FC, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { FaArrowDown, FaArrowUp, FaCheck, FaDownload, FaRecycle } from 'react-icons/fa'; +import { FaArrowDown, FaArrowUp, FaCheck, FaDownload, FaRecycle, FaTrash } from 'react-icons/fa'; import { InstallType, Plugin } from '../../plugin'; import { StorePlugin, requestPluginInstall } from '../../store'; @@ -128,76 +128,82 @@ const PluginCard: FC = ({ storePlugin, installedPlugin }) => {
)}
-
- - -
+ + requestPluginInstall(storePlugin.name, storePlugin.versions[selectedOption], installType)} + > + {installType === InstallType.UPDATE ? ( + <> + {t('PluginCard.plugin_update')} + + ) : installType === InstallType.REINSTALL ? ( + <> + {t('PluginCard.plugin_reinstall')} + + ) : installType === InstallType.DOWNGRADE ? ( + <> + {t('PluginCard.plugin_downgrade')} + + ) : installType === InstallType.OVERWRITE ? ( + <> + {t('PluginCard.plugin_overwrite')} + + ) : ( + // installType === InstallType.INSTALL (also fallback) + <> + {t('PluginCard.plugin_install')} + + )} + + {installedPlugin && installedVersionIndex === selectedOption ? ( + { + DeckyPluginLoader.uninstallPlugin( + installedPlugin.name, + t('PluginLoader.plugin_uninstall.title', { name: installedPlugin.name }), + t('PluginLoader.plugin_uninstall.button'), + t('PluginLoader.plugin_uninstall.desc', { name: installedPlugin.name }), + ); + }} > - - requestPluginInstall(storePlugin.name, storePlugin.versions[selectedOption], installType) - } - > - - {installType === InstallType.UPDATE ? ( - <> - {t('PluginCard.plugin_update')} - - ) : installType === InstallType.REINSTALL ? ( - <> - {t('PluginCard.plugin_reinstall')} - - ) : installType === InstallType.DOWNGRADE ? ( - <> - {t('PluginCard.plugin_downgrade')} - - ) : installType === InstallType.OVERWRITE ? ( - <> - {t('PluginCard.plugin_overwrite')} - - ) : ( - // installType === InstallType.INSTALL (also fallback) - <> - {t('PluginCard.plugin_install')} - - )} - - -
-
- ({ - data: index, - label: ( -
- {version.name} - {installedPlugin && installedVersionIndex === index ? : null} -
- ), - })) as SingleDropdownOption[] - } - menuLabel={t('PluginCard.plugin_version_label') as string} - selectedOption={selectedOption} - onChange={({ data }) => setSelectedOption(data)} - /> -
-
-
-
+ + + ) : null} +
+ ({ + data: index, + label: ( +
+ {version.name} + {installedPlugin && installedVersionIndex === index ? : null} +
+ ), + }), + )} + menuLabel={t('PluginCard.plugin_version_label') as string} + selectedOption={selectedOption} + onChange={({ data }) => setSelectedOption(data)} + /> +
+
+
); diff --git a/frontend/src/components/store/Store.tsx b/frontend/src/components/store/Store.tsx index 3209ba08..4c5d7da8 100644 --- a/frontend/src/components/store/Store.tsx +++ b/frontend/src/components/store/Store.tsx @@ -109,11 +109,6 @@ const BrowseTab: FC<{ setPluginCount: Dispatch> }> return ( <> - {/* This should be used once filtering is added From bb69a9a578abc765104141239c6abf653b547ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Cuesta?= <1827495+alvaro-cuesta@users.noreply.github.com> Date: Fri, 17 Jan 2025 09:39:15 +0100 Subject: [PATCH 3/5] revert(48f23fd7): "refactor: remove unused classnames" Although the classes seemed to be unused, they exist for theme developers. Also add a warning documenting this. --- frontend/src/components/store/PluginCard.tsx | 164 ++++++++++--------- 1 file changed, 91 insertions(+), 73 deletions(-) diff --git a/frontend/src/components/store/PluginCard.tsx b/frontend/src/components/store/PluginCard.tsx index 9fb3c2a1..0d555f19 100644 --- a/frontend/src/components/store/PluginCard.tsx +++ b/frontend/src/components/store/PluginCard.tsx @@ -30,8 +30,10 @@ const PluginCard: FC = ({ storePlugin, installedPlugin }) => { const { t } = useTranslation(); + // IMPORTANT! The `deckyStore*` classes below seem unused but they exist for theme developers return (
= ({ storePlugin, installedPlugin }) => { }} >
= ({ storePlugin, installedPlugin }) => { }} > = ({ storePlugin, installedPlugin }) => { />
= ({ storePlugin, installedPlugin }) => { >
= ({ storePlugin, installedPlugin }) => { {storePlugin.name} = ({ storePlugin, installedPlugin }) => { {storePlugin.author} = ({ storePlugin, installedPlugin }) => { {root && (
= ({ storePlugin, installedPlugin }) => { > {t('PluginCard.plugin_full_access')}{' '} = ({ storePlugin, installedPlugin }) => {
)}
- - - requestPluginInstall(storePlugin.name, storePlugin.versions[selectedOption], installType)} - > - {installType === InstallType.UPDATE ? ( - <> - {t('PluginCard.plugin_update')} - - ) : installType === InstallType.REINSTALL ? ( - <> - {t('PluginCard.plugin_reinstall')} - - ) : installType === InstallType.DOWNGRADE ? ( - <> - {t('PluginCard.plugin_downgrade')} - - ) : installType === InstallType.OVERWRITE ? ( - <> - {t('PluginCard.plugin_overwrite')} - - ) : ( - // installType === InstallType.INSTALL (also fallback) - <> - {t('PluginCard.plugin_install')} - - )} - - {installedPlugin && installedVersionIndex === selectedOption ? ( +
+ + { - DeckyPluginLoader.uninstallPlugin( - installedPlugin.name, - t('PluginLoader.plugin_uninstall.title', { name: installedPlugin.name }), - t('PluginLoader.plugin_uninstall.button'), - t('PluginLoader.plugin_uninstall.desc', { name: installedPlugin.name }), - ); - }} + onClick={() => + requestPluginInstall(storePlugin.name, storePlugin.versions[selectedOption], installType) + } > - + + {installType === InstallType.UPDATE ? ( + <> + {t('PluginCard.plugin_update')} + + ) : installType === InstallType.REINSTALL ? ( + <> + {t('PluginCard.plugin_reinstall')} + + ) : installType === InstallType.DOWNGRADE ? ( + <> + {t('PluginCard.plugin_downgrade')} + + ) : installType === InstallType.OVERWRITE ? ( + <> + {t('PluginCard.plugin_overwrite')} + + ) : ( + // installType === InstallType.INSTALL (also fallback) + <> + {t('PluginCard.plugin_install')} + + )} + - ) : null} -
- ({ - data: index, - label: ( -
- {version.name} - {installedPlugin && installedVersionIndex === index ? : null} -
- ), - }), - )} - menuLabel={t('PluginCard.plugin_version_label') as string} - selectedOption={selectedOption} - onChange={({ data }) => setSelectedOption(data)} - /> -
-
-
+ {installedPlugin && installedVersionIndex === selectedOption ? ( + { + DeckyPluginLoader.uninstallPlugin( + installedPlugin.name, + t('PluginLoader.plugin_uninstall.title', { name: installedPlugin.name }), + t('PluginLoader.plugin_uninstall.button'), + t('PluginLoader.plugin_uninstall.desc', { name: installedPlugin.name }), + ); + }} + > + + + ) : null} +
+ ({ + data: index, + label: ( +
+ {version.name} + {installedPlugin && installedVersionIndex === index ? : null} +
+ ), + }), + )} + menuLabel={t('PluginCard.plugin_version_label') as string} + selectedOption={selectedOption} + onChange={({ data }) => setSelectedOption(data)} + /> +
+ + +
); From 3396928ea3ac297f888dcf5d839619d2b7755316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Cuesta?= <1827495+alvaro-cuesta@users.noreply.github.com> Date: Fri, 17 Jan 2025 10:02:41 +0100 Subject: [PATCH 4/5] revert(partial): restore "deckyStoreCardInstallContainer" Class was removed in ebc2f52e because it seemed no longer needed after removing some styling, but it's actually there for theme developers. --- frontend/src/components/store/PluginCard.tsx | 76 ++++++++++---------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/frontend/src/components/store/PluginCard.tsx b/frontend/src/components/store/PluginCard.tsx index 0d555f19..25446c61 100644 --- a/frontend/src/components/store/PluginCard.tsx +++ b/frontend/src/components/store/PluginCard.tsx @@ -141,44 +141,46 @@ const PluginCard: FC = ({ storePlugin, installedPlugin }) => {
- - requestPluginInstall(storePlugin.name, storePlugin.versions[selectedOption], installType) - } - > - + + requestPluginInstall(storePlugin.name, storePlugin.versions[selectedOption], installType) + } > - {installType === InstallType.UPDATE ? ( - <> - {t('PluginCard.plugin_update')} - - ) : installType === InstallType.REINSTALL ? ( - <> - {t('PluginCard.plugin_reinstall')} - - ) : installType === InstallType.DOWNGRADE ? ( - <> - {t('PluginCard.plugin_downgrade')} - - ) : installType === InstallType.OVERWRITE ? ( - <> - {t('PluginCard.plugin_overwrite')} - - ) : ( - // installType === InstallType.INSTALL (also fallback) - <> - {t('PluginCard.plugin_install')} - - )} - - + + {installType === InstallType.UPDATE ? ( + <> + {t('PluginCard.plugin_update')} + + ) : installType === InstallType.REINSTALL ? ( + <> + {t('PluginCard.plugin_reinstall')} + + ) : installType === InstallType.DOWNGRADE ? ( + <> + {t('PluginCard.plugin_downgrade')} + + ) : installType === InstallType.OVERWRITE ? ( + <> + {t('PluginCard.plugin_overwrite')} + + ) : ( + // installType === InstallType.INSTALL (also fallback) + <> + {t('PluginCard.plugin_install')} + + )} + + +
{installedPlugin && installedVersionIndex === selectedOption ? ( Date: Fri, 17 Jan 2025 10:06:23 +0100 Subject: [PATCH 5/5] chore: remove unneeded formatting change --- frontend/src/components/store/PluginCard.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/frontend/src/components/store/PluginCard.tsx b/frontend/src/components/store/PluginCard.tsx index 25446c61..c01c2b97 100644 --- a/frontend/src/components/store/PluginCard.tsx +++ b/frontend/src/components/store/PluginCard.tsx @@ -149,12 +149,7 @@ const PluginCard: FC = ({ storePlugin, installedPlugin }) => { > {installType === InstallType.UPDATE ? ( <>