Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Dockerfile
docs
node_modules
storybook_static
.tanstack
1 change: 0 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:
env:
VITE_VERSION: ${{ inputs.version || github.sha }}
VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }}
VITE_GRAASP_WS_HOST: ${{ vars.VITE_GRAASP_WS_HOST }}
VITE_GRAASP_LIBRARY_HOST: ${{ vars.VITE_GRAASP_LIBRARY_HOST }}
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }}
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
unit:
name: Unit
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/account/settings/preferences.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('Display preferences', () => {
pathname: /\/api\/members\/current\/marketing\/unsubscribe$/,
},
({ reply }) => {
reply();
reply({});
},
).as('unsubscribe');

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/builder/item/bookmarks/bookmarks.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const removefromItemCard = (itemId: string) => {
cy.get(`#${buildItemCard(itemId)} ${UNBOOKMARK_ICON_SELECTOR}`).click();
};
const removefromBookmarkCard = (itemId: string) => {
cy.get(`#${BOOKMARK_MANAGE_BUTTON_ID} `).click();
cy.get(`#${BOOKMARK_MANAGE_BUTTON_ID}`).click();
cy.get(buildBookmarkCardRemoveButton(itemId)).click();
};

Expand Down Expand Up @@ -85,7 +85,7 @@ describe('Bookmarked Item', () => {
});
});

it('remove item from item card', () => {
it('remove item from bookmark card', () => {
const itemId = ITEMS[1].id;

removefromBookmarkCard(itemId);
Expand Down
3 changes: 3 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ import {
mockPostAvatar,
mockPostInvitations,
mockPostItem,
mockPostItemActions,
mockPostItemChatMessage,
mockPostItemFlag,
mockPostItemLogin,
Expand Down Expand Up @@ -541,6 +542,8 @@ Cypress.Commands.add(
mockEnroll();

mockGetCurrentSettings(currentMember, currentSettings);

mockPostItemActions();
},
);

Expand Down
28 changes: 28 additions & 0 deletions cypress/support/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,22 @@ export const mockGetItemChat = (
{ items }: { items: ItemForTest[] },
shouldThrowError: boolean,
): void => {
cy.intercept(
{
method: HttpMethod.Get,
pathname: /\/api\/items\/[0-9a-fA-F-]{36}\/chat$/,
},
({ reply, url }) => {
if (shouldThrowError) {
return reply({ statusCode: StatusCodes.BAD_REQUEST });
}

const itemId = url.split('/')[-2];
const item = items.find(({ id }) => itemId === id);

return reply(item?.chat ?? []);
},
).as('getItemChatAPI');
cy.intercept(
{
method: HttpMethod.Get,
Expand Down Expand Up @@ -2424,3 +2440,15 @@ export const mockGetCurrentSettings = (
},
).as('getCurrentSettings');
};

export const mockPostItemActions = (): void => {
cy.intercept(
{
method: HttpMethod.Post,
pathname: /\/api\/items\/[0-9a-fA-F-]{36}\/actions$/,
},
({ reply }) => {
reply([]);
},
).as('postItemActions');
};
3 changes: 1 addition & 2 deletions src/config/env.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
export const API_HOST =
import.meta.env.VITE_GRAASP_API_HOST ?? 'http://localhost:3000';

export const WS_HOST =
import.meta.env.VITE_GRAASP_WS_HOST ?? 'ws://localhost:3000';
export const WS_HOST = API_HOST.replace('http', 'ws');

export const SHOW_NOTIFICATIONS =
(import.meta.env.VITE_SHOW_NOTIFICATIONS ?? 'true') === 'true';
Expand Down
4 changes: 3 additions & 1 deletion src/config/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ i18n
// namespaces that will be loaded by default
ns: ['common'],
backend: {
loadPath: '/locales/{{lng}}/{{ns}}.json',
loadPath: `${
import.meta.env.VITE_BASE_URL ? '/client' : ''
}/locales/{{lng}}/{{ns}}.json`,
},
// specify which languages are supported
// 1. prefers exact match across all supported langs
Expand Down
14 changes: 6 additions & 8 deletions src/config/queryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { configureWebsocketClient } from '@graasp/sdk';

import { configureQueryClient } from '@/query';

import { API_HOST, SHOW_NOTIFICATIONS } from './env';
import { API_HOST, SHOW_NOTIFICATIONS, WS_HOST } from './env';
import notifier from './notifier';

export const WS_CLIENT = configureWebsocketClient(
`${API_HOST.replace('http', 'ws')}/ws`,
);
export const WS_CLIENT = configureWebsocketClient(WS_HOST);

const {
queryClient,
Expand All @@ -29,13 +27,13 @@ const {
wsClient: WS_CLIENT,
});
export {
useQueryClient,
axios,
hooks,
mutations,
queryClient,
QueryClientProvider,
hooks,
useMutation,
ReactQueryDevtools,
axios,
useMutation,
useQuery,
useQueryClient,
};
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const config = ({ mode }: { mode: string }): UserConfig => {
const shouldOpen = BROWSER && BROWSER !== 'none';

return defineConfig({
base: '/',
base: process.env.VITE_BASE_URL ? '/client' : '/',
server: {
port: PORT,
// whether we should open the url on start
Expand Down