33import { useContent } from './hooks/use-content'
44import { useShikiTheme } from '@/configs/shiki'
55import ShikiHighlighter , { Language } from 'react-shiki'
6- import { useFilesystemNode , useSelectedPath } from './hooks/use-node'
7- import { FileType } from 'e2b'
6+ import { useSelectedPath } from './hooks/use-node'
87import SandboxInspectFrame from './frame'
98import SandboxInspectViewerHeader from './viewer-header'
109import { ScrollArea , ScrollBar } from '@/ui/primitives/scroll-area'
11- import { useFileOperations } from './hooks/use-file'
10+ import { useFile } from './hooks/use-file'
1211
1312export default function SandboxInspectViewer ( ) {
1413 const path = useSelectedPath ( )
@@ -21,19 +20,18 @@ export default function SandboxInspectViewer() {
2120}
2221
2322function SandboxInspectViewerContent ( { path } : { path : string } ) {
24- const node = useFilesystemNode ( path )
25- const { refresh } = useFileOperations ( path )
23+ const { name, isLoading, refresh } = useFile ( path )
2624 const { content } = useContent ( path )
2725 const shikiTheme = useShikiTheme ( )
2826
29- if ( content === undefined || node ?. type !== FileType . FILE ) {
27+ if ( content === undefined ) {
3028 return null
3129 }
3230
33- const hasDot = node . name . includes ( '.' )
34- let language : Language = node . name . split ( '.' ) . pop ( ) ?? 'text'
31+ const hasDot = name . includes ( '.' )
32+ let language : Language = name . split ( '.' ) . pop ( ) ?? 'text'
3533
36- if ( ! hasDot || ( node . name . startsWith ( '.' ) && language ) ) {
34+ if ( ! hasDot || ( name . startsWith ( '.' ) && language ) ) {
3735 language = 'text'
3836 }
3937
@@ -42,9 +40,9 @@ function SandboxInspectViewerContent({ path }: { path: string }) {
4240 className = "max-w-1/2"
4341 header = {
4442 < SandboxInspectViewerHeader
45- name = { node . name }
43+ name = { name }
4644 content = { content }
47- isLoading = { node . isLoading ?? false }
45+ isLoading = { isLoading }
4846 onRefresh = { refresh }
4947 />
5048 }
0 commit comments