File size: 2,564 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { localize } from 'i18n-calypso';
import { Component } from 'react';
import { connect } from 'react-redux';
import FeatureExample from 'calypso/components/feature-example';
import FormattedHeader from 'calypso/components/formatted-header';
import { getPreference } from 'calypso/state/preferences/selectors';
import UpgradeBanner from '../activity-log-banner/upgrade-banner';
import ActivityLogItem from '../activity-log-item';

import './style.scss';

class ActivityLogExample extends Component {
	render() {
		const { isIntroDismissed, siteId, siteIsOnFreePlan, translate } = this.props;

		const exampleContents = [
			{
				activityTs: new Date( '2018-06-28T18:38:00.000Z' ).getTime(),
				activityDescription: [ translate( 'My journey through Asia' ) ],
				activityIcon: 'posts',
				activityStatus: 'success',
				activityTitle: translate( 'Post published' ),
				actorName: 'Maria',
				actorRole: 'administrator',
			},
			{
				activityTs: new Date( '2018-06-28T15:10:00.000Z' ).getTime(),
				activityDescription: [ translate( 'Lovely summer photos' ) ],
				activityIcon: 'comment',
				activityStatus: 'warning',
				activityTitle: translate( 'Comment waiting approval' ),
				actorName: 'Filippa',
			},
			{
				activityTs: new Date( '2018-06-28T00:20:00.000Z' ).getTime(),
				activityDescription: [ translate( 'My journey through Asia' ) ],
				activityIcon: 'posts',
				activityTitle: translate( 'Post draft modified' ),
				actorName: 'Vincent',
				actorRole: 'administrator',
			},
		];

		const exampleItems = exampleContents.map( ( example ) => {
			return Object.assign(
				{
					activityMeta: {},
					activityStatus: null,
					actorRole: '',
					actorType: 'Person',
				},
				example
			);
		} );

		return (
			<div className="activity-log-example">
				{ isIntroDismissed && (
					<FormattedHeader
						headerText={ translate( 'Welcome to Activity' ) }
						subHeaderText={ translate( 'All of your site activity will appear here.' ) }
					/>
				) }
				<FeatureExample role="presentation">
					{ exampleItems.map( ( log ) => (
						<ActivityLogItem
							key={ log.activityTs }
							activity={ log }
							disableRestore
							disableBackup
							siteId={ siteId }
						/>
					) ) }
				</FeatureExample>
				{ siteIsOnFreePlan && ! isIntroDismissed && <UpgradeBanner siteId={ siteId } /> }
			</div>
		);
	}
}

export default connect( ( state, { siteId } ) => ( {
	siteId,
	isIntroDismissed: getPreference( state, 'dismissible-card-activity-introduction-banner' ),
} ) )( localize( ActivityLogExample ) );