mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-24 23:06:51 +00:00
一些小更新
This commit is contained in:
@@ -4440,18 +4440,23 @@
|
|||||||
|
|
||||||
// 折叠群入口样式
|
// 折叠群入口样式
|
||||||
.session-item.fold-entry {
|
.session-item.fold-entry {
|
||||||
background: var(--card-inner-bg, rgba(0,0,0,0.03));
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: var(--hover-bg, rgba(0,0,0,0.05));
|
||||||
|
}
|
||||||
|
|
||||||
.fold-entry-avatar {
|
.fold-entry-avatar {
|
||||||
width: 48px;
|
width: 48px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background: var(--primary-color, #07c160);
|
background: #fff;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
color: #fff;
|
color: #fa9d3b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.session-name {
|
.session-name {
|
||||||
|
|||||||
@@ -356,18 +356,19 @@ const SessionItem = React.memo(function SessionItem({
|
|||||||
if (isFoldEntry) {
|
if (isFoldEntry) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`session-item fold-entry`}
|
className={`session-item fold-entry ${isActive ? 'active' : ''}`}
|
||||||
onClick={() => onSelect(session)}
|
onClick={() => onSelect(session)}
|
||||||
>
|
>
|
||||||
<div className="fold-entry-avatar">
|
<div className="fold-entry-avatar">
|
||||||
<FolderClosed size={22} />
|
<MessageSquare size={22} />
|
||||||
</div>
|
</div>
|
||||||
<div className="session-info">
|
<div className="session-info">
|
||||||
<div className="session-top">
|
<div className="session-top">
|
||||||
<span className="session-name">折叠的群聊</span>
|
<span className="session-name">折叠的聊天</span>
|
||||||
|
<span className="session-time">{timeText}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="session-bottom">
|
<div className="session-bottom">
|
||||||
<span className="session-summary">{session.summary || ''}</span>
|
<span className="session-summary">{session.summary || '暂无消息'}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2966,10 +2967,51 @@ function ChatPage(props: ChatPageProps) {
|
|||||||
setFilteredSessions([])
|
setFilteredSessions([])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const visible = sessions.filter(s => {
|
|
||||||
|
// 检查是否有折叠的群聊
|
||||||
|
const foldedGroups = sessions.filter(s => s.isFolded && !s.username.toLowerCase().includes('placeholder_foldgroup'))
|
||||||
|
const hasFoldedGroups = foldedGroups.length > 0
|
||||||
|
|
||||||
|
let visible = sessions.filter(s => {
|
||||||
if (s.isFolded && !s.username.toLowerCase().includes('placeholder_foldgroup')) return false
|
if (s.isFolded && !s.username.toLowerCase().includes('placeholder_foldgroup')) return false
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 如果有折叠的群聊,但列表中没有入口,则插入入口
|
||||||
|
if (hasFoldedGroups && !visible.some(s => s.username.toLowerCase().includes('placeholder_foldgroup'))) {
|
||||||
|
// 找到最新的折叠消息
|
||||||
|
const latestFolded = foldedGroups.reduce((latest, current) => {
|
||||||
|
const latestTime = latest.sortTimestamp || latest.lastTimestamp || latest.timestamp
|
||||||
|
const currentTime = current.sortTimestamp || current.lastTimestamp || current.timestamp
|
||||||
|
return currentTime > latestTime ? current : latest
|
||||||
|
})
|
||||||
|
|
||||||
|
const foldEntry: ChatSession = {
|
||||||
|
username: 'placeholder_foldgroup',
|
||||||
|
displayName: '折叠的聊天',
|
||||||
|
summary: `${latestFolded.displayName || latestFolded.username}: ${latestFolded.summary}`,
|
||||||
|
timestamp: latestFolded.timestamp,
|
||||||
|
sortTimestamp: latestFolded.sortTimestamp || latestFolded.lastTimestamp || latestFolded.timestamp,
|
||||||
|
lastTimestamp: latestFolded.lastTimestamp || latestFolded.sortTimestamp || latestFolded.timestamp,
|
||||||
|
unreadCount: foldedGroups.reduce((sum, s) => sum + (s.unreadCount || 0), 0),
|
||||||
|
isMuted: false,
|
||||||
|
isFolded: false,
|
||||||
|
isGroup: true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按时间戳插入到正确位置
|
||||||
|
const foldTime = foldEntry.sortTimestamp || foldEntry.lastTimestamp || foldEntry.timestamp
|
||||||
|
const insertIndex = visible.findIndex(s => {
|
||||||
|
const sTime = s.sortTimestamp || s.lastTimestamp || s.timestamp
|
||||||
|
return sTime < foldTime
|
||||||
|
})
|
||||||
|
if (insertIndex === -1) {
|
||||||
|
visible.push(foldEntry)
|
||||||
|
} else {
|
||||||
|
visible.splice(insertIndex, 0, foldEntry)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!searchKeyword.trim()) {
|
if (!searchKeyword.trim()) {
|
||||||
setFilteredSessions(visible)
|
setFilteredSessions(visible)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user