Skip to content

Commit

Permalink
EPMRPP-79223, EPMRPP-79899 || fix: move to separate component
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Krasovsky committed Dec 27, 2022
1 parent d8b7442 commit b011fc1
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ import {
MAX_DEFECT_TYPES_COUNT,
WARNING_DEFECT_TYPES_COUNT,
} from 'pages/inside/projectSettingsPageContainer/content/defectTypes/constants';
import { CenteredContainerForPage } from 'pages/inside/projectSettingsPageContainer';
import { SystemMessage } from 'componentLibrary/systemMessage';
import { COMMON_LOCALE_KEYS } from 'common/constants/localization';
import { PROJECT_SETTINGS_DEFECT_TYPES_EVENTS } from 'analyticsEvents/projectSettingsPageEvents';
import { SettingsPageContent } from '../settingsPageContent';
import { DefectTypeRow } from './defectTypeRow';
import { messages } from './defectTypesMessages';
import styles from './defectTypes.scss';
Expand Down Expand Up @@ -146,7 +146,7 @@ export const DefectTypes = ({ setHeaderTitleNode }) => {
}, [defectTypes, canAddNewDefectType, isEditable]);

return (
<CenteredContainerForPage>
<SettingsPageContent>
<TabDescription>{formatMessage(messages.description)}</TabDescription>
<Divider />
{(isInformationMessage || !canAddNewDefectType) && (
Expand Down Expand Up @@ -219,7 +219,7 @@ export const DefectTypes = ({ setHeaderTitleNode }) => {
);
})}
</div>
</CenteredContainerForPage>
</SettingsPageContent>
);
};
DefectTypes.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { isEmailIntegrationAvailableSelector } from 'controllers/plugins';
import { showModalAction } from 'controllers/modal';
import { activeProjectRoleSelector, userAccountRoleSelector } from 'controllers/user';
import { EmptyStatePage } from 'pages/inside/projectSettingsPageContainer/content/emptyStatePage';
import { CenteredContainerForPage } from 'pages/inside/projectSettingsPageContainer';
import { Button } from 'componentLibrary/button';
import { Checkbox } from 'componentLibrary/checkbox';
import {
Expand All @@ -47,6 +46,7 @@ import { SpinningPreloader } from 'components/preloaders/spinningPreloader';
import { PROJECT_SETTINGS_NOTIFICATIONS_EVENTS } from 'analyticsEvents/projectSettingsPageEvents';
import { RuleList, FieldElement, NotificationRuleContent } from '../elements';
import { Layout } from '../layout';
import { SettingsPageContent } from '../settingsPageContent';
import styles from './notifications.scss';
import { DEFAULT_CASE_CONFIG } from './constants';
import { convertNotificationCaseForSubmission } from './utils';
Expand Down Expand Up @@ -225,7 +225,7 @@ export const Notifications = ({ setHeaderTitleNode }) => {
return (
<>
{notifications.length ? (
<CenteredContainerForPage>
<SettingsPageContent>
<Layout description={formatMessage(messages.tabDescription)}>
<FieldElement
withoutProvider
Expand All @@ -252,7 +252,7 @@ export const Notifications = ({ setHeaderTitleNode }) => {
dataAutomationId="notificationsRulesList"
/>
</div>
</CenteredContainerForPage>
</SettingsPageContent>
) : (
<EmptyStatePage
title={formatMessage(messages.noItemsMessage)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useIntl } from 'react-intl';
import { canUpdateSettings } from 'common/utils/permissions';
import { activeProjectRoleSelector, userAccountRoleSelector } from 'controllers/user';
import PropTypes from 'prop-types';
import { CenteredContainerForPage } from 'pages/inside/projectSettingsPageContainer';
import { SettingsPageContent } from '../settingsPageContent';
import { PatternAnalysisContent } from './patternAnalysisContent';
import { EmptyStatePage } from '../emptyStatePage/';
import { messages } from './messages';
Expand Down Expand Up @@ -67,14 +67,14 @@ export const PatternAnalysis = ({ setHeaderTitleNode }) => {
return (
<>
{patterns.length > 0 ? (
<CenteredContainerForPage>
<SettingsPageContent>
<PatternAnalysisContent
setHeaderTitleNode={setHeaderTitleNode}
onAddPattern={onAddPattern}
patterns={patterns}
disabled={!isAbleToCreate}
/>
</CenteredContainerForPage>
</SettingsPageContent>
) : (
<EmptyStatePage
title={formatMessage(messages.noPatternAnalysisTitle)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2022 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import PropTypes from 'prop-types';
import classNames from 'classnames/bind';

import styles from './settingsPageContent.scss';

const cx = classNames.bind(styles);

export const SettingsPageContent = ({ children }) => (
<div className={cx('settings-page-content')}>{children}</div>
);
SettingsPageContent.propTypes = {
children: PropTypes.node.isRequired,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2022 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

.settings-page-content {
margin: 0 auto;
max-width: 1200px;
}
5 changes: 1 addition & 4 deletions app/src/pages/inside/projectSettingsPageContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,4 @@
* limitations under the License.
*/

export {
ProjectSettingsPageContainer,
CenteredContainerForPage,
} from './projectSettingsPageContainer';
export { ProjectSettingsPageContainer } from './projectSettingsPageContainer';
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import React, { useCallback, useMemo, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { FormattedMessage, useIntl } from 'react-intl';
import PropTypes from 'prop-types';
import classNames from 'classnames/bind';
import {
PROJECT_SETTINGS_TAB_PAGE,
Expand Down Expand Up @@ -200,10 +199,3 @@ export const ProjectSettingsPageContainer = () => {
</SettingsLayout>
);
};

export const CenteredContainerForPage = ({ children }) => (
<div className={cx('centred-content')}>{children}</div>
);
CenteredContainerForPage.propTypes = {
children: PropTypes.node.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,3 @@ $Z-INDEX-PAGE-CONTAINER-HEADER: 2;
.content {
padding: 33px 32px 60px;
}

.centred-content {
margin: 0 auto;
max-width: 1200px;
}

0 comments on commit b011fc1

Please sign in to comment.