-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathpureTreePreviewPanel.tsx
More file actions
44 lines (40 loc) · 1.45 KB
/
pureTreePreviewPanel.tsx
File metadata and controls
44 lines (40 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'use client';
import { useRef } from "react";
import { FileTreeItemComponent } from "@/app/[domain]/browse/components/fileTreeItemComponent";
import { getBrowsePath } from "../../hooks/utils";
import { ScrollArea } from "@/components/ui/scroll-area";
import { useBrowseParams } from "../../hooks/useBrowseParams";
import { useDomain } from "@/hooks/useDomain";
import { FileTreeItem } from "@/features/git";
interface PureTreePreviewPanelProps {
items: FileTreeItem[];
}
export const PureTreePreviewPanel = ({ items }: PureTreePreviewPanelProps) => {
const { repoName, revisionName } = useBrowseParams();
const scrollAreaRef = useRef<HTMLDivElement>(null);
const domain = useDomain();
return (
<ScrollArea
className="flex flex-col p-0.5"
ref={scrollAreaRef}
>
{items.map((item) => (
<FileTreeItemComponent
key={item.path}
node={item}
isActive={false}
depth={0}
isCollapseChevronVisible={false}
parentRef={scrollAreaRef}
href={getBrowsePath({
repoName,
revisionName,
path: item.path,
pathType: item.type === 'tree' ? 'tree' : 'blob',
domain,
})}
/>
))}
</ScrollArea>
)
}