From c2ebc78836cafc96f03546e6dba5acfa86795d65 Mon Sep 17 00:00:00 2001 From: Andrew Moore Date: Wed, 14 Feb 2024 23:45:55 -0500 Subject: [Feature] Freeze updates for devs (#582) --- .../settings/pages/plugin_list/PluginListLabel.tsx | 22 +++++++++++++--- .../settings/pages/plugin_list/index.tsx | 30 ++++++++++++++++++---- 2 files changed, 44 insertions(+), 8 deletions(-) (limited to 'frontend/src/components/settings/pages/plugin_list') diff --git a/frontend/src/components/settings/pages/plugin_list/PluginListLabel.tsx b/frontend/src/components/settings/pages/plugin_list/PluginListLabel.tsx index a49f808f..fec03e56 100644 --- a/frontend/src/components/settings/pages/plugin_list/PluginListLabel.tsx +++ b/frontend/src/components/settings/pages/plugin_list/PluginListLabel.tsx @@ -1,18 +1,34 @@ import { FC } from 'react'; import { useTranslation } from 'react-i18next'; -import { FaEyeSlash } from 'react-icons/fa'; +import { FaEyeSlash, FaLock } from 'react-icons/fa'; interface PluginListLabelProps { + frozen: boolean; hidden: boolean; name: string; version?: string; } -const PluginListLabel: FC = ({ name, hidden, version }) => { +const PluginListLabel: FC = ({ name, frozen, hidden, version }) => { const { t } = useTranslation(); return (
-
{version ? `${name} - ${version}` : name}
+
+ {name} + {version && ( + <> + {' - '} + + {frozen && ( + <> + {' '} + + )} + {version} + + + )} +
{hidden && (
('loader/reload_plugin'); @@ -45,7 +54,7 @@ function PluginInteractables(props: { entry: ReorderableEntry } return null; } - const { name, update, version, onHide, onShow, hidden } = props.entry.data; + const { name, update, version, onHide, onShow, hidden, onFreeze, onUnfreeze, frozen, isDeveloper } = props.entry.data; const showCtxMenu = (e: MouseEvent | GamepadEvent) => { showContextMenu( @@ -80,6 +89,11 @@ function PluginInteractables(props: { entry: ReorderableEntry } ) : ( {t('PluginListIndex.hide')} )} + {frozen ? ( + {t('PluginListIndex.unfreeze')} + ) : ( + isDeveloper && {t('PluginListIndex.freeze')} + )} , e.currentTarget ?? window, ); @@ -134,8 +148,8 @@ type PluginData = { version?: string; }; -export default function PluginList() { - const { plugins, updates, pluginOrder, setPluginOrder, hiddenPlugins } = useDeckyState(); +export default function PluginList({ isDeveloper }: { isDeveloper: boolean }) { + const { plugins, updates, pluginOrder, setPluginOrder, frozenPlugins, hiddenPlugins } = useDeckyState(); const [_, setPluginOrderSetting] = useSetting( 'pluginOrder', plugins.map((plugin) => plugin.name), @@ -148,20 +162,26 @@ export default function PluginList() { const [pluginEntries, setPluginEntries] = useState[]>([]); const hiddenPluginsService = DeckyPluginLoader.hiddenPluginsService; + const frozenPluginsService = DeckyPluginLoader.frozenPluginsService; useEffect(() => { setPluginEntries( plugins.map(({ name, version }) => { + const frozen = frozenPlugins.includes(name); const hidden = hiddenPlugins.includes(name); return { - label: