feat(ui): implement keyword highlighting and improve search experience
All checks were successful
Frontend CI / ota-ios (push) Successful in 1m33s
Frontend CI / ota-android (push) Successful in 1m34s
Frontend CI / build-and-push-web (push) Successful in 2m31s
Frontend CI / build-android-apk (push) Successful in 1h2m56s

- Add keyword highlighting in `PostCard` and `PostContentRenderer` using `HighlightText`.
- Implement smart excerpt logic in `PostCard` to show relevant context around search keywords.
- Update `SearchBar` styles for better visual feedback and consistency.
- Enhance `SearchScreen` with modern tab variants and improved tag styling.
- Add support for updating group descriptions in `GroupInfoScreen` and `GroupService`.
- Refactor various UI components for improved layout stability and typography.
This commit is contained in:
2026-05-07 01:08:58 +08:00
parent 7f606e14dd
commit ea9e51b0b0
8 changed files with 122 additions and 46 deletions

View File

@@ -265,7 +265,7 @@ export const SearchScreen: React.FC<SearchScreenProps> = ({ onBack }) => {
post={post}
onAction={(action) => handlePostAction(post, action)}
variant="list"
features={isMobile ? 'compact' : 'full'}
features="full"
highlightKeyword={currentKeyword}
/>
))}
@@ -288,7 +288,7 @@ export const SearchScreen: React.FC<SearchScreenProps> = ({ onBack }) => {
post={item}
onAction={(action) => handlePostAction(item, action)}
variant="list"
features="compact"
features="full"
highlightKeyword={currentKeyword}
/>
)}
@@ -542,11 +542,12 @@ export const SearchScreen: React.FC<SearchScreenProps> = ({ onBack }) => {
activeIndex={activeIndex}
onTabChange={(index) => {
setActiveIndex(index);
// 如果已经搜索过切换Tab时重新搜索
if (currentKeyword && hasSearched) {
performSearch(currentKeyword);
}
}}
variant="modern"
icons={['file-document-outline', 'account-outline']}
/>
</View>
@@ -571,22 +572,12 @@ function createSearchScreenStyles(colors: AppColors) {
},
searchShell: {
flex: 1,
borderRadius: borderRadius.xl,
backgroundColor: `${colors.primary.main}08`,
paddingHorizontal: spacing.xs,
paddingVertical: spacing.xs,
// 移除阴影效果
shadowColor: 'transparent',
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0,
shadowRadius: 0,
elevation: 0,
},
cancelButton: {
backgroundColor: `${colors.primary.main}14`,
backgroundColor: `${colors.primary.main}12`,
borderRadius: borderRadius.full,
paddingHorizontal: spacing.md,
paddingVertical: spacing.xs,
paddingVertical: spacing.sm,
},
cancelText: {
fontSize: fontSizes.md,
@@ -610,7 +601,7 @@ function createSearchScreenStyles(colors: AppColors) {
marginBottom: spacing.sm,
},
sectionTitle: {
fontWeight: '600',
fontWeight: '700',
color: colors.text.primary,
},
tagContainer: {
@@ -620,13 +611,14 @@ function createSearchScreenStyles(colors: AppColors) {
tag: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: colors.background.paper,
borderRadius: borderRadius.lg,
borderWidth: 1,
borderColor: colors.divider,
backgroundColor: `${colors.primary.main}10`,
borderRadius: borderRadius.full,
borderWidth: 0,
},
tagText: {
marginLeft: spacing.xs,
color: colors.primary.main,
fontWeight: '500',
},
userCard: {
backgroundColor: colors.background.paper,