дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 17:47:08 +02:00
The split panels' own overflow: auto showed a native scrollbar whenever a fractional panel height left 1px of rounding overflow, so it flickered while the tool window was dragged. The log's panes scroll themselves; their panels now clip instead.
44 рядки
1.5 KiB
TypeScript
44 рядки
1.5 KiB
TypeScript
import type { Commit } from "@/bindings";
|
|
import { type MenuItem } from "@/ui";
|
|
import { type CSSProperties, type ReactNode } from "react";
|
|
import { type LogOptions } from "../logOptions";
|
|
import { updateLogOptions } from "../logStore";
|
|
|
|
export const ROW = 26;
|
|
|
|
export const LANE = 14;
|
|
|
|
/**
|
|
* Style for the log's split panels. Their panes scroll themselves; the panel's own
|
|
* `overflow: auto` showed a scrollbar for sub-pixel overflow while a split was dragged.
|
|
*/
|
|
export const PANE_STYLE: CSSProperties = { overflow: "hidden" };
|
|
|
|
export interface LogColumn {
|
|
id: string;
|
|
title: string;
|
|
width: number;
|
|
render(commit: Commit): ReactNode;
|
|
}
|
|
|
|
// The flexible "Commit" column shares the same order and can be dragged like the rest.
|
|
export const SUBJECT_COLUMN: LogColumn = { id: "subject", title: "Commit", width: 0, render: () => "" };
|
|
|
|
// Until the user drags the commit column somewhere, it leads the row.
|
|
export const columnSequence = (columnOrder: string[], builtins: LogColumn[]): string[] => {
|
|
const ids = [...new Set([...columnOrder, ...builtins.map((c) => c.id)])];
|
|
return columnOrder.includes(SUBJECT_COLUMN.id) ? ids : [SUBJECT_COLUMN.id, ...ids];
|
|
};
|
|
|
|
export type RowEvents = {
|
|
onHover: (edge: string | null) => void;
|
|
onFragment: (from: string, target: string, expand: boolean) => void;
|
|
onNavigate: (index: number, key?: string) => void;
|
|
};
|
|
|
|
export const toggle = (label: string, o: LogOptions, key: keyof LogOptions): MenuItem => ({
|
|
label,
|
|
checked: !!o[key],
|
|
run: () => updateLogOptions({ [key]: !o[key] }),
|
|
});
|