From 987b2efd5a2152e1b10d1085270a10afde2a93e2 Mon Sep 17 00:00:00 2001 From: Andrey Zhavoronkov Date: Wed, 18 Aug 2021 15:18:55 +0300 Subject: [PATCH] Added footer with cookie notice (#3553) * added footer * updated license headers * version++ * fixed eslint issues * Update cvat-ui/src/components/login-page/intel-footer-drawer.tsx Co-authored-by: Boris Sekachev * Update cvat-ui/src/components/login-page/intel-footer-drawer.tsx Co-authored-by: Boris Sekachev * Update cvat-ui/src/components/login-page/intel-footer-drawer.tsx Co-authored-by: Boris Sekachev * fixed comments * minor fix * fixed linter Co-authored-by: Boris Sekachev --- cvat-ui/package-lock.json | 2 +- cvat-ui/package.json | 2 +- .../login-page/cookie-policy-drawer.tsx | 49 ------------- .../login-page/intel-footer-drawer.tsx | 27 +++++++ .../src/components/login-page/login-page.tsx | 60 +++++++++------- .../register-page/register-page.tsx | 70 ++++++++++--------- .../reset-password-confirm-page.tsx | 43 +++++++----- .../reset-password-page.tsx | 44 +++++++----- cvat-ui/src/consts.ts | 6 ++ cvat-ui/src/utils/enviroment.ts | 2 +- 10 files changed, 158 insertions(+), 147 deletions(-) delete mode 100644 cvat-ui/src/components/login-page/cookie-policy-drawer.tsx create mode 100644 cvat-ui/src/components/login-page/intel-footer-drawer.tsx diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 496f22e7d357..0fa568b5d88c 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.23.0", + "version": "1.23.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 4bbffd0cc03f..577a27307770 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.23.0", + "version": "1.23.1", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/components/login-page/cookie-policy-drawer.tsx b/cvat-ui/src/components/login-page/cookie-policy-drawer.tsx deleted file mode 100644 index f1c6238bdb07..000000000000 --- a/cvat-ui/src/components/login-page/cookie-policy-drawer.tsx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2020 Intel Corporation -// -// SPDX-License-Identifier: MIT - -import React, { useState, useEffect } from 'react'; -import Drawer from 'antd/lib/drawer'; -import Paragraph from 'antd/lib/typography/Paragraph'; -import Button from 'antd/lib/button/button'; - -import { isPublic } from 'utils/enviroment'; - -function CookieDrawer(): JSX.Element { - const [drawerVisible, setDrawerVisible] = useState(false); - - useEffect(() => { - const cookiePolicyAccepted = localStorage.getItem('cookiePolicyAccepted'); - if (cookiePolicyAccepted === null && isPublic()) { - setDrawerVisible(true); - } - }, []); - - const onClose = (): void => { - localStorage.setItem('cookiePolicyAccepted', 'true'); - setDrawerVisible(false); - }; - - return ( - - - This site uses cookies for functionality, analytics, and advertising purposes as described in our Cookie - and Similar Technologies Notice. To see what cookies we serve and set your preferences, please visit our - Cookie Consent Tool. By continuing to use our website, you - agree to our use of cookies. - - - - ); -} - -export default CookieDrawer; diff --git a/cvat-ui/src/components/login-page/intel-footer-drawer.tsx b/cvat-ui/src/components/login-page/intel-footer-drawer.tsx new file mode 100644 index 000000000000..2d14e4577fad --- /dev/null +++ b/cvat-ui/src/components/login-page/intel-footer-drawer.tsx @@ -0,0 +1,27 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +import React from 'react'; +import { Layout } from 'antd'; + +import { isPublic } from 'utils/enviroment'; +import consts from 'consts'; + +function FooterDrawer(): JSX.Element | null { + const { Footer } = Layout; + const { INTEL_TERMS_OF_USE_URL, INTEL_COOKIES_URL, INTEL_PRIVACY_URL } = consts; + + return isPublic() ? ( + + ) : null; +} + +export default React.memo(FooterDrawer); diff --git a/cvat-ui/src/components/login-page/login-page.tsx b/cvat-ui/src/components/login-page/login-page.tsx index 7fb3daa566e6..66505c7fde63 100644 --- a/cvat-ui/src/components/login-page/login-page.tsx +++ b/cvat-ui/src/components/login-page/login-page.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -8,9 +8,11 @@ import { Link, withRouter } from 'react-router-dom'; import Title from 'antd/lib/typography/Title'; import Text from 'antd/lib/typography/Text'; import { Row, Col } from 'antd/lib/grid'; +import { Layout } from 'antd'; + +import FooterDrawer from 'components/login-page/intel-footer-drawer'; import LoginForm, { LoginData } from './login-form'; -import CookieDrawer from './cookie-policy-drawer'; interface LoginPageComponentProps { fetching: boolean; @@ -27,40 +29,44 @@ function LoginPageComponent(props: LoginPageComponentProps & RouteComponentProps xl: { span: 4 }, }; + const { Content } = Layout; + const { fetching, onLogin, renderResetPassword } = props; return ( - <> - - - Login - { - onLogin(loginData.username, loginData.password); - }} - /> - - - - New to CVAT? Create - an account - - - - {renderResetPassword && ( + + + + + Login + { + onLogin(loginData.username, loginData.password); + }} + /> - Forgot your password? + New to CVAT? Create + an account - )} - - - - + {renderResetPassword && ( + + + + Forgot your password? + + + + )} + + + + + ); } diff --git a/cvat-ui/src/components/register-page/register-page.tsx b/cvat-ui/src/components/register-page/register-page.tsx index b3a299a5a466..8776bee61614 100644 --- a/cvat-ui/src/components/register-page/register-page.tsx +++ b/cvat-ui/src/components/register-page/register-page.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -9,9 +9,10 @@ import { Link, withRouter } from 'react-router-dom'; import Title from 'antd/lib/typography/Title'; import Text from 'antd/lib/typography/Text'; import { Row, Col } from 'antd/lib/grid'; +import { Layout } from 'antd'; import { UserAgreement } from 'reducers/interfaces'; -import CookieDrawer from 'components/login-page/cookie-policy-drawer'; +import FooterDrawer from 'components/login-page/intel-footer-drawer'; import RegisterForm, { RegisterData, UserConfirmation } from './register-form'; interface RegisterPageComponentProps { @@ -38,39 +39,42 @@ function RegisterPageComponent(props: RegisterPageComponentProps & RouteComponen }; const { fetching, userAgreements, onRegister } = props; + const { Content } = Layout; return ( - <> - - - Create an account - { - onRegister( - registerData.username, - registerData.firstName, - registerData.lastName, - registerData.email, - registerData.password1, - registerData.password2, - registerData.confirmations, - ); - }} - /> - - - - Already have an account? - Login - - - - - - - + + + + + Create an account + { + onRegister( + registerData.username, + registerData.firstName, + registerData.lastName, + registerData.email, + registerData.password1, + registerData.password2, + registerData.confirmations, + ); + }} + /> + + + + Already have an account? + Login + + + + + + + + ); } diff --git a/cvat-ui/src/components/reset-password-confirm-page/reset-password-confirm-page.tsx b/cvat-ui/src/components/reset-password-confirm-page/reset-password-confirm-page.tsx index 24c4735b5d05..723d78d0e106 100644 --- a/cvat-ui/src/components/reset-password-confirm-page/reset-password-confirm-page.tsx +++ b/cvat-ui/src/components/reset-password-confirm-page/reset-password-confirm-page.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -6,10 +6,12 @@ import React from 'react'; import { connect } from 'react-redux'; import Title from 'antd/lib/typography/Title'; import { Row, Col } from 'antd/lib/grid'; +import { Layout } from 'antd'; import { CombinedState } from 'reducers/interfaces'; import { resetPasswordAsync } from 'actions/auth-actions'; +import FooterDrawer from 'components/login-page/intel-footer-drawer'; import ResetPasswordConfirmForm, { ResetPasswordConfirmData } from './reset-password-confirm-form'; interface StateToProps { @@ -46,23 +48,30 @@ function ResetPasswordPagePageComponent(props: ResetPasswordConfirmPageComponent const { fetching, onResetPasswordConfirm } = props; + const { Content } = Layout; + return ( - - - Change password - { - onResetPasswordConfirm( - resetPasswordConfirmData.newPassword1, - resetPasswordConfirmData.newPassword2, - resetPasswordConfirmData.uid, - resetPasswordConfirmData.token, - ); - }} - /> - - + + + + + Change password + { + onResetPasswordConfirm( + resetPasswordConfirmData.newPassword1, + resetPasswordConfirmData.newPassword2, + resetPasswordConfirmData.uid, + resetPasswordConfirmData.token, + ); + }} + /> + + + + + ); } diff --git a/cvat-ui/src/components/reset-password-page/reset-password-page.tsx b/cvat-ui/src/components/reset-password-page/reset-password-page.tsx index f02b5a7598cf..3b34386592ef 100644 --- a/cvat-ui/src/components/reset-password-page/reset-password-page.tsx +++ b/cvat-ui/src/components/reset-password-page/reset-password-page.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -8,9 +8,11 @@ import { connect } from 'react-redux'; import Title from 'antd/lib/typography/Title'; import Text from 'antd/lib/typography/Text'; import { Row, Col } from 'antd/lib/grid'; +import { Layout } from 'antd'; import { requestPasswordResetAsync } from 'actions/auth-actions'; import { CombinedState } from 'reducers/interfaces'; +import FooterDrawer from 'components/login-page/intel-footer-drawer'; import ResetPasswordForm, { ResetPasswordData } from './reset-password-form'; interface StateToProps { @@ -46,27 +48,33 @@ function ResetPasswordPagePageComponent(props: ResetPasswordPageComponentProps): }; const { fetching, onResetPassword } = props; + const { Content } = Layout; return ( - - - Reset password - { - onResetPassword(resetPasswordData.email); - }} - /> - - - - Go to - login page - + + + + + Reset password + { + onResetPassword(resetPasswordData.email); + }} + /> + + + + Go to + login page + + + - - + + + ); } diff --git a/cvat-ui/src/consts.ts b/cvat-ui/src/consts.ts index e5df214cc701..a062480e8e69 100644 --- a/cvat-ui/src/consts.ts +++ b/cvat-ui/src/consts.ts @@ -22,6 +22,9 @@ const LATEST_COMMENTS_SHOWN_QUICK_ISSUE = 3; const QUICK_ISSUE_INCORRECT_POSITION_TEXT = 'Wrong position'; const QUICK_ISSUE_INCORRECT_ATTRIBUTE_TEXT = 'Wrong attribute'; const DEFAULT_PROJECT_SUBSETS = ['Train', 'Test', 'Validation']; +const INTEL_TERMS_OF_USE_URL = 'https://www.intel.com/content/www/us/en/legal/terms-of-use.html'; +const INTEL_COOKIES_URL = 'https://www.intel.com/content/www/us/en/privacy/intel-cookie-notice.html'; +const INTEL_PRIVACY_URL = 'https://www.intel.com/content/www/us/en/privacy/intel-privacy-notice.html'; export default { UNDEFINED_ATTRIBUTE_VALUE, @@ -41,4 +44,7 @@ export default { QUICK_ISSUE_INCORRECT_POSITION_TEXT, QUICK_ISSUE_INCORRECT_ATTRIBUTE_TEXT, DEFAULT_PROJECT_SUBSETS, + INTEL_TERMS_OF_USE_URL, + INTEL_COOKIES_URL, + INTEL_PRIVACY_URL, }; diff --git a/cvat-ui/src/utils/enviroment.ts b/cvat-ui/src/utils/enviroment.ts index 41c033153fff..c2edca5c1986 100644 --- a/cvat-ui/src/utils/enviroment.ts +++ b/cvat-ui/src/utils/enviroment.ts @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT