Migrate layout

This commit is contained in:
2025-05-18 13:08:03 +02:00
parent a8a525531e
commit 834a7b1e7e
5 changed files with 50 additions and 25 deletions

View File

@@ -0,0 +1,50 @@
import React, { useEffect } from 'react';
import { Box } from '@mantine/core';
import FileActions from '../files/FileActions';
import FileTree from '../files/FileTree';
import { useGitOperations } from '../../hooks/useGitOperations';
import { useWorkspace } from '../../contexts/WorkspaceContext';
import { FileNode } from '@/types/fileApi';
interface SidebarProps {
selectedFile: string | null;
handleFileSelect: (filePath: string | null) => Promise<void>;
files: FileNode[];
loadFileList: () => Promise<void>;
}
const Sidebar: React.FC<SidebarProps> = ({
selectedFile,
handleFileSelect,
files,
loadFileList,
}) => {
const { settings } = useWorkspace();
const { handlePull } = useGitOperations();
useEffect(() => {
loadFileList();
}, [loadFileList]);
return (
<Box
style={{
width: '25%',
minWidth: '200px',
maxWidth: '300px',
borderRight: '1px solid var(--app-shell-border-color)',
height: '100%',
overflow: 'hidden',
}}
>
<FileActions handlePullChanges={handlePull} selectedFile={selectedFile} />
<FileTree
files={files}
handleFileSelect={handleFileSelect}
showHiddenFiles={settings.showHiddenFiles || false}
/>
</Box>
);
};
export default Sidebar;