Moved Join button to right side of MoreChannels modal
Этот коммит содержится в:
@@ -24,6 +24,7 @@ export default class MoreChannels extends React.Component {
|
|||||||
this.onListenerChange = this.onListenerChange.bind(this);
|
this.onListenerChange = this.onListenerChange.bind(this);
|
||||||
this.handleJoin = this.handleJoin.bind(this);
|
this.handleJoin = this.handleJoin.bind(this);
|
||||||
this.handleNewChannel = this.handleNewChannel.bind(this);
|
this.handleNewChannel = this.handleNewChannel.bind(this);
|
||||||
|
this.createChannelRow = this.createChannelRow.bind(this);
|
||||||
|
|
||||||
var initState = getStateFromStores();
|
var initState = getStateFromStores();
|
||||||
initState.channelType = '';
|
initState.channelType = '';
|
||||||
@@ -70,13 +71,49 @@ export default class MoreChannels extends React.Component {
|
|||||||
$(ReactDOM.findDOMNode(this.refs.modal)).modal('hide');
|
$(ReactDOM.findDOMNode(this.refs.modal)).modal('hide');
|
||||||
this.setState({showNewChannelModal: true});
|
this.setState({showNewChannelModal: true});
|
||||||
}
|
}
|
||||||
|
createChannelRow(channel, index) {
|
||||||
|
let joinButton;
|
||||||
|
if (this.state.joiningChannel === index) {
|
||||||
|
joinButton = (
|
||||||
|
<img
|
||||||
|
className='join-channel-loading-gif'
|
||||||
|
src='/static/images/load.gif'
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
joinButton = (
|
||||||
|
<button
|
||||||
|
onClick={this.handleJoin.bind(self, channel, index)}
|
||||||
|
className='btn btn-primary'
|
||||||
|
>
|
||||||
|
<FormattedMessage
|
||||||
|
id='more_channels.join'
|
||||||
|
defaultMessage='Join'
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<tr key={channel.id}>
|
||||||
|
<td className='more-row'>
|
||||||
|
<div className='more-details'>
|
||||||
|
<p className='more-name'>{channel.display_name}</p>
|
||||||
|
<p className='more-description'>{channel.purpose}</p>
|
||||||
|
</div>
|
||||||
|
<div className='more-actions'>
|
||||||
|
{joinButton}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
}
|
||||||
render() {
|
render() {
|
||||||
var serverError;
|
var serverError;
|
||||||
if (this.state.serverError) {
|
if (this.state.serverError) {
|
||||||
serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
|
serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
|
||||||
var moreChannels;
|
var moreChannels;
|
||||||
|
|
||||||
if (this.state.channels != null) {
|
if (this.state.channels != null) {
|
||||||
@@ -87,41 +124,7 @@ export default class MoreChannels extends React.Component {
|
|||||||
moreChannels = (
|
moreChannels = (
|
||||||
<table className='more-table table'>
|
<table className='more-table table'>
|
||||||
<tbody>
|
<tbody>
|
||||||
{channels.map(function cMap(channel, index) {
|
{channels.map(this.createChannelRow)}
|
||||||
var joinButton;
|
|
||||||
if (self.state.joiningChannel === index) {
|
|
||||||
joinButton = (
|
|
||||||
<img
|
|
||||||
className='join-channel-loading-gif'
|
|
||||||
src='/static/images/load.gif'
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
joinButton = (
|
|
||||||
<button
|
|
||||||
onClick={self.handleJoin.bind(self, channel, index)}
|
|
||||||
className='btn btn-primary'
|
|
||||||
>
|
|
||||||
<FormattedMessage
|
|
||||||
id='more_channels.join'
|
|
||||||
defaultMessage='Join'
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<tr key={channel.id}>
|
|
||||||
<td>
|
|
||||||
<p className='more-name'>{channel.display_name}</p>
|
|
||||||
<p className='more-description'>{channel.purpose}</p>
|
|
||||||
</td>
|
|
||||||
<td className='td--action'>
|
|
||||||
{joinButton}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ export default function UserListRow({user, actions}) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td
|
<td
|
||||||
key={user.id}
|
key={user.id}
|
||||||
className='direct-channel'
|
|
||||||
style={{display: 'flex'}}
|
style={{display: 'flex'}}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
|
|||||||
@@ -23,17 +23,29 @@
|
|||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
.more-row {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.more-details {
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-shrink: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.more-actions {
|
||||||
|
flex-grow: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
.more-name {
|
.more-name {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 0.95em;
|
font-size: 0.95em;
|
||||||
overflow: hidden;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
.more-description {
|
.more-description {
|
||||||
@include opacity(0.7);
|
@include opacity(0.7);
|
||||||
display: block;
|
display: block;
|
||||||
overflow: hidden;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
tbody {
|
tbody {
|
||||||
> tr {
|
> tr {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user