fix(app): add tooltip with shortcut hint to source control explorer toggle

The git checkout mode explorer button was missing the tooltip that
the non-git and mobile variants already had via HeaderToggleButton.
This commit is contained in:
Mohamed Boudra
2026-03-23 13:25:41 +07:00
parent a6f24508e8
commit 12ea75ab65
@@ -2046,16 +2046,21 @@ function WorkspaceScreenContent({ serverId, workspaceId }: WorkspaceScreenProps)
serverId={normalizedServerId} serverId={normalizedServerId}
cwd={normalizedWorkspaceId} cwd={normalizedWorkspaceId}
/> />
<Tooltip delayDuration={0} enabledOnDesktop enabledOnMobile={false}>
<TooltipTrigger asChild>
<Pressable <Pressable
testID="workspace-explorer-toggle" testID="workspace-explorer-toggle"
onPress={handleToggleExplorer} onPress={handleToggleExplorer}
accessibilityRole="button" accessibilityRole="button"
accessibilityLabel={isExplorerOpen ? "Close explorer" : "Open explorer"} accessibilityLabel={
isExplorerOpen ? "Close explorer" : "Open explorer"
}
accessibilityState={{ expanded: isExplorerOpen }} accessibilityState={{ expanded: isExplorerOpen }}
style={({ hovered, pressed }) => [ style={({ hovered, pressed }) => [
styles.sourceControlButton, styles.sourceControlButton,
workspaceDescriptor?.diffStat && styles.sourceControlButtonWithStats, workspaceDescriptor?.diffStat && styles.sourceControlButtonWithStats,
(hovered || pressed || isExplorerOpen) && styles.sourceControlButtonHovered, (hovered || pressed || isExplorerOpen) &&
styles.sourceControlButtonHovered,
]} ]}
> >
{({ hovered, pressed }) => { {({ hovered, pressed }) => {
@@ -2065,7 +2070,10 @@ function WorkspaceScreenContent({ serverId, workspaceId }: WorkspaceScreenProps)
: theme.colors.foregroundMuted; : theme.colors.foregroundMuted;
return ( return (
<> <>
<SourceControlPanelIcon size={theme.iconSize.md} color={iconColor} /> <SourceControlPanelIcon
size={theme.iconSize.md}
color={iconColor}
/>
{workspaceDescriptor?.diffStat ? ( {workspaceDescriptor?.diffStat ? (
<View style={styles.diffStatRow}> <View style={styles.diffStatRow}>
<Text style={styles.diffStatAdditions}> <Text style={styles.diffStatAdditions}>
@@ -2080,6 +2088,19 @@ function WorkspaceScreenContent({ serverId, workspaceId }: WorkspaceScreenProps)
); );
}} }}
</Pressable> </Pressable>
</TooltipTrigger>
<TooltipContent
testID="workspace-explorer-toggle-tooltip"
side="left"
align="center"
offset={8}
>
<View style={styles.explorerTooltipRow}>
<Text style={styles.explorerTooltipText}>Toggle explorer</Text>
<Shortcut keys={["mod", "E"]} style={styles.explorerTooltipShortcut} />
</View>
</TooltipContent>
</Tooltip>
</> </>
) : null} ) : null}
{!isMobile && !isGitCheckout ? ( {!isMobile && !isGitCheckout ? (
@@ -2347,6 +2368,19 @@ const styles = StyleSheet.create((theme) => ({
backgroundColor: theme.colors.surface3, backgroundColor: theme.colors.surface3,
borderColor: theme.colors.borderAccent, borderColor: theme.colors.borderAccent,
}, },
explorerTooltipRow: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
},
explorerTooltipText: {
fontSize: theme.fontSize.sm,
color: theme.colors.popoverForeground,
},
explorerTooltipShortcut: {
backgroundColor: theme.colors.surface3,
borderColor: theme.colors.borderAccent,
},
mobileTabsRow: { mobileTabsRow: {
backgroundColor: theme.colors.surface0, backgroundColor: theme.colors.surface0,
borderBottomWidth: theme.borderWidth[1], borderBottomWidth: theme.borderWidth[1],