feat(message): add pinned conversations sorting and unified timeline
Some checks failed
Frontend CI / build-and-push-web (push) Failing after 3m34s
Frontend CI / ota-android (push) Successful in 10m39s
Frontend CI / build-android-apk (push) Successful in 39m33s

Sort conversation list with pinned items first, then by updated_at timestamp.
Also fixes timestamp text alignment by adding lineHeight, textAlignVertical,
and includeFontPadding properties for consistent vertical centering.
This commit is contained in:
lafay
2026-04-25 13:01:09 +08:00
parent f16f001f6c
commit 19054d64b3
2 changed files with 13 additions and 2 deletions

View File

@@ -475,11 +475,16 @@ export const MessageListScreen: React.FC = () => {
};
};
// 合并列表数据
// 合并列表数据:系统消息与普通会话一起按时间排序
const listData: ConversationResponse[] = [
createSystemMessageItem(),
...conversationList,
];
].sort((a, b) => {
const aPinned = a.is_pinned ? 1 : 0;
const bPinned = b.is_pinned ? 1 : 0;
if (aPinned !== bPinned) return bPinned - aPinned;
return new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime();
});
const listConvRef = useRef(new Map<string, ConversationResponse>());
listConvRef.current = new Map(listData.map((c) => [String(c.id), c]));
@@ -981,6 +986,9 @@ function createMessageListStyles(colors: AppColors) {
color: colors.primary.contrast,
fontSize: 11,
fontWeight: '600',
lineHeight: 18,
textAlignVertical: 'center',
includeFontPadding: false,
},
headerRight: {
width: 44,

View File

@@ -265,6 +265,9 @@ function createConversationRowStyles(colors: AppColors) {
color: '#FFFFFF',
fontSize: 12,
fontWeight: '700',
lineHeight: 20,
textAlignVertical: 'center',
includeFontPadding: false,
},
});
}