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