fix(app): align diff headers with canvas borders
This commit is contained in:
@@ -967,7 +967,7 @@ test("the first click after a canvas selection only dismisses the selection", as
|
|||||||
await expect(page.getByTestId("inline-review-editor")).toBeVisible();
|
await expect(page.getByTestId("inline-review-editor")).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("canvas diff copies exact multiline text forwards and backwards", async ({
|
test("canvas diff replaces a selection with forward and backward drags", async ({
|
||||||
context,
|
context,
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -975,19 +975,13 @@ test("canvas diff copies exact multiline text forwards and backwards", async ({
|
|||||||
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
|
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
|
||||||
await useUnwrappedDiffLines(page);
|
await useUnwrappedDiffLines(page);
|
||||||
await openSelectionWorkspaceChanges(page, workspace);
|
await openSelectionWorkspaceChanges(page, workspace);
|
||||||
for (const [start, end] of [
|
for (const [start, end, expectedText] of [
|
||||||
[
|
[{ line: 0, offset: 2 }, { line: 1, offset: 3 }, "CDE\nFGH"],
|
||||||
{ line: 0, offset: 2 },
|
[{ line: 1, offset: 5 }, { line: 0, offset: 3 }, "DE\nFGHIJ"],
|
||||||
{ line: 1, offset: 3 },
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{ line: 1, offset: 3 },
|
|
||||||
{ line: 0, offset: 2 },
|
|
||||||
],
|
|
||||||
] as const) {
|
] as const) {
|
||||||
await dragAddedTextRange(page, { lines: ["ABCDE", "FGHIJ"], start, end });
|
await dragAddedTextRange(page, { lines: ["ABCDE", "FGHIJ"], start, end });
|
||||||
await page.keyboard.press("ControlOrMeta+C");
|
await page.keyboard.press("ControlOrMeta+C");
|
||||||
await expect.poll(() => page.evaluate(() => navigator.clipboard.readText())).toBe("CDE\nFGH");
|
await expect.poll(() => page.evaluate(() => navigator.clipboard.readText())).toBe(expectedText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ interface DocumentFileHeaderProps {
|
|||||||
mode: DiffDocumentProps["mode"];
|
mode: DiffDocumentProps["mode"];
|
||||||
onToggleFile: (path: string) => void;
|
onToggleFile: (path: string) => void;
|
||||||
onSelectPath: (path: string) => void;
|
onSelectPath: (path: string) => void;
|
||||||
showTopBorder: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DocumentFileHeader = memo(function DocumentFileHeader({
|
export const DocumentFileHeader = memo(function DocumentFileHeader({
|
||||||
@@ -18,7 +17,6 @@ export const DocumentFileHeader = memo(function DocumentFileHeader({
|
|||||||
mode,
|
mode,
|
||||||
onToggleFile,
|
onToggleFile,
|
||||||
onSelectPath,
|
onSelectPath,
|
||||||
showTopBorder,
|
|
||||||
}: DocumentFileHeaderProps) {
|
}: DocumentFileHeaderProps) {
|
||||||
const activate = useCallback(
|
const activate = useCallback(
|
||||||
(path: string) => {
|
(path: string) => {
|
||||||
@@ -35,7 +33,6 @@ export const DocumentFileHeader = memo(function DocumentFileHeader({
|
|||||||
bodyVisible={!file.isCollapsed}
|
bodyVisible={!file.isCollapsed}
|
||||||
isSelected={selectedPath === file.path}
|
isSelected={selectedPath === file.path}
|
||||||
interactive={mode.kind === "working"}
|
interactive={mode.kind === "working"}
|
||||||
showTopBorder={showTopBorder}
|
|
||||||
workspaceFileDragScope={working?.workspaceFileDragScope}
|
workspaceFileDragScope={working?.workspaceFileDragScope}
|
||||||
onActivate={activate}
|
onActivate={activate}
|
||||||
onSelect={onSelectPath}
|
onSelect={onSelectPath}
|
||||||
@@ -82,7 +79,6 @@ function documentFileHeaderIdentityMatches(
|
|||||||
previous.file.file !== next.file.file ||
|
previous.file.file !== next.file.file ||
|
||||||
previous.file.fileIndex !== next.file.fileIndex ||
|
previous.file.fileIndex !== next.file.fileIndex ||
|
||||||
previous.file.isCollapsed !== next.file.isCollapsed ||
|
previous.file.isCollapsed !== next.file.isCollapsed ||
|
||||||
previous.showTopBorder !== next.showTopBorder ||
|
|
||||||
(previous.selectedPath === previous.file.path) !== (next.selectedPath === next.file.path) ||
|
(previous.selectedPath === previous.file.path) !== (next.selectedPath === next.file.path) ||
|
||||||
previous.onToggleFile !== next.onToggleFile ||
|
previous.onToggleFile !== next.onToggleFile ||
|
||||||
previous.onSelectPath !== next.onSelectPath ||
|
previous.onSelectPath !== next.onSelectPath ||
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ export interface FileHeaderProps {
|
|||||||
depth?: number;
|
depth?: number;
|
||||||
showDir?: boolean;
|
showDir?: boolean;
|
||||||
interactive?: boolean;
|
interactive?: boolean;
|
||||||
showTopBorder?: boolean;
|
|
||||||
onActivate?: (path: string) => void;
|
onActivate?: (path: string) => void;
|
||||||
onSelect?: (path: string) => void;
|
onSelect?: (path: string) => void;
|
||||||
onOpenFile?: (path: string) => void;
|
onOpenFile?: (path: string) => void;
|
||||||
@@ -100,9 +99,9 @@ function fileHeaderPressFeedbackStyle(showsBodyState: boolean) {
|
|||||||
return showsBodyState ? styles.documentPressFeedback : workspaceTreeRowStyles.active;
|
return showsBodyState ? styles.documentPressFeedback : workspaceTreeRowStyles.active;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileHeaderContainerStyle(showsBodyState: boolean, showTopBorder: boolean) {
|
function fileHeaderContainerStyle(showsBodyState: boolean) {
|
||||||
if (!showsBodyState) return null;
|
if (!showsBodyState) return null;
|
||||||
return [styles.documentContainer, !showTopBorder && styles.documentContainerWithoutTopBorder];
|
return styles.documentContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileHeaderNameStyle(showsBodyState: boolean, isHovered: boolean) {
|
function fileHeaderNameStyle(showsBodyState: boolean, isHovered: boolean) {
|
||||||
@@ -189,7 +188,6 @@ export const FileHeader = memo(function FileHeader({
|
|||||||
depth = 0,
|
depth = 0,
|
||||||
showDir = true,
|
showDir = true,
|
||||||
interactive = true,
|
interactive = true,
|
||||||
showTopBorder = true,
|
|
||||||
onActivate,
|
onActivate,
|
||||||
onSelect,
|
onSelect,
|
||||||
onHeaderHeightChange,
|
onHeaderHeightChange,
|
||||||
@@ -301,7 +299,7 @@ export const FileHeader = memo(function FileHeader({
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[styles.container, fileHeaderContainerStyle(showsBodyState, showTopBorder)]}
|
style={[styles.container, fileHeaderContainerStyle(showsBodyState)]}
|
||||||
onLayout={interaction.onLayout}
|
onLayout={interaction.onLayout}
|
||||||
onPointerEnter={hover.handlePointerEnter}
|
onPointerEnter={hover.handlePointerEnter}
|
||||||
onPointerLeave={hover.handlePointerLeave}
|
onPointerLeave={hover.handlePointerLeave}
|
||||||
@@ -327,12 +325,9 @@ const styles = StyleSheet.create((theme) => ({
|
|||||||
documentContainer: {
|
documentContainer: {
|
||||||
height: 30,
|
height: 30,
|
||||||
backgroundColor: theme.colors.surface0,
|
backgroundColor: theme.colors.surface0,
|
||||||
borderTopWidth: theme.borderWidth[1],
|
|
||||||
borderTopColor: theme.colors.borderAccent,
|
|
||||||
borderBottomWidth: theme.borderWidth[1],
|
borderBottomWidth: theme.borderWidth[1],
|
||||||
borderBottomColor: theme.colors.borderAccent,
|
borderBottomColor: theme.colors.borderAccent,
|
||||||
},
|
},
|
||||||
documentContainerWithoutTopBorder: { borderTopColor: "transparent" },
|
|
||||||
header: {
|
header: {
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
|||||||
Reference in New Issue
Block a user