Skip to content

Commit

Permalink
refactor: update ui
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia committed Sep 27, 2024
1 parent f1c7c8e commit 6523dfe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
10 changes: 3 additions & 7 deletions cypress/support/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,19 +433,15 @@ export const mockGetItemsTags = (
).as('getItemsTags');
};

export const mockGetLoginSchemaType = (
// eslint-disable-next-line @typescript-eslint/no-unused-vars
itemLogins: { [key: string]: string },
// eslint-disable-next-line @typescript-eslint/no-unused-vars
member: Member | null,
): void => {
export const mockGetLoginSchemaType = (itemLogins: {
[key: string]: string;
}): void => {
cy.intercept(
{
method: DEFAULT_GET.method,
url: new RegExp(`${API_HOST}/${buildGetItemLoginSchemaRoute(ID_FORMAT)}`),
},
({ reply, url }) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const itemId = url.slice(API_HOST.length).split('/')[2];

// todo: add response for itemLoginSchemaType
Expand Down
3 changes: 2 additions & 1 deletion src/contexts/CurrentMemberContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createContext, useContext, useEffect } from 'react';

import { AccountType } from '@graasp/sdk';
import { DEFAULT_LANG } from '@graasp/translations';

import i18n from '@/config/i18n';
import { hooks } from '@/config/queryClient';
Expand All @@ -25,7 +26,7 @@ export const CurrentMemberContextProvider = ({
const lang =
query.data && query.data?.type === AccountType.Individual
? query.data?.extra?.lang
: undefined;
: DEFAULT_LANG;
useEffect(() => {
if (lang !== i18n.language) {
i18n.changeLanguage(lang);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ const AppContent = ({ item }: { item: AppItemType }): JSX.Element => {
contextPayload={{
apiHost: API_HOST,
settings: item.settings,
lang: item.lang ?? memberLang,
lang: memberLang,
permission: PermissionLevel.Read,
context: Context.Player,
accountId: member?.id,
Expand Down
6 changes: 4 additions & 2 deletions src/modules/pages/ItemPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useNavigate, useParams } from 'react-router-dom';
import { Container, Stack, Typography, styled } from '@mui/material';

import { ItemLoginSchemaType } from '@graasp/sdk';
import { Button, CustomInitialLoader } from '@graasp/ui';
import { Button, CustomInitialLoader, ItemLoginWrapper } from '@graasp/ui';

import { usePlayerTranslation } from '@/config/i18n';
import { HOME_PATH } from '@/config/paths';
Expand Down Expand Up @@ -109,13 +109,15 @@ const ItemPage = (): JSX.Element | null => {
}

return (
<ItemLoginScreen
<ItemLoginWrapper
itemId={itemId}
signIn={itemLoginSignIn}
itemLoginSchemaType={itemLoginSchemaType}
usernameInputId={ITEM_LOGIN_USERNAME_INPUT_ID}
signInButtonId={ITEM_LOGIN_SIGN_IN_BUTTON_ID}
passwordInputId={ITEM_LOGIN_PASSWORD_INPUT_ID}
enrollContent={<EnrollScreen />}
// requestAccessContent={<Reque}
/>
);
}
Expand Down

0 comments on commit 6523dfe

Please sign in to comment.