fix(agent): replace tailwind classes with custom css for avatar hover overlay

main
sp mac bookpro 2605 2026-05-25 19:28:20 +08:00
parent 150a0b5a3a
commit 109d9cc779
2 changed files with 38 additions and 4 deletions

View File

@ -330,10 +330,21 @@ export default function AgentEditor() {
> >
<div style={{ display: 'flex', alignItems: 'center', gap: 14 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 14 }}>
<div <div
className="rounded-full flex items-center justify-center text-2xl text-white font-bold shadow-md cursor-pointer overflow-hidden group relative" className="avatar-container"
style={{ style={{
width: 72, width: 72,
height: 72, height: 72,
borderRadius: '50%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: '24px',
color: 'white',
fontWeight: 'bold',
boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',
cursor: 'pointer',
overflow: 'hidden',
position: 'relative',
background: isImageUrl(agent?.avatar || selectedAvatar) ? '#f3f4f6' : agent?.avatar || selectedAvatar, background: isImageUrl(agent?.avatar || selectedAvatar) ? '#f3f4f6' : agent?.avatar || selectedAvatar,
border: '3px solid rgba(255,255,255,0.92)', border: '3px solid rgba(255,255,255,0.92)',
}} }}
@ -342,14 +353,14 @@ export default function AgentEditor() {
{isImageUrl(agent?.avatar || selectedAvatar) ? ( {isImageUrl(agent?.avatar || selectedAvatar) ? (
<img <img
src={agent?.avatar || selectedAvatar} src={agent?.avatar || selectedAvatar}
className="w-full h-full object-cover" style={{ width: '100%', height: '100%', objectFit: 'cover' }}
alt="avatar" alt="avatar"
/> />
) : ( ) : (
(agentName?.charAt(0) || '?').toUpperCase() (agentName?.charAt(0) || '?').toUpperCase()
)} )}
<div className="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity"> <div className="avatar-overlay">
<span className="text-[10px] text-white font-medium drop-shadow-md"></span> <span className="avatar-overlay-text"></span>
</div> </div>
</div> </div>
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0 }}>

View File

@ -959,3 +959,26 @@ body {
border-color: var(--color-border); border-color: var(--color-border);
color: var(--color-text-secondary); color: var(--color-text-secondary);
} }
/* Avatar Hover Overlay */
.avatar-overlay {
position: absolute;
inset: 0;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
display: flex;
align-items: center;
justify-content: center;
transition: opacity 0.2s ease-in-out;
}
.avatar-container:hover .avatar-overlay {
opacity: 1;
}
.avatar-overlay-text {
font-size: 10px;
color: white;
font-weight: 500;
text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}