blob: 0d47ba7e1beaa0363a70fab874d6f24bbd3ae47f (
plain)
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
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import * as Utils from 'utils/utils.jsx';
import {addUserToTeamFromInvite} from 'actions/team_actions.jsx';
import React from 'react';
import PropTypes from 'prop-types';
import {Link, browserHistory} from 'react-router/es6';
import {Tooltip, OverlayTrigger} from 'react-bootstrap';
import {Constants} from 'utils/constants.jsx';
export default class SelectTeamItem extends React.PureComponent {
static propTypes = {
team: PropTypes.object.isRequired,
onTeamClick: PropTypes.func.isRequired,
loading: PropTypes.bool.isRequired
};
handleTeamClick = () => {
addUserToTeamFromInvite('', '', this.props.team.invite_id,
() => {
browserHistory.push(`/${this.props.team.name}/channels/town-square`);
}
);
this.props.onTeamClick(this.props.team);
}
render() {
let icon;
const infoIcon = Constants.TEAM_INFO_SVG;
if (this.props.loading) {
icon = (
<span className='fa fa-refresh fa-spin right signup-team__icon'/>
);
} else {
icon = (
<span className='fa fa-angle-right right signup-team__icon'/>
);
}
var descriptionTooltip = '';
var showDescriptionTooltip = '';
if (this.props.team.description) {
descriptionTooltip = (
<Tooltip id='team-description__tooltip'>
{this.props.team.description}
</Tooltip>
);
showDescriptionTooltip = (
<OverlayTrigger
trigger={['hover', 'focus', 'click']}
delayShow={1000}
placement='top'
overlay={descriptionTooltip}
ref='descriptionOverlay'
>
<span
className='icon icon--info'
dangerouslySetInnerHTML={{__html: infoIcon}}
/>
</OverlayTrigger>
);
}
return (
<div className='signup-team-dir'>
{showDescriptionTooltip}
<Link
id={Utils.createSafeId(this.props.team.display_name)}
onClick={this.handleTeamClick}
>
<span className='signup-team-dir__name'>{this.props.team.display_name}</span>
{icon}
</Link>
</div>
);
}
}
|