diff --git a/package.json b/package.json index 3f96a51c3..24d58798b 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,9 @@ "@emotion/react": "11.11.1", "@emotion/styled": "11.11.0", "@graasp/chatbox": "3.0.1", - "@graasp/query-client": "2.2.1", - "@graasp/sdk": "3.3.0", - "@graasp/translations": "1.21.1", + "@graasp/query-client": "2.3.0", + "@graasp/sdk": "3.4.1", + "@graasp/translations": "1.22.1", "@graasp/ui": "4.3.1", "@mui/icons-material": "5.14.19", "@mui/lab": "5.0.0-alpha.151", diff --git a/src/components/common/PlayerViewButton.tsx b/src/components/common/PlayerViewButton.tsx index dc469de4f..182b252b1 100644 --- a/src/components/common/PlayerViewButton.tsx +++ b/src/components/common/PlayerViewButton.tsx @@ -22,7 +22,7 @@ const PlayerViewButton = ({ itemId }: Props): JSX.Element => { const { t: translateBuilder } = useBuilderTranslation(); const onClick = () => { - redirect(buildGraaspPlayerView(itemId), { + redirect(window, buildGraaspPlayerView(itemId), { name: buildPlayerTabName(itemId), openInNewTab: true, }); diff --git a/src/components/item/publish/ItemPublishTab.tsx b/src/components/item/publish/ItemPublishTab.tsx index 98526f116..29aacdece 100644 --- a/src/components/item/publish/ItemPublishTab.tsx +++ b/src/components/item/publish/ItemPublishTab.tsx @@ -188,7 +188,7 @@ const ItemPublishTab = ({ const handleClick = () => { const url = CC_LICENSE_ABOUT_URL; - redirect(url, { openInNewTab: true }); + redirect(window, url, { openInNewTab: true }); }; const displayItemValidationMessage = () => { diff --git a/src/components/main/Redirect.tsx b/src/components/main/Redirect.tsx index 2c62e31ae..a5cf7da80 100644 --- a/src/components/main/Redirect.tsx +++ b/src/components/main/Redirect.tsx @@ -7,7 +7,7 @@ import { HOME_PATH } from '../../config/paths'; const Redirect = (): JSX.Element => { useEffect(() => { - redirectToSavedUrl(HOME_PATH); + redirectToSavedUrl(window, HOME_PATH); }, []); return ; diff --git a/src/components/main/itemSelectionModal/AccessibleNavigationTree.tsx b/src/components/main/itemSelectionModal/AccessibleNavigationTree.tsx index 094441ec5..9f11f1a6a 100644 --- a/src/components/main/itemSelectionModal/AccessibleNavigationTree.tsx +++ b/src/components/main/itemSelectionModal/AccessibleNavigationTree.tsx @@ -2,6 +2,8 @@ import { useState } from 'react'; import { Pagination, Stack } from '@mui/material'; +import { PermissionLevel } from '@graasp/sdk'; + import { hooks } from '@/config/queryClient'; import RowMenu, { RowMenuProps } from './RowMenu'; @@ -24,7 +26,10 @@ const AccessibleNavigationTree = ({ // todo: to change with real recent items (most used) const [page, setPage] = useState(1); // todo: show only items with admin rights - const { data: accessibleItems } = hooks.useAccessibleItems({}, { page }); + const { data: accessibleItems } = hooks.useAccessibleItems( + { permissions: [PermissionLevel.Write, PermissionLevel.Admin] }, + { page }, + ); const nbPages = accessibleItems ? Math.ceil(accessibleItems.totalCount / PAGE_SIZE) diff --git a/src/components/main/itemSelectionModal/RootNavigationTree.tsx b/src/components/main/itemSelectionModal/RootNavigationTree.tsx index 438afd766..0efd7db5c 100644 --- a/src/components/main/itemSelectionModal/RootNavigationTree.tsx +++ b/src/components/main/itemSelectionModal/RootNavigationTree.tsx @@ -1,6 +1,6 @@ import { Typography } from '@mui/material'; -import { DiscriminatedItem, ItemType } from '@graasp/sdk'; +import { DiscriminatedItem, ItemType, PermissionLevel } from '@graasp/sdk'; import { useBuilderTranslation } from '@/config/i18n'; import { hooks } from '@/config/queryClient'; @@ -29,7 +29,11 @@ const RootNavigationTree = ({ const { t: translateBuilder } = useBuilderTranslation(); // todo: to change with real recent items (most used) - const { data: recentItems } = hooks.useAccessibleItems({}, { pageSize: 5 }); + const { data: recentItems } = hooks.useAccessibleItems( + // you can move into an item you have at least write permission + { permissions: [PermissionLevel.Admin, PermissionLevel.Write] }, + { pageSize: 5 }, + ); const recentFolders = recentItems?.data?.filter( ({ type }) => type === ItemType.FOLDER, ); diff --git a/yarn.lock b/yarn.lock index 724f89389..2fc5da718 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1233,12 +1233,12 @@ __metadata: languageName: node linkType: hard -"@graasp/query-client@npm:2.2.1": - version: 2.2.1 - resolution: "@graasp/query-client@npm:2.2.1" +"@graasp/query-client@npm:2.3.0": + version: 2.3.0 + resolution: "@graasp/query-client@npm:2.3.0" dependencies: - "@graasp/sdk": "npm:3.3.0" - "@graasp/translations": "npm:1.21.1" + "@graasp/sdk": "npm:3.4.1" + "@graasp/translations": "npm:1.22.1" axios: "npm:0.27.2" crypto-js: "npm:4.2.0" http-status-codes: "npm:2.3.0" @@ -1247,7 +1247,7 @@ __metadata: uuid: "npm:9.0.1" peerDependencies: react: ^17.0.0 || ^18.0.0 - checksum: bad1c3a4163f38e45f0f64d8beb28eb6ca6fd4cf123d971be9421a6012d0d2860c71cc0c71b14bf7d46ea3afe73355a32823e037d0216caa8154905d0d408f8f + checksum: 7cbf30cc71c27e19b50d896899b2bed3de924c4d7b0d09346198ee07c0d640261908fdb718cce11b00888f2333b581e175ca2d31bac766163b27ef069a29abfa languageName: node linkType: hard @@ -1276,12 +1276,12 @@ __metadata: languageName: node linkType: hard -"@graasp/translations@npm:1.21.1": - version: 1.21.1 - resolution: "@graasp/translations@npm:1.21.1" +"@graasp/translations@npm:1.22.1": + version: 1.22.1 + resolution: "@graasp/translations@npm:1.22.1" dependencies: - i18next: "npm:23.7.7" - checksum: d95ac9cf2f2a587d6779d5b28f9c95f2f5410d3d28235b78cdf4e8ad36acd6b6ca4ac90831a6b28fecd91c6fad080f1230ab72c88295cf7742725bfa8a10c416 + i18next: "npm:23.7.16" + checksum: 29043007a9926ff54236101c41ceb92eead09d8ce99edf46943790171f3275fb2cc1acd552bfa605247c42b4866bbf1f83dd889da3f571d388eca5f2dd598e17 languageName: node linkType: hard @@ -6310,9 +6310,9 @@ __metadata: "@emotion/react": "npm:11.11.1" "@emotion/styled": "npm:11.11.0" "@graasp/chatbox": "npm:3.0.1" - "@graasp/query-client": "npm:2.2.1" - "@graasp/sdk": "npm:3.3.0" - "@graasp/translations": "npm:1.21.1" + "@graasp/query-client": "npm:2.3.0" + "@graasp/sdk": "npm:3.4.1" + "@graasp/translations": "npm:1.22.1" "@graasp/ui": "npm:4.3.1" "@mui/icons-material": "npm:5.14.19" "@mui/lab": "npm:5.0.0-alpha.151" @@ -6685,12 +6685,12 @@ __metadata: languageName: node linkType: hard -"i18next@npm:23.7.7": - version: 23.7.7 - resolution: "i18next@npm:23.7.7" +"i18next@npm:23.7.16": + version: 23.7.16 + resolution: "i18next@npm:23.7.16" dependencies: "@babel/runtime": "npm:^7.23.2" - checksum: c8d112f5bbe62b3402b0fc47094f85e6ae6f939ff0b3299c5f2b3d30e05125184ae3faa10abfc14e21ea7f8dc78526455c251dc7e5eb40cf1a204257f22e6071 + checksum: 77e74c07a73316f6fb6678a5a3e8ce58a6e66be457dd1ccd23941e9fc57ad8e1da55193fa6328c70b86073337b776cd267f3c13c6309f548b3116f27a1e41787 languageName: node linkType: hard