import { useMemo } from 'react'
import { ScrollView, Text } from 'react-native'
import { MobileSyntaxSegments } from '../components/MobileSyntaxSegments'
import { formatPreviewByteLength } from './mobile-file-preview-request'
import { buildMobileFilePreviewSyntax } from './mobile-file-preview-syntax'
import { filePreviewStyles as styles } from './mobile-file-preview-styles'
export function MobileFilePreviewSourceText({
relativePath,
content,
truncated,
byteLength
}: {
relativePath: string
content: string
truncated?: boolean
byteLength?: number
}) {
const syntax = useMemo(
() => buildMobileFilePreviewSyntax(relativePath, content),
[content, relativePath]
)
return (
{truncated ? (
) : null}
)
}
export function MobileFilePreviewTruncatedNote({ byteLength }: { byteLength: number }) {
return (
Preview truncated. File size: {formatPreviewByteLength(byteLength)}.
)
}