From 5fa0d97224505f9e76f4bd649eec902ea07251f9 Mon Sep 17 00:00:00 2001 From: Konv Suu <2583695112@qq.com> Date: Tue, 29 Jul 2025 12:14:01 +0800 Subject: [PATCH] feat(desktop): improve integration settings search with empty states (#4265) --- .../integration/CustomIntegrationSection.tsx | 9 +- .../settings/tabs/integration/index.tsx | 134 ++++++++++-------- 2 files changed, 80 insertions(+), 63 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/CustomIntegrationSection.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/CustomIntegrationSection.tsx index 3e6864158..c176d5263 100644 --- a/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/CustomIntegrationSection.tsx +++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/CustomIntegrationSection.tsx @@ -133,8 +133,13 @@ export const CustomIntegrationSection = memo(({ searchQuery }: CustomIntegration [settings.customIntegration], ) - if (!customIntegrationsMatchesSearch) { - return null + if (settings.enableCustomIntegration && !customIntegrationsMatchesSearch) { + return ( +
+ +

No custom integration found

+
+ ) } return ( diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/index.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/index.tsx index d09acde9c..0260a1f94 100644 --- a/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/index.tsx +++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/index.tsx @@ -401,74 +401,86 @@ export const SettingIntegration = () => { {/* Built-in Integration Section */} -
-
- - - - {filteredCategories.reduce( - (acc, cat) => acc + cat.integrations.filter((i) => i.configured).length, - 0, - )} - /{filteredCategories.reduce((acc, cat) => acc + cat.integrations.length, 0)} configured - -
+ {filteredCategories.length > 0 ? ( + <> +
+
+ + + + {filteredCategories.reduce( + (acc, cat) => acc + cat.integrations.filter((i) => i.configured).length, + 0, + )} + /{filteredCategories.reduce((acc, cat) => acc + cat.integrations.length, 0)}{" "} + configured + +
-
- {filteredCategories.map((category) => ( - - - - {category.icon} - - {category.title as string} - - - {category.integrations.filter((i) => i.configured).length}/ - {category.integrations.length} - -
- } - defaultOpen={shouldDefaultOpen(category)} - className="border-border bg-background rounded-lg border px-4 py-2 shadow-sm" - contentClassName="px-4 pb-4 pt-8" - > -
- {category.integrations.map((integration) => ( -
-
+
+ {filteredCategories.map((category) => ( + + - {integration.icon} + {category.icon} -

{integration.title as string}

-
- {integration.configured && ( - - - {t("integration.status.configured")} + {category.title as string} + + + {category.integrations.filter((i) => i.configured).length}/ + {category.integrations.length} + +
+ } + defaultOpen={shouldDefaultOpen(category)} + className="border-border bg-background rounded-lg border px-4 py-2 shadow-sm" + contentClassName="px-4 pb-4 pt-8" + > +
+ {category.integrations.map((integration) => ( +
+
+ + {integration.icon} - )} - {integration.enabled && ( - - - {t("integration.status.enabled")} - - )} +

{integration.title as string}

+
+ {integration.configured && ( + + + {t("integration.status.configured")} + + )} + {integration.enabled && ( + + + {t("integration.status.enabled")} + + )} +
+
+
+ +
-
-
- -
+ ))}
- ))} -
- - - ))} + + + ))} +
+
+ + ) : ( +
+ +

+ No built-in integration found +

-
+ )}