Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Commit

Permalink
fix: update mui version to v6 (#880)
Browse files Browse the repository at this point in the history
* fix: udpate mui version to v6

* fix: update deps

* fix: tests
  • Loading branch information
spaenleh authored Oct 25, 2024
1 parent 581e360 commit d2a9356
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 262 deletions.
3 changes: 0 additions & 3 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
mockGetItemChat,
mockGetItemGeolocation,
mockGetItemMembershipsForItem,
mockGetItemTags,
mockGetItemsInMap,
mockGetItemsTags,
mockGetLoginSchemaType,
Expand Down Expand Up @@ -56,8 +55,6 @@ Cypress.Commands.add(
mockGetItemChat({ chatMessages });
mockGetItemMembershipsForItem(items, currentMember);

mockGetItemTags(items, currentMember);

mockGetItemsTags(items, currentMember);
mockGetLoginSchemaType(itemLogins);

Expand Down
46 changes: 1 addition & 45 deletions cypress/support/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { API_ROUTES } from '@graasp/query-client';
import {
ChatMessage,
DiscriminatedItem,
HttpMethod,
ItemTag,
Member,
Expand All @@ -21,7 +20,7 @@ import {
buildGetAppData,
} from '../fixtures/apps';
import { MEMBERS } from '../fixtures/members';
import { MockItem, MockItemTag } from '../fixtures/mockTypes';
import { MockItem } from '../fixtures/mockTypes';
import {
ACCOUNT_HOST,
ANALYTICS_HOST,
Expand All @@ -48,7 +47,6 @@ const {
buildGetItemLoginSchemaRoute,
buildGetItemMembershipsForItemsRoute,
buildGetItemRoute,
buildGetItemTagsRoute,
buildGetMembersByEmailRoute,
buildGetMembersByIdRoute,
buildGetCurrentMemberRoute,
Expand Down Expand Up @@ -351,48 +349,6 @@ export const mockDefaultDownloadFile = (
).as('downloadFile');
};

export const mockGetItemTags = (
items: MockItem[],
member: Member | null,
): void => {
cy.intercept(
{
method: DEFAULT_GET.method,
url: new RegExp(`${API_HOST}/${buildGetItemTagsRoute(ID_FORMAT)}$`),
},
({ reply, url }) => {
const itemId = url.slice(API_HOST.length).split('/')[2];
const item = items.find(({ id }) => id === itemId);

// item does not exist in db
if (!item) {
return reply({
statusCode: StatusCodes.NOT_FOUND,
});
}

const error = checkMemberHasAccess({ item, items, member });
if (isError(error)) {
return reply(error);
}

const itemTags = items
.filter((i) => item.path.startsWith(i.path) && (i.public || i.hidden))
.map(
(i) =>
[i.public, i.hidden].filter(Boolean).map((t) => ({
...t,
item: i as DiscriminatedItem,
})) as ItemTag[],
);
const result =
itemTags.reduce<MockItemTag[]>((acc, tags) => [...acc, ...tags], []) ||
[];
return reply(result);
},
).as('getItemTags');
};

export const mockGetItemsTags = (
items: MockItem[],
member: Member | null,
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
"@emotion/react": "11.13.3",
"@emotion/styled": "11.13.0",
"@graasp/chatbox": "3.3.0",
"@graasp/query-client": "4.2.0",
"@graasp/query-client": "5.0.0",
"@graasp/sdk": "4.32.1",
"@graasp/stylis-plugin-rtl": "2.2.0",
"@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",
"@graasp/ui": "5.4.0",
"@mui/icons-material": "6.1.5",
"@mui/lab": "6.0.0-beta.13",
"@mui/material": "6.1.5",
"@sentry/react": "7.119.2",
"axios": "1.7.7",
"classnames": "2.5.1",
"date-fns": "4.1.0",
"i18next": "23.16.2",
"i18next": "23.16.3",
"katex": "0.16.11",
"lodash.isarray": "4.0.0",
"lodash.truncate": "4.4.2",
Expand Down Expand Up @@ -79,21 +79,21 @@
"@types/katex": "^0.16.7",
"@types/lodash.isarray": "^4.0.9",
"@types/lodash.truncate": "^4.4.9",
"@types/node": "^20.16.12",
"@types/node": "^20.17.0",
"@types/react": "18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react-helmet": "^6.1.11",
"@types/uuid": "10.0.0",
"@typescript-eslint/eslint-plugin": "8.11.0",
"@typescript-eslint/parser": "8.11.0",
"@vitejs/plugin-react": "^4.3.2",
"@vitejs/plugin-react": "^4.3.3",
"commitlint": "19.5.0",
"concurrently": "9.0.1",
"cypress": "13.15.0",
"cypress": "13.15.1",
"cypress-iframe": "1.0.1",
"cypress-vite": "1.5.0",
"env-cmd": "10.1.0",
"eslint": "^9.12.0",
"eslint": "^9.13.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-typescript": "3.6.3",
Expand Down
16 changes: 7 additions & 9 deletions src/modules/pages/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useState } from 'react';
import { ReactNode, useState } from 'react';
import { Helmet } from 'react-helmet';

import {
Alert,
Grid2 as Grid,
Pagination,
PaginationItem,
Stack,
Typography,
} from '@mui/material';
import Grid2 from '@mui/material/Unstable_Grid2';

import { PackedItem } from '@graasp/sdk';

Expand All @@ -29,10 +29,8 @@ const { useAccessibleItems } = hooks;
// should be a multiple of 6 to create full pages that split into 2, 3 and 6 columns
const PAGE_SIZE = 24;

const GridWrapper = ({ children }: { children: JSX.Element }): JSX.Element => (
<Grid2 xs={12} sm={6} md={4} xl={2}>
{children}
</Grid2>
const GridWrapper = ({ children }: { children: ReactNode }): JSX.Element => (
<Grid size={{ xs: 12, sm: 6, md: 4, xl: 2 }}>{children}</Grid>
);

const DisplayItems = ({
Expand All @@ -41,7 +39,7 @@ const DisplayItems = ({
}: {
items?: PackedItem[];
isLoading: boolean;
}): JSX.Element[] | JSX.Element | null => {
}): ReactNode | null => {
const { t } = usePlayerTranslation();

if (items) {
Expand Down Expand Up @@ -89,9 +87,9 @@ const HomePage = (): JSX.Element => {
<Typography variant="h4" component="h1" mb={1}>
{t(PLAYER.RECENT_ITEMS_TITLE)}
</Typography>
<Grid2 container spacing={3} justifyItems="center">
<Grid container spacing={3} justifyItems="center">
<DisplayItems items={accessibleItems?.data} isLoading={isLoading} />
</Grid2>
</Grid>
</Stack>
<Pagination
id={HOME_PAGE_PAGINATION_ID}
Expand Down
6 changes: 3 additions & 3 deletions src/modules/rightPanel/SideContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useParams, useSearchParams } from 'react-router-dom';

import EnterFullscreenIcon from '@mui/icons-material/Fullscreen';
import ExitFullscreenIcon from '@mui/icons-material/FullscreenExit';
import { Grid, Stack, Tooltip, styled } from '@mui/material';
import { Stack, Tooltip, styled } from '@mui/material';
import IconButton from '@mui/material/IconButton';

import { DiscriminatedItem } from '@graasp/sdk';
Expand Down Expand Up @@ -166,15 +166,15 @@ const SideContent = ({ content, item }: Props): JSX.Element | null => {
>
{displayChatbox()}
{displayPinnedItems()}
<Grid id="contentGrid">
<Stack id="contentGrid">
<StyledMain
isShifted={isChatboxOpen || (isPinnedOpen && pinnedCount > 0)}
>
{displayFullscreenButton()}

{content}
</StyledMain>
</Grid>
</Stack>
</Fullscreen>
);
};
Expand Down
Loading

0 comments on commit d2a9356

Please sign in to comment.