-
Notifications
You must be signed in to change notification settings - Fork 2k
/
index.jsx
88 lines (76 loc) · 2.32 KB
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/** @format */
/**
* External dependencies
*/
import React from 'react';
import i18n, { localize } from 'i18n-calypso';
import { connect } from 'react-redux';
/**
* Internal dependencies
*/
import FoldableCard from 'components/foldable-card';
import FormSectionHeading from 'components/forms/form-section-heading';
import { getCurrentUserId } from 'state/current-user/selectors';
import { getUserPurchases } from 'state/purchases/selectors';
/**
* Style dependencies
*/
import './style.scss';
const thanksgiving2018ClosureStartsAt = i18n.moment( 'Thu, 22 Nov 2018 00:00:00 +0000' );
const BusinessPlanMessage = ( { translate } ) => {
const message = [];
if ( i18n.moment() < thanksgiving2018ClosureStartsAt ) {
message.push(
translate(
"{{p}}Live chat will be closed on Thursday, November 22, 2018 for the US Thanksgiving holiday. If you need to get in touch with us, you’ll be able to submit a support request from this page and we'll respond by email. Live chat will reopen on November 23rd. Thank you!!{{/p}}",
{
components: {
p: <p />,
},
}
)
);
} else {
message.push(
translate(
"{{p}}Live chat is closed today for the US Thanksgiving holiday. If you need to get in touch with us, submit a support request below and we'll respond by email. Live chat will reopen on November 23rd. Thank you!{{/p}}",
{
components: {
p: <p />,
},
}
)
);
}
return message;
};
const HelpContactClosed = ( { compact, translate } ) => {
const closureHeading = translate( 'Limited Support November 22' );
const closureMessage = <BusinessPlanMessage compact={ compact } translate={ translate } />;
if ( compact ) {
return (
<FoldableCard
className="help-contact-closed"
clickableHeader={ true }
compact={ true }
header={ closureHeading }
>
{ closureMessage }
{ translate( '{{contactLink}}Read more.{{/contactLink}}', {
components: { contactLink: <a href="/help/contact" /> },
} ) }
</FoldableCard>
);
}
return (
<div className="help-contact-closed">
<FormSectionHeading>{ closureHeading }</FormSectionHeading>
<div>{ closureMessage }</div>
<hr />
</div>
);
};
export default connect( state => {
const userId = getCurrentUserId( state );
return { purchases: getUserPurchases( state, userId ) };
} )( localize( HelpContactClosed ) );