mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-05 13:55:54 +03:00
Render all message types in the sidebar also
This commit is contained in:
parent
34826d6e19
commit
19e05d70e2
@ -83,6 +83,30 @@ export class Sidebar extends Component {
|
|||||||
this.props.history.push('/~chat/new');
|
this.props.history.push('/~chat/new');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
summarizeMessage(speech) {
|
||||||
|
const fallback = '...';
|
||||||
|
if (_.has(speech, 'lin')) {
|
||||||
|
return speech.lin.msg;
|
||||||
|
} else if (_.has(speech, 'url')) {
|
||||||
|
return speech.url;
|
||||||
|
} else if (_.has(speech, 'exp')) {
|
||||||
|
return '# ' + speech.exp.exp;
|
||||||
|
} else if (_.has(speech, 'ire')) {
|
||||||
|
return this.summarizeMessage(speech.ire.sep);
|
||||||
|
} else if (_.has(speech, 'app')) {
|
||||||
|
return this.summarizeMessage(speech.app.sep);
|
||||||
|
} else if (_.has(speech, 'fat')) {
|
||||||
|
const msg = this.summarizeMessage(speech.fat.sep);
|
||||||
|
if (msg !== '' && msg !== fallback) return msg;
|
||||||
|
return 'Attachment' +
|
||||||
|
(_.has(speech, 'fat.tac.name.nom')
|
||||||
|
? ': ' + speech.fat.tac.name.nom
|
||||||
|
: '');
|
||||||
|
} else {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { props, state } = this;
|
const { props, state } = this;
|
||||||
let station = props.match.params.ship + '/' + props.match.params.station;
|
let station = props.match.params.ship + '/' + props.match.params.station;
|
||||||
@ -93,7 +117,9 @@ export class Sidebar extends Component {
|
|||||||
})
|
})
|
||||||
.map((cir) => {
|
.map((cir) => {
|
||||||
let msg = props.messagePreviews[cir];
|
let msg = props.messagePreviews[cir];
|
||||||
let content = _.get(msg, 'gam.sep.lin.msg', 'No messages yet');
|
let content = _.has(msg, 'gam.sep')
|
||||||
|
? this.summarizeMessage(msg.gam.sep)
|
||||||
|
: 'No messages yet';
|
||||||
let aut = !!msg ? msg.gam.aut : '';
|
let aut = !!msg ? msg.gam.aut : '';
|
||||||
let wen = !!msg ? msg.gam.wen : 0;
|
let wen = !!msg ? msg.gam.wen : 0;
|
||||||
let datetime =
|
let datetime =
|
||||||
|
Loading…
Reference in New Issue
Block a user