import { useMemo } from 'react'
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
Skeleton,
} from '@chakra-ui/react'
import cx from 'classnames'
import FileAPI from '@/client/api/file'
import { Text } from '@/lib'
export type PathProps = {
rootId: string
fileId: string
maxCharacters?: number
onClick?: (fileId: string) => void
}
const Path = ({ rootId, fileId, maxCharacters, onClick }: PathProps) => {
const { data: path, error, isLoading } = FileAPI.useGetPath(fileId)
const hasMore = path && path.length > 3
const shortPath = useMemo(() => {
if (!path) {
return []
}
return hasMore ? path.slice(1).slice(-3) : path.slice(1)
}, [hasMore, path])
return (
<>
{path && !error ? (