From 2b9b5530f33cdeee4d1d5cbccf2ccaa7615b1cee Mon Sep 17 00:00:00 2001 From: viown <48097677+viown@users.noreply.github.com> Date: Fri, 27 Jun 2025 01:54:09 +0300 Subject: [PATCH] Apply review feedback --- .../features/plugins/components/PluginCard.tsx | 2 +- .../features/plugins/constants/categoryLabels.ts | 2 +- src/apps/dashboard/routes/plugins/catalog.tsx | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/apps/dashboard/features/plugins/components/PluginCard.tsx b/src/apps/dashboard/features/plugins/components/PluginCard.tsx index 5ea7eef539..3c9d26bcaf 100644 --- a/src/apps/dashboard/features/plugins/components/PluginCard.tsx +++ b/src/apps/dashboard/features/plugins/components/PluginCard.tsx @@ -47,7 +47,7 @@ const PluginCard = ({ plugin, configurationPage }: IProps) => { const navigateToPluginSettings = useCallback(() => { navigate(pluginPage); - }, [ navigate, location, configurationPage ]); + }, [ navigate, pluginPage ]); const onEnablePlugin = useCallback(() => { if (plugin.Id && plugin.Version) { diff --git a/src/apps/dashboard/features/plugins/constants/categoryLabels.ts b/src/apps/dashboard/features/plugins/constants/categoryLabels.ts index 52be2cef75..3cf4604030 100644 --- a/src/apps/dashboard/features/plugins/constants/categoryLabels.ts +++ b/src/apps/dashboard/features/plugins/constants/categoryLabels.ts @@ -1,5 +1,5 @@ /** A mapping of category names used by the plugin repository to translation keys. */ -export const CATEGORY_LABELS = { +export const CATEGORY_LABELS: Record = { Administration: 'HeaderAdmin', Anime: 'Anime', Authentication: 'LabelAuthProvider', // Legacy diff --git a/src/apps/dashboard/routes/plugins/catalog.tsx b/src/apps/dashboard/routes/plugins/catalog.tsx index b2106d8fed..e550963387 100644 --- a/src/apps/dashboard/routes/plugins/catalog.tsx +++ b/src/apps/dashboard/routes/plugins/catalog.tsx @@ -14,6 +14,7 @@ import TextField from '@mui/material/TextField'; import IconButton from '@mui/material/IconButton'; import Settings from '@mui/icons-material/Settings'; import { Link } from 'react-router-dom'; +import { CATEGORY_LABELS } from 'apps/dashboard/features/plugins/constants/categoryLabels'; export const Component = () => { const { data: packages, isPending: isPackagesPending } = usePackages(); @@ -29,6 +30,17 @@ export const Component = () => { setSearchQuery(e.target.value); }, []); + const getCategoryLabel = (category: string) => { + const categoryKey = category.replace(/\s/g, ''); + + if (CATEGORY_LABELS[categoryKey]) { + return globalize.translate(CATEGORY_LABELS[categoryKey]); + } + + console.warn('[AvailablePlugins] unmapped category label', category); + return category; + }; + if (isPackagesPending) { return ; } @@ -62,7 +74,7 @@ export const Component = () => { {packageCategories.map(category => ( - {category} + {getCategoryLabel(category)} {getPackagesByCategory(filteredPackages, category).map(pkg => (