From 133b47446ad2d4962f6171a4a16c68c06bbaf681 Mon Sep 17 00:00:00 2001 From: Alexandre Chau Date: Wed, 5 Jul 2023 17:23:44 +0200 Subject: [PATCH] feat: add published tab --- package.json | 3 +- src/components/main/ItemsTable.tsx | 3 +- src/components/main/PublishedItems.tsx | 49 +++++++++++++++++++++++--- src/config/selectors.ts | 2 ++ yarn.lock | 20 +++++++---- 5 files changed, 63 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 9ff5fe425..e9019360b 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,8 @@ "nth-check": "2.1.1", "react-error-overlay": "6.0.11", "@types/react": "17.0.62", - "@svgr/webpack": "8.0.1" + "@svgr/webpack": "8.0.1", + "@graasp/translations": "portal:/home/momochan/dev/graasp/graasp-translations" }, "packageManager": "yarn@3.6.0" } diff --git a/src/components/main/ItemsTable.tsx b/src/components/main/ItemsTable.tsx index b85e83e68..8f7714ceb 100644 --- a/src/components/main/ItemsTable.tsx +++ b/src/components/main/ItemsTable.tsx @@ -16,7 +16,6 @@ import { ItemRecord, ResultOfRecord } from '@graasp/sdk/frontend'; import { BUILDER, COMMON } from '@graasp/translations'; import { Table as GraaspTable } from '@graasp/ui/dist/table'; -import { ITEMS_TABLE_CONTAINER_HEIGHT } from '../../config/constants'; import i18n, { useBuilderTranslation, useCommonTranslation, @@ -273,7 +272,7 @@ const ItemsTable = ({ { + const { t: translateBuilder } = useBuilderTranslation(); + const { + data: sharedItems, + isLoading, + isError, + } = hooks.usePublishedItemsForMember(member.id); -interface Props {} + if (isError) { + return ; + } + + if (isLoading) { + return ; + } -const PublishedItems = ({}: Props): JSX.Element => { return (
- {} +
); }; +const PublishedItems = (): JSX.Element => { + const { data: member, isError } = useCurrentUserContext(); + + if (!member || isError) { + return ; + } + + return ; +}; + export default PublishedItems; diff --git a/src/config/selectors.ts b/src/config/selectors.ts index e5f5c6d77..ec005fe57 100644 --- a/src/config/selectors.ts +++ b/src/config/selectors.ts @@ -45,6 +45,7 @@ export const DELETE_MEMBER_BUTTON_ID = 'deleteMemberButton'; export const MODE_GRID_BUTTON_ID = 'modeCardButton'; export const SHARED_ITEMS_ID = 'sharedItems'; +export const PUBLISHED_ITEMS_ID = 'publishedItems'; export const FAVORITE_ITEMS_ID = 'favoriteItems'; export const RECYCLED_ITEMS_ID = 'recycledItems'; export const OWNED_ITEMS_ID = 'ownedItems'; @@ -88,6 +89,7 @@ export const ITEM_LOGIN_SIGN_IN_MODE_ID = 'itemLoginSignInMode'; export const ITEM_MAIN_CLASS = 'itemMain'; export const HOME_ERROR_ALERT_ID = 'homeErrorAlert'; export const SHARED_ITEMS_ERROR_ALERT_ID = 'sharedItemsErrorAlert'; +export const PUBLISHED_ITEMS_ERROR_ALERT_ID = 'publishedItemsErrorAlert'; export const FAVORITE_ITEMS_ERROR_ALERT_ID = 'favoriteItemsErrorAlert'; export const ITEM_MENU_SHORTCUT_BUTTON_CLASS = 'itemMenuShortcutButton'; export const ITEM_MENU_FAVORITE_BUTTON_CLASS = 'itemMenuFavoriteButton'; diff --git a/yarn.lock b/yarn.lock index 4b3ff8392..400114702 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3834,7 +3834,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.14.5, @babel/runtime@npm:^7.15.4, @babel/runtime@npm:^7.16.3, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.6, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.3.4, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.6.2, @babel/runtime@npm:^7.7.2, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7, @babel/runtime@npm:^7.9.2": +"@babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.14.5, @babel/runtime@npm:^7.15.4, @babel/runtime@npm:^7.16.3, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.3.4, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.6.2, @babel/runtime@npm:^7.7.2, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7, @babel/runtime@npm:^7.9.2": version: 7.22.3 resolution: "@babel/runtime@npm:7.22.3" dependencies: @@ -3843,6 +3843,15 @@ __metadata: languageName: node linkType: hard +"@babel/runtime@npm:^7.20.6": + version: 7.22.6 + resolution: "@babel/runtime@npm:7.22.6" + dependencies: + regenerator-runtime: ^0.13.11 + checksum: e585338287c4514a713babf4fdb8fc2a67adcebab3e7723a739fc62c79cfda875b314c90fd25f827afb150d781af97bc16c85bfdbfa2889f06053879a1ddb597 + languageName: node + linkType: hard + "@babel/template@npm:^7.18.10, @babel/template@npm:^7.20.7, @babel/template@npm:^7.21.9, @babel/template@npm:^7.3.3": version: 7.21.9 resolution: "@babel/template@npm:7.21.9" @@ -4768,14 +4777,13 @@ __metadata: languageName: node linkType: hard -"@graasp/translations@npm:1.15.0": - version: 1.15.0 - resolution: "@graasp/translations@npm:1.15.0" +"@graasp/translations@portal:/home/momochan/dev/graasp/graasp-translations::locator=graasp-builder%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@graasp/translations@portal:/home/momochan/dev/graasp/graasp-translations::locator=graasp-builder%40workspace%3A." dependencies: i18next: 22.4.15 - checksum: e073b83374462f2d108f1d697b7aa14460d05f4ec2e10757db0e0a0a72574bff4721f997851d8e88e871f3704c8bcf887533590dd7acdcbf9d607109bae25c8a languageName: node - linkType: hard + linkType: soft "@graasp/ui@npm:3.2.1": version: 3.2.1