diff --git a/package.json b/package.json index 87916cad..eb4b12a0 100644 --- a/package.json +++ b/package.json @@ -33,11 +33,11 @@ "@emotion/react": "11.13.0", "@emotion/server": "11.11.0", "@emotion/styled": "11.13.0", - "@graasp/query-client": "4.0.2", - "@graasp/sdk": "4.31.0", + "@graasp/query-client": "4.2.0", + "@graasp/sdk": "4.32.1", "@graasp/stylis-plugin-rtl": "2.2.0", - "@graasp/translations": "1.35.0", - "@graasp/ui": "5.2.1", + "@graasp/translations": "1.40.0", + "@graasp/ui": "5.3.1", "@mui/icons-material": "5.16.7", "@mui/lab": "5.0.0-alpha.173", "@mui/material": "5.16.7", diff --git a/src/components/collection/Collection.tsx b/src/components/collection/Collection.tsx index f26094cd..3b785dff 100644 --- a/src/components/collection/Collection.tsx +++ b/src/components/collection/Collection.tsx @@ -6,7 +6,11 @@ import { useContext, useEffect } from 'react'; import { Box } from '@mui/material'; -import { AccountType } from '@graasp/sdk'; +import { + AccountType, + PermissionLevel, + PermissionLevelCompare, +} from '@graasp/sdk'; import { ERROR_INVALID_COLLECTION_ID_CODE, @@ -18,9 +22,6 @@ import MainWrapper from '../layout/MainWrapper'; import UnpublishedItemAlert from './UnpublishedItemAlert'; import Summary from './summary/Summary'; -// todo: get similar collections in same call -// import SimilarCollections from './SimilarCollections'; - type Props = { id?: string; }; @@ -32,7 +33,6 @@ const Collection = ({ id }: Props) => { isError, } = hooks.useItem(id); const { data: currentMember } = hooks.useCurrentMember(); - const { data: tags } = hooks.useItemTags(id); // get item published const { data: itemPublishEntry, @@ -49,8 +49,10 @@ const Collection = ({ id }: Props) => { postView({ itemId: id, payload: { type: 'collection-view' } }); } }, [id]); - // if tags could be fetched then user has at least read access - const canRead = Boolean(tags); + + const canRead = collection?.permission + ? PermissionLevelCompare.gte(collection.permission, PermissionLevel.Read) + : false; const canPublish = (collection && @@ -105,7 +107,6 @@ const Collection = ({ id }: Props) => { isLoading={isLoadingItem} totalViews={itemPublishEntry?.totalViews ?? 0} /> - {/* */} ); diff --git a/src/components/layout/StyledLink.tsx b/src/components/layout/StyledLink.tsx index ad040b1d..010aba8e 100644 --- a/src/components/layout/StyledLink.tsx +++ b/src/components/layout/StyledLink.tsx @@ -1,5 +1,7 @@ import Link from 'next/link'; +import { ReactNode } from 'react'; + import { styled } from '@mui/material'; import { HEADER_GRAASP_LOGO_LINK_ID } from '../../config/selectors'; @@ -12,7 +14,7 @@ const StyledLink = styled(Link)(() => ({ const HeaderLinkComponent = ({ children, }: { - children: JSX.Element; + children: ReactNode; }): JSX.Element => ( {children} diff --git a/yarn.lock b/yarn.lock index e7a18b49..1f6d44f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1228,10 +1228,10 @@ __metadata: languageName: node linkType: hard -"@faker-js/faker@npm:9.0.1": - version: 9.0.1 - resolution: "@faker-js/faker@npm:9.0.1" - checksum: 10/708629605392fdbe06887ca9b083d73801c64b47917f790870b240858ab65cada14b52dddf2cb7e471ad0f6ddf66ea30e7ffda741c5ba9bd5c27318b47262279 +"@faker-js/faker@npm:9.0.3": + version: 9.0.3 + resolution: "@faker-js/faker@npm:9.0.3" + checksum: 10/60ea71c31d6bd6317184736de17daee415e229cab5e10a4146a19622f3eb22f49f42345ff339dc9261f0214ca1f9b019c63fd9aac842a2d359f135102788ec90 languageName: node linkType: hard @@ -1273,9 +1273,9 @@ __metadata: languageName: node linkType: hard -"@graasp/query-client@npm:4.0.2": - version: 4.0.2 - resolution: "@graasp/query-client@npm:4.0.2" +"@graasp/query-client@npm:4.2.0": + version: 4.2.0 + resolution: "@graasp/query-client@npm:4.2.0" dependencies: "@tanstack/react-query": "npm:5.59.8" "@tanstack/react-query-devtools": "npm:5.59.8" @@ -1285,22 +1285,22 @@ __metadata: "@graasp/sdk": ^4.0.0 "@graasp/translations": "*" react: ^18.0.0 - checksum: 10/333f4856725d59e128581d104037997a397f7f6ddf09ffaab7a3ff8a8e1fb716b870b2a97dda600e45c5e3a63395ca1df5796755dabfdcaf465a5a793d5d459e + checksum: 10/fdf06272486d4c9979459c00f7cb0d9f98c027deef0c948ff734679b46435658076aeede49d54730922f0d12e572cf9d3bac045e346ab38629a15fab6b30d00d languageName: node linkType: hard -"@graasp/sdk@npm:4.31.0": - version: 4.31.0 - resolution: "@graasp/sdk@npm:4.31.0" +"@graasp/sdk@npm:4.32.1": + version: 4.32.1 + resolution: "@graasp/sdk@npm:4.32.1" dependencies: - "@faker-js/faker": "npm:9.0.1" + "@faker-js/faker": "npm:9.0.3" filesize: "npm:10.1.6" js-cookie: "npm:3.0.5" validator: "npm:13.12.0" peerDependencies: date-fns: ^3 || ^4.0.0 uuid: ^9 || ^10 - checksum: 10/9b2bf85a51cc12b6f2bdefeb7bbc0c615db9ea3188ace6d460b14e61503763aeab13fd2aa1c4135cee602c2c58465895569b2845b91d942982f96f5594dfd1d4 + checksum: 10/74125fa4c2aed104142cccc77e8a8a90d2ae303dcaae83e40198f7d30d6615ad3136532789b0d1c2f7034847937f238c046b9aee5fcee5d319bbe7be8cb4f257 languageName: node linkType: hard @@ -1315,18 +1315,18 @@ __metadata: languageName: node linkType: hard -"@graasp/translations@npm:1.35.0": - version: 1.35.0 - resolution: "@graasp/translations@npm:1.35.0" +"@graasp/translations@npm:1.40.0": + version: 1.40.0 + resolution: "@graasp/translations@npm:1.40.0" peerDependencies: i18next: ^23.8.1 - checksum: 10/d5227f2ced80faaa7a852a1b4760c47ac592b8cfc2f8fba63e4bd45e27139f17451a060714020a8eb0f2a988d7e726b164fc609af4a056339a4f634866d45797 + checksum: 10/07f603161644e66541bd88949f7e2edf92355bc735a9a6eafbf7f93eab433c4b21a7a00cbecf61c9650037d81360693d68c997462b9359840e836c80d66fd143 languageName: node linkType: hard -"@graasp/ui@npm:5.2.1": - version: 5.2.1 - resolution: "@graasp/ui@npm:5.2.1" +"@graasp/ui@npm:5.3.1": + version: 5.3.1 + resolution: "@graasp/ui@npm:5.3.1" dependencies: http-status-codes: "npm:2.3.0" interweave: "npm:13.1.0" @@ -1335,7 +1335,7 @@ __metadata: react-dnd: "npm:16.0.1" react-dnd-html5-backend: "npm:16.0.1" react-quill: "npm:2.0.0" - react-rnd: "npm:10.4.12" + react-rnd: "npm:10.4.13" uuid: "npm:10.0.0" peerDependencies: "@emotion/cache": ~11.10.7 || ~11.11.0 || ~11.13.0 @@ -1349,13 +1349,13 @@ __metadata: "@mui/material": ~5.14.0 || ~5.15.0 || ~5.16.0 i18next: ^22.4.15 || ^23.0.0 katex: 0.16.11 - lucide-react: ^0.417.0 || ^0.429.0 || ^0.436.0 || ^0.439.0 || ^0.441.0 || ^0.446.0 + lucide-react: ^0.417.0 || ^0.429.0 || ^0.436.0 || ^0.439.0 || ^0.441.0 || ^0.446.0 || ^0.447.0 || ^0.451.0 react: ^18.0.0 react-dom: ^18.0.0 react-i18next: ^13.0.0 || ^14.0.0 || ^15.0.0 react-router-dom: ^6.11.0 stylis: ^4.1.3 - checksum: 10/35c2596b5e5cdee10224e6f65a846278653428a0aeaef48ff8a00c92326be0e20596d8c438d21247d6b1d554aa72497f2481b6e9b6483a023126eb5c1f196bf6 + checksum: 10/00185d14f6c0984d90db5a1b63d68b07193e5aee62298b9920489f75df4c46dfc6057605de34660c02b6afa970474bbc3533164d60d4a1d27733b7e3d80b87dd languageName: node linkType: hard @@ -7258,11 +7258,11 @@ __metadata: "@emotion/react": "npm:11.13.0" "@emotion/server": "npm:11.11.0" "@emotion/styled": "npm:11.13.0" - "@graasp/query-client": "npm:4.0.2" - "@graasp/sdk": "npm:4.31.0" + "@graasp/query-client": "npm:4.2.0" + "@graasp/sdk": "npm:4.32.1" "@graasp/stylis-plugin-rtl": "npm:2.2.0" - "@graasp/translations": "npm:1.35.0" - "@graasp/ui": "npm:5.2.1" + "@graasp/translations": "npm:1.40.0" + "@graasp/ui": "npm:5.3.1" "@mui/icons-material": "npm:5.16.7" "@mui/lab": "npm:5.0.0-alpha.173" "@mui/material": "npm:5.16.7" @@ -10474,13 +10474,13 @@ __metadata: languageName: node linkType: hard -"re-resizable@npm:6.9.17": - version: 6.9.17 - resolution: "re-resizable@npm:6.9.17" +"re-resizable@npm:6.10.0": + version: 6.10.0 + resolution: "re-resizable@npm:6.10.0" peerDependencies: react: ^16.13.1 || ^17.0.0 || ^18.0.0 react-dom: ^16.13.1 || ^17.0.0 || ^18.0.0 - checksum: 10/768c3a0fe39d6916caf4e003240d326d62c4d7512c7d3115cc2a98085416fdba80097afdbb93df57b69543c41ce56b33589f2fea6987cd5149faa83cf11c8ba1 + checksum: 10/303e582feffdfd3e491e2b51dc75c8641c726882e2d8e3ec249b2bc1d23bfffa73bd4a982ed5456bcab9ec25f52b5430e8c632f32647295ed773679691a961a2 languageName: node linkType: hard @@ -10653,17 +10653,17 @@ __metadata: languageName: node linkType: hard -"react-rnd@npm:10.4.12": - version: 10.4.12 - resolution: "react-rnd@npm:10.4.12" +"react-rnd@npm:10.4.13": + version: 10.4.13 + resolution: "react-rnd@npm:10.4.13" dependencies: - re-resizable: "npm:6.9.17" + re-resizable: "npm:6.10.0" react-draggable: "npm:4.4.6" tslib: "npm:2.6.2" peerDependencies: react: ">=16.3.0" react-dom: ">=16.3.0" - checksum: 10/f29429a9ceafdf19c3b50571882c36eee29430a22d526fe2aaf641e38146e1bf5a1337639e0c9eba7c6ddaa85721cff9f390cf8d807a62634a27a77e49e2653c + checksum: 10/3a343d71117c37e105286eeee38e244d9dc62e0e4b2efa929128995056408cf7fda15f5100f66b8548370ae63f886b94c7851e862fd90dd0b543ec382f43c4f1 languageName: node linkType: hard