From fed6c1592118a11731d1ab9c9ab2c7c07b5c235b Mon Sep 17 00:00:00 2001 From: Mateusz Tylka Date: Tue, 7 Feb 2023 14:28:30 +0100 Subject: [PATCH] PopUpMessage reminder for register --- src/App.js | 29 ++++- src/components/auth/AuthHeader.js | 79 ------------- src/components/auth/AuthInput.js | 47 -------- src/components/auth/AuthOption.js | 58 --------- src/components/content_sections/Hero.js | 131 ++++++++++++--------- src/components/generic/Button.js | 2 +- src/components/generic/PopupMessage.js | 57 +++++---- src/components/navigation/MobileNavMenu.js | 12 +- src/components/navigation/NavBar/NavBar.js | 9 +- src/pages/LandingPage.js | 30 ++--- 10 files changed, 170 insertions(+), 284 deletions(-) delete mode 100644 src/components/auth/AuthHeader.js delete mode 100644 src/components/auth/AuthInput.js delete mode 100644 src/components/auth/AuthOption.js diff --git a/src/App.js b/src/App.js index 4686be2..669c7e5 100644 --- a/src/App.js +++ b/src/App.js @@ -25,6 +25,8 @@ const App = () => { const [loggedBarHover, setLoggedBarHover] = React.useState(false); const [popUpHeader, setPopUpHeader] = React.useState(''); const [popUpMessage, setPopUpMessage] = React.useState(''); + const [confirmPopUpHandler, setConfirmPopUpHandler] = React.useState(null); + React.useEffect(() => { if (sessionStorage.getItem('logged') !== 'yes') { if (KeyCloakService.isLoggedIn()) { @@ -42,9 +44,14 @@ const App = () => { }, 1500); }); - const popUpMessageHandler = (header, message) => { + const popUpMessageHandler = (header, message, confirmHandler) => { setPopUpHeader(header); setPopUpMessage(message); + if (confirmHandler !== null) { + setConfirmPopUpHandler(() => confirmHandler()); + } else { + setConfirmPopUpHandler(null); + } }; const popUpMessageRender = () => { @@ -53,6 +60,7 @@ const App = () => { ); @@ -78,7 +86,10 @@ const App = () => { {popUpMessageRender()} - + {!IS_MOBILE() ? ( { ) : ( <> - } /> - } /> + + } + /> + + } + /> )} diff --git a/src/components/auth/AuthHeader.js b/src/components/auth/AuthHeader.js deleted file mode 100644 index 04f43ad..0000000 --- a/src/components/auth/AuthHeader.js +++ /dev/null @@ -1,79 +0,0 @@ -import React from 'react'; -import {FlexRow} from '../../utils/containers'; -import styled from 'styled-components'; -import {H3} from '../../utils/fonts'; -import {Link} from 'react-router-dom'; -import PropsTypes from 'prop-types'; - -const AuthHeaderStyle = styled(FlexRow)` - border-width: 1px 1px 0 1px; - border-style: solid; - border-color: ${({theme}) => theme.colors.dark03}; - width: 260px; - height: 48px; - justify-content: flex-start; - gap: 24px; - padding: 0 20px; - box-shadow: ${({theme}) => theme.authHeaderShadow}; - - @media (min-width: ${({theme}) => theme.overMobile}) { - justify-content: space-around; - width: 400px; - height: 80px; - } - - h1 { - color: ${({theme}) => theme.colors.green}; - } - - a { - font-family: 'Kanit', sans-serif; - font-weight: 400; - font-size: 18px; - line-height: 22px; - color: ${({theme}) => theme.colors.dark}; - text-decoration: none; - transition: color 0.3s ease-in-out; - - &:hover { - color: ${({theme}) => theme.colors.green}; - } - - @media (min-width: ${({theme}) => theme.overMobile}) { - font-size: 24px; - line-height: 26px; - } - } -`; - -const AuthHeader = (props) => { - if (props.register) { - return ( - -

- Register -

- - Sign in - -
- ); - } else { - return ( - -

- Sign in -

- - Register - -
- ); - } -}; - -AuthHeader.propTypes = { - register: PropsTypes.bool.isRequired, -}; - -export default AuthHeader; \ No newline at end of file diff --git a/src/components/auth/AuthInput.js b/src/components/auth/AuthInput.js deleted file mode 100644 index 9578e16..0000000 --- a/src/components/auth/AuthInput.js +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; -import {FlexColumn, FlexRow} from '../../utils/containers'; -import styled from 'styled-components'; -import {Medium} from '../../utils/fonts'; - -const AuthInputStyle = styled(Medium)` - width: 188px; - height: 36px; - padding: 4px; - border: 1px solid ${({theme}) => theme.colors.dark05}; - - @media (min-width: ${({theme}) => theme.overMobile}) { - width: 310px; - height: 52px; - padding: 8px; - } -`; - -const AuthLabel = styled(FlexRow)` - position: absolute; - top: -10px; - left: 14px; - background-color: ${({theme}) => theme.colors.white}; - font-size: 10px; - font-family: 'Roboto', sans-serif; - font-weight: 400; - padding: 4px; - z-index: 2; - - @media (min-width: ${({theme}) => theme.overMobile}) { - font-size: 16px; - top: -14px; - } -`; - -const AuthInput = (props) => { - return ( - - - {props.label} - - - - ); -}; - -export default AuthInput; \ No newline at end of file diff --git a/src/components/auth/AuthOption.js b/src/components/auth/AuthOption.js deleted file mode 100644 index ed6d811..0000000 --- a/src/components/auth/AuthOption.js +++ /dev/null @@ -1,58 +0,0 @@ -import React from 'react'; -import {FlexRow, Svg} from '../../utils/containers'; -import theme from '../../utils/theme'; -import PropsTypes from 'prop-types'; -import {Body} from '../../utils/fonts'; -import styled from 'styled-components'; -import {Link} from 'react-router-dom'; - -const AuthOptionStyle = styled(FlexRow)` - gap: 16px; - padding: 10px 12px; - min-width: 180px; - justify-content: flex-start; - border: 1px solid ${({theme}) => theme.colors.dark03}; - box-shadow: ${({theme}) => theme.shadow}; - cursor: pointer; - transition: transform 0.3s ease-in-out; - - * { - cursor: pointer; - } - - &:hover { - transform: scale(1.05); - } - - @media (min-width: ${({theme}) => theme.overMobile}) { - width: 260px; - height: 50px; - padding: 10px 24px; - gap: 40px; - } -`; - -const AuthOption = (props) => { - return ( - - - - {props.children} - - - ); -}; - -AuthOption.propTypes = { - children: PropsTypes.node, - icon: PropsTypes.string, - to: PropsTypes.string, -}; - -AuthOption.defaultProps = { - children: '', - icon: '', - to: '#' -}; - -export default AuthOption; \ No newline at end of file diff --git a/src/components/content_sections/Hero.js b/src/components/content_sections/Hero.js index ff193dc..79fb0d7 100644 --- a/src/components/content_sections/Hero.js +++ b/src/components/content_sections/Hero.js @@ -1,6 +1,6 @@ import React from 'react'; -import {Body, H1, Medium} from '../../utils/fonts'; -import {Container, FlexColumn, FlexRow, Svg} from '../../utils/containers'; +import { Body, H1, Medium } from '../../utils/fonts'; +import { Container, FlexColumn, FlexRow, Svg } from '../../utils/containers'; import theme from '../../utils/theme'; import ButtonLink from '../generic/ButtonLink'; import Media from 'react-media'; @@ -13,62 +13,81 @@ const TitleParagraph = styled(Medium)` line-height: 28px; `; -const mobileRender = () => { +const Hero = (props) => { + const mobileRender = () => { return ( - -

- Welcome to - -  Gonito! - -

- - A data challenge platform for machine learning research, - competition, cooperation and reproducibility. - - - Join us! + +

+ Welcome to + +  Gonito! + +

+ + A data challenge platform for machine learning research, competition, + cooperation and reproducibility. + + + props.popUpMessageHandler( + 'Reminder', + 'Remember to check your spam mailbox to confirm your account.', + () => KeyCloakService.doRegister + ) + } + > + Join us! + +
+ ); + }; + + const desktopRender = () => { + return ( + +

+ Welcome to + +  Gonito! + +

+ + + + A data challenge platform for machine learning research, + competition, cooperation and reproducibility. + + + props.popUpMessageHandler( + 'Reminder', + 'Remember to check your spam mailbox to confirm your account.', + () => KeyCloakService.doRegister + ) + } + > + Join us! -
+ + + +
); + }; + return ( + <> + {mobileRender()} + {desktopRender()} + + ); }; -const desktopRender = () => { - return ( - -

- Welcome to - -  Gonito! - -

- - - - A data challenge platform for machine learning research, - competition, cooperation and reproducibility. - - - Join us! - - - - -
- ); -}; - -const Hero = () => { - return ( - <> - - {mobileRender()} - - - {desktopRender()} - - - ); -}; - -export default Hero; \ No newline at end of file +export default Hero; diff --git a/src/components/generic/Button.js b/src/components/generic/Button.js index ec37de9..706c4a8 100644 --- a/src/components/generic/Button.js +++ b/src/components/generic/Button.js @@ -30,7 +30,7 @@ const Button = (props) => { return ( props.handler()} width={props.width} height={props.height} color={props.color} diff --git a/src/components/generic/PopupMessage.js b/src/components/generic/PopupMessage.js index 9154407..70afe87 100644 --- a/src/components/generic/PopupMessage.js +++ b/src/components/generic/PopupMessage.js @@ -1,30 +1,43 @@ import React from 'react'; -import {FlexColumn} from '../../utils/containers'; +import { FlexColumn } from '../../utils/containers'; import theme from '../../utils/theme'; -import {Body, H3} from '../../utils/fonts'; +import { Body, H3 } from '../../utils/fonts'; import Button from './Button'; - const PopupMessage = (props) => { - return ( - - - -

- {props.header} -

- - {props.message} - -
- -
+ const confirmPopUp = () => { + if (props.confirmHandler) { + props.confirmHandler(); + } + props.popUpMessageHandler('', ''); + }; + + return ( + + + +

{props.header}

+ {props.message}
- ); + +
+
+ ); }; -export default PopupMessage; \ No newline at end of file +export default PopupMessage; diff --git a/src/components/navigation/MobileNavMenu.js b/src/components/navigation/MobileNavMenu.js index aacbcd8..8c8a06e 100644 --- a/src/components/navigation/MobileNavMenu.js +++ b/src/components/navigation/MobileNavMenu.js @@ -73,7 +73,17 @@ const MobileNavMenu = (props) => { Privacy policy {!KeyCloakService.isLoggedIn() ? ( - + + props.popUpMessageHandler( + 'Reminder', + 'Remember to check your spam mailbox to confirm your account.', + () => KeyCloakService.doRegister + ) + } + gap="16px" + > Register diff --git a/src/components/navigation/NavBar/NavBar.js b/src/components/navigation/NavBar/NavBar.js index 2dd0a55..fd992ca 100644 --- a/src/components/navigation/NavBar/NavBar.js +++ b/src/components/navigation/NavBar/NavBar.js @@ -65,7 +65,13 @@ const NavBar = (props) => { {!KeyCloakService.isLoggedIn() ? ( + props.popUpMessageHandler( + 'Reminder', + 'Remember to check your spam mailbox to confirm your account.', + () => KeyCloakService.doRegister + ) + } gap="16px" > @@ -96,6 +102,7 @@ const NavBar = (props) => { mobileMenuHoverFalse={mobileMenuHoverFalse} translateY={navMenuTranslateY} toggleNavMenu={toggleNavMenu} + popUpMessageHandler={props.popUpMessageHandler} /> ); diff --git a/src/pages/LandingPage.js b/src/pages/LandingPage.js index c5c444d..805a6ff 100644 --- a/src/pages/LandingPage.js +++ b/src/pages/LandingPage.js @@ -1,5 +1,5 @@ import React from 'react'; -import {FlexColumn} from '../utils/containers'; +import { FlexColumn } from '../utils/containers'; import Motivation from '../components/content_sections/Motivation'; import Csi from '../components/content_sections/Csi'; import Commercial from '../components/content_sections/Commercial'; @@ -19,7 +19,7 @@ const LandingPageStyle = styled(FlexColumn)` width: 80%; } - @media (min-width: ${({theme}) => theme.overMobile}) { + @media (min-width: ${({ theme }) => theme.overMobile}) { padding: 172px 0 124px; .main-container { @@ -29,18 +29,18 @@ const LandingPageStyle = styled(FlexColumn)` } `; -const LandingPage = () => { - return ( - - - - - - - - - - ); +const LandingPage = (props) => { + return ( + + + + + + + + + + ); }; -export default LandingPage; \ No newline at end of file +export default LandingPage;