mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-04 03:40:33 +08:00
feat(TopicsTab): Allow deletion of inactive topics (#7415)
* fix(主题列表): 修复主题列表项悬停样式和菜单显示条件 调整主题列表项悬停时的背景色过渡效果,并修正菜单显示逻辑,仅在非挂起状态显示 * fix(TopicsTab): 移除话题待处理状态检查 * fix(TopicsTab): 修复删除话题时未检查当前活跃话题的问题
This commit is contained in:
parent
b4c8e42d87
commit
32d6c2e1d8
@ -127,11 +127,13 @@ const Topics: FC<Props> = ({ assistant: _assistant, activeTopic, setActiveTopic
|
|||||||
}
|
}
|
||||||
await modelGenerating()
|
await modelGenerating()
|
||||||
const index = findIndex(assistant.topics, (t) => t.id === topic.id)
|
const index = findIndex(assistant.topics, (t) => t.id === topic.id)
|
||||||
setActiveTopic(assistant.topics[index + 1 === assistant.topics.length ? index - 1 : index + 1])
|
if (topic.id === activeTopic.id) {
|
||||||
|
setActiveTopic(assistant.topics[index + 1 === assistant.topics.length ? index - 1 : index + 1])
|
||||||
|
}
|
||||||
removeTopic(topic)
|
removeTopic(topic)
|
||||||
setDeletingTopicId(null)
|
setDeletingTopicId(null)
|
||||||
},
|
},
|
||||||
[assistant.topics, onClearMessages, removeTopic, setActiveTopic]
|
[activeTopic.id, assistant.topics, onClearMessages, removeTopic, setActiveTopic]
|
||||||
)
|
)
|
||||||
|
|
||||||
const onPinTopic = useCallback(
|
const onPinTopic = useCallback(
|
||||||
@ -471,7 +473,7 @@ const Topics: FC<Props> = ({ assistant: _assistant, activeTopic, setActiveTopic
|
|||||||
<TopicName className={getTopicNameClassName()} title={topicName}>
|
<TopicName className={getTopicNameClassName()} title={topicName}>
|
||||||
{topicName}
|
{topicName}
|
||||||
</TopicName>
|
</TopicName>
|
||||||
{isActive && !topic.pinned && (
|
{!topic.pinned && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
mouseEnterDelay={0.7}
|
mouseEnterDelay={0.7}
|
||||||
@ -548,6 +550,10 @@ const TopicListItem = styled.div`
|
|||||||
}
|
}
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--color-list-item-hover);
|
background-color: var(--color-list-item-hover);
|
||||||
|
transition: background-color 0.1s;
|
||||||
|
.menu {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&.active {
|
&.active {
|
||||||
background-color: var(--color-list-item);
|
background-color: var(--color-list-item);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user