2024-07-18 21:07:04 +00:00
|
|
|
import { memo } from 'react';
|
2024-07-24 15:43:32 +00:00
|
|
|
import type { FileMap } from '~/lib/stores/files';
|
|
|
|
import { WORK_DIR } from '~/utils/constants';
|
|
|
|
import { renderLogger } from '~/utils/logger';
|
2024-07-17 18:54:46 +00:00
|
|
|
import { FileTree } from './FileTree';
|
|
|
|
|
2024-07-18 21:07:04 +00:00
|
|
|
interface FileTreePanelProps {
|
|
|
|
files?: FileMap;
|
|
|
|
selectedFile?: string;
|
2024-07-24 14:10:39 +00:00
|
|
|
unsavedFiles?: Set<string>;
|
2024-07-18 21:07:04 +00:00
|
|
|
onFileSelect?: (value?: string) => void;
|
|
|
|
}
|
|
|
|
|
2024-07-24 14:10:39 +00:00
|
|
|
export const FileTreePanel = memo(({ files, unsavedFiles, selectedFile, onFileSelect }: FileTreePanelProps) => {
|
2024-07-18 21:07:04 +00:00
|
|
|
renderLogger.trace('FileTreePanel');
|
|
|
|
|
2024-07-17 18:54:46 +00:00
|
|
|
return (
|
2024-07-26 09:05:53 +00:00
|
|
|
<div className="flex-1 overflow-y-scroll">
|
2024-07-24 14:10:39 +00:00
|
|
|
<FileTree
|
2024-07-26 09:05:53 +00:00
|
|
|
className="h-full"
|
2024-07-24 14:10:39 +00:00
|
|
|
files={files}
|
|
|
|
unsavedFiles={unsavedFiles}
|
|
|
|
rootFolder={WORK_DIR}
|
|
|
|
selectedFile={selectedFile}
|
|
|
|
onFileSelect={onFileSelect}
|
|
|
|
/>
|
2024-07-17 18:54:46 +00:00
|
|
|
</div>
|
|
|
|
);
|
2024-07-18 21:07:04 +00:00
|
|
|
});
|