2021-11-04 22:48:21 +01:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { useHistory } from 'react-router-dom';
|
|
|
|
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
2022-10-27 12:25:30 +02:00
|
|
|
import { ADD_POPULAR_CUSTOM_NETWORK } from '../../../../helpers/constants/routes';
|
2021-11-04 22:48:21 +01:00
|
|
|
import Button from '../../../../components/ui/button';
|
|
|
|
|
|
|
|
const NetworksFormSubheader = ({ addNewNetwork }) => {
|
|
|
|
const t = useI18nContext();
|
|
|
|
const history = useHistory();
|
2022-06-30 18:19:07 +02:00
|
|
|
|
2021-11-04 22:48:21 +01:00
|
|
|
return addNewNetwork ? (
|
|
|
|
<div className="networks-tab__subheader">
|
|
|
|
<span className="networks-tab__sub-header-text">{t('networks')}</span>
|
2022-06-30 18:19:07 +02:00
|
|
|
<span className="networks-tab__sub-header-text">{' > '}</span>
|
|
|
|
<div className="networks-tab__sub-header-text">{t('addANetwork')}</div>
|
2021-11-04 22:48:21 +01:00
|
|
|
<span>{' > '}</span>
|
2022-06-30 18:19:07 +02:00
|
|
|
<div className="networks-tab__subheader--break">
|
|
|
|
{t('addANetworkManually')}
|
|
|
|
</div>
|
2021-11-04 22:48:21 +01:00
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
<div className="settings-page__sub-header">
|
|
|
|
<span className="settings-page__sub-header-text">{t('networks')}</span>
|
|
|
|
<div className="networks-tab__add-network-header-button-wrapper">
|
|
|
|
<Button
|
|
|
|
type="primary"
|
|
|
|
onClick={(event) => {
|
|
|
|
event.preventDefault();
|
2022-10-27 12:25:30 +02:00
|
|
|
history.push(ADD_POPULAR_CUSTOM_NETWORK);
|
2021-11-04 22:48:21 +01:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{t('addANetwork')}
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
NetworksFormSubheader.propTypes = {
|
|
|
|
addNewNetwork: PropTypes.bool.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default NetworksFormSubheader;
|