feature: button to collapse all folders

This commit is contained in:
Kevin
2025-06-13 10:18:39 -05:00
parent c1e02065bf
commit a5768a06a1
2 changed files with 19 additions and 14 deletions

View File

@ -118,11 +118,11 @@ export const FileExplorer = ({
parentProject, parentProject,
openedRows, openedRows,
selectedRow, selectedRow,
onRowClickCallback onRowClickCallback,
}: { }: {
parentProject: Project, parentProject: Project
openedRows: {[key:string]: boolean}, openedRows: { [key: string]: boolean }
selectedRow: FileEntry | null, selectedRow: FileEntry | null
onRowClickCallback: (file: FileExplorerEntry) => void onRowClickCallback: (file: FileExplorerEntry) => void
}) => { }) => {
// Wrap the FileEntry in a FileExplorerEntry to keep track for more metadata // Wrap the FileEntry in a FileExplorerEntry to keep track for more metadata

View File

@ -1,8 +1,11 @@
import type { Project, FileEntry } from '@src/lib/project' import type { Project, FileEntry } from '@src/lib/project'
import { FileExplorer, constructPath } from '@src/components/Explorer/FileExplorer' import {
import type {FileExplorerEntry} from '@src/components/Explorer/FileExplorer' FileExplorer,
constructPath,
} from '@src/components/Explorer/FileExplorer'
import type { FileExplorerEntry } from '@src/components/Explorer/FileExplorer'
import { FileExplorerHeaderActions } from '@src/components/Explorer/FileExplorerHeaderActions' import { FileExplorerHeaderActions } from '@src/components/Explorer/FileExplorerHeaderActions'
import {useState} from 'react' import { useState } from 'react'
/** /**
* Wrap the header and the tree into a single component * Wrap the header and the tree into a single component
@ -52,18 +55,20 @@ export const ProjectExplorer = ({
console.log('onRefreshExplorer TODO') console.log('onRefreshExplorer TODO')
}} }}
onCollapseExplorer={() => { onCollapseExplorer={() => {
console.log('onCollapseExplorer TODO') setOpenedRows({})
}} }}
></FileExplorerHeaderActions> ></FileExplorerHeaderActions>
</div> </div>
</div> </div>
<div className="h-96 overflow-y-auto overflow-x-hidden"> <div className="h-96 overflow-y-auto overflow-x-hidden">
{project && <FileExplorer {project && (
parentProject={project} <FileExplorer
openedRows={openedRows} parentProject={project}
selectedRow={selectedRow} openedRows={openedRows}
onRowClickCallback={onRowClickCallback} selectedRow={selectedRow}
></FileExplorer>} onRowClickCallback={onRowClickCallback}
></FileExplorer>
)}
</div> </div>
</div> </div>
) )