Skip to content

Commit

Permalink
fix: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh committed Feb 20, 2024
1 parent c1a41f9 commit 10140f9
Show file tree
Hide file tree
Showing 5 changed files with 450 additions and 433 deletions.
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,30 @@
"dependencies": {
"@emotion/react": "11.11.3",
"@emotion/styled": "11.11.0",
"@graasp/sdk": "3.6.0",
"@mui/icons-material": "5.15.5",
"@mui/material": "5.15.5",
"@graasp/sdk": "3.8.3",
"@mui/icons-material": "5.15.10",
"@mui/material": "5.15.10",
"axios": "0.27.2",
"dexie": "3.2.4",
"dexie": "3.2.6",
"http-status-codes": "2.3.0",
"miragejs": "0.1.48",
"msw": "1.3.2",
"uuid": "9.0.1"
},
"devDependencies": {
"@commitlint/cli": "18.4.4",
"@commitlint/config-conventional": "18.4.4",
"@commitlint/cli": "18.6.1",
"@commitlint/config-conventional": "18.6.2",
"@tanstack/react-query": "4.36.1",
"@tanstack/react-query-devtools": "4.36.1",
"@testing-library/react": "14.1.2",
"@testing-library/react": "14.2.1",
"@trivago/prettier-plugin-sort-imports": "4.3.0",
"@types/jest": "29.5.11",
"@types/node": "20.11.5",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"@types/uuid": "9.0.7",
"@typescript-eslint/eslint-plugin": "6.20.0",
"@typescript-eslint/parser": "6.20.0",
"@types/jest": "29.5.12",
"@types/node": "20.11.19",
"@types/react": "18.2.57",
"@types/react-dom": "18.2.19",
"@types/uuid": "9.0.8",
"@typescript-eslint/eslint-plugin": "7.0.2",
"@typescript-eslint/parser": "7.0.2",
"@vitejs/plugin-react": "4.2.1",
"date-fns": "3.3.1",
"eslint": "8.56.0",
Expand All @@ -77,21 +77,21 @@
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"husky": "8.0.3",
"husky": "9.0.11",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"nock": "13.5.0",
"prettier": "3.2.4",
"nock": "13.5.3",
"prettier": "3.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-test-renderer": "18.2.0",
"ts-jest": "29.1.2",
"ts-node": "10.9.2",
"typescript": "5.3.3",
"vite": "5.0.12",
"vite-plugin-checker": "0.6.2",
"vite-plugin-dts": "3.7.1",
"vitest": "1.2.1"
"vite": "5.1.3",
"vite-plugin-checker": "0.6.4",
"vite-plugin-dts": "3.7.2",
"vitest": "1.3.0"
},
"peerDependencies": {
"@mui/icons-material": "^5.15.5",
Expand Down
45 changes: 13 additions & 32 deletions src/components/withContext.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { ReactElement, createContext, useContext } from 'react';

import { Refresh } from '@mui/icons-material';
import { Button, Stack, Typography } from '@mui/material';

import { Context, PermissionLevel } from '@graasp/sdk';

import { UseQueryResult } from '@tanstack/react-query';

import { LocalContext } from '../types';
import { AutoResizer } from './AutoResizer';
import { Button, Stack, Typography } from '@mui/material';
import { Refresh } from '@mui/icons-material';

export const defaultContextValue: LocalContext = {
apiHost: '',
Expand Down Expand Up @@ -45,14 +46,8 @@ const WithLocalContext = ({
useAutoResize,
children,
}: WithLocalContextProps): JSX.Element => {
const itemId =
new URL(window.location.toString()).searchParams.get('itemId') || '';
const {
data: context,
isLoading,
isError,
error,
} = useGetLocalContext(itemId, defaultValue);
const itemId = new URL(window.location.toString()).searchParams.get('itemId') || '';
const { data: context, isLoading, isError, error } = useGetLocalContext(itemId, defaultValue);
if (context) {
return (
<LocalContextContext.Provider value={context}>
Expand Down Expand Up @@ -81,9 +76,8 @@ const WithLocalContext = ({
return (
<Stack direction="column" alignItems="center" spacing={2}>
<Typography maxWidth="50ch">
Could not get `LocalContext`. Check if you have mocking enabled, or if
you are running in an iframe, that the parent window replies to your
messages.
Could not get `LocalContext`. Check if you have mocking enabled, or if you are running in an
iframe, that the parent window replies to your messages.
</Typography>
<Button onClick={() => window.location.reload()} startIcon={<Refresh />}>
Refresh
Expand Down Expand Up @@ -120,22 +114,10 @@ const withContext = <P extends object>(
props: Props,
): ((childProps: P) => JSX.Element) => {
const WithContextComponent = (childProps: P): JSX.Element => {
const {
LoadingComponent,
defaultValue,
useGetLocalContext,
onError,
useAutoResize,
} = props;

const itemId =
new URL(window.location.toString()).searchParams.get('itemId') || '';
const {
data: context,
isLoading,
isError,
error,
} = useGetLocalContext(itemId, defaultValue);
const { LoadingComponent, defaultValue, useGetLocalContext, onError, useAutoResize } = props;

const itemId = new URL(window.location.toString()).searchParams.get('itemId') || '';
const { data: context, isLoading, isError, error } = useGetLocalContext(itemId, defaultValue);
if (context) {
const children = <Component {...childProps} />;

Expand Down Expand Up @@ -165,9 +147,8 @@ const withContext = <P extends object>(
}
return (
<div>
Could not get `LocalContext`. Check if you have mocking enabled, or if
you are running in an iframe, that the parent window replies to your
messages
Could not get `LocalContext`. Check if you have mocking enabled, or if you are running in an
iframe, that the parent window replies to your messages
</div>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/mockServer/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const MOCK_SERVER_ITEM: AppItemType = {
url: 'myappurl',
},
},
lang: 'en',
type: ItemType.APP,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
Expand Down
10 changes: 3 additions & 7 deletions test/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
AppSetting,
CompleteMember,
Context,
FolderItemFactory,
FolderItemType,
ItemType,
MemberType,
Expand Down Expand Up @@ -72,18 +73,13 @@ export const APPS = [
},
];

export const MOCK_ITEM: FolderItemType = {
export const MOCK_ITEM: FolderItemType = FolderItemFactory({
description: '',
type: ItemType.FOLDER,
extra: { [ItemType.FOLDER]: { childrenOrder: [] } },
id: '123',
name: '',
path: '',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
creator: MEMBER_RESPONSE,
settings: {},
};
});

export const buildAppData = ({ id = v4(), data = {} }: Partial<AppData> = {}): AppData => ({
id,
Expand Down
Loading

0 comments on commit 10140f9

Please sign in to comment.