diff --git a/src/renderer/src/pages/home/Assistants.tsx b/src/renderer/src/pages/home/Assistants.tsx index a33dadba6e..03d7e83cf8 100644 --- a/src/renderer/src/pages/home/Assistants.tsx +++ b/src/renderer/src/pages/home/Assistants.tsx @@ -25,7 +25,7 @@ const Assistants: FC = ({ activeAssistant, setActiveAssistant, onCreateAs const { assistants, removeAssistant, addAssistant, updateAssistants } = useAssistants() const generating = useAppSelector((state) => state.runtime.generating) const { updateAssistant, removeAllTopics } = useAssistant(activeAssistant.id) - const { toggleShowTopics } = useShowTopics() + const { showTopics, toggleShowTopics } = useShowTopics() const { t } = useTranslation() const onDelete = useCallback( @@ -108,25 +108,22 @@ const Assistants: FC = ({ activeAssistant, setActiveAssistant, onCreateAs return ( - {(assistant) => ( - - onSwitchAssistant(assistant)} - className={assistant.id === activeAssistant?.id ? 'active' : ''}> - {assistant.name || t('chat.default.name')} - { - if (assistant.id === activeAssistant?.id) { - toggleShowTopics() - } - }}> - - - {false && {assistant.topics.length}} - - - )} + {(assistant) => { + const isCurrent = assistant.id === activeAssistant?.id + return ( + + onSwitchAssistant(assistant)} className={isCurrent ? 'active' : ''}> + {assistant.name || t('chat.default.name')} + isCurrent && toggleShowTopics()}> + + + {false && {assistant.topics.length}} + + + ) + }} ) @@ -188,7 +185,6 @@ const ArrowRightButton = styled.div` flex-direction: row; justify-content: center; align-items: center; - transition: all 0.2s ease; width: 24px; height: 24px; min-width: 24px; @@ -203,6 +199,9 @@ const ArrowRightButton = styled.div` &:hover { background-color: var(--color-background); } + &.active { + background-color: var(--color-background); + } ` const TopicCount = styled.div`