feat: Enhance Assistant and Topic components with title attributes for better accessibility
This commit is contained in:
parent
a68cbe4438
commit
2ab8f325df
@ -108,12 +108,13 @@ const AssistantItem: FC<AssistantItemProps> = ({ assistant, isActive, onSwitch,
|
||||
}, [clickAssistantToShowTopic, onSwitch, assistant, topicPosition])
|
||||
|
||||
const assistantName = assistant.name || t('chat.default.name')
|
||||
const fullAssistantName = assistant.emoji ? `${assistant.emoji} ${assistantName}` : assistantName
|
||||
|
||||
return (
|
||||
<Dropdown menu={{ items: getMenuItems(assistant) }} trigger={['contextMenu']}>
|
||||
<Container onClick={handleSwitch} className={isActive ? 'active' : ''}>
|
||||
<AssistantName className="name">
|
||||
{assistant.emoji ? `${assistant.emoji} ${assistantName}` : assistantName}
|
||||
<AssistantName className="name" title={fullAssistantName}>
|
||||
{fullAssistantName}
|
||||
</AssistantName>
|
||||
{isActive && (
|
||||
<MenuButton onClick={() => EventEmitter.emit(EVENT_NAMES.SWITCH_TOPIC_SIDEBAR)}>
|
||||
|
||||
@ -293,16 +293,21 @@ const Topics: FC<Props> = ({ assistant: _assistant, activeTopic, setActiveTopic
|
||||
<DragableList list={assistant.topics} onUpdate={updateTopics}>
|
||||
{(topic) => {
|
||||
const isActive = topic.id === activeTopic?.id
|
||||
const topicName = topic.name.replace('`', '')
|
||||
const topicPrompt = topic.prompt
|
||||
const fullTopicPrompt = t('common.prompt') + ': ' + topicPrompt
|
||||
return (
|
||||
<Dropdown menu={{ items: getTopicMenuItems(topic) }} trigger={['contextMenu']} key={topic.id}>
|
||||
<TopicListItem
|
||||
className={isActive ? 'active' : ''}
|
||||
onClick={() => onSwitchTopic(topic)}
|
||||
style={{ borderRadius }}>
|
||||
<TopicName className="name">{topic.name.replace('`', '')}</TopicName>
|
||||
{topic.prompt && (
|
||||
<TopicPromptText className="prompt">
|
||||
{t('common.prompt')}: {topic.prompt}
|
||||
<TopicName className="name" title={topicName}>
|
||||
{topicName}
|
||||
</TopicName>
|
||||
{topicPrompt && (
|
||||
<TopicPromptText className="prompt" title={fullTopicPrompt}>
|
||||
{fullTopicPrompt}
|
||||
</TopicPromptText>
|
||||
)}
|
||||
{showTopicTime && (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user