mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-14 11:15:13 -05:00
components/app: introduce updateDocumentTitle()
The logic in here will get more involved once we add unread counts and such.
This commit is contained in:
parent
9924f08794
commit
4d6f14ab0b
1 changed files with 10 additions and 5 deletions
|
@ -556,11 +556,7 @@ export default class App extends Component {
|
|||
this.whoChannelBuffer(buf.name, buf.server);
|
||||
}
|
||||
|
||||
if (buf.type !== BufferType.SERVER) {
|
||||
document.title = buf.name + ' · ' + this.baseTitle;
|
||||
} else {
|
||||
document.title = this.baseTitle;
|
||||
}
|
||||
this.updateDocumentTitle();
|
||||
});
|
||||
|
||||
// TODO: only mark as read if user scrolled at the bottom
|
||||
|
@ -610,6 +606,15 @@ export default class App extends Component {
|
|||
});
|
||||
}
|
||||
|
||||
updateDocumentTitle() {
|
||||
let buf = State.getBuffer(this.state, this.state.activeBuffer);
|
||||
if (buf && buf.type !== BufferType.SERVER) {
|
||||
document.title = buf.name + ' · ' + this.baseTitle;
|
||||
} else {
|
||||
document.title = this.baseTitle;
|
||||
}
|
||||
}
|
||||
|
||||
prepareChatMessage(serverID, msg) {
|
||||
// Treat server-wide broadcasts as highlights. They're sent by server
|
||||
// operators and can contain important information.
|
||||
|
|
Loading…
Reference in a new issue