From 010feddf36646fb9695106bd64eab41e47e962fe Mon Sep 17 00:00:00 2001 From: Jonas Dellinger Date: Mon, 29 May 2023 18:29:36 +0200 Subject: Add update all button to plugin list (#466) --- .../settings/pages/plugin_list/index.tsx | 49 +++++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'frontend/src/components/settings') diff --git a/frontend/src/components/settings/pages/plugin_list/index.tsx b/frontend/src/components/settings/pages/plugin_list/index.tsx index d7ff7bd9..ce349393 100644 --- a/frontend/src/components/settings/pages/plugin_list/index.tsx +++ b/frontend/src/components/settings/pages/plugin_list/index.tsx @@ -14,7 +14,12 @@ import { useTranslation } from 'react-i18next'; import { FaDownload, FaEllipsisH, FaRecycle } from 'react-icons/fa'; import { InstallType } from '../../../../plugin'; -import { StorePluginVersion, getPluginList, requestPluginInstall } from '../../../../store'; +import { + StorePluginVersion, + getPluginList, + requestMultiplePluginInstalls, + requestPluginInstall, +} from '../../../../store'; import { useSetting } from '../../../../utils/hooks/useSetting'; import { useDeckyState } from '../../../DeckyState'; @@ -67,9 +72,9 @@ function PluginInteractables(props: { entry: ReorderableEntry }) { onClick={() => requestPluginInstall(pluginName, data?.update as StorePluginVersion, InstallType.UPDATE)} onOKButton={() => requestPluginInstall(pluginName, data?.update as StorePluginVersion, InstallType.UPDATE)} > -
+
{t('PluginListIndex.update_to', { name: data?.update?.name })} - +
) : ( @@ -78,14 +83,22 @@ function PluginInteractables(props: { entry: ReorderableEntry }) { onClick={() => reinstallPlugin(pluginName, data?.version)} onOKButton={() => reinstallPlugin(pluginName, data?.version)} > -
+
{t('PluginListIndex.reinstall')} - +
)} @@ -146,6 +159,30 @@ export default function PluginList() { return ( + {updates && updates.size > 0 && ( + + requestMultiplePluginInstalls( + [...updates.entries()].map(([plugin, selectedVer]) => ({ + installType: InstallType.UPDATE, + plugin, + selectedVer, + })), + ) + } + style={{ + position: 'absolute', + top: '57px', + right: '2.8vw', + width: 'auto', + display: 'flex', + alignItems: 'center', + }} + > + {t('PluginListIndex.update_all', { count: updates.size })} + + + )} entries={pluginEntries} onSave={onSave} interactables={PluginInteractables} /> -- cgit v1.2.3