Skip to content

Commit 5b258ba

Browse files
chore(lint): fix lint issues and add redirectWithDelay
1 parent dd2eb12 commit 5b258ba

7 files changed

Lines changed: 39 additions & 46 deletions

File tree

src/base-container/components/welcome-page-layout/LargeLayout.jsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import React from 'react';
2-
import classNames from 'classnames';
32
import { useSelector } from 'react-redux';
43

54
import { getConfig } from '@edx/frontend-platform';
65
import { useIntl } from '@edx/frontend-platform/i18n';
76
import { Hyperlink, Image } from '@openedx/paragon';
7+
import classNames from 'classnames';
88
import PropTypes from 'prop-types';
99

1010
import messages from './messages';
1111

12-
1312
const LargeLayout = ({ fullName = null }) => {
1413
const { formatMessage } = useIntl();
1514

@@ -20,8 +19,7 @@ const LargeLayout = ({ fullName = null }) => {
2019
const enterpriseLogoUrl = enterpriseBranding?.enterpriseLogoUrl || null;
2120
const enterpriseName = enterpriseBranding?.enterpriseName || null;
2221

23-
const enterpriseWelcomeHtml =
24-
enterpriseBranding?.enterpriseBrandedWelcomeString
22+
const enterpriseWelcomeHtml = enterpriseBranding?.enterpriseBrandedWelcomeString
2523
|| enterpriseBranding?.platformWelcomeString
2624
|| '';
2725

@@ -103,4 +101,4 @@ LargeLayout.propTypes = {
103101
fullName: PropTypes.string,
104102
};
105103

106-
export default LargeLayout;
104+
export default LargeLayout;

src/base-container/components/welcome-page-layout/MediumLayout.jsx

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React from 'react';
22
import { useSelector } from 'react-redux';
3+
34
import { getConfig } from '@edx/frontend-platform';
45
import { useIntl } from '@edx/frontend-platform/i18n';
56
import { Hyperlink, Image } from '@openedx/paragon';
67
import PropTypes from 'prop-types';
7-
import classNames from 'classnames';
8+
89
import messages from './messages';
910

10-
const MediumLayout = ({ fullName = null }) => {
11+
const MediumLayout = () => {
1112
const { formatMessage } = useIntl();
1213

1314
const enterpriseBranding = useSelector(
@@ -16,8 +17,7 @@ const MediumLayout = ({ fullName = null }) => {
1617

1718
const enterpriseLogoUrl = enterpriseBranding?.enterpriseLogoUrl || null;
1819
const enterpriseName = enterpriseBranding?.enterpriseName || null;
19-
const enterpriseWelcomeHtml =
20-
enterpriseBranding?.enterpriseBrandedWelcomeString
20+
const enterpriseWelcomeHtml = enterpriseBranding?.enterpriseBrandedWelcomeString
2121
|| enterpriseBranding?.platformWelcomeString
2222
|| '';
2323

@@ -45,11 +45,11 @@ const MediumLayout = ({ fullName = null }) => {
4545
</div>
4646
)}
4747

48-
<div className="auth-hero-slash" aria-hidden="true">
49-
<svg xmlns="http://www.w3.org/2000/svg" width="191" height="250" viewBox="0 0 191 250" fill="none" style={{ width: '100%', height: '100%' }}>
50-
<line x1="69.8107" y1="33.833" x2="32.9503" y2="206.952" stroke="#F0CC00" strokeWidth="8" />
51-
</svg>
52-
</div>
48+
<div className="auth-hero-slash" aria-hidden="true">
49+
<svg xmlns="http://www.w3.org/2000/svg" width="191" height="250" viewBox="0 0 191 250" fill="none" style={{ width: '100%', height: '100%' }}>
50+
<line x1="69.8107" y1="33.833" x2="32.9503" y2="206.952" stroke="#F0CC00" strokeWidth="8" />
51+
</svg>
52+
</div>
5353

5454
<div className="auth-hero-heading">
5555
<div className="auth-hero-heading-line text-white">
@@ -81,12 +81,5 @@ const MediumLayout = ({ fullName = null }) => {
8181
);
8282
};
8383

84-
MediumLayout.propTypes = {
85-
fullName: PropTypes.string,
86-
};
87-
88-
MediumLayout.defaultProps = {
89-
fullName: null,
90-
};
9184

92-
export default MediumLayout;
85+
export default MediumLayout;

src/base-container/components/welcome-page-layout/SmallLayout.jsx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React from 'react';
22
import { useSelector } from 'react-redux';
3+
34
import { getConfig } from '@edx/frontend-platform';
45
import { useIntl } from '@edx/frontend-platform/i18n';
56
import { Hyperlink, Image } from '@openedx/paragon';
67
import PropTypes from 'prop-types';
7-
import classNames from 'classnames';
8+
89
import messages from './messages';
910

10-
const SmallLayout = ({ fullName = null }) => {
11+
const SmallLayout = () => {
1112
const { formatMessage } = useIntl();
1213

1314
const enterpriseBranding = useSelector(
@@ -16,8 +17,7 @@ const SmallLayout = ({ fullName = null }) => {
1617

1718
const enterpriseLogoUrl = enterpriseBranding?.enterpriseLogoUrl || null;
1819
const enterpriseName = enterpriseBranding?.enterpriseName || null;
19-
const enterpriseWelcomeHtml =
20-
enterpriseBranding?.enterpriseBrandedWelcomeString
20+
const enterpriseWelcomeHtml = enterpriseBranding?.enterpriseBrandedWelcomeString
2121
|| enterpriseBranding?.platformWelcomeString
2222
|| '';
2323

@@ -44,10 +44,10 @@ const SmallLayout = ({ fullName = null }) => {
4444
)}
4545

4646
<div className="auth-hero-slash" aria-hidden="true">
47-
<svg xmlns="http://www.w3.org/2000/svg" width="191" height="250" viewBox="0 0 191 250" fill="none" style={{ width: '100%', height: '100%' }}>
48-
<line x1="69.8107" y1="33.833" x2="32.9503" y2="206.952" stroke="#F0CC00" strokeWidth="8" />
49-
</svg>
50-
</div>
47+
<svg xmlns="http://www.w3.org/2000/svg" width="191" height="250" viewBox="0 0 191 250" fill="none" style={{ width: '100%', height: '100%' }}>
48+
<line x1="69.8107" y1="33.833" x2="32.9503" y2="206.952" stroke="#F0CC00" strokeWidth="8" />
49+
</svg>
50+
</div>
5151

5252
<div className="auth-hero-heading">
5353
<div className="auth-hero-heading-line text-white">
@@ -70,12 +70,5 @@ const SmallLayout = ({ fullName = null }) => {
7070
);
7171
};
7272

73-
SmallLayout.propTypes = {
74-
fullName: PropTypes.string,
75-
};
76-
77-
SmallLayout.defaultProps = {
78-
fullName: null,
79-
};
8073

81-
export default SmallLayout;
74+
export default SmallLayout;

src/data/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const RECOMMENDATIONS = '/recommendations';
99
export const PASSWORD_RESET_CONFIRM = '/password_reset_confirm/:token/';
1010
export const PAGE_NOT_FOUND = '/notfound';
1111
export const ENTERPRISE_LOGIN_URL = '/enterprise/login';
12-
export const APP_NAME = 'authn';
12+
export const APP_NAME = 'authn';
1313

1414
// Constants
1515
export const SUPPORTED_ICON_CLASSES = ['apple', 'facebook', 'google', 'microsoft'];

src/data/utils/dataUtils.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,13 @@ export const addEnterpriseSlugToNext = (queryParams, enterpriseSlug) => {
114114

115115
return updatedParams;
116116
};
117+
118+
export const redirectWithDelay = (url, delay = 1000) => {
119+
if (!url) {
120+
return;
121+
}
122+
123+
window.setTimeout(() => {
124+
window.location.assign(url);
125+
}, delay);
126+
};

src/login/LoginPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const LoginPage = ({
4444
}) => {
4545
const dispatch = useDispatch();
4646
const backupFormState = useCallback((data) => dispatch(backupLoginFormBegin(data)), [dispatch]);
47-
const getTPADataFromBackend = useCallback(
47+
const getTPADataFromBackend = useCallback(
4848
(urlParams) => dispatch(getThirdPartyAuthContext(urlParams)),
4949
[dispatch],
5050
);

src/logistration/Logistration.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ import { Navigate, useNavigate } from 'react-router-dom';
1717
import BaseContainer from '../base-container';
1818
import { clearThirdPartyAuthContextErrorMessage } from '../common-components/data/actions';
1919
import {
20+
thirdPartyAuthContextSelector,
2021
tpaProvidersSelector,
21-
thirdPartyAuthContextSelector
2222
} from '../common-components/data/selectors';
2323
import messages from '../common-components/messages';
2424
import { LOGIN_PAGE, REGISTER_PAGE } from '../data/constants';
2525
import {
2626
getTpaHint, getTpaProvider, updatePathWithQueryParams,
2727
} from '../data/utils';
2828
import { backupLoginForm } from '../login/data/actions';
29-
import LoginComponentSlot from '../plugin-slots/LoginComponentSlot';
29+
import LoginComponentSlot from '../plugin-slots/MainAppSlot/index';
3030
import { RegistrationPage } from '../register';
3131
import { backupRegistrationForm } from '../register/data/actions';
3232

@@ -40,22 +40,21 @@ const Logistration = ({
4040
providers,
4141
secondaryProviders,
4242
} = tpaProviders;
43-
const thirdPartyAuthContext = useSelector(thirdPartyAuthContextSelector);
43+
const thirdPartyAuthContext = useSelector(thirdPartyAuthContextSelector);
4444
const { formatMessage } = useIntl();
4545
const [institutionLogin, setInstitutionLogin] = useState(false);
4646
const [key, setKey] = useState('');
4747
const navigate = useNavigate();
4848
const disablePublicAccountCreation = getConfig().ALLOW_PUBLIC_ACCOUNT_CREATION === false;
4949
const hideRegistrationLink = getConfig().SHOW_REGISTRATION_LINKS === false;
50-
const enterpriseBranding = useSelector(
50+
const enterpriseBranding = useSelector(
5151
state => state.commonComponents?.thirdPartyAuthContext?.enterpriseBranding,
5252
);
53-
53+
5454
const fullName = thirdPartyAuthContext?.pipelineUserDetails?.full_name
5555
|| thirdPartyAuthContext?.pipelineUserDetails?.name
5656
|| null;
5757

58-
5958
// Show welcome banner if enterprise branding is available
6059
const showWelcomeBanner = !!enterpriseBranding;
6160
useEffect(() => {

0 commit comments

Comments
 (0)