diff --git a/.env b/.env index be54f10..9a7fd9a 100644 --- a/.env +++ b/.env @@ -2,4 +2,4 @@ REACT_APP_KC_URL=https://auth-dev.csi.wmi.amu.edu.pl/ REACT_APP_KC_REALM=gonito-dev REACT_APP_KC_CLIENT_ID=gonito-dev-localhost -REACT_APP_API=https://gonito.net/api \ No newline at end of file +REACT_APP_API=https://gonito-back-dev.csi.wmi.amu.edu.pl/api \ No newline at end of file diff --git a/src/components/specific_challenge/DesktopChallengeMenu.js b/src/components/specific_challenge/DesktopChallengeMenu.js index 44dc769..3811160 100644 --- a/src/components/specific_challenge/DesktopChallengeMenu.js +++ b/src/components/specific_challenge/DesktopChallengeMenu.js @@ -5,6 +5,10 @@ import { H3 } from '../../utils/fonts'; 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_NO_LOGIN, +} from '../../utils/globals'; const DesktopChallengeMenuStyle = styled(FlexColumn)` justify-content: flex-start; @@ -39,16 +43,9 @@ const Option = styled(FlexColumn)` `; const DesktopChallengeMenu = (props) => { - let options = ['Leaderboard', 'All entries', 'Readme', 'How to']; + let options = MENU_CHALLENGE_SECTIONS_NO_LOGIN; if (KeyCloakService.isLoggedIn()) - options = [ - 'Leaderboard', - 'All entries', - 'Readme', - 'How to', - 'My entries', - 'Submit', - ]; + options = MENU_CHALEENGE_SECTIONS_WITH_LOGIN; return ( {options.map((option, index) => { diff --git a/src/components/specific_challenge/MobileChallengeMenu.js b/src/components/specific_challenge/MobileChallengeMenu.js index 9393483..549a4d6 100644 --- a/src/components/specific_challenge/MobileChallengeMenu.js +++ b/src/components/specific_challenge/MobileChallengeMenu.js @@ -4,6 +4,12 @@ import styled from 'styled-components'; import { Medium } from '../../utils/fonts'; import PropsTypes from 'prop-types'; import KeyCloakService from '../../services/KeyCloakService'; +import { + CHALLENGE_SECTIONS, + MENU_CHALEENGE_SECTIONS_WITH_LOGIN, + MENU_CHALLENGE_SECTIONS_NO_LOGIN, +} from '../../utils/globals'; +import { Link } from 'react-router-dom'; const MenuOption = styled(Medium)` cursor: pointer; @@ -17,54 +23,83 @@ const MenuOption = styled(Medium)` `; const MobileChallengeMenu = (props) => { - let options = ['Leaderboard', 'Readme', 'How to']; + let options = MENU_CHALLENGE_SECTIONS_NO_LOGIN; if (KeyCloakService.isLoggedIn()) - options = ['Leaderboard', 'Readme', 'How to', 'My entries', 'Submit']; + options = MENU_CHALEENGE_SECTIONS_WITH_LOGIN; const renderLoggedOptions = () => { - if (options.length > 3) { - return ( - - - {options[3]} - - - {options[4]} - - - ); - } + return ( + + + {options[CHALLENGE_SECTIONS.HOW_TO]} + + + {options[CHALLENGE_SECTIONS.MY_ENTRIES]} + + + {options[CHALLENGE_SECTIONS.SUBMIT]} + + + ); }; return ( <> - {options[0]} + {options[CHALLENGE_SECTIONS.LEADERBOARD]} - {options[1]} + {options[CHALLENGE_SECTIONS.ALL_ENTRIES]} - {options[2]} + {options[CHALLENGE_SECTIONS.README]} {renderLoggedOptions()} diff --git a/src/components/specific_challenge/MyEntries/MyEntries.js b/src/components/specific_challenge/MyEntries/MyEntries.js index c6b740a..c9e575b 100644 --- a/src/components/specific_challenge/MyEntries/MyEntries.js +++ b/src/components/specific_challenge/MyEntries/MyEntries.js @@ -132,6 +132,27 @@ const MyEntries = (props) => { {!loading ? ( <> + { format: EVALUATIONS_FORMAT, order: 2, align: 'left', - mobileRender, }} pageNr={pageNr} elements={myEntries} diff --git a/src/utils/globals.js b/src/utils/globals.js index a408516..44dbb91 100644 --- a/src/utils/globals.js +++ b/src/utils/globals.js @@ -18,6 +18,21 @@ const ROOT_URL = window.location.origin; const LOGIN_REQUIRED_PAGES = ['myentries', 'submit']; +const MENU_CHALLENGE_SECTIONS_NO_LOGIN = [ + 'Leaderboard', + 'All entries', + 'Readme', + 'How to', +]; +const MENU_CHALEENGE_SECTIONS_WITH_LOGIN = [ + 'Leaderboard', + 'All entries', + 'Readme', + 'How to', + 'My entries', + 'Submit', +]; + const CHALLENGE_SECTIONS = { LEADERBOARD: 0, ALL_ENTRIES: 1, @@ -96,6 +111,8 @@ export { ROOT_URL, LOGIN_REQUIRED_PAGES, CHALLENGE_SECTIONS, + MENU_CHALLENGE_SECTIONS_NO_LOGIN, + MENU_CHALEENGE_SECTIONS_WITH_LOGIN, MINI_DESCRIPTION_RENDER, RENDER_ICO, CALC_PAGES,