mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-15 03:15:01 -05:00
Add reconnect button
This commit is contained in:
parent
fc93a8cef5
commit
f6895fed32
2 changed files with 20 additions and 26 deletions
|
@ -1634,6 +1634,7 @@ export default class App extends Component {
|
||||||
onChannelClick=${this.handleChannelClick}
|
onChannelClick=${this.handleChannelClick}
|
||||||
onClose=${() => this.close(activeBuffer)}
|
onClose=${() => this.close(activeBuffer)}
|
||||||
onJoin=${() => this.handleJoinClick(activeBuffer)}
|
onJoin=${() => this.handleJoinClick(activeBuffer)}
|
||||||
|
onReconnect=${() => this.reconnect()}
|
||||||
onAddNetwork=${this.handleAddNetworkClick}
|
onAddNetwork=${this.handleAddNetworkClick}
|
||||||
onManageNetwork=${() => this.handleManageNetworkClick(activeBuffer.server)}
|
onManageNetwork=${() => this.handleManageNetworkClick(activeBuffer.server)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -21,23 +21,6 @@ function NickStatus(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function BufferHeader(props) {
|
export default function BufferHeader(props) {
|
||||||
function handleCloseClick(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
props.onClose();
|
|
||||||
}
|
|
||||||
function handleJoinClick(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
props.onJoin();
|
|
||||||
}
|
|
||||||
function handleAddNetworkClick(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
props.onAddNetwork();
|
|
||||||
}
|
|
||||||
function handleManageNetworkClick(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
props.onManageNetwork();
|
|
||||||
}
|
|
||||||
|
|
||||||
let fullyConnected = props.server.status === ServerStatus.REGISTERED;
|
let fullyConnected = props.server.status === ServerStatus.REGISTERED;
|
||||||
if (props.bouncerNetwork) {
|
if (props.bouncerNetwork) {
|
||||||
fullyConnected = fullyConnected && props.bouncerNetwork.state === "connected";
|
fullyConnected = fullyConnected && props.bouncerNetwork.state === "connected";
|
||||||
|
@ -82,9 +65,15 @@ export default function BufferHeader(props) {
|
||||||
let joinButton = html`
|
let joinButton = html`
|
||||||
<button
|
<button
|
||||||
key="join"
|
key="join"
|
||||||
onClick=${handleJoinClick}
|
onClick=${props.onJoin}
|
||||||
>Join channel</button>
|
>Join channel</button>
|
||||||
`;
|
`;
|
||||||
|
let reconnectButton = html`
|
||||||
|
<button
|
||||||
|
key="reconect"
|
||||||
|
onClick=${props.onReconnect}
|
||||||
|
>Reconnect</button>
|
||||||
|
`;
|
||||||
|
|
||||||
if (props.server.isBouncer) {
|
if (props.server.isBouncer) {
|
||||||
if (props.server.bouncerNetID) {
|
if (props.server.bouncerNetID) {
|
||||||
|
@ -95,7 +84,7 @@ export default function BufferHeader(props) {
|
||||||
actions.push(html`
|
actions.push(html`
|
||||||
<button
|
<button
|
||||||
key="manage"
|
key="manage"
|
||||||
onClick=${handleManageNetworkClick}
|
onClick=${props.onManageNetwork}
|
||||||
>Manage network</button>
|
>Manage network</button>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
@ -104,27 +93,31 @@ export default function BufferHeader(props) {
|
||||||
actions.push(html`
|
actions.push(html`
|
||||||
<button
|
<button
|
||||||
key="add"
|
key="add"
|
||||||
onClick=${handleAddNetworkClick}
|
onClick=${props.onAddNetwork}
|
||||||
>Add network</button>
|
>Add network</button>
|
||||||
`);
|
`);
|
||||||
|
} else if (props.server.status === ServerStatus.DISCONNECTED) {
|
||||||
|
actions.push(reconnectButton);
|
||||||
}
|
}
|
||||||
actions.push(html`
|
actions.push(html`
|
||||||
<button
|
<button
|
||||||
key="disconnect"
|
key="disconnect"
|
||||||
class="danger"
|
class="danger"
|
||||||
onClick=${handleCloseClick}
|
onClick=${props.onClose}
|
||||||
>Disconnect</button>
|
>Disconnect</button>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fullyConnected) {
|
if (fullyConnected) {
|
||||||
actions.push(joinButton);
|
actions.push(joinButton);
|
||||||
|
} else if (props.server.status === ServerStatus.DISCONNECTED) {
|
||||||
|
actions.push(reconnectButton);
|
||||||
}
|
}
|
||||||
actions.push(html`
|
actions.push(html`
|
||||||
<button
|
<button
|
||||||
key="disconnect"
|
key="disconnect"
|
||||||
class="danger"
|
class="danger"
|
||||||
onClick=${handleCloseClick}
|
onClick=${props.onClose}
|
||||||
>Disconnect</button>
|
>Disconnect</button>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +131,7 @@ export default function BufferHeader(props) {
|
||||||
<button
|
<button
|
||||||
key="part"
|
key="part"
|
||||||
class="danger"
|
class="danger"
|
||||||
onClick=${handleCloseClick}
|
onClick=${props.onClose}
|
||||||
>Leave</button>
|
>Leave</button>
|
||||||
`);
|
`);
|
||||||
} else {
|
} else {
|
||||||
|
@ -146,7 +139,7 @@ export default function BufferHeader(props) {
|
||||||
actions.push(html`
|
actions.push(html`
|
||||||
<button
|
<button
|
||||||
key="join"
|
key="join"
|
||||||
onClick=${handleJoinClick}
|
onClick=${props.onJoin}
|
||||||
>Join</button>
|
>Join</button>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +147,7 @@ export default function BufferHeader(props) {
|
||||||
<button
|
<button
|
||||||
key="part"
|
key="part"
|
||||||
class="danger"
|
class="danger"
|
||||||
onClick=${handleCloseClick}
|
onClick=${props.onClose}
|
||||||
>Close</button>
|
>Close</button>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
@ -213,7 +206,7 @@ export default function BufferHeader(props) {
|
||||||
<button
|
<button
|
||||||
key="close"
|
key="close"
|
||||||
class="danger"
|
class="danger"
|
||||||
onClick=${handleCloseClick}
|
onClick=${props.onClose}
|
||||||
>Close</button>
|
>Close</button>
|
||||||
`;
|
`;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue