mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-06 21:35:52 +08:00
* fix: ssistant emoji displaying incorrectly in specific situations * chore: remove unuse import * fix: ensure default emoji * fix: remove redundant min-width in AssistantItem and EmojiIcon components; enhance emoji click handling --------- Co-authored-by: 自由的世界人 <3196812536@qq.com>
This commit is contained in:
parent
15f93e53f2
commit
c808b8d2dc
@ -1,4 +1,3 @@
|
|||||||
import { getLeadingEmoji } from '@renderer/utils'
|
|
||||||
import { FC } from 'react'
|
import { FC } from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
|
||||||
@ -8,12 +7,10 @@ interface EmojiIconProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EmojiIcon: FC<EmojiIconProps> = ({ emoji, className }) => {
|
const EmojiIcon: FC<EmojiIconProps> = ({ emoji, className }) => {
|
||||||
const _emoji = getLeadingEmoji(emoji || '⭐️') || '⭐️'
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container className={className}>
|
<Container className={className}>
|
||||||
<EmojiBackground>{_emoji}</EmojiBackground>
|
<EmojiBackground>{emoji || '⭐️'}</EmojiBackground>
|
||||||
{_emoji}
|
{emoji}
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ const EmojiPicker: FC<Props> = ({ onEmojiClick }) => {
|
|||||||
if (ref.current) {
|
if (ref.current) {
|
||||||
ref.current.addEventListener('emoji-click', (event: any) => {
|
ref.current.addEventListener('emoji-click', (event: any) => {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
onEmojiClick(event.detail.emoji.unicode)
|
onEmojiClick(event.detail.unicode || event.detail.emoji.unicode)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, [onEmojiClick])
|
}, [onEmojiClick])
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import AssistantSettingsPopup from '@renderer/pages/settings/AssistantSettings'
|
|||||||
import { getDefaultModel, getDefaultTopic } from '@renderer/services/AssistantService'
|
import { getDefaultModel, getDefaultTopic } from '@renderer/services/AssistantService'
|
||||||
import { EVENT_NAMES, EventEmitter } from '@renderer/services/EventService'
|
import { EVENT_NAMES, EventEmitter } from '@renderer/services/EventService'
|
||||||
import { Assistant, AssistantsSortType } from '@renderer/types'
|
import { Assistant, AssistantsSortType } from '@renderer/types'
|
||||||
import { uuid } from '@renderer/utils'
|
import { getLeadingEmoji, uuid } from '@renderer/utils'
|
||||||
import { hasTopicPendingRequests } from '@renderer/utils/queue'
|
import { hasTopicPendingRequests } from '@renderer/utils/queue'
|
||||||
import { Dropdown, MenuProps } from 'antd'
|
import { Dropdown, MenuProps } from 'antd'
|
||||||
import { omit } from 'lodash'
|
import { omit } from 'lodash'
|
||||||
@ -151,7 +151,7 @@ const AssistantItem: FC<AssistantItemProps> = ({
|
|||||||
) : (
|
) : (
|
||||||
assistantIconType === 'emoji' && (
|
assistantIconType === 'emoji' && (
|
||||||
<EmojiIcon
|
<EmojiIcon
|
||||||
emoji={assistant.emoji || assistantName.slice(0, 1)}
|
emoji={assistant.emoji || getLeadingEmoji(assistantName)}
|
||||||
className={isPending && !isActive ? 'animation-pulse' : ''}
|
className={isPending && !isActive ? 'animation-pulse' : ''}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@ -423,7 +423,6 @@ const MenuButton = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
min-width: 22px;
|
min-width: 22px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
min-width: 22px;
|
|
||||||
min-height: 22px;
|
min-height: 22px;
|
||||||
border-radius: 11px;
|
border-radius: 11px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user