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: 3 additions & 0 deletions src/AppContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { RootState } from './state/rootReducer';
import { LMSParametersName } from './types/LMSParameters';
import { getPackedUrlCurrentPathForFeideLogin } from './utils/rewriteSearchParams';
import BackButton from './components/BackButton';
import { Alert } from '@mui/material';

const StyledApp = styled.div`
min-height: 100vh;
Expand Down Expand Up @@ -52,6 +53,8 @@ const AppContent: FC<LMSServiceProps> = ({ mainContentRef, userError }) => {
{navbar ? <Header /> : <BackButton />}
{userError && <ErrorBanner error={userError} />}
<StyledContent tabIndex={-1} ref={mainContentRef} role="main" id="content">
<br />
<Alert severity="info">{t('explanation_text.disabled_create_resource_button')}</Alert>
<AppRoutes />
</StyledContent>
{footer && <Footer />}
Expand Down
47 changes: 31 additions & 16 deletions src/layout/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import LoginButton from './LoginButton';
import Logo from './Logo';
import styled from 'styled-components';
import { Button, IconButton, Typography, useMediaQuery } from '@mui/material';
import { Button, IconButton, Tooltip, Typography, useMediaQuery } from '@mui/material';
import { Link, Link as RouterLink } from 'react-router-dom';
import MenuIcon from '@mui/icons-material/Menu';
import { useSelector } from 'react-redux';
Expand Down Expand Up @@ -50,6 +50,11 @@ const StyledLanguageButtonUserIsNotLoggedInVariant = styled.div`
justify-content: flex-end;
`;

const StyledDisabledButton = styled.div`
cursor: not-allowed;
opacity: 0.5;
`;

const Header = () => {
const user = useSelector((state: RootState) => state.user);
const { t } = useTranslation();
Expand Down Expand Up @@ -83,13 +88,18 @@ const Header = () => {
open={Boolean(anchorEl)}
onClose={handleBurgerMenuClose}>
{user.id && (
<MenuItem
onClick={handleBurgerMenuClose}
component={Link}
to={generateNewUrlAndRetainLMSParams('/registration')}>
<AddIcon />
<Typography variant="button">{t('resource.new_registration')}</Typography>
</MenuItem>
<Tooltip title={t('explanation_text.disabled_create_resource_button')} placement="right">
<StyledDisabledButton>
<MenuItem
onClick={handleBurgerMenuClose}
component={Link}
to={generateNewUrlAndRetainLMSParams('/registration')}
disabled>
<AddIcon />
<Typography variant="button">{t('resource.new_registration')}</Typography>
</MenuItem>
</StyledDisabledButton>
</Tooltip>
)}
{user.id && (
<MenuItem
Expand Down Expand Up @@ -133,14 +143,19 @@ const Header = () => {

{!isMediumOrSmallerScreen && user.id && (
<>
<Button
color="neutral"
component={RouterLink}
data-testid="new-registration-link"
to={generateNewUrlAndRetainLMSParams('/registration')}
startIcon={<AddIcon />}>
<Typography variant="button">{t('resource.new_registration')}</Typography>
</Button>
<Tooltip title={t('explanation_text.disabled_create_resource_button')}>
<StyledDisabledButton>
<Button
color="neutral"
component={RouterLink}
data-testid="new-registration-link"
to={generateNewUrlAndRetainLMSParams('/registration')}
startIcon={<AddIcon />}
disabled>
<Typography variant="button">{t('resource.new_registration')}</Typography>
</Button>
</StyledDisabledButton>
</Tooltip>

<Button
color="neutral"
Expand Down
1 change: 1 addition & 0 deletions src/translations/translations_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
"description_helper_example3": "Illustration sketch of the body's internal organs. The illustration shows the position of the organs in relation to each other",
"description_helper_text1": "Provide a short description about your resource content",
"description_helper_text2": "Description examples",
"disabled_create_resource_button": "DLR is closed for new uploads as the service is being shut down.",
"file_title_helper_aria_label": "Show file title explanation",
"file_title_helper_example1": "\"Orange blossoms on tree\" is a better file title than \"img_23434.jpg\"",
"file_title_helper_example2": "The filename \"thesis.pdf\" can be used as file title",
Expand Down
1 change: 1 addition & 0 deletions src/translations/translations_NO.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
"description_helper_example3": "Illustrasjonstegning av kroppens indre organer. Ilustrasjonen viser posisjonen til organene i forhold til hverandre",
"description_helper_text1": "Gi en kort beskrivelse av hva ressursen inneholder",
"description_helper_text2": "Eksempler på beskrivelser",
"disabled_create_resource_button": "DLR er stengt for opplastning av nytt innhold da tjenesten skal legges ned.",
"file_title_helper_aria_label": "Vis filtittel forklaring",
"file_title_helper_example1": "\"Appelsinblomster på tre\" som filtittel er bedre enn \"img_23434.jpg\"",
"file_title_helper_example2": "Filnavnet \"thesis.pdf\" kan godt også brukes som filtittel",
Expand Down