fix(frontend): update Share interface property from download_count to downloads
All checks were successful
Automated Container Build / build-and-push (push) Successful in 3m25s

This commit is contained in:
Elijah 2026-05-26 14:54:50 -07:00
parent ed3eed6bb7
commit 1f83d57942
21 changed files with 241 additions and 137 deletions

View file

@ -7,6 +7,7 @@ import api from '@/lib/api';
import dynamic from 'next/dynamic';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
import { formatSize, getFileDisplayName } from '@/lib/utils';
const DynamicPdfViewer = dynamic(() => import('./PdfViewer'), { ssr: false });
@ -21,11 +22,7 @@ interface FilePreviewProps {
downloadToken?: string;
}
function getFileDisplayName(name: string) {
const dotIndex = name.lastIndexOf('.');
if (dotIndex > 0) return name.substring(0, dotIndex);
return name;
}
// getFileDisplayName imported from utils
export default function FilePreview({ file, onClose, downloadToken }: FilePreviewProps) {
const [content, setContent] = useState<string | null>(null);
@ -264,11 +261,6 @@ function getIcon(type: PreviewType) {
}
}
function formatSize(bytes: number): string {
if (bytes === 0) return '0 B';
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(1024));
return `${(bytes / Math.pow(1024, i)).toFixed(1)} ${units[i]}`;
}
// formatSize imported from utils