Move join button to buffer header
This commit is contained in:
@@ -168,7 +168,6 @@ export default class App extends Component {
|
|||||||
this.handleBufferListClick = this.handleBufferListClick.bind(this);
|
this.handleBufferListClick = this.handleBufferListClick.bind(this);
|
||||||
this.handleComposerSubmit = this.handleComposerSubmit.bind(this);
|
this.handleComposerSubmit = this.handleComposerSubmit.bind(this);
|
||||||
this.handleNickClick = this.handleNickClick.bind(this);
|
this.handleNickClick = this.handleNickClick.bind(this);
|
||||||
this.handleJoinClick = this.handleJoinClick.bind(this);
|
|
||||||
this.autocomplete = this.autocomplete.bind(this);
|
this.autocomplete = this.autocomplete.bind(this);
|
||||||
this.handleBufferScrollTop = this.handleBufferScrollTop.bind(this);
|
this.handleBufferScrollTop = this.handleBufferScrollTop.bind(this);
|
||||||
this.dismissError = this.dismissError.bind(this);
|
this.dismissError = this.dismissError.bind(this);
|
||||||
@@ -824,15 +823,12 @@ export default class App extends Component {
|
|||||||
this.switchBuffer(id);
|
this.switchBuffer(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleJoinClick(event) {
|
handleJoinClick(netID) {
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
var channel = prompt("Join channel:");
|
var channel = prompt("Join channel:");
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var netID = getActiveNetworkID(this.state);
|
|
||||||
var client = this.clients.get(netID);
|
var client = this.clients.get(netID);
|
||||||
|
|
||||||
client.send({ command: "JOIN", params: [channel] });
|
client.send({ command: "JOIN", params: [channel] });
|
||||||
@@ -925,7 +921,7 @@ export default class App extends Component {
|
|||||||
if (activeBuffer) {
|
if (activeBuffer) {
|
||||||
bufferHeader = html`
|
bufferHeader = html`
|
||||||
<section id="buffer-header">
|
<section id="buffer-header">
|
||||||
<${BufferHeader} buffer=${activeBuffer} network=${activeNetwork} onClose=${() => this.close(activeBuffer)}/>
|
<${BufferHeader} buffer=${activeBuffer} network=${activeNetwork} onClose=${() => this.close(activeBuffer)} onJoin=${() => this.handleJoinClick(activeBuffer.network)}/>
|
||||||
</section>
|
</section>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -945,9 +941,6 @@ export default class App extends Component {
|
|||||||
return html`
|
return html`
|
||||||
<section id="buffer-list">
|
<section id="buffer-list">
|
||||||
<${BufferList} buffers=${this.state.buffers} networks=${this.state.networks} activeBuffer=${this.state.activeBuffer} onBufferClick=${this.handleBufferListClick}/>
|
<${BufferList} buffers=${this.state.buffers} networks=${this.state.networks} activeBuffer=${this.state.activeBuffer} onBufferClick=${this.handleBufferListClick}/>
|
||||||
<div class="actions">
|
|
||||||
<a href="#" onClick=${this.handleJoinClick}>Join channel</a>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
${bufferHeader}
|
${bufferHeader}
|
||||||
<${ScrollManager} target=${this.buffer} scrollKey=${this.state.activeBuffer} onScrollTop=${this.handleBufferScrollTop}>
|
<${ScrollManager} target=${this.buffer} scrollKey=${this.state.activeBuffer} onScrollTop=${this.handleBufferScrollTop}>
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ export default function BufferHeader(props) {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
props.onClose();
|
props.onClose();
|
||||||
}
|
}
|
||||||
|
function handleJoinClick(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
props.onJoin();
|
||||||
|
}
|
||||||
|
|
||||||
var description = null;
|
var description = null;
|
||||||
if (props.buffer.serverInfo) {
|
if (props.buffer.serverInfo) {
|
||||||
@@ -63,9 +67,11 @@ export default function BufferHeader(props) {
|
|||||||
description = html`<${NickStatus} status=${UserStatus.OFFLINE}/> ${props.buffer.name}`;
|
description = html`<${NickStatus} status=${UserStatus.OFFLINE}/> ${props.buffer.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var actions = null;
|
||||||
var closeText = "Close";
|
var closeText = "Close";
|
||||||
switch (props.buffer.type) {
|
switch (props.buffer.type) {
|
||||||
case BufferType.SERVER:
|
case BufferType.SERVER:
|
||||||
|
actions = html`<a href="#" onClick=${handleJoinClick}>Join</a>`;
|
||||||
closeText = "Disconnect";
|
closeText = "Disconnect";
|
||||||
break;
|
break;
|
||||||
case BufferType.CHANNEL:
|
case BufferType.CHANNEL:
|
||||||
@@ -76,6 +82,8 @@ export default function BufferHeader(props) {
|
|||||||
return html`
|
return html`
|
||||||
<span class="description">${description}</span>
|
<span class="description">${description}</span>
|
||||||
<span class="actions">
|
<span class="actions">
|
||||||
|
${actions}
|
||||||
|
${" "}
|
||||||
<a href="#" onClick=${handlePartClick}>${closeText}</a>
|
<a href="#" onClick=${handlePartClick}>${closeText}</a>
|
||||||
</span>
|
</span>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -50,14 +50,6 @@ body {
|
|||||||
#buffer-list li.unread-highlight a {
|
#buffer-list li.unread-highlight a {
|
||||||
color: #22009b;
|
color: #22009b;
|
||||||
}
|
}
|
||||||
#buffer-list .actions {
|
|
||||||
flex-shrink: 0;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
#buffer-list .actions a {
|
|
||||||
display: block;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#buffer-header, #member-list-header {
|
#buffer-header, #member-list-header {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|||||||
Reference in New Issue
Block a user