chat: surface chat title in header

This commit is contained in:
Matilde Park 2020-03-05 19:15:49 -05:00
parent 1dd78ef413
commit 9f45554047
6 changed files with 56 additions and 12 deletions

View File

@ -233,11 +233,18 @@ export class ChatScreen extends Component {
const group = Array.from(props.group.values());
const isinPopout = this.props.popout ? "popout/" : "";
const isinPopout = props.popout ? "popout/" : "";
let ownerContact = (window.ship in props.contacts)
? props.contacts[window.ship] : false;
let title = props.station.substr(1);
if ((props.association) && (props.association.metadata)) {
title = (props.association.metadata.title !== "")
? props.association.metadata.title : props.station.substr(1);
}
return (
<div
key={props.station}
@ -258,9 +265,10 @@ export class ChatScreen extends Component {
<Link to={`/~chat/` + isinPopout + `room` + props.station}
className="pt2 white-d">
<h2
className="mono dib f9 fw4 v-top"
className={"dib f9 fw4 lh-solid v-top " +
((title === props.station.substr(1)) ? "mono" : "")}
style={{ width: "max-content" }}>
{props.station.substr(1)}
{title}
</h2>
</Link>
<ChatTabBar

View File

@ -50,6 +50,13 @@ export class MemberScreen extends Component {
let isinPopout = this.props.popout ? "popout/" : "";
let title = props.station.substr(1);
if ((props.association) && (props.association.metadata)) {
title = (props.association.metadata.title !== "")
? props.association.metadata.title : props.station.substr(1);
}
return (
<div className="h-100 w-100 overflow-x-hidden flex flex-column white-d">
<div
@ -68,9 +75,10 @@ export class MemberScreen extends Component {
<Link to={`/~chat/` + isinPopout + `room` + props.station}
className="pt2 white-d">
<h2
className="mono dib f9 fw4 v-top"
className={"dib f9 fw4 lh-solid v-top " +
((title === props.station.substr(1)) ? "mono" : "")}
style={{ width: "max-content" }}>
{props.station.substr(1)}
{title}
</h2>
</Link>
<ChatTabBar

View File

@ -162,6 +162,10 @@ export class Root extends Component {
roomContacts = contacts[associatedGroup]
}
let association = (associations.chat[station])
? associations.chat[station] : {};
let group = state.groups[station] || new Set([]);
let popout = props.match.url.includes("/popout/");
@ -175,6 +179,7 @@ export class Root extends Component {
>
<ChatScreen
station={station}
association={association}
api={api}
subscription={subscription}
read={mailbox.config.read}
@ -210,6 +215,8 @@ export class Root extends Component {
};
let popout = props.match.url.includes("/popout/");
let association = (associations.chat[station])
? associations.chat[station] : {};
return (
<Skeleton
@ -223,6 +230,7 @@ export class Root extends Component {
{...props}
api={api}
station={station}
association={association}
permission={permission}
contacts={contacts}
permissions={state.permissions}

View File

@ -234,6 +234,13 @@ export class SettingsScreen extends Component {
text = "Leaving...";
}
let title = props.station.substr(1);
if ((props.association) && (props.association.metadata)) {
title = (props.association.metadata.title !== "")
? props.association.metadata.title : props.station.substr(1);
}
return (
<div className="h-100 w-100 overflow-x-hidden flex flex-column white-d">
<div
@ -251,9 +258,10 @@ export class SettingsScreen extends Component {
<Link to={`/~chat/` + isinPopout + `room` + props.station}
className="pt2 white-d">
<h2
className="mono dib f9 fw4 v-top"
className={"dib f9 fw4 lh-solid v-top " +
((title === props.station.substr(1)) ? "mono" : "")}
style={{ width: "max-content" }}>
{props.station.substr(1)}
{title}
</h2>
</Link>
<ChatTabBar
@ -269,6 +277,13 @@ export class SettingsScreen extends Component {
);
}
let title = props.station.substr(1);
if ((props.association) && (props.association.metadata)) {
title = (props.association.metadata.title !== "")
? props.association.metadata.title : props.station.substr(1);
}
return (
<div className="h-100 w-100 overflow-x-hidden flex flex-column white-d">
<div
@ -286,9 +301,10 @@ export class SettingsScreen extends Component {
<Link to={`/~chat/` + isinPopout + `room` + props.station}
className="pt2">
<h2
className="mono dib f9 fw4 v-top"
className={"dib f9 fw4 lh-solid v-top " +
((title === props.station.substr(1)) ? "mono" : "")}
style={{ width: "max-content" }}>
{props.station.substr(1)}
{title}
</h2>
</Link>
<ChatTabBar

View File

@ -39,10 +39,10 @@ export class Sidebar extends Component {
let author = !!msg ? msg.author : '';
let when = !!msg ? msg.when : 0;
let title = box;
let title = box.substr(1);
if ((props.associations.chat[box]) && (props.associations.chat[box].metadata)) {
title = (props.associations.chat[box].metadata.title)
? props.associations.chat[box].metadata.title : box;
? props.associations.chat[box].metadata.title : box.substr(1);
}
let nickname = author;

View File

@ -38,6 +38,10 @@ export class Subscription {
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
api.bind('/app-name/contacts', 'PUT', api.authTokens.ship, 'metadata-store',
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
}
handleEvent(diff) {