mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
31190b967b
GitOrigin-RevId: 3043d1369ed85b38b1fec7479385b123a304c05b
13 lines
475 B
TypeScript
13 lines
475 B
TypeScript
import { useMemo } from 'react'
|
|
import useScopeValue from '../../../shared/hooks/use-scope-value'
|
|
import { File, FileOrDirectory, filterFolders } from '../utils/file'
|
|
|
|
export const useCurrentProjectFolders: () => [
|
|
File[] | undefined,
|
|
File
|
|
] = () => {
|
|
const [rootFolder] = useScopeValue<FileOrDirectory>('rootFolder')
|
|
const rootFile = { ...rootFolder, path: '' }
|
|
const folders = useMemo(() => filterFolders(rootFolder), [rootFolder])
|
|
return [folders, rootFile]
|
|
}
|