diff --git a/src/components/SearchHistory.tsx b/src/components/SearchHistory.tsx index cd3a501..e8644d2 100644 --- a/src/components/SearchHistory.tsx +++ b/src/components/SearchHistory.tsx @@ -63,9 +63,15 @@ export function SearchHistory({ history, onRestore, onClear }: SearchHistoryProp return badges } + // Popup页面显示上限配置 + const POPUP_MAX_DISPLAY = 50 // popup页面最多显示50条记录 + // 计算要显示的记录数 - const displayCount = showAll ? history.length : 10 + const displayCount = showAll + ? Math.min(history.length, POPUP_MAX_DISPLAY) // 展开时最多显示50条 + : 10 // 默认显示10条 const hasMore = history.length > 10 + const reachedLimit = history.length > POPUP_MAX_DISPLAY // 是否超过popup显示上限 return (
{showAll - ? t('searchHistory.showingAll', { count: history.length }) + ? reachedLimit + ? t('searchHistory.showingLimit', { limit: POPUP_MAX_DISPLAY, total: history.length }) + : t('searchHistory.showingAll', { count: displayCount }) : t('searchHistory.showingRecent', { showing: 10, total: history.length }) }
@@ -149,7 +157,9 @@ export function SearchHistory({ history, onRestore, onClear }: SearchHistoryProp > {showAll ? t('searchHistory.collapse') - : t('searchHistory.expandAll', { count: history.length }) + : reachedLimit + ? t('searchHistory.expandLimit', { limit: POPUP_MAX_DISPLAY }) + : t('searchHistory.expandAll', { count: history.length }) } {!showAll && ( @@ -157,6 +167,22 @@ export function SearchHistory({ history, onRestore, onClear }: SearchHistoryProp {t('searchHistory.viewAllHint')} )} + {/* 当已展开且超过上限时,显示引导到设置页面的提示 */} + {showAll && reachedLimit && ( ++ 💡 {t('searchHistory.viewAllInSettings', { total: history.length })} +
+ +