mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-06 21:35:52 +08:00
style(ui): improve layout and text overflow handling in agent components
- Add max-width to agent name tag in ChatNavbar - Adjust header padding in AgentSettingsPopup - Replace span with Ellipsis component for agent names to handle overflow
This commit is contained in:
parent
cb922b67ad
commit
b8a84f62ac
@ -179,7 +179,7 @@ const SessionWorkspaceMeta: FC<{ agentId: string; sessionId: string }> = ({ agen
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
infoItems.push(<InfoTag key="name" text={agent.name ?? ''} />)
|
infoItems.push(<InfoTag key="name" text={agent.name ?? ''} className="max-w-60" />)
|
||||||
|
|
||||||
if (firstAccessiblePath) {
|
if (firstAccessiblePath) {
|
||||||
infoItems.push(<InfoTag key="path" text={firstAccessiblePath} className="max-w-60" />)
|
infoItems.push(<InfoTag key="path" text={firstAccessiblePath} className="max-w-60" />)
|
||||||
|
|||||||
@ -114,7 +114,13 @@ const AgentSettingPopupContainer: React.FC<AgentSettingPopupParams> = ({ tab, ag
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column'
|
flexDirection: 'column'
|
||||||
},
|
},
|
||||||
header: { padding: '10px 15px', borderBottom: '0.5px solid var(--color-border)', margin: 0, borderRadius: 0 },
|
header: {
|
||||||
|
padding: '10px 15px',
|
||||||
|
paddingRight: '32px',
|
||||||
|
borderBottom: '0.5px solid var(--color-border)',
|
||||||
|
margin: 0,
|
||||||
|
borderRadius: 0
|
||||||
|
},
|
||||||
body: {
|
body: {
|
||||||
padding: 0,
|
padding: 0,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { Avatar, AvatarProps, cn } from '@heroui/react'
|
import { Avatar, AvatarProps, cn } from '@heroui/react'
|
||||||
|
import Ellipsis from '@renderer/components/Ellipsis'
|
||||||
import EmojiIcon from '@renderer/components/EmojiIcon'
|
import EmojiIcon from '@renderer/components/EmojiIcon'
|
||||||
import { getAgentDefaultAvatar } from '@renderer/config/agent'
|
import { getAgentDefaultAvatar } from '@renderer/config/agent'
|
||||||
import { getAgentTypeLabel } from '@renderer/i18n/label'
|
import { getAgentTypeLabel } from '@renderer/i18n/label'
|
||||||
@ -38,10 +39,12 @@ export const AgentLabel: React.FC<AgentLabelProps> = ({ agent, classNames, avata
|
|||||||
const emoji = isDefault ? undefined : agent?.configuration?.avatar
|
const emoji = isDefault ? undefined : agent?.configuration?.avatar
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn('flex items-center gap-2', classNames?.container)}>
|
<div className={cn('flex w-full items-center gap-2', classNames?.container)}>
|
||||||
{isDefault && <Avatar src={src} {...avatarProps} className={cn('h-6 w-6 text-lg', classNames?.avatar)} />}
|
{isDefault && <Avatar src={src} {...avatarProps} className={cn('h-6 w-6 text-lg', classNames?.avatar)} />}
|
||||||
{!isDefault && <EmojiIcon emoji={emoji || '⭐️'} className={classNames?.avatar} />}
|
{!isDefault && <EmojiIcon emoji={emoji || '⭐️'} className={classNames?.avatar} />}
|
||||||
<span className={classNames?.name}>{agent?.name ?? (agent?.type ? getAgentTypeLabel(agent.type) : '')}</span>
|
<Ellipsis className={classNames?.name}>
|
||||||
|
{agent?.name ?? (agent?.type ? getAgentTypeLabel(agent.type) : '')}
|
||||||
|
</Ellipsis>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user