Show diff file paths in a tooltip (#1061)

* fix: add file path titles to diff headers

* Show diff file paths in a tooltip

* Fix workspace layout hydration

* Revert "Fix workspace layout hydration"

This reverts commit 05c89909b70b4724648a2464ea0bfa64e33655cd.
This commit is contained in:
Myriad-Dreamin
2026-05-17 16:02:29 +08:00
committed by GitHub
parent f6afe0d864
commit e379707a68
+10 -1
View File
@@ -842,6 +842,8 @@ const DiffFileHeader = memo(function DiffFileHeader({
return ( return (
<View style={containerStyle} onLayout={handleLayout} testID={testID}> <View style={containerStyle} onLayout={handleLayout} testID={testID}>
<Tooltip delayDuration={300} enabledOnDesktop enabledOnMobile={false}>
<TooltipTrigger asChild>
<Pressable <Pressable
testID={testID ? `${testID}-toggle` : undefined} testID={testID ? `${testID}-toggle` : undefined}
style={fileHeaderPressableStyle} style={fileHeaderPressableStyle}
@@ -856,7 +858,9 @@ const DiffFileHeader = memo(function DiffFileHeader({
{file.path.split("/").pop()} {file.path.split("/").pop()}
</Text> </Text>
<Text style={styles.fileDir} numberOfLines={1}> <Text style={styles.fileDir} numberOfLines={1}>
{file.path.includes("/") ? ` ${file.path.slice(0, file.path.lastIndexOf("/"))}` : ""} {file.path.includes("/")
? ` ${file.path.slice(0, file.path.lastIndexOf("/"))}`
: ""}
</Text> </Text>
{file.isNew && ( {file.isNew && (
<View style={styles.newBadge}> <View style={styles.newBadge}>
@@ -873,6 +877,11 @@ const DiffFileHeader = memo(function DiffFileHeader({
<DiffStat additions={file.additions} deletions={file.deletions} /> <DiffStat additions={file.additions} deletions={file.deletions} />
</View> </View>
</Pressable> </Pressable>
</TooltipTrigger>
<TooltipContent side="bottom" align="start" offset={6} maxWidth={520}>
<Text style={styles.tooltipText}>{file.path}</Text>
</TooltipContent>
</Tooltip>
</View> </View>
); );
}); });