Refactor emails list heading to respect DRY [MAILPOET-1408]
This commit is contained in:
23
assets/js/src/newsletters/listings/heading.jsx
Normal file
23
assets/js/src/newsletters/listings/heading.jsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Link } from 'react-router';
|
||||||
|
import MailPoet from 'mailpoet';
|
||||||
|
|
||||||
|
const ListingHeading = () => (
|
||||||
|
<h1 className="title">
|
||||||
|
{MailPoet.I18n.t('pageTitle')}
|
||||||
|
<Link
|
||||||
|
className="page-title-action"
|
||||||
|
to="/new"
|
||||||
|
onClick={() => MailPoet.trackEvent(
|
||||||
|
'Emails > Add New',
|
||||||
|
{ 'MailPoet Free version': window.mailpoet_version }
|
||||||
|
)}
|
||||||
|
data-automation-id="new_email"
|
||||||
|
>
|
||||||
|
{MailPoet.I18n.t('new')}
|
||||||
|
</Link>
|
||||||
|
</h1>
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = ListingHeading;
|
@@ -3,6 +3,7 @@ import { Link } from 'react-router';
|
|||||||
|
|
||||||
import Listing from 'listing/listing.jsx';
|
import Listing from 'listing/listing.jsx';
|
||||||
import ListingTabs from 'newsletters/listings/tabs.jsx';
|
import ListingTabs from 'newsletters/listings/tabs.jsx';
|
||||||
|
import ListingHeading from 'newsletters/listings/heading.jsx';
|
||||||
|
|
||||||
import { MailerMixin } from 'newsletters/listings/mixins.jsx';
|
import { MailerMixin } from 'newsletters/listings/mixins.jsx';
|
||||||
|
|
||||||
@@ -310,19 +311,7 @@ const NewsletterListNotification = React.createClass({
|
|||||||
render: function render() {
|
render: function render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="title">
|
<ListingHeading />
|
||||||
{ MailPoet.I18n.t('pageTitle') }
|
|
||||||
<Link
|
|
||||||
className="page-title-action"
|
|
||||||
to="/new"
|
|
||||||
onClick={() => MailPoet.trackEvent('Emails > Add New',
|
|
||||||
{ 'MailPoet Free version': window.mailpoet_version }
|
|
||||||
)}
|
|
||||||
data-automation-id="new_email"
|
|
||||||
>
|
|
||||||
{ MailPoet.I18n.t('new') }
|
|
||||||
</Link>
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<ListingTabs tab="notification" />
|
<ListingTabs tab="notification" />
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@ import Hooks from 'wp-js-hooks';
|
|||||||
|
|
||||||
import Listing from 'listing/listing.jsx';
|
import Listing from 'listing/listing.jsx';
|
||||||
import ListingTabs from 'newsletters/listings/tabs.jsx';
|
import ListingTabs from 'newsletters/listings/tabs.jsx';
|
||||||
|
import ListingHeading from 'newsletters/listings/heading.jsx';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
QueueMixin,
|
QueueMixin,
|
||||||
@@ -97,19 +98,7 @@ const NewsletterListNotificationHistory = React.createClass({
|
|||||||
render: function render() {
|
render: function render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="title">
|
<ListingHeading />
|
||||||
{ MailPoet.I18n.t('pageTitle') }
|
|
||||||
<Link
|
|
||||||
className="page-title-action"
|
|
||||||
to="/new"
|
|
||||||
onClick={() => MailPoet.trackEvent('Emails > Add New',
|
|
||||||
{ 'MailPoet Free version': window.mailpoet_version }
|
|
||||||
)}
|
|
||||||
data-automation-id="new_email"
|
|
||||||
>
|
|
||||||
{ MailPoet.I18n.t('new') }
|
|
||||||
</Link>
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<ListingTabs tab="notification" />
|
<ListingTabs tab="notification" />
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Link } from 'react-router';
|
|
||||||
import { confirmAlert } from 'react-confirm-alert';
|
import { confirmAlert } from 'react-confirm-alert';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import MailPoet from 'mailpoet';
|
import MailPoet from 'mailpoet';
|
||||||
@@ -7,6 +6,7 @@ import Hooks from 'wp-js-hooks';
|
|||||||
|
|
||||||
import Listing from 'listing/listing.jsx';
|
import Listing from 'listing/listing.jsx';
|
||||||
import ListingTabs from 'newsletters/listings/tabs.jsx';
|
import ListingTabs from 'newsletters/listings/tabs.jsx';
|
||||||
|
import ListingHeading from 'newsletters/listings/heading.jsx';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
QueueMixin,
|
QueueMixin,
|
||||||
@@ -214,19 +214,7 @@ const NewsletterListStandard = React.createClass({
|
|||||||
render: function render() {
|
render: function render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="title">
|
<ListingHeading />
|
||||||
{ MailPoet.I18n.t('pageTitle') }
|
|
||||||
<Link
|
|
||||||
className="page-title-action"
|
|
||||||
to="/new"
|
|
||||||
onClick={() => MailPoet.trackEvent('Emails > Add New',
|
|
||||||
{ 'MailPoet Free version': window.mailpoet_version }
|
|
||||||
)}
|
|
||||||
data-automation-id="new_email"
|
|
||||||
>
|
|
||||||
{ MailPoet.I18n.t('new') }
|
|
||||||
</Link>
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<ListingTabs tab="standard" />
|
<ListingTabs tab="standard" />
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Link } from 'react-router';
|
|
||||||
|
|
||||||
import Listing from 'listing/listing.jsx';
|
import Listing from 'listing/listing.jsx';
|
||||||
import ListingTabs from 'newsletters/listings/tabs.jsx';
|
import ListingTabs from 'newsletters/listings/tabs.jsx';
|
||||||
|
import ListingHeading from 'newsletters/listings/heading.jsx';
|
||||||
|
|
||||||
import { StatisticsMixin, MailerMixin } from 'newsletters/listings/mixins.jsx';
|
import { StatisticsMixin, MailerMixin } from 'newsletters/listings/mixins.jsx';
|
||||||
|
|
||||||
@@ -293,19 +293,7 @@ const NewsletterListWelcome = React.createClass({
|
|||||||
render: function render() {
|
render: function render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="title">
|
<ListingHeading />
|
||||||
{ MailPoet.I18n.t('pageTitle') }
|
|
||||||
<Link
|
|
||||||
className="page-title-action"
|
|
||||||
to="/new"
|
|
||||||
onClick={() => MailPoet.trackEvent('Emails > Add New',
|
|
||||||
{ 'MailPoet Free version': window.mailpoet_version }
|
|
||||||
)}
|
|
||||||
data-automation-id="new_email"
|
|
||||||
>
|
|
||||||
{ MailPoet.I18n.t('new') }
|
|
||||||
</Link>
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<ListingTabs tab="welcome" />
|
<ListingTabs tab="welcome" />
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user