From 99e2e8e812ff4e53a51c35eb522e96ce0d86bdab Mon Sep 17 00:00:00 2001 From: yts20031209 <703987939@qq.com> Date: Fri, 17 Apr 2026 18:33:40 +0800 Subject: [PATCH] feat: improve category search feedback --- public/locales/en/translation.json | 4 + public/locales/zh/translation.json | 4 + src/pages/tools-by-category/index.tsx | 122 ++++++++++++++++---------- 3 files changed, 82 insertions(+), 48 deletions(-) diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 71f10e6..3ef9a70 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -231,6 +231,10 @@ "toolLayout": { "allToolsTitle": "All {{type}}" }, + "toolsByCategory": { + "noResultsTitle": "No tools found", + "noResultsDescription": "Try adjusting your search or filter criteria" + }, "toolMultiFileResult": { "copied": "File copied", "copyFailed": "Failed to copy: {{error}}", diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json index 085d983..efed7f7 100644 --- a/public/locales/zh/translation.json +++ b/public/locales/zh/translation.json @@ -223,6 +223,10 @@ "toolLayout": { "allToolsTitle": "全部 {{type}}" }, + "toolsByCategory": { + "noResultsTitle": "未找到工具", + "noResultsDescription": "请尝试调整搜索条件或筛选条件" + }, "toolMultiFileResult": { "copied": "文件已复制", "copyFailed": "复制失败: {{error}}", diff --git a/src/pages/tools-by-category/index.tsx b/src/pages/tools-by-category/index.tsx index 436311c..1b3eb63 100644 --- a/src/pages/tools-by-category/index.tsx +++ b/src/pages/tools-by-category/index.tsx @@ -88,7 +88,8 @@ export default function ToolsByCategory() { , sx: { @@ -113,53 +114,78 @@ export default function ToolsByCategory() { onUserTypesChange={setSelectedUserTypes} /> - - {categoryTools.map((tool, index) => ( - - navigate('/' + tool.path)} - direction={'row'} - alignItems={'center'} - spacing={2} - padding={2} - border={`1px solid ${theme.palette.background.default}`} - borderRadius={2} - > - - - - {/*@ts-ignore*/} - {t(tool.name)} - - - {/*@ts-ignore*/} - {t(tool.shortDescription)} - - - - - ))} - + {categoryTools.length > 0 ? ( + + {categoryTools.map((tool, index) => ( + + navigate('/' + tool.path)} + direction={'row'} + alignItems={'center'} + spacing={2} + padding={2} + border={`1px solid ${theme.palette.background.default}`} + borderRadius={2} + > + + + + {/*@ts-ignore*/} + {t(tool.name)} + + + {/*@ts-ignore*/} + {t(tool.shortDescription)} + + + + + ))} + + ) : ( + + + + {t('translation:toolsByCategory.noResultsTitle')} + + + {t('translation:toolsByCategory.noResultsDescription')} + + + )} );