mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-30 22:31:52 +02:00
Decouple Tree from client app's hotkey system by adding getSelectedItems() to TreeHandle and having callers register hotkeys externally. Extract shared action callbacks to eliminate duplication between hotkey and context menu handlers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
913 B
TypeScript
33 lines
913 B
TypeScript
import classNames from 'classnames';
|
|
import { useAtomValue } from 'jotai';
|
|
import { memo } from 'react';
|
|
import { hoveredParentDepthFamily, isAncestorHoveredFamily } from './atoms';
|
|
|
|
export const TreeIndentGuide = memo(function TreeIndentGuide({
|
|
treeId,
|
|
depth,
|
|
ancestorIds,
|
|
}: {
|
|
treeId: string;
|
|
depth: number;
|
|
ancestorIds: string[];
|
|
}) {
|
|
const parentDepth = useAtomValue(hoveredParentDepthFamily(treeId));
|
|
const isHovered = useAtomValue(isAncestorHoveredFamily({ treeId, ancestorIds }));
|
|
|
|
return (
|
|
<div className="flex">
|
|
{Array.from({ length: depth }).map((_, i) => (
|
|
<div
|
|
// biome-ignore lint/suspicious/noArrayIndexKey: none
|
|
key={i}
|
|
className={classNames(
|
|
'w-[calc(1rem+0.5px)] border-r border-r-text-subtlest',
|
|
!(parentDepth === i + 1 && isHovered) && 'opacity-30',
|
|
)}
|
|
/>
|
|
))}
|
|
</div>
|
|
);
|
|
});
|