feat: add title to selection action button in compact mode (#6498)

* feat: add title prototype to selection action button in compact mode

* fix: optimize the display name logic for action buttons in the selection toolbar
This commit is contained in:
shiquda 2025-05-27 12:51:49 +08:00 committed by GitHub
parent 7a255c1b6d
commit 55a5e7c3af

View File

@ -65,8 +65,10 @@ const ActionIcons: FC<{
const renderActionButton = useCallback( const renderActionButton = useCallback(
(action: ActionItem) => { (action: ActionItem) => {
const displayName = action.isBuiltIn ? t(action.name) : action.name
return ( return (
<ActionButton key={action.id} onClick={() => handleAction(action)}> <ActionButton key={action.id} onClick={() => handleAction(action)} title={isCompact ? displayName : undefined}>
<ActionIcon> <ActionIcon>
{action.id === 'copy' ? ( {action.id === 'copy' ? (
renderCopyIcon() renderCopyIcon()
@ -79,9 +81,7 @@ const ActionIcons: FC<{
/> />
)} )}
</ActionIcon> </ActionIcon>
{!isCompact && ( {!isCompact && <ActionTitle className="btn-title">{displayName}</ActionTitle>}
<ActionTitle className="btn-title">{action.isBuiltIn ? t(action.name) : action.name}</ActionTitle>
)}
</ActionButton> </ActionButton>
) )
}, },