solve error in Table mobile version

This commit is contained in:
Mateusz Tylka 2023-04-11 10:37:44 +02:00
parent 9455bcc6c3
commit acbcd41948
3 changed files with 44 additions and 43 deletions

View File

@ -6,7 +6,7 @@ import PropsTypes from 'prop-types';
import KeyCloakService from '../../services/KeyCloakService';
import { Link } from 'react-router-dom';
import {
MENU_CHALEENGE_SECTIONS_WITH_LOGIN,
MENU_CHALLENGE_SECTIONS_WITH_LOGIN,
MENU_CHALLENGE_SECTIONS_NO_LOGIN,
} from '../../utils/globals';
@ -45,7 +45,7 @@ const Option = styled(FlexColumn)`
const DesktopChallengeMenu = (props) => {
let options = MENU_CHALLENGE_SECTIONS_NO_LOGIN;
if (KeyCloakService.isLoggedIn())
options = MENU_CHALEENGE_SECTIONS_WITH_LOGIN;
options = MENU_CHALLENGE_SECTIONS_WITH_LOGIN;
return (
<DesktopChallengeMenuStyle>
{options.map((option, index) => {

View File

@ -6,7 +6,7 @@ import PropsTypes from 'prop-types';
import KeyCloakService from '../../services/KeyCloakService';
import {
CHALLENGE_SECTIONS,
MENU_CHALEENGE_SECTIONS_WITH_LOGIN,
MENU_CHALLENGE_SECTIONS_WITH_LOGIN,
MENU_CHALLENGE_SECTIONS_NO_LOGIN,
} from '../../utils/globals';
import { Link } from 'react-router-dom';
@ -25,45 +25,46 @@ const MenuOption = styled(Medium)`
const MobileChallengeMenu = (props) => {
let options = MENU_CHALLENGE_SECTIONS_NO_LOGIN;
if (KeyCloakService.isLoggedIn())
options = MENU_CHALEENGE_SECTIONS_WITH_LOGIN;
options = MENU_CHALLENGE_SECTIONS_WITH_LOGIN;
const renderLoggedOptions = () => {
return (
<FlexRow gap="36px">
<MenuOption
as={Link}
active={CHALLENGE_SECTIONS.HOW_TO === props.section}
to={`/challenge/${props.challengeName}/${options[
CHALLENGE_SECTIONS.HOW_TO
]
.toLowerCase()
.replace(' ', '')}`}
>
{options[CHALLENGE_SECTIONS.HOW_TO]}
</MenuOption>
<MenuOption
as={Link}
active={CHALLENGE_SECTIONS.MY_ENTRIES === props.section}
to={`/challenge/${props.challengeName}/${options[
CHALLENGE_SECTIONS.MY_ENTRIES
]
.toLowerCase()
.replace(' ', '')}`}
>
{options[CHALLENGE_SECTIONS.MY_ENTRIES]}
</MenuOption>
<MenuOption
as={Link}
active={CHALLENGE_SECTIONS.SUBMIT === props.section}
to={`/challenge/${props.challengeName}/${options[
CHALLENGE_SECTIONS.SUBMIT
]
.toLowerCase()
.replace(' ', '')}`}
>
{options[CHALLENGE_SECTIONS.SUBMIT]}
</MenuOption>
</FlexRow>
);
if (options === MENU_CHALLENGE_SECTIONS_WITH_LOGIN)
return (
<FlexRow gap="36px">
<MenuOption
as={Link}
active={CHALLENGE_SECTIONS.HOW_TO === props.section}
to={`/challenge/${props.challengeName}/${options[
CHALLENGE_SECTIONS.HOW_TO
]
.toLowerCase()
.replace(' ', '')}`}
>
{options[CHALLENGE_SECTIONS.HOW_TO]}
</MenuOption>
<MenuOption
as={Link}
active={CHALLENGE_SECTIONS.MY_ENTRIES === props.section}
to={`/challenge/${props.challengeName}/${options[
CHALLENGE_SECTIONS.MY_ENTRIES
]
.toLowerCase()
.replace(' ', '')}`}
>
{options[CHALLENGE_SECTIONS.MY_ENTRIES]}
</MenuOption>
<MenuOption
as={Link}
active={CHALLENGE_SECTIONS.SUBMIT === props.section}
to={`/challenge/${props.challengeName}/${options[
CHALLENGE_SECTIONS.SUBMIT
]
.toLowerCase()
.replace(' ', '')}`}
>
{options[CHALLENGE_SECTIONS.SUBMIT]}
</MenuOption>
</FlexRow>
);
};
return (
<>

View File

@ -24,7 +24,7 @@ const MENU_CHALLENGE_SECTIONS_NO_LOGIN = [
'Readme',
'How to',
];
const MENU_CHALEENGE_SECTIONS_WITH_LOGIN = [
const MENU_CHALLENGE_SECTIONS_WITH_LOGIN = [
'Leaderboard',
'All entries',
'Readme',
@ -112,7 +112,7 @@ export {
LOGIN_REQUIRED_PAGES,
CHALLENGE_SECTIONS,
MENU_CHALLENGE_SECTIONS_NO_LOGIN,
MENU_CHALEENGE_SECTIONS_WITH_LOGIN,
MENU_CHALLENGE_SECTIONS_WITH_LOGIN,
MINI_DESCRIPTION_RENDER,
RENDER_ICO,
CALC_PAGES,