From e7fe41810e80aeed991a262f5b90718fca783051 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Tue, 26 Aug 2025 22:40:32 +0800 Subject: [PATCH] fix: dark mode for plugins management page --- .../plugins/plugin-installed/PluginCardVO.ts | 3 + .../PluginInstalledComponent.tsx | 1 + .../plugin-card/PluginCardComponent.tsx | 12 ++-- .../plugin-market/PluginMarketComponent.tsx | 2 +- .../PluginDetailDialog.tsx | 52 +++++++------- .../PluginMarketCardComponent.tsx | 14 ++-- web/src/i18n/locales/en-US.ts | 1 + web/src/i18n/locales/ja-JP.ts | 1 + web/src/i18n/locales/zh-Hans.ts | 1 + web/src/i18n/locales/zh-Hant.ts | 67 +++++++++++++++++++ 10 files changed, 120 insertions(+), 34 deletions(-) diff --git a/web/src/app/home/plugins/plugin-installed/PluginCardVO.ts b/web/src/app/home/plugins/plugin-installed/PluginCardVO.ts index e230bec4..9712cead 100644 --- a/web/src/app/home/plugins/plugin-installed/PluginCardVO.ts +++ b/web/src/app/home/plugins/plugin-installed/PluginCardVO.ts @@ -2,6 +2,7 @@ import { PluginComponent } from '@/app/infra/entities/plugin'; export interface IPluginCardVO { author: string; + label: string; name: string; description: string; version: string; @@ -16,6 +17,7 @@ export interface IPluginCardVO { export class PluginCardVO implements IPluginCardVO { author: string; + label: string; name: string; description: string; version: string; @@ -29,6 +31,7 @@ export class PluginCardVO implements IPluginCardVO { constructor(prop: IPluginCardVO) { this.author = prop.author; + this.label = prop.label; this.description = prop.description; this.enabled = prop.enabled; this.components = prop.components; diff --git a/web/src/app/home/plugins/plugin-installed/PluginInstalledComponent.tsx b/web/src/app/home/plugins/plugin-installed/PluginInstalledComponent.tsx index 52c49d7a..5581fc7a 100644 --- a/web/src/app/home/plugins/plugin-installed/PluginInstalledComponent.tsx +++ b/web/src/app/home/plugins/plugin-installed/PluginInstalledComponent.tsx @@ -74,6 +74,7 @@ const PluginInstalledComponent = forwardRef( value.plugins.map((plugin) => { return new PluginCardVO({ author: plugin.manifest.manifest.metadata.author ?? '', + label: extractI18nObject(plugin.manifest.manifest.metadata.label), description: extractI18nObject( plugin.manifest.manifest.metadata.description ?? { en_US: '', diff --git a/web/src/app/home/plugins/plugin-installed/plugin-card/PluginCardComponent.tsx b/web/src/app/home/plugins/plugin-installed/plugin-card/PluginCardComponent.tsx index 5772a3f6..a67237b5 100644 --- a/web/src/app/home/plugins/plugin-installed/plugin-card/PluginCardComponent.tsx +++ b/web/src/app/home/plugins/plugin-installed/plugin-card/PluginCardComponent.tsx @@ -83,7 +83,7 @@ export default function PluginCardComponent({ return ( <>
@@ -99,11 +99,13 @@ export default function PluginCardComponent({
-
- {cardVO.author} /{' '} +
+ {cardVO.author} / {cardVO.name}
-
{cardVO.name}
+
+ {cardVO.label} +
v{cardVO.version} @@ -166,7 +168,7 @@ export default function PluginCardComponent({
-
+
{cardVO.description}
diff --git a/web/src/app/home/plugins/plugin-market/PluginMarketComponent.tsx b/web/src/app/home/plugins/plugin-market/PluginMarketComponent.tsx index 27b181b8..dbde8774 100644 --- a/web/src/app/home/plugins/plugin-market/PluginMarketComponent.tsx +++ b/web/src/app/home/plugins/plugin-market/PluginMarketComponent.tsx @@ -341,7 +341,7 @@ function MarketPageContent({ {isLoading ? (
- {t('cloud.loading')} + {t('market.loading')}
) : plugins.length === 0 ? (
diff --git a/web/src/app/home/plugins/plugin-market/plugin-detail-dialog/PluginDetailDialog.tsx b/web/src/app/home/plugins/plugin-market/plugin-detail-dialog/PluginDetailDialog.tsx index 4e9f11f2..83a3994b 100644 --- a/web/src/app/home/plugins/plugin-market/plugin-detail-dialog/PluginDetailDialog.tsx +++ b/web/src/app/home/plugins/plugin-market/plugin-detail-dialog/PluginDetailDialog.tsx @@ -79,11 +79,11 @@ export default function PluginDetailDialog({ return ( - + {isLoading ? (
- {t('cloud.loading')} + {t('market.loading')}
) : plugin ? (
@@ -97,20 +97,20 @@ export default function PluginDetailDialog({ pluginName!, )} alt={plugin.name} - className="w-16 h-16 rounded-xl border bg-gray-50 object-cover flex-shrink-0" + className="w-16 h-16 rounded-xl border bg-gray-50 object-cover flex-shrink-0 dark:bg-[#1f1f22]" />
-

+

{extractI18nObject(plugin.label) || plugin.name}

-
+
{plugin.author} / {plugin.name}
-
+
v{plugin.latest_version} @@ -128,7 +128,7 @@ export default function PluginDetailDialog({ {plugin.repository && ( -

+

{t('market.description')}

-

+

{extractI18nObject(plugin.description) || t('market.noDescription')}

@@ -158,12 +158,16 @@ export default function PluginDetailDialog({ {/* 标签 */} {plugin.tags && plugin.tags.length > 0 && (
-

+

{t('market.tags')}

{plugin.tags.map((tag) => ( - + {tag} ))} @@ -200,7 +204,7 @@ export default function PluginDetailDialog({
- {t('cloud.loading')} + {t('market.loading')}
) : ( @@ -209,54 +213,56 @@ export default function PluginDetailDialog({ components={{ // 自定义样式 h1: ({ children }) => ( -

+

{children}

), h2: ({ children }) => ( -

+

{children}

), h3: ({ children }) => ( -

+

{children}

), p: ({ children }) => ( -

+

{children}

), ul: ({ children }) => ( -
    +
      {children}
    ), ol: ({ children }) => ( -
      +
        {children}
      ), li: ({ children }) => ( -
    1. {children}
    2. +
    3. + {children} +
    4. ), code: ({ children, node }) => { const isInline = node?.children?.length === 1 && node?.children[0]?.type === 'text'; return isInline ? ( - + {children} ) : ( - + {children} ); }, blockquote: ({ children }) => ( -
      +
      {children}
      ), @@ -265,7 +271,7 @@ export default function PluginDetailDialog({ href={href} target="_blank" rel="noopener noreferrer" - className="text-blue-600 hover:text-blue-800 underline" + className="text-blue-600 hover:text-blue-800 underline dark:text-[#29f]" > {children} diff --git a/web/src/app/home/plugins/plugin-market/plugin-market-card/PluginMarketCardComponent.tsx b/web/src/app/home/plugins/plugin-market/plugin-market-card/PluginMarketCardComponent.tsx index f7a621ca..6fb6618b 100644 --- a/web/src/app/home/plugins/plugin-market/plugin-market-card/PluginMarketCardComponent.tsx +++ b/web/src/app/home/plugins/plugin-market/plugin-market-card/PluginMarketCardComponent.tsx @@ -15,7 +15,7 @@ export default function PluginMarketCardComponent({ return (
      @@ -25,13 +25,17 @@ export default function PluginMarketCardComponent({
      -
      {cardVO.pluginId}
      +
      + {cardVO.pluginId} +
      -
      {cardVO.label}
      +
      + {cardVO.label} +
      -
      +
      {cardVO.description}
      @@ -39,7 +43,7 @@ export default function PluginMarketCardComponent({
      {cardVO.githubURL && (