From bd6c2e519c62780103a0093f63d1f6b6a5a8c51f Mon Sep 17 00:00:00 2001 From: JzoNg Date: Fri, 22 Nov 2024 09:09:22 +0800 Subject: [PATCH] fix: corner mark --- web/app/components/plugins/card/index.tsx | 9 +++++---- web/app/components/plugins/types.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/web/app/components/plugins/card/index.tsx b/web/app/components/plugins/card/index.tsx index b262727506..2d66e1b872 100644 --- a/web/app/components/plugins/card/index.tsx +++ b/web/app/components/plugins/card/index.tsx @@ -11,6 +11,7 @@ import Placeholder from './base/placeholder' import cn from '@/utils/classnames' import { useGetLanguage } from '@/context/i18n' import { getLanguage } from '@/i18n/language' +import { useCategories } from '../hooks' export type Props = { className?: string @@ -41,9 +42,9 @@ const Card = ({ }: Props) => { const defaultLocale = useGetLanguage() const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale - - const { type, name, org, label, brief, icon, verified } = payload - + const { categoriesMap } = useCategories() + const { type, category, name, org, label, brief, icon, verified } = payload + const cornerMark = type !== 'plugin' ? type : categoriesMap[category].label const getLocalizedText = (obj: Record | undefined) => obj?.[locale] || obj?.['en-US'] || obj?.en_US || '' @@ -59,7 +60,7 @@ const Card = ({ return (
- {!hideCornerMark && } + {!hideCornerMark && } {/* Header */}
diff --git a/web/app/components/plugins/types.ts b/web/app/components/plugins/types.ts index 4bf4f54c66..b300b6b6e4 100644 --- a/web/app/components/plugins/types.ts +++ b/web/app/components/plugins/types.ts @@ -107,7 +107,7 @@ export type PluginDetail = { } export type Plugin = { - type: PluginType + type: 'plugin' | 'bundle' org: string name: string plugin_id: string