feat(docs-ui): shared FileIcon + signed-state pill on EntityFolderView rows
- Extract FileIcon mapping to `src/components/files/file-icon.tsx` (single source of truth for mime→icon+colour palette; was previously inline in FileGrid only). - EntityFolderView file rows now render the type-specific icon (PDF/red, Image/blue, Sheet/green, Video/purple) instead of a generic FileText — multi-deal clients become scannable at a glance. - Add an inline "Signed" pill on rows where signedFromDocumentId is set so reps can distinguish a signed-from-workflow copy from a vanilla upload without hovering for "View signing details". - Tighter hover treatment (row picks up a subtle bg on hover) for affordance. - FileGrid refactored to consume the shared FileIcon so both surfaces stay in lockstep on future mime additions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,10 @@
|
||||
'use client';
|
||||
|
||||
import {
|
||||
Download,
|
||||
FileText,
|
||||
Film,
|
||||
Image,
|
||||
MoreHorizontal,
|
||||
Pencil,
|
||||
Sheet,
|
||||
Trash2,
|
||||
} from 'lucide-react';
|
||||
import { Download, FileText, MoreHorizontal, Pencil, Trash2 } from 'lucide-react';
|
||||
import { format } from 'date-fns';
|
||||
|
||||
import { FileIcon as SharedFileIcon } from './file-icon';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DropdownMenu,
|
||||
@@ -56,19 +49,7 @@ function formatBytes(bytes: string | null): string {
|
||||
}
|
||||
|
||||
function FileIcon({ mimeType }: { mimeType: string | null }) {
|
||||
if (!mimeType) return <FileText className="h-8 w-8 text-muted-foreground" />;
|
||||
// eslint-disable-next-line jsx-a11y/alt-text
|
||||
if (mimeType.startsWith('image/')) return <Image className="h-8 w-8 text-blue-500" />;
|
||||
if (mimeType === 'application/pdf') return <FileText className="h-8 w-8 text-red-500" />;
|
||||
if (
|
||||
mimeType === 'application/vnd.ms-excel' ||
|
||||
mimeType === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
|
||||
mimeType === 'text/csv'
|
||||
) {
|
||||
return <Sheet className="h-8 w-8 text-green-600" />;
|
||||
}
|
||||
if (mimeType.startsWith('video/')) return <Film className="h-8 w-8 text-purple-500" />;
|
||||
return <FileText className="h-8 w-8 text-muted-foreground" />;
|
||||
return <SharedFileIcon mimeType={mimeType} className="h-8 w-8" />;
|
||||
}
|
||||
|
||||
export function FileGrid({
|
||||
|
||||
Reference in New Issue
Block a user