From 40e78f05e2c04a2b06e4a3a8d2e5c9511db4b082 Mon Sep 17 00:00:00 2001 From: leonardost Date: Wed, 18 Oct 2023 14:45:19 -0300 Subject: [PATCH] Remove unused component `ContactsPrivacy` and related code (#82617) --- .../contacts-privacy/card.jsx | 166 ------------------ .../contacts-privacy/index.jsx | 129 -------------- .../contacts-privacy/style.scss | 63 ------- .../domains/domain-management/index.jsx | 2 - .../contact-information}/contact-display.jsx | 0 .../contact-information/contacts-card.tsx | 2 +- 6 files changed, 1 insertion(+), 361 deletions(-) delete mode 100644 client/my-sites/domains/domain-management/contacts-privacy/card.jsx delete mode 100644 client/my-sites/domains/domain-management/contacts-privacy/index.jsx delete mode 100644 client/my-sites/domains/domain-management/contacts-privacy/style.scss rename client/my-sites/domains/domain-management/{contacts-privacy => settings/cards/contact-information}/contact-display.jsx (100%) diff --git a/client/my-sites/domains/domain-management/contacts-privacy/card.jsx b/client/my-sites/domains/domain-management/contacts-privacy/card.jsx deleted file mode 100644 index a3e8efa3f190b..0000000000000 --- a/client/my-sites/domains/domain-management/contacts-privacy/card.jsx +++ /dev/null @@ -1,166 +0,0 @@ -import { Card, Gridicon } from '@automattic/components'; -import { localizeUrl } from '@automattic/i18n-utils'; -import { ToggleControl } from '@wordpress/components'; -import { localize } from 'i18n-calypso'; -import PropTypes from 'prop-types'; -import { Component, Fragment } from 'react'; -import { connect } from 'react-redux'; -import { PUBLIC_VS_PRIVATE } from 'calypso/lib/url/support'; -import { - enableDomainPrivacy, - disableDomainPrivacy, - discloseDomainContactInfo, - redactDomainContactInfo, -} from 'calypso/state/sites/domains/actions'; -import { isUpdatingDomainPrivacy } from 'calypso/state/sites/domains/selectors'; -import ContactDisplay from './contact-display'; - -class ContactsPrivacyCard extends Component { - static propTypes = { - privateDomain: PropTypes.bool.isRequired, - privacyAvailable: PropTypes.bool.isRequired, - selectedDomainName: PropTypes.string.isRequired, - selectedSite: PropTypes.oneOfType( [ PropTypes.object, PropTypes.bool ] ).isRequired, - contactInfoDisclosureAvailable: PropTypes.bool.isRequired, - contactInfoDisclosed: PropTypes.bool.isRequired, - isPendingIcannVerification: PropTypes.bool.isRequired, - }; - - togglePrivacy = () => { - const { selectedSite, privateDomain, selectedDomainName: name } = this.props; - - if ( privateDomain ) { - this.props.disableDomainPrivacy( selectedSite.ID, name ); - } else { - this.props.enableDomainPrivacy( selectedSite.ID, name ); - } - }; - - toggleContactInfo = () => { - const { selectedSite, contactInfoDisclosed, selectedDomainName: name } = this.props; - - if ( contactInfoDisclosed ) { - this.props.redactDomainContactInfo( selectedSite.ID, name ); - } else { - this.props.discloseDomainContactInfo( selectedSite.ID, name ); - } - }; - - getPrivacyProtection() { - const { privateDomain, privacyAvailable } = this.props; - const { translate, isUpdatingPrivacy } = this.props; - - let privacyProtectionNote; - if ( ! privacyAvailable ) { - privacyProtectionNote = ( -
- -

{ translate( 'Privacy settings can not be changed for this domain' ) }

-
- ); - } - - return ( - -
- -
- { privacyProtectionNote } -
- ); - } - - getContactInfoDisclosed() { - const { - contactInfoDisclosed, - contactInfoDisclosureAvailable, - isPendingIcannVerification, - isUpdatingPrivacy, - privacyAvailable, - privateDomain, - translate, - } = this.props; - - if ( ! privacyAvailable || ! contactInfoDisclosureAvailable || privateDomain ) { - return false; - } - - const contactVerificationNotice = isPendingIcannVerification ? ( -
- -

- { translate( - 'You need to verify the contact information for the domain before you can disclose it publicly.' - ) } -

-
- ) : null; - - return ( - -
- -
- { contactVerificationNotice } -
- ); - } - - render() { - const { translate, selectedDomainName } = this.props; - - return ( -
- -

{ translate( 'Your domain contact information' ) }

- - - - { this.getPrivacyProtection() } - - { this.getContactInfoDisclosed() } - -

- { translate( '{{a}}Learn more{{/a}} about private registration and GDPR protection.', { - components: { - a: ( - - ), - }, - } ) } -

-
-
- ); - } -} - -export default connect( - ( state, ownProps ) => ( { - isUpdatingPrivacy: isUpdatingDomainPrivacy( - state, - ownProps.selectedSite.ID, - ownProps.selectedDomainName - ), - } ), - { - enableDomainPrivacy, - disableDomainPrivacy, - discloseDomainContactInfo, - redactDomainContactInfo, - } -)( localize( ContactsPrivacyCard ) ); diff --git a/client/my-sites/domains/domain-management/contacts-privacy/index.jsx b/client/my-sites/domains/domain-management/contacts-privacy/index.jsx deleted file mode 100644 index dbf9d1eb7e2a6..0000000000000 --- a/client/my-sites/domains/domain-management/contacts-privacy/index.jsx +++ /dev/null @@ -1,129 +0,0 @@ -import config from '@automattic/calypso-config'; -import { localize } from 'i18n-calypso'; -import page from 'page'; -import PropTypes from 'prop-types'; -import { PureComponent } from 'react'; -import { connect } from 'react-redux'; -import Main from 'calypso/components/main'; -import VerticalNav from 'calypso/components/vertical-nav'; -import VerticalNavItem from 'calypso/components/vertical-nav/item'; -import { getSelectedDomain } from 'calypso/lib/domains'; -import DomainMainPlaceholder from 'calypso/my-sites/domains/domain-management/components/domain/main-placeholder'; -import NonOwnerCard from 'calypso/my-sites/domains/domain-management/components/domain/non-owner-card'; -import Header from 'calypso/my-sites/domains/domain-management/components/header'; -import { - domainManagementEdit, - domainManagementEditContactInfo, - domainManagementManageConsent, -} from 'calypso/my-sites/domains/paths'; -import getCurrentRoute from 'calypso/state/selectors/get-current-route'; -import isRequestingWhois from 'calypso/state/selectors/is-requesting-whois'; -import ContactsPrivacyCard from './card'; - -import './style.scss'; - -class ContactsPrivacy extends PureComponent { - static propTypes = { - domains: PropTypes.array.isRequired, - selectedDomainName: PropTypes.string.isRequired, - selectedSite: PropTypes.oneOfType( [ PropTypes.object, PropTypes.bool ] ).isRequired, - }; - - renderForOwner() { - const { translate } = this.props; - const domain = getSelectedDomain( this.props ); - const { - privateDomain, - privacyAvailable, - contactInfoDisclosed, - contactInfoDisclosureAvailable, - isPendingIcannVerification, - } = domain; - - const canManageConsent = - config.isEnabled( 'domains/gdpr-consent-page' ) && domain.supportsGdprConsentManagement; - - return ( - <> - - - - { translate( 'Edit contact info' ) } - - - { canManageConsent && ( - - { translate( 'Manage Consent for Personal Data Use' ) } - - ) } - - ); - } - - renderForOthers() { - const { domains, selectedDomainName } = this.props; - return ; - } - - render() { - if ( this.isDataLoading() ) { - return ; - } - - const { translate } = this.props; - const domain = getSelectedDomain( this.props ); - - return ( -
-
- { translate( 'Contacts and Privacy' ) } -
- - - { domain.currentUserCanManage ? this.renderForOwner() : this.renderForOthers() } - -
- ); - } - - isDataLoading() { - return ! getSelectedDomain( this.props ) || this.props.isRequestingWhois; - } - - goToEdit = () => { - page( - domainManagementEdit( - this.props.selectedSite.slug, - this.props.selectedDomainName, - this.props.currentRoute - ) - ); - }; -} - -export default connect( ( state, ownProps ) => { - return { - currentRoute: getCurrentRoute( state ), - isRequestingWhois: isRequestingWhois( state, ownProps.selectedDomainName ), - }; -} )( localize( ContactsPrivacy ) ); diff --git a/client/my-sites/domains/domain-management/contacts-privacy/style.scss b/client/my-sites/domains/domain-management/contacts-privacy/style.scss deleted file mode 100644 index d4a0258b570a1..0000000000000 --- a/client/my-sites/domains/domain-management/contacts-privacy/style.scss +++ /dev/null @@ -1,63 +0,0 @@ -.contacts-privacy__card { - .contacts-privacy__settings { - margin-bottom: 10px; - - &.warning { - color: var(--color-text-subtle); - - @include breakpoint-deprecated( ">660px" ) { - padding: 0; - text-align: left; - } - - p { - font-size: $font-body-extra-small; - margin: 0; - - @include breakpoint-deprecated( ">660px" ) { - margin-left: 24px; - } - } - - .gridicon { - float: left; - - @include breakpoint-deprecated( "<660px" ) { - display: none; - } - } - } - } - - .contacts-privacy__settings-explanation { - color: var(--color-text-subtle); - display: block; - font-size: $font-body-small; - font-style: italic; - margin: 5px 0; - } - - .notice { - clear: both; - font-size: $font-body-extra-small; - margin-top: 10px; - margin-bottom: 10px; - } - - .contact-display { - .contact-display__content { - background-color: var(--color-neutral-0); - color: var(--color-neutral); - font-size: $font-body-extra-small; - /* stylelint-disable-next-line declaration-property-unit-allowed-list */ - line-height: 140%; - margin: 0; - padding: 16px; - - p { - margin-bottom: 0; - } - } - margin-bottom: 1.5em; - } -} diff --git a/client/my-sites/domains/domain-management/index.jsx b/client/my-sites/domains/domain-management/index.jsx index 4100595f78fbe..36a238d612aa4 100644 --- a/client/my-sites/domains/domain-management/index.jsx +++ b/client/my-sites/domains/domain-management/index.jsx @@ -1,6 +1,5 @@ import BulkAllDomains from 'calypso/my-sites/domains/domain-management/list/bulk-all-domains'; import BulkSiteDomains from 'calypso/my-sites/domains/domain-management/list/bulk-site-domains'; -import ContactsPrivacy from './contacts-privacy'; import AddDnsRecord from './dns/add-dns-record'; import DnsRecords from './dns/dns-records'; import DomainConnectMapping from './domain-connect-mapping'; @@ -19,7 +18,6 @@ import TransferDomainToOtherUser from './transfer/transfer-to-other-user/transfe export default { AddDnsRecord, BulkEditContactInfoPage, - ContactsPrivacy, DnsRecords, DomainConnectMapping, EditContactInfoPage, diff --git a/client/my-sites/domains/domain-management/contacts-privacy/contact-display.jsx b/client/my-sites/domains/domain-management/settings/cards/contact-information/contact-display.jsx similarity index 100% rename from client/my-sites/domains/domain-management/contacts-privacy/contact-display.jsx rename to client/my-sites/domains/domain-management/settings/cards/contact-information/contact-display.jsx diff --git a/client/my-sites/domains/domain-management/settings/cards/contact-information/contacts-card.tsx b/client/my-sites/domains/domain-management/settings/cards/contact-information/contacts-card.tsx index 1734e4927efc2..01214f171be29 100644 --- a/client/my-sites/domains/domain-management/settings/cards/contact-information/contacts-card.tsx +++ b/client/my-sites/domains/domain-management/settings/cards/contact-information/contacts-card.tsx @@ -5,7 +5,6 @@ import { useTranslate } from 'i18n-calypso'; import { connect } from 'react-redux'; import useDomainTransferRequestQuery from 'calypso/data/domains/transfers/use-domain-transfer-request-query'; import { PRIVACY_PROTECTION, PUBLIC_VS_PRIVATE } from 'calypso/lib/url/support'; -import ContactDisplay from 'calypso/my-sites/domains/domain-management/contacts-privacy/contact-display'; import { domainManagementEditContactInfo, domainManagementManageConsent, @@ -19,6 +18,7 @@ import { } from 'calypso/state/sites/domains/actions'; import { isUpdatingDomainPrivacy } from 'calypso/state/sites/domains/selectors'; import { IAppState } from 'calypso/state/types'; +import ContactDisplay from './contact-display'; import type { ContactsCardPassedProps, ContactsCardProps } from './types'; const ContactsPrivacyCard = ( props: ContactsCardProps ) => {