diff --git a/web/src/components/ResourceCard.tsx b/web/src/components/ResourceCard.tsx index 1ee9a86f..7b8fd7c9 100644 --- a/web/src/components/ResourceCard.tsx +++ b/web/src/components/ResourceCard.tsx @@ -75,18 +75,15 @@ const ResourceCard = ({ resource, handlecheckClick, handleUncheckClick }: Resour return (
-
+
handleSelectBtnClick()}> - {isSelected ? ( - - ) : ( - - )} + {isSelected ? : }
} actions={ <>
-
+
-
-
{resource.filename}
-
{dayjs(resource.createdTs).locale("en").format("YYYY/MM/DD HH:mm:ss")}
+
+
{resource.filename}
+
{dayjs(resource.createdTs).locale("en").format("YYYY/MM/DD HH:mm:ss")}
); diff --git a/web/src/components/ResourceCover.tsx b/web/src/components/ResourceCover.tsx index a70cb9ef..8a69666f 100644 --- a/web/src/components/ResourceCover.tsx +++ b/web/src/components/ResourceCover.tsx @@ -6,8 +6,31 @@ interface ResourceCoverProps { resource: Resource; } +const getResourceType = (resource: Resource) => { + if (resource.type.startsWith("image")) { + return "image/*"; + } else if (resource.type.startsWith("video")) { + return "video/*"; + } else if (resource.type.startsWith("audio")) { + return "audio/*"; + } else if (resource.type.startsWith("text")) { + return "text/*"; + } else if (resource.type.startsWith("application/epub+zip")) { + 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")) { + return "application/msword"; + } else { + return "application/octet-stream"; + } +}; + const ResourceCover = ({ resource }: ResourceCoverProps) => { - switch (resource.type) { + const resourceType = getResourceType(resource); + switch (resourceType) { case "image/*": return ; case "video/*": diff --git a/web/src/components/ResourceSearchBar.tsx b/web/src/components/ResourceSearchBar.tsx index 6a364f4d..1985d4d9 100644 --- a/web/src/components/ResourceSearchBar.tsx +++ b/web/src/components/ResourceSearchBar.tsx @@ -23,7 +23,7 @@ const ResourceSearchBar = ({ setQuery }: ResourceSearchBarProps) => { ); return ( -
+
{ }; return ( -
+
-

+

{t("common.resources")}

-
-
-
-
- {isVisiable && ( - - )} -
- -
- + )} + + + -
- - - - - } - /> -
+ } + actions={ + <> + + + } + /> +
+
{loadingState.isLoading ? ( -
+

{t("resources.fetching-data")}

) : ( -
+
{resources.length === 0 ? (

{t("resources.no-resources")}

) : (