Skip to content
Open
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
3 changes: 0 additions & 3 deletions src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ export const SHOW_NOTIFICATIONS =

export const APP_VERSION = import.meta.env.VITE_VERSION;

export const GRAASP_LIBRARY_HOST =
import.meta.env.VITE_GRAASP_LIBRARY_HOST ?? 'http://localhost:3005';

export const SENTRY_ENV = import.meta.env.VITE_SENTRY_ENV;
export const SENTRY_DSN = import.meta.env.VITE_SENTRY_DSN;
export const GRAASP_REDIRECTION_HOST = import.meta.env
Expand Down
10 changes: 1 addition & 9 deletions src/lib/ClientManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,7 @@ export class ClientManager {
qs: { [key: string]: string | number | boolean } = {},
) {
// make a copy of the host
let host = new URL(this.host.toString());
if (context === Context.Library) {
const libraryHost = this.clientHosts.get(context);
if (libraryHost) {
host = libraryHost;
} else {
throw new Error('Library host used before it was defined.');
}
}
const host = new URL(this.host.toString());
const prefix = this.getPrefix(context);
const url =
context === Context.Player
Expand Down
10 changes: 2 additions & 8 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ import { theme } from '@/ui/theme';

import { AuthProvider, useAuth } from './AuthContext';
import './app.css';
import {
APP_VERSION,
GRAASP_LIBRARY_HOST,
SENTRY_DSN,
SENTRY_ENV,
} from './config/env';
import { APP_VERSION, SENTRY_DSN, SENTRY_ENV } from './config/env';
import { QueryClientProvider, queryClient } from './config/queryClient';
import { ClientManager } from './lib/ClientManager';
import { routeTree } from './routeTree.gen';
Expand Down Expand Up @@ -64,8 +59,7 @@ const clientManager = ClientManager.getInstance();
clientManager.addPrefix(Context.Builder, '/builder/items');
clientManager.addPrefix(Context.Analytics, '/analytics/items');
clientManager.addPrefix(Context.Player, '/player');
clientManager.addHost(Context.Library, new URL(GRAASP_LIBRARY_HOST));
clientManager.addPrefix(Context.Library, '/collections');
clientManager.addPrefix(Context.Library, '/library/collections');

// Set up a Router instance
const router = createRouter({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { useAuth } from '@/AuthContext';
import { BorderedSection } from '@/components/layout/BorderedSection';
import { Button } from '@/components/ui/Button';
import { NS } from '@/config/constants';
import { GRAASP_LIBRARY_HOST } from '@/config/env';
import {
PUBLIC_PROFILE_BIO_ID,
PUBLIC_PROFILE_SAVE_BUTTON_ID,
Expand Down Expand Up @@ -99,9 +98,7 @@ export function EditPublicProfile({
<BorderedSection title={t('TITLE')}>
<Typography variant="body1">{t('DESCRIPTION')}</Typography>
{profile && user && (
<a href={`${GRAASP_LIBRARY_HOST}/members/${user.id}`}>
{t('CHECK_TEXT')}
</a>
<a href={`/library/members/${user.id}`}>{t('CHECK_TEXT')}</a>
)}

<Stack
Expand Down
3 changes: 1 addition & 2 deletions src/modules/analytics/PageWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { getRouteApi } from '@tanstack/react-router';

import { HeaderRightContent } from '@/components/ui/HeaderRightContent';
import { NS } from '@/config/constants';
import { GRAASP_LIBRARY_HOST } from '@/config/env';
import { HomeHeaderLink } from '@/ui/Main/HomeHeaderLink';
import Main from '@/ui/Main/Main';
import PlatformSwitch from '@/ui/PlatformSwitch/PlatformSwitch';
Expand Down Expand Up @@ -41,7 +40,7 @@ export function PageWrapper({
href: `/player/${itemId}/${itemId}`,
},
[Platform.Library]: {
href: GRAASP_LIBRARY_HOST,
href: `/library`,
},
[Platform.Analytics]: {
disabled: true,
Expand Down
16 changes: 10 additions & 6 deletions src/modules/builder/components/pages/home/LibraryCard.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { useTranslation } from 'react-i18next';

import { Stack, Typography, useMediaQuery, useTheme } from '@mui/material';
import {
Button,
Stack,
Typography,
useMediaQuery,
useTheme,
} from '@mui/material';

import { ArrowRightIcon } from 'lucide-react';

import { ButtonLink } from '@/components/ui/ButtonLink';
import { NS } from '@/config/constants';
import { GRAASP_LIBRARY_HOST } from '@/config/env';
import LibraryIcon from '@/ui/icons/LibraryIcon';
import { AccentColors } from '@/ui/theme';

Expand Down Expand Up @@ -38,14 +42,14 @@ function LibraryCard() {
<LibraryIcon primaryColor="white" />
</Stack>
<Typography color="white">{t('SUBTITLE')}</Typography>
<ButtonLink
<Button
sx={{ background: 'white', color: AccentColors.library }}
variant="contained"
endIcon={<ArrowRightIcon size={20} />}
to={GRAASP_LIBRARY_HOST}
href="/library"
>
{t('BUTTON_TEXT')}
</ButtonLink>
</Button>
</Stack>
</Stack>
</Stack>
Expand Down
7 changes: 3 additions & 4 deletions src/modules/landing/aboutUs/PresentationVideoSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Stack, Typography } from '@mui/material';
import { Button } from '@/components/ui/Button';
import { ButtonLink } from '@/components/ui/ButtonLink';
import { NS } from '@/config/constants';
import { GRAASP_LIBRARY_HOST } from '@/config/env';

function PresentationVideoSection() {
const { t } = useTranslation(NS.Landing, {
Expand Down Expand Up @@ -36,9 +35,9 @@ function PresentationVideoSection() {
<ButtonLink variant="contained" to="/auth/register">
{t('JOIN_BUTTON_TEXT')}
</ButtonLink>
<a href={GRAASP_LIBRARY_HOST}>
<Button color="secondary">{t('LIBRARY_BUTTON_TEXT')}</Button>
</a>
<Button variant="contained" href="/library" color="secondary">
{t('LIBRARY_BUTTON_TEXT')}
</Button>
</Stack>
</Stack>
);
Expand Down
10 changes: 2 additions & 8 deletions src/modules/landing/header/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { useTranslation } from 'react-i18next';

import { Stack } from '@mui/material';
import { Button, Stack } from '@mui/material';

import { ButtonLink } from '@/components/ui/ButtonLink';
import { NS } from '@/config/constants';
import { GRAASP_LIBRARY_HOST } from '@/config/env';

export function Menu() {
const { t } = useTranslation(NS.Landing, { keyPrefix: 'NAVBAR' });
Expand All @@ -16,12 +15,7 @@ export function Menu() {
<ButtonLink activeProps={() => ({ fontWeight: 'bold' })} to="/support">
{t('GETTING_STARTED')}
</ButtonLink>
<ButtonLink
activeProps={() => ({ fontWeight: 'bold' })}
to={GRAASP_LIBRARY_HOST}
>
{t('LIBRARY')}
</ButtonLink>
<Button href="/library">{t('LIBRARY')}</Button>
<ButtonLink activeProps={() => ({ fontWeight: 'bold' })} to="/about-us">
{t('ABOUT_US')}
</ButtonLink>
Expand Down
11 changes: 3 additions & 8 deletions src/modules/landing/header/MobileMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import type { MouseEvent } from 'react';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';

import { Divider, IconButton } from '@mui/material';
import { Divider, IconButton, MenuItem } from '@mui/material';
import Menu from '@mui/material/Menu';

import { MenuIcon } from 'lucide-react';

import { MenuItemLink } from '@/components/ui/MenuItemLink';
import { NS } from '@/config/constants';
import { GRAASP_LIBRARY_HOST } from '@/config/env';

import useUserMenu from './useUserMenu';

Expand Down Expand Up @@ -92,13 +91,9 @@ export function MobileMenu() {
>
{t('GETTING_STARTED')}
</MenuItemLink>
<MenuItemLink
activeProps={() => ({ selected: true })}
to={GRAASP_LIBRARY_HOST}
onClick={handleClose}
>
<MenuItem href="/library" onClick={handleClose}>
{t('LIBRARY')}
</MenuItemLink>
</MenuItem>
<MenuItemLink
activeProps={() => ({ selected: true })}
to="/about-us"
Expand Down
21 changes: 9 additions & 12 deletions src/modules/landing/home/messages/MessageLibrary.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { Trans, useTranslation } from 'react-i18next';

import {
Button,
Grid,
Stack,
Typography,
useMediaQuery,
useTheme,
} from '@mui/material';

import { ButtonLink } from '@/components/ui/ButtonLink';
import { NS } from '@/config/constants';
import { GRAASP_LIBRARY_HOST } from '@/config/env';

import { Message } from '../Message';
import { UserCapsuleExample } from '../UserCapsuleExample';
Expand Down Expand Up @@ -41,33 +40,31 @@ function MessageLibrary() {
/>
</Typography>
<Stack direction="row" gap={2}>
<ButtonLink
to={GRAASP_LIBRARY_HOST}
<Button
href="/library"
sx={{
// make button take only needed space
width: 'fit-content',
}}
color="primary"
variant="contained"
dataUmamiEvent="messages-library-button"
data-umami-event="messages-library-button"
>
{t('LIBRARY_BUTTON_TEXT')}
</ButtonLink>
</Button>
{isSmUp && (
<ButtonLink
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
to={`${GRAASP_LIBRARY_HOST}/oer`}
<Button
href="/library/oer"
sx={{
// make button take only needed space
width: 'fit-content',
}}
color="secondary"
variant="contained"
dataUmamiEvent="messages-library-oer-button"
data-umami-event="messages-library-oer-button"
>
{t('OER_BUTTON_TEXT')}
</ButtonLink>
</Button>
)}
</Stack>
</Message>
Expand Down
3 changes: 1 addition & 2 deletions src/routes/builder/items/$itemId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { ButtonLink } from '@/components/ui/ButtonLink';
import { HeaderRightContent } from '@/components/ui/HeaderRightContent';
import { MainMenuItem } from '@/components/ui/MainMenuItem';
import { NS } from '@/config/constants';
import { GRAASP_LIBRARY_HOST } from '@/config/env';
import { hooks, mutations } from '@/config/queryClient';
import {
APP_NAVIGATION_PLATFORM_SWITCH_ID,
Expand Down Expand Up @@ -108,7 +107,7 @@ function RouteComponent() {
href: `/player/${itemId}/${itemId}`,
},
[Platform.Library]: {
href: GRAASP_LIBRARY_HOST,
href: `/library`,
},
[Platform.Analytics]: {
href: `/analytics/items/${itemId}`,
Expand Down
3 changes: 1 addition & 2 deletions src/routes/player/$rootId/$itemId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { ItemNavigation } from '@/components/tree/ItemNavigation';
import { CustomLink } from '@/components/ui/CustomLink';
import { HeaderRightContent } from '@/components/ui/HeaderRightContent';
import { NS } from '@/config/constants';
import { GRAASP_LIBRARY_HOST } from '@/config/env';
import { hooks } from '@/config/queryClient';
import Main from '@/ui/Main/Main';
import PlatformSwitch from '@/ui/PlatformSwitch/PlatformSwitch';
Expand Down Expand Up @@ -62,7 +61,7 @@ function PlayerWrapper(): JSX.Element {
href: '/player',
},
[Platform.Library]: {
href: GRAASP_LIBRARY_HOST,
href: '/library',
},
[Platform.Analytics]: {
href: `/analytics/items/${itemId}`,
Expand Down
Loading