Max Red - Created activity-row component [skip ci]
This commit is contained in:
parent
6ddac56bc5
commit
ff8ae643b3
|
@ -0,0 +1,69 @@
|
|||
import React from 'react';
|
||||
import {Link} from 'react-router';
|
||||
|
||||
import Icon from 'core-components/icon';
|
||||
|
||||
import i18n from 'lib-app/i18n';
|
||||
|
||||
class ActivityRow extends React.Component {
|
||||
|
||||
static propTypes = {
|
||||
type: React.PropTypes.oneOf([
|
||||
'COMMENT',
|
||||
'ASSIGN',
|
||||
'UN_ASSIGN',
|
||||
'CLOSE',
|
||||
'RE_OPEN',
|
||||
'DEPARTMENT_CHANGED',
|
||||
'PRIORITY_CHANGED'
|
||||
]),
|
||||
ticketNumber: React.PropTypes.string,
|
||||
author: React.PropTypes.shape({
|
||||
name: React.PropTypes.string,
|
||||
staff: React.PropTypes.bool,
|
||||
id: React.PropTypes.string
|
||||
})
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="activity-row">
|
||||
<Icon {...this.getIconProps()} className="activity-row__icon"/>
|
||||
<span>
|
||||
<Link className="activity-row__name-link" to={this.getNameLinkDestination()}>
|
||||
{this.props.author.name}
|
||||
</Link>
|
||||
</span>
|
||||
<span className="activity-row__message">{i18n('ACTIVITY_' + this.props.type)}</span>
|
||||
<span>
|
||||
<Link className="activity-row__ticket-link" to={'/admin/panel/tickets/view-ticket/' + this.props.ticketNumber}>
|
||||
#{this.props.ticketNumber}
|
||||
</Link>
|
||||
</span>
|
||||
<span className="separator" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
getNameLinkDestination() {
|
||||
return (this.props.author.staff ? '/admin/panel/staff/view-staff/' : '/admin/panel/users/view-user/') + this.props.author.id;
|
||||
}
|
||||
|
||||
getIconProps() {
|
||||
const iconName = {
|
||||
'COMMENT': 'comment-o',
|
||||
'ASSIGN': 'user',
|
||||
'UN_ASSIGN': 'user-times',
|
||||
'CLOSE': 'lock',
|
||||
'RE_OPEN': 'unlock-alt',
|
||||
'DEPARTMENT_CHANGED': 'exchange',
|
||||
'PRIORITY_CHANGED': 'exclamation'
|
||||
};
|
||||
|
||||
return {
|
||||
name: iconName[this.props.type]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default ActivityRow;
|
|
@ -0,0 +1,26 @@
|
|||
@import "../scss/vars";
|
||||
|
||||
.activity-row {
|
||||
text-align: left;
|
||||
font-size: $font-size--sm;
|
||||
|
||||
&__icon {
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
&__name-link {
|
||||
|
||||
}
|
||||
|
||||
&__message {
|
||||
|
||||
}
|
||||
|
||||
&__ticket-link {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.separator {
|
||||
margin: 15px;
|
||||
}
|
|
@ -1,14 +1,59 @@
|
|||
import React from 'react';
|
||||
|
||||
import Header from 'core-components/header';
|
||||
|
||||
import i18n from 'lib-app/i18n';
|
||||
import ActivityRow from 'app-components/activity-row';
|
||||
|
||||
class AdminPanelActivity extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
/admin/panel/activity
|
||||
<Header title={i18n('LAST_ACTIVITY')} />
|
||||
<ActivityRow {...this.getActivityRowProps()} />
|
||||
<ActivityRow {...this.getActivityRowProps2()} />
|
||||
<ActivityRow {...this.getActivityRowProps3()} />
|
||||
<ActivityRow {...this.getActivityRowProps()} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
getActivityRowProps() {
|
||||
return {
|
||||
"type": "COMMENT",
|
||||
"ticketNumber": "683061",
|
||||
"author": {
|
||||
"name": "Tyrion Lannister",
|
||||
"staff": false,
|
||||
"id": "10"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getActivityRowProps2() {
|
||||
return {
|
||||
"type": "RE_OPEN",
|
||||
"ticketNumber": "683049",
|
||||
"author": {
|
||||
"name": "Emilia Clarke",
|
||||
"staff": true,
|
||||
"id": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getActivityRowProps3() {
|
||||
return {
|
||||
"type": "UN_ASSIGN",
|
||||
"ticketNumber": "683049",
|
||||
"author": {
|
||||
"name": "Emilia Clarke",
|
||||
"staff": true,
|
||||
"id": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default AdminPanelActivity;
|
|
@ -119,6 +119,13 @@ export default {
|
|||
'DELETE_STAFF_MEMBER': 'Delete staff member',
|
||||
'MAINTENANCE_MODE': 'Maintenance mode',
|
||||
'RECOVER_DEFAULT': 'Recover default',
|
||||
'ACTIVITY_COMMENT': ' commented ',
|
||||
'ACTIVITY_ASSIGN': ' assigned ',
|
||||
'ACTIVITY_UN_ASSIGN': ' unassigned ',
|
||||
'ACTIVITY_CLOSED': ' closed ',
|
||||
'ACTIVITY_RE_OPEN': ' reopened ',
|
||||
'ACTIVITY_DEPARTMENT_CHANGED': ' changed departments of ',
|
||||
'ACTIVITY_PRIORITY_CHANGED': ' changed priority of ',
|
||||
|
||||
//VIEW DESCRIPTIONS
|
||||
'CREATE_TICKET_DESCRIPTION': 'This is a form for creating tickets. Fill the form and send us your issues/doubts/suggestions. Our support system will answer it as soon as possible.',
|
||||
|
|
Loading…
Reference in New Issue