Skip to content

Commit

Permalink
directory listing collapse
Browse files Browse the repository at this point in the history
  • Loading branch information
prasunanand committed Nov 26, 2024
1 parent 9ce55fe commit 9bc6c07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 4 additions & 2 deletions ui/src/ide/sidebar/FileBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const FileItem = ({ content, handleFileClick }: { content: IContent; handleFileC
const iconMap: { [key: string]: string } = {
go: './images/editor/go-icon.svg',
mod: './images/editor/go-icon.svg',
sum: './images/editor/go-icon.svg',
py: './images/editor/py-icon.svg',
ipynb: './images/editor/py-icon.svg',
js: './images/editor/js-icon.svg',
Expand Down Expand Up @@ -150,15 +151,16 @@ const DirectoryItem = ({data, sendDataToParent }) => {
const [text, setText] = useState(data.name);
const [menuPosition, setMenuPosition] = useState<{ xPos: number; yPos: number } | null>(null);
const [isMenuVisible, setIsMenuVisible] = useState(false);
const [isCollapsed, setIsCollapsed] = useState(false);

const handleDirectoryClick = async (path: string) => {
setIsCollapsed(!isCollapsed)
console.log("handleDirectoryClick")
const res = await fetch(BaseApiUrl + '/api/contents?type=notebook&hash=0', {
method: 'POST',
body: JSON.stringify({ path }),
});
const resJson = await res.json();
// sendDataToParent(resJson.name, resJson.path, resJson.type);
setContent(resJson)
};

Expand Down Expand Up @@ -201,7 +203,7 @@ const DirectoryItem = ({data, sendDataToParent }) => {
)}
<ul>
<ul className='file-list list-unstyled'>
{content.content !== null && content.content.map((content, index) => (
{isCollapsed && content.content !== null && content.content.map((content, index) => (
content.type === 'directory' ? (
<DirectoryItem key={index}
sendDataToParent={sendDataToParent}
Expand Down
8 changes: 0 additions & 8 deletions ui/src/ide/terminal/Terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,6 @@ export default function TerminalTab (props) {
}
}

// socketRef.current.onmessage = (event: MessageEvent) => {
// terminal.write(event.data);
// };

// terminal.onData((data: string) => {
// socketRef.current?.send(data);
// });

return () => {
// Clean up on component unmount
socketRef.current?.close()
Expand Down

0 comments on commit 9bc6c07

Please sign in to comment.