Skip to content

Commit

Permalink
feat: replace profile path, add translations (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia authored Nov 9, 2023
1 parent 4dc694a commit e1e3280
Show file tree
Hide file tree
Showing 23 changed files with 35 additions and 984 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ jobs:
VITE_VERSION: ${{ github.sha }}
VITE_GRAASP_DOMAIN: ${{ vars.VITE_GRAASP_DOMAIN }}
VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }}
VITE_GRAASP_ACCOUNT_HOST: ${{ vars.VITE_GRAASP_ACCOUNT_HOST }}
VITE_GRAASP_ANALYZER_HOST: ${{ vars.VITE_GRAASP_ANALYZER_HOST }}
VITE_GRAASP_AUTH_HOST: ${{ vars.VITE_GRAASP_AUTH_HOST }}
VITE_GRAASP_PLAYER_HOST: ${{ vars.VITE_GRAASP_PLAYER_HOST }}
VITE_GRAASP_LIBRARY_HOST: ${{ vars.VITE_GRAASP_LIBRARY_HOST }}
VITE_GRAASP_ANALYZER_HOST: ${{ vars.VITE_GRAASP_ANALYZER_HOST }}
VITE_GRAASP_PLAYER_HOST: ${{ vars.VITE_GRAASP_PLAYER_HOST }}
VITE_H5P_INTEGRATION_URL: ${{ secrets.VITE_H5P_INTEGRATION_URL }}
VITE_GRAASP_ASSETS_URL: ${{ secrets.VITE_GRAASP_ASSETS_URL }}
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ jobs:
VITE_VERSION: ${{ github.event.client_payload.tag }}
VITE_GRAASP_DOMAIN: ${{ vars.VITE_GRAASP_DOMAIN }}
VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }}
VITE_GRAASP_ACCOUNT_HOST: ${{ vars.VITE_GRAASP_ACCOUNT_HOST }}
VITE_GRAASP_ANALYZER_HOST: ${{ vars.VITE_GRAASP_ANALYZER_HOST }}
VITE_GRAASP_AUTH_HOST: ${{ vars.VITE_GRAASP_AUTH_HOST }}
VITE_GRAASP_PLAYER_HOST: ${{ vars.VITE_GRAASP_PLAYER_HOST }}
VITE_GRAASP_LIBRARY_HOST: ${{ vars.VITE_GRAASP_LIBRARY_HOST }}
VITE_GRAASP_ANALYZER_HOST: ${{ vars.VITE_GRAASP_ANALYZER_HOST }}
VITE_GRAASP_PLAYER_HOST: ${{ vars.VITE_GRAASP_PLAYER_HOST }}
VITE_H5P_INTEGRATION_URL: ${{ secrets.VITE_H5P_INTEGRATION_URL }}
VITE_GRAASP_ASSETS_URL: ${{ secrets.VITE_GRAASP_ASSETS_URL }}
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ jobs:
VITE_VERSION: ${{ github.event.client_payload.tag }}
VITE_GRAASP_DOMAIN: ${{ vars.VITE_GRAASP_DOMAIN }}
VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }}
VITE_GRAASP_ACCOUNT_HOST: ${{ vars.VITE_GRAASP_ACCOUNT_HOST }}
VITE_GRAASP_ANALYZER_HOST: ${{ vars.VITE_GRAASP_ANALYZER_HOST }}
VITE_GRAASP_AUTH_HOST: ${{ vars.VITE_GRAASP_AUTH_HOST }}
VITE_GRAASP_PLAYER_HOST: ${{ vars.VITE_GRAASP_PLAYER_HOST }}
VITE_GRAASP_LIBRARY_HOST: ${{ vars.VITE_GRAASP_LIBRARY_HOST }}
VITE_GRAASP_ANALYZER_HOST: ${{ vars.VITE_GRAASP_ANALYZER_HOST }}
VITE_GRAASP_PLAYER_HOST: ${{ vars.VITE_GRAASP_PLAYER_HOST }}
VITE_H5P_INTEGRATION_URL: ${{ secrets.VITE_H5P_INTEGRATION_URL }}
VITE_GRAASP_ASSETS_URL: ${{ secrets.VITE_GRAASP_ASSETS_URL }}
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }}
Expand Down
17 changes: 0 additions & 17 deletions cypress/e2e/header.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import {
APP_NAVIGATION_PLATFORM_SWITCH_BUTTON_IDS,
APP_NAVIGATION_PLATFORM_SWITCH_ID,
HEADER_MEMBER_MENU_BUTTON_ID,
HEADER_MEMBER_MENU_SEE_PROFILE_BUTTON_ID,
HEADER_MEMBER_MENU_SIGN_OUT_BUTTON_ID,
MEMBER_PROFILE_MEMBER_NAME_ID,
} from '../../src/config/selectors';
import { SIGN_IN_PATH } from '../support/paths';

Expand All @@ -20,21 +18,6 @@ describe('Header', () => {
});

describe('User Menu', () => {
it('Standalone actions', () => {
cy.setUpApi();
cy.visit(HOME_PATH);
// go to profile
cy.get(`#${HEADER_MEMBER_MENU_BUTTON_ID}`).click();
cy.get(`#${HEADER_MEMBER_MENU_SEE_PROFILE_BUTTON_ID}`).click();
cy.get(`#${MEMBER_PROFILE_MEMBER_NAME_ID}`).should('be.visible');

// disable switch users
// sign in as another user
// cy.get(`#${HEADER_MEMBER_MENU_BUTTON_ID}`).click();
// cy.get(`#${HEADER_MEMBER_MENU_SIGN_IN_BUTTON_ID}`).click();
// cy.url().should('equal', SIGN_IN_PATH);
});

it('Sign out', () => {
cy.setUpApi();
cy.visit(HOME_PATH);
Expand Down
20 changes: 1 addition & 19 deletions cypress/e2e/item/thumbnails/uploadThumbnail.cy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import {
MEMBER_PROFILE_PATH,
buildItemPath,
} from '../../../../src/config/paths';
import { buildItemPath } from '../../../../src/config/paths';
import {
CROP_MODAL_CONFIRM_BUTTON_CLASSNAME,
ITEM_SETTINGS_BUTTON_CLASS,
MEMBER_PROFILE_AVATAR_UPLOAD_BUTTON_CLASSNAME,
THUMBNAIL_SETTING_UPLOAD_BUTTON_CLASSNAME,
} from '../../../../src/config/selectors';
import {
Expand Down Expand Up @@ -34,18 +30,4 @@ describe('Upload Thumbnails', () => {
cy.get(`.${CROP_MODAL_CONFIRM_BUTTON_CLASSNAME}`).click();
cy.wait(`@uploadItemThumbnail`);
});

it(`upload member avatar`, () => {
cy.visit(MEMBER_PROFILE_PATH);

// change item thumbnail
// selectFile ???
cy.attachFile(
cy.get(`.${MEMBER_PROFILE_AVATAR_UPLOAD_BUTTON_CLASSNAME}`),
THUMBNAIL_MEDIUM_PATH,
);
cy.wait(FILE_LOADING_PAUSE);
cy.get(`.${CROP_MODAL_CONFIRM_BUTTON_CLASSNAME}`).click();
cy.wait(`@uploadAvatar`);
});
});
163 changes: 0 additions & 163 deletions cypress/e2e/memberProfile.cy.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@graasp/chatbox": "3.0.0",
"@graasp/query-client": "2.0.0",
"@graasp/sdk": "2.0.1",
"@graasp/translations": "1.19.2",
"@graasp/translations": "1.19.4",
"@graasp/ui": "4.0.0",
"@mui/icons-material": "5.14.16",
"@mui/lab": "5.0.0-alpha.151",
Expand Down
10 changes: 0 additions & 10 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
FAVORITE_ITEMS_PATH,
HOME_PATH,
ITEMS_PATH,
MEMBER_PROFILE_PATH,
PUBLISHED_ITEMS_PATH,
RECYCLE_BIN_PATH,
REDIRECT_PATH,
Expand All @@ -30,7 +29,6 @@ import Home from './main/Home';
import ItemScreen from './main/ItemScreen';
import PublishedItems from './main/PublishedItems';
import Redirect from './main/Redirect';
import MemberProfileScreen from './member/MemberProfileScreen';

const { useItemFeedbackUpdates } = hooks;

Expand Down Expand Up @@ -62,10 +60,6 @@ const App = (): JSX.Element => {
FavoriteItems,
withAuthorizationProps,
);
const MemberWithAuthorization = withAuthorization(
MemberProfileScreen,
withAuthorizationProps,
);
const RecycleWithAuthorization = withAuthorization(
RecycleBinScreen,
withAuthorizationProps,
Expand All @@ -89,10 +83,6 @@ const App = (): JSX.Element => {
element={<PublishedWithAuthorization />}
/>
<Route path={buildItemPath()} element={<ItemScreen />} />
<Route
path={MEMBER_PROFILE_PATH}
element={<MemberWithAuthorization />}
/>
<Route path={RECYCLE_BIN_PATH} element={<RecycleWithAuthorization />} />
<Route path={ITEMS_PATH} element={<HomeWithAuthorization />} />
<Route path={REDIRECT_PATH} element={<Redirect />} />
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/UserSwitchWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CompleteMember } from '@graasp/sdk';
import { UserSwitchWrapper as GraaspUserSwitch } from '@graasp/ui';

import { GRAASP_ACCOUNT_HOST } from '@/config/env';
import { SIGN_IN_PATH } from '@/config/externalPaths';
import { useBuilderTranslation } from '@/config/i18n';
import { MEMBER_PROFILE_PATH } from '@/config/paths';
import { mutations } from '@/config/queryClient';
import {
HEADER_MEMBER_MENU_BUTTON_ID,
Expand Down Expand Up @@ -47,7 +47,7 @@ const UserSwitchWrapper = ({ ButtonContent }: Props): JSX.Element => {
)}
signOutText={translateBuilder(BUILDER.USER_SWITCH_SIGN_OUT_BUTTON)}
// switchMemberText={translateBuilder(BUILDER.USER_SWITCH_SWITCH_USER_TEXT)}
profilePath={MEMBER_PROFILE_PATH}
profilePath={GRAASP_ACCOUNT_HOST}
redirectPath={SIGN_IN_PATH}
buttonId={HEADER_MEMBER_MENU_BUTTON_ID}
signInMenuItemId={HEADER_MEMBER_MENU_SIGN_IN_BUTTON_ID}
Expand Down
16 changes: 9 additions & 7 deletions src/components/context/FlagItemModalContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { createContext, useMemo, useState } from 'react';

import { routines } from '@graasp/query-client';
import { FlagType } from '@graasp/sdk';
import { COMMON } from '@graasp/translations';
import { ItemFlagDialog } from '@graasp/ui';

import { useBuilderTranslation } from '../../config/i18n';
import { BUILDER } from '@/langs/constants';

import { useBuilderTranslation, useCommonTranslation } from '../../config/i18n';
import notifier from '../../config/notifier';
import { mutations } from '../../config/queryClient';

Expand All @@ -20,6 +23,7 @@ const FlagItemModalProvider = ({
children: JSX.Element | JSX.Element[];
}): JSX.Element => {
const { t: translateBuilder } = useBuilderTranslation();
const { t: translateCommon } = useCommonTranslation();
const { mutate: postItemFlag } = mutations.usePostItemFlag();
const [open, setOpen] = useState(false);
const [itemId, setItemId] = useState<string | null>(null);
Expand Down Expand Up @@ -58,12 +62,10 @@ const FlagItemModalProvider = ({
onFlag={onFlag}
open={open}
onClose={onClose}
descriptionText={translateBuilder(
'Select reason for flagging this item',
)}
title={translateBuilder('Flag Item')}
cancelButtonText={translateBuilder('Cancel')}
confirmButtonText={translateBuilder('Flag')}
descriptionText={translateBuilder(BUILDER.FLAG_REASON_DESCRIPTION)}
title={translateBuilder(BUILDER.FLAG_MODAL_TITLE)}
cancelButtonText={translateCommon(COMMON.CANCEL_BUTTON)}
confirmButtonText={translateBuilder(BUILDER.FLAG_MODAL_CONFIRM)}
/>
{children}
</FlagItemModalContext.Provider>
Expand Down
Loading

0 comments on commit e1e3280

Please sign in to comment.