From adf01ed511221706de6e5b384436bfb22ee88386 Mon Sep 17 00:00:00 2001 From: CorrectRoadH Date: Sun, 26 Mar 2023 20:58:02 +0800 Subject: [PATCH] feat: add more resource cover icon (#1413) * stash: file upload * feat: add style button * feat: add style of list * feat: add checkbox for list * feat: support file upload by drag * feat: beautify the ui * feat: support file upload * stash * fix: the resource is incorrectly when upload multiple files * feat: beautify the ui * chore: reduce unused line * stash * chore: deleted unused line * chore: deleted unused line * chore * chore: change the function declare * feat: support to prompt file is too large * feat:drop prompt to cover all element * fix: eslint * fix: the name of i18n * chore: refactor the import deps * feat: beautify the ui * feat: support the style of button * feat: beautify the switch ui * chore: refactor the component * chore: refactor the resource item dropdown * feat: use memo to reduce unused computing in drop * feat: use memo to reduce the calc of resource list * chore:change name * Update web/src/locales/en.json Co-authored-by: boojack * chore: the import of deps * fix: the window size of fecting data * feat: support to save the state of style * remove pnpm-lock * merge main * chore: simpify the statement * fix: delete conflict marker * feat: add i18n for select * feat:support dark mode * eslint * feat: add more file icon * feat: delete the storage of resource style * Update web/src/components/ResourceCover.tsx Co-authored-by: boojack --------- Co-authored-by: boojack --- web/src/components/ResourceCover.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/web/src/components/ResourceCover.tsx b/web/src/components/ResourceCover.tsx index 8a69666f..b7baf475 100644 --- a/web/src/components/ResourceCover.tsx +++ b/web/src/components/ResourceCover.tsx @@ -19,10 +19,14 @@ const getResourceType = (resource: Resource) => { return "application/epub+zip"; } else if (resource.type.startsWith("application/pdf")) { return "application/pdf"; - } else if (resource.type.startsWith("application/vnd.openxmlformats-officedocument.wordprocessingml.document")) { - return "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; - } else if (resource.type.startsWith("application/msword")) { + } else if (resource.type.includes("word")) { return "application/msword"; + } else if (resource.type.includes("excel")) { + return "application/msexcel"; + } else if (resource.type.startsWith("application/zip")) { + return "application/zip"; + } else if (resource.type.startsWith("application/x-java-archive")) { + return "application/x-java-archive"; } else { return "application/octet-stream"; } @@ -43,10 +47,14 @@ const ResourceCover = ({ resource }: ResourceCoverProps) => { return ; case "application/pdf": return ; - case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": - return ; case "application/msword": return ; + case "application/msexcel": + return ; + case "application/zip": + return ; + case "application/x-java-archive": + return ; default: return ; }