MCPcopy Create free account
hub / github.com/apitable/apitable / renderFileIconUrl

Function renderFileIconUrl

packages/datasheet/src/pc/utils/file_type.ts:141–177  ·  view source on GitHub ↗
(curFile: IFileLikeProps)

Source from the content-addressed store, hash-verified

139}
140
141export function renderFileIconUrl(curFile: IFileLikeProps) {
142 const type = isWhatFileType({ name: curFile.name, type: curFile.type });
143 switch (type) {
144 case FileType.Image: {
145 return IconImg;
146 }
147 case FileType.Media: {
148 return IconAudio;
149 }
150 case FileType.Doc: {
151 const docType = isDocType(curFile);
152 if (docType === DocType.Word) {
153 return IconWord;
154 }
155 if (docType === DocType.Excel) {
156 return IconExcel;
157 }
158 if (docType === DocType.PPT) {
159 return IconPpt;
160 }
161 return IconOther;
162 }
163 case FileType.Pdf: {
164 return IconPdf;
165 }
166 case FileType.Zip: {
167 return IconZip;
168 }
169 case FileType.Txt: {
170 return IconTxt;
171 }
172 case FileType.Other:
173 default: {
174 return IconOther;
175 }
176 }
177}
178
179export const imageSizeExceeded = (size: number) => {
180 if (getEnvVariables().IGNORE_IMG_SIZE_LIMIT) {

Callers 6

preview_type.tsxFile · 0.90
PreviewImageFunction · 0.90
renderIconFunction · 0.90
renderCellAttachmentMethod · 0.90
getImageSrcFunction · 0.90
getCellValueThumbSrcFunction · 0.70

Calls 2

isWhatFileTypeFunction · 0.70
isDocTypeFunction · 0.70

Tested by

no test coverage detected