Refactor Settings, FileTree, GitPanel, Shell, and CodeEditor components (#402)

This commit is contained in:
Haileyesus
2026-02-25 19:07:07 +03:00
committed by GitHub
parent 23801e9cc1
commit 5e3a7b69d7
149 changed files with 11627 additions and 8453 deletions

View File

@@ -0,0 +1,74 @@
import { useCallback, useState } from 'react';
import type { Project, ProjectSession } from '../../../types/app';
import Shell from '../../shell/view/Shell';
import StandaloneShellEmptyState from './subcomponents/StandaloneShellEmptyState';
import StandaloneShellHeader from './subcomponents/StandaloneShellHeader';
type StandaloneShellProps = {
project?: Project | null;
session?: ProjectSession | null;
command?: string | null;
isPlainShell?: boolean | null;
autoConnect?: boolean;
onComplete?: ((exitCode: number) => void) | null;
onClose?: (() => void) | null;
title?: string | null;
className?: string;
showHeader?: boolean;
compact?: boolean;
minimal?: boolean;
};
export default function StandaloneShell({
project = null,
session = null,
command = null,
isPlainShell = null,
autoConnect = true,
onComplete = null,
onClose = null,
title = null,
className = '',
showHeader = true,
compact = false,
minimal = false,
}: StandaloneShellProps) {
const [isCompleted, setIsCompleted] = useState(false);
// Keep `compact` in the public API for compatibility with existing callers.
void compact;
const shouldUsePlainShell = isPlainShell !== null ? isPlainShell : command !== null;
const handleProcessComplete = useCallback(
(exitCode: number) => {
setIsCompleted(true);
onComplete?.(exitCode);
},
[onComplete],
);
if (!project) {
return <StandaloneShellEmptyState className={className} />;
}
return (
<div className={`h-full w-full flex flex-col ${className}`}>
{!minimal && showHeader && title && (
<StandaloneShellHeader title={title} isCompleted={isCompleted} onClose={onClose} />
)}
<div className="flex-1 w-full min-h-0">
<Shell
selectedProject={project}
selectedSession={session}
initialCommand={command}
isPlainShell={shouldUsePlainShell}
onProcessComplete={handleProcessComplete}
minimal={minimal}
autoConnect={minimal ? true : autoConnect}
/>
</div>
</div>
);
}