Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default function App() {
[pathOf],
);

const handleTreeSelect = useCallback(
const handleTreeActivate = useCallback(
(row: Row) => {
select(row.id);
if (row.isDir) {
Expand Down Expand Up @@ -203,10 +203,7 @@ export default function App() {
[generation, select],
);

const handleTreeKeySelect = useCallback(
(row: Row) => select(row.id),
[select],
);
const handleTreeSelect = useCallback((row: Row) => select(row.id), [select]);

// Only a pure `ext:` filter is treated as the active type list; other queries start fresh.
const { filter } = scan;
Expand Down Expand Up @@ -422,7 +419,7 @@ export default function App() {
onRevealed={handleRevealed}
onToggle={scan.toggleExpand}
onSelect={handleTreeSelect}
onKeySelect={handleTreeKeySelect}
onActivate={handleTreeActivate}
onHoverRow={setHoveredId}
onContext={handleContextMenu}
onSort={scan.changeSort}
Expand Down
15 changes: 10 additions & 5 deletions ui/src/components/TreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ interface TreeRowProps {
hoveredId: number | null;
onToggle: (id: number) => void;
onSelect: (row: Row) => void;
onActivate: (row: Row) => void;
onHoverRow: (id: number | null) => void;
onContext: (id: number, x: number, y: number) => void;
}
Expand All @@ -142,6 +143,7 @@ function TreeRow({
hoveredId,
onToggle,
onSelect,
onActivate,
onHoverRow,
onContext,
}: RowComponentProps<TreeRowProps>) {
Expand All @@ -162,6 +164,7 @@ function TreeRow({
onClick={() => onSelect(row)}
onDoubleClick={() => {
if (row.isDir && row.hasChildren) onToggle(row.id);
onActivate(row);
}}
onContextMenu={(e) => {
e.preventDefault();
Expand Down Expand Up @@ -308,9 +311,10 @@ export interface TreeViewProps {
revealId: number | null;
onRevealed: () => void;
onToggle: (id: number) => void;
/** Click and arrow keys: select only, the treemap stays where it is. */
onSelect: (row: Row) => void;
/** Arrow-key selection: select only — Enter (onSelect) moves the view. */
onKeySelect: (row: Row) => void;
/** Enter and double-click: move the treemap to the row. */
onActivate: (row: Row) => void;
onHoverRow: (id: number | null) => void;
onContext: (id: number, x: number, y: number) => void;
onSort: (key: SortKey) => void;
Expand All @@ -328,7 +332,7 @@ export function TreeView({
onRevealed,
onToggle,
onSelect,
onKeySelect,
onActivate,
onHoverRow,
onContext,
onSort,
Expand Down Expand Up @@ -359,7 +363,7 @@ export function TreeView({
const action = navAction(e.key, flat, selectedIndex, expanded);
if (!action) return;
if (action.kind === "step") {
onKeySelect(flat[action.index].row);
onSelect(flat[action.index].row);
listRef.current?.scrollToRow({
index: action.index,
align: "smart",
Expand All @@ -368,7 +372,7 @@ export function TreeView({
} else if (action.kind === "toggle") {
onToggle(action.id);
} else {
onSelect(action.row);
onActivate(action.row);
}
};

Expand All @@ -393,6 +397,7 @@ export function TreeView({
hoveredId,
onToggle,
onSelect,
onActivate,
onHoverRow,
onContext,
}}
Expand Down
Loading