popup messege to log in in HowTo

This commit is contained in:
Mateusz Tylka 2023-02-24 14:52:23 +01:00
parent 6a4c9f00d9
commit 0364f78182
3 changed files with 23 additions and 4 deletions

View File

@ -116,7 +116,12 @@ const App = () => {
/>
<Route
path={`${CHALLENGE_PAGE}/:challengeId/howto`}
element={<Challenge section={2} />}
element={
<Challenge
popUpMessageHandler={popUpMessageHandler}
section={2}
/>
}
/>
<Route
path={`${CHALLENGE_PAGE}/:challengeId/myentries`}

View File

@ -48,7 +48,13 @@ const Challenge = (props) => {
/>
);
case 2:
return <HowTo challengeName={challengeName} user={user} />;
return (
<HowTo
popUpMessageHandler={props.popUpMessageHandler}
challengeName={challengeName}
user={user}
/>
);
case 3:
return <MyEntries challengeName={challengeName} />;
case 4:

View File

@ -1,16 +1,24 @@
import React from 'react';
import getFullUser from '../../../api/getFullUserInfo';
import KeyCloakService from '../../../services/KeyCloakService';
import { FlexColumn } from '../../../utils/containers';
import { IS_MOBILE } from '../../../utils/globals';
import HowToContent from './sections/HowToContent';
const HowTo = (props) => {
const [userFullInfo, setUserFullInfo] = React.useState(null);
// const [loading, setLoading] = React.useState(true);
React.useEffect(() => {
getFullUser(setUserFullInfo);
}, []);
if (!KeyCloakService.isLoggedIn()) {
props.popUpMessageHandler(
'Please log in',
'To see everything you must log in',
() => KeyCloakService.doLogin
);
}
}, [props]);
return (
<FlexColumn