{{-- Text Viewer Component Variables: - $content: The text content to display - $url: The URL of the file (optional, for download link) - $item: The FileSystemItem model (optional) --}} @php $content = $content ?? null; $url = $url ?? null; $item = $item ?? null; $extension = $item ? strtolower(pathinfo($item->name, PATHINFO_EXTENSION)) : ''; // Map extensions to language hints for potential syntax highlighting $languageMap = [ 'php' => 'php', 'js' => 'javascript', 'ts' => 'typescript', 'jsx' => 'jsx', 'tsx' => 'tsx', 'json' => 'json', 'xml' => 'xml', 'html' => 'html', 'css' => 'css', 'py' => 'python', 'rb' => 'ruby', 'java' => 'java', 'c' => 'c', 'cpp' => 'cpp', 'go' => 'go', 'rs' => 'rust', 'sql' => 'sql', 'sh' => 'bash', 'bash' => 'bash', 'yml' => 'yaml', 'yaml' => 'yaml', 'md' => 'markdown', ]; $language = $languageMap[$extension] ?? 'plaintext'; @endphp
{{ $item?->name ?? 'Text file' }} {{ $extension }}
{{ $content }}