From df99ef5c3d1cb32ea7ea0dfb823c631bc1602fce Mon Sep 17 00:00:00 2001 From: kim Date: Mon, 1 Jul 2024 13:41:03 +0200 Subject: [PATCH] refactor: update --- package.json | 2 +- src/components/file/FileUploader.tsx | 3 +- src/components/item/FolderContent.tsx | 5 +- src/components/main/ItemCard.tsx | 144 -------------------------- yarn.lock | 10 +- 5 files changed, 10 insertions(+), 154 deletions(-) delete mode 100644 src/components/main/ItemCard.tsx diff --git a/package.json b/package.json index 81faab3ce..84a76d805 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "@emotion/styled": "11.11.5", "@graasp/chatbox": "3.1.0", "@graasp/map": "1.16.0", - "@graasp/query-client": "3.14.0", + "@graasp/query-client": "3.15.0", "@graasp/sdk": "4.15.1", "@graasp/translations": "1.31.0", "@graasp/ui": "github:graasp/graasp-ui#dnd-table-1", diff --git a/src/components/file/FileUploader.tsx b/src/components/file/FileUploader.tsx index a988f7bfc..d0ffe6a02 100644 --- a/src/components/file/FileUploader.tsx +++ b/src/components/file/FileUploader.tsx @@ -92,7 +92,8 @@ const FileUploader = ({ onDrop([...e.target.files]); } }} - loading={isLoading && Math.ceil(totalProgress * 100)} + isLoading={isLoading} + uploadProgress={Math.ceil(totalProgress * 100)} multiple onDrop={onDrop} error={error} diff --git a/src/components/item/FolderContent.tsx b/src/components/item/FolderContent.tsx index dd850c594..7826b569f 100644 --- a/src/components/item/FolderContent.tsx +++ b/src/components/item/FolderContent.tsx @@ -86,13 +86,12 @@ const FolderContent = ({ item }: { item: PackedItem }): JSX.Element => { - {mode === ItemLayoutMode.Map && ( + {mode === ItemLayoutMode.Map ? ( <> - )} - {mode !== ItemLayoutMode.Map && ( + ) : ( <> { - const [searchParams] = useSearchParams(); - const NameComponent = ({ - children, - }: PropsWithChildren): JSX.Element => ( - - {children} - - ); - return NameComponent; -}; - -type Props = { - item: PackedItem; - itemsStatuses?: ItemsStatuses; - canMove?: boolean; -}; - -const ItemComponent = ({ - item, - itemsStatuses, - canMove = true, -}: Props): JSX.Element => { - const { id, name } = item; - const { data: thumbnailUrl, isLoading } = hooks.useItemThumbnailUrl({ - id, - size: ThumbnailSize.Medium, - }); - - const alt = name; - const defaultValueComponent = ( - - - - ); - - const linkUrl = - item.type === ItemType.LINK - ? item?.extra?.[ItemType.LINK]?.thumbnails?.[0] - : undefined; - - const ThumbnailComponent = ( - - ); - - const { data: member } = useCurrentUserContext(); - - const canWrite = item.permission - ? PermissionLevelCompare.gte(item.permission, PermissionLevel.Write) - : false; - const canAdmin = item.permission - ? PermissionLevelCompare.gte(item.permission, PermissionLevel.Admin) - : false; - - const Actions = ( - <> - {canWrite && } - {((member && member.id) || itemsStatuses?.[item.id]?.isPublic) && ( - - )} - {member && member.id && } - - ); - // here we use the same component as the table this is why it is instantiated a bit weirdly - const Badges = BadgesCellRenderer({ itemsStatuses }); - - return ( - } - name={item.name} - creator={item.creator?.name} - ItemMenu={ - - } - Thumbnail={ThumbnailComponent} - cardId={buildItemCard(item.id)} - NameWrapper={NameWrapper({ - id: item.id, - style: { - textDecoration: 'none', - color: 'inherit', - }, - })} - /> - ); -}; - -export default ItemComponent; diff --git a/yarn.lock b/yarn.lock index 51d49e81d..6cd6c49f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1536,9 +1536,9 @@ __metadata: languageName: node linkType: hard -"@graasp/query-client@npm:3.14.0": - version: 3.14.0 - resolution: "@graasp/query-client@npm:3.14.0" +"@graasp/query-client@npm:3.15.0": + version: 3.15.0 + resolution: "@graasp/query-client@npm:3.15.0" dependencies: "@tanstack/react-query": "npm:4.36.1" "@tanstack/react-query-devtools": "npm:4.36.1" @@ -1549,7 +1549,7 @@ __metadata: "@graasp/sdk": ^4.0.0 "@graasp/translations": "*" react: ^18.0.0 - checksum: 10/2d47d8de6092572ccc525e54b6d78a7d34095e1da6e44de60a126e13c48b604040e24a372f858583f1cc30a0387992474d3dbb917bead4423cd14df98b26e556 + checksum: 10/4a1c2a745dc924a6857f55e29ecc533593e8335ba9c6daadf46ceb81f88d060c98b62f4d06f41e212e3dab865ac7b752c6d2fc9a2e3b4f8502c6cbf8b3249b76 languageName: node linkType: hard @@ -7545,7 +7545,7 @@ __metadata: "@emotion/styled": "npm:11.11.5" "@graasp/chatbox": "npm:3.1.0" "@graasp/map": "npm:1.16.0" - "@graasp/query-client": "npm:3.14.0" + "@graasp/query-client": "npm:3.15.0" "@graasp/sdk": "npm:4.15.1" "@graasp/translations": "npm:1.31.0" "@graasp/ui": "github:graasp/graasp-ui#dnd-table-1"