aboutsummaryrefslogtreecommitdiff
path: root/apps/web/lib/document-icon.tsx
blob: a0f56e6328fd4c9e4d5aca945b6ede5b561be47d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { MCPIcon } from '@/components/menu';
import { colors } from '@repo/ui/memory-graph/constants';
import {
  GoogleDocs,
  MicrosoftWord,
  NotionDoc,
  GoogleDrive,
  GoogleSheets,
  GoogleSlides,
  PDF,
  OneDrive,
  MicrosoftOneNote,
  MicrosoftPowerpoint,
  MicrosoftExcel,
} from '@ui/assets/icons';
import { FileText } from 'lucide-react';

export const getDocumentIcon = (type: string, className: string, source?: string) => {
  const iconProps = {
    className,
    style: { color: colors.text.muted },
  };

  if(source === "mcp") {
    return <MCPIcon {...iconProps} />;
  }

  switch (type) {
    case 'google_doc':
      return <GoogleDocs {...iconProps} />;
    case 'google_sheet':
      return <GoogleSheets {...iconProps} />;
    case 'google_slide':
      return <GoogleSlides {...iconProps} />;
    case 'google_drive':
      return <GoogleDrive {...iconProps} />;
    case 'notion':
    case 'notion_doc':
      return <NotionDoc {...iconProps} />;
    case 'word':
    case 'microsoft_word':
      return <MicrosoftWord {...iconProps} />;
    case 'excel':
    case 'microsoft_excel':
      return <MicrosoftExcel {...iconProps} />;
    case 'powerpoint':
    case 'microsoft_powerpoint':
      return <MicrosoftPowerpoint {...iconProps} />;
    case 'onenote':
    case 'microsoft_onenote':
      return <MicrosoftOneNote {...iconProps} />;
    case 'onedrive':
      return <OneDrive {...iconProps} />;
    case 'pdf':
      return <PDF {...iconProps} />;
    default:
      return <FileText {...iconProps} />;
  }
};