diff --git a/package.json b/package.json index 46c1acce2..12757cb1c 100644 --- a/package.json +++ b/package.json @@ -147,8 +147,7 @@ "wait-on": "7.0.1" }, "resolutions": { - "@graasp/sdk": "0.4.1", - "@graasp/ui": "0.11.1", + "@graasp/ui": "0.11.2", "@mui/icons-material": "5.11.0", "@mui/material": "5.11.6", "ansi-html": "0.0.8", diff --git a/src/components/context/CurrentUserContext.tsx b/src/components/context/CurrentUserContext.tsx index 757a33f67..fe5f5a37a 100644 --- a/src/components/context/CurrentUserContext.tsx +++ b/src/components/context/CurrentUserContext.tsx @@ -6,9 +6,9 @@ import { MemberRecord } from '@graasp/sdk/frontend'; import i18n from '../../config/i18n'; import { hooks } from '../../config/queryClient'; -type CurrentUserContextType = QueryObserverResult | null; +type CurrentUserContextType = QueryObserverResult | undefined; -const CurrentUserContext = createContext(null); +const CurrentUserContext = createContext(undefined); type Props = { children: JSX.Element | JSX.Element[]; diff --git a/src/components/context/LayoutContext.tsx b/src/components/context/LayoutContext.tsx index fa49499a8..1c9c6d3b5 100644 --- a/src/components/context/LayoutContext.tsx +++ b/src/components/context/LayoutContext.tsx @@ -1,4 +1,4 @@ -import React, { createContext, useContext, useMemo, useState } from 'react'; +import { createContext, useContext, useMemo, useState } from 'react'; import { DEFAULT_ITEM_LAYOUT_MODE } from '../../config/constants'; import { ChatStatus, ITEM_LAYOUT_MODES } from '../../enums'; diff --git a/src/components/item/header/ItemHeaderActions.tsx b/src/components/item/header/ItemHeaderActions.tsx index 5b195caca..6cf902156 100644 --- a/src/components/item/header/ItemHeaderActions.tsx +++ b/src/components/item/header/ItemHeaderActions.tsx @@ -8,8 +8,12 @@ import { ChatboxButton } from '@graasp/ui'; import { ITEM_TYPES_WITH_CAPTIONS } from '../../../config/constants'; import { useBuilderTranslation } from '../../../config/i18n'; import { hooks } from '../../../config/queryClient'; +import { ITEM_CHATBOX_BUTTON_ID } from '../../../config/selectors'; import { ItemActionTabs } from '../../../enums'; -import { isItemUpdateAllowedForUser } from '../../../utils/membership'; +import { + getHighestPermissionForMemberFromMemberships, + isItemUpdateAllowedForUser, +} from '../../../utils/membership'; import AnalyticsDashboardButton from '../../common/AnalyticsDashboardButton'; import EditItemCaptionButton from '../../common/EditItemCaptionButton'; import ItemMetadataButton from '../../common/ItemMetadataButton'; diff --git a/src/utils/membership.ts b/src/utils/membership.ts index b0f30b927..22c8b70cf 100644 --- a/src/utils/membership.ts +++ b/src/utils/membership.ts @@ -18,7 +18,7 @@ export const isItemUpdateAllowedForUser = ({ memberships, memberId, }: { - memberships: List; + memberships?: List; memberId: string; }): boolean => Boolean( @@ -79,7 +79,7 @@ export const getMembershipsForItem = ({ items: List; }): List | undefined => { const index = items.findKey(({ id }) => id === itemId); - const m = manyMemberships?.get(index); + const m = manyMemberships?.get(index as number); if (isError(m)) { return undefined; } diff --git a/yarn.lock b/yarn.lock index de84ea22b..4301b215b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2384,9 +2384,9 @@ __metadata: languageName: node linkType: hard -"@graasp/ui@npm:0.11.1": - version: 0.11.1 - resolution: "@graasp/ui@https://github.com/graasp/graasp-ui.git#commit=08e149ac68d3eb50743606dad1a1d48b65e73b24" +"@graasp/ui@npm:0.11.2": + version: 0.11.2 + resolution: "@graasp/ui@npm:0.11.2" dependencies: "@graasp/sdk": 0.4.1 clsx: 1.1.1 @@ -2419,7 +2419,7 @@ __metadata: optional: true ag-grid-react: optional: true - checksum: 6763e4ef1aec40039a6faff99fec8a5fd856d3196d8c8494ff75155153805e05a04a5ac4516db7a9a57f3e4df24ec9ce2d8e49967c0f3a521a07ae2dca424c1a + checksum: f0732062e011dcd45c28657eb36aeb7fdcca80cf73835f9b759c998b195ec6fe26b0e7b942dde6a090e3dd93edbd974dbc6a050a6db06d8ecd557754c2fa3ade languageName: node linkType: hard