message_table = (messages) => Table(
messages,
{
layout: 'auto',
rows: 30,
sort: 'timestamp',
columns: ['cid', 'flow', 'method', 'value', 'timestamp'],
format: {
timestamp: x => d3.timeFormat('%Y/%m/%d %X')(new Date(x*1000)),
cid: x => html`<a href="https://filfox.info/en/message/${x}">${x.substr(0,4)}...${x.substr(-6)}</a>`,
flow: ({from, to, through}) => {
return html`
${addr(from)}
→
${addr(to)}
${through && `(signed by ${addr(through, 'sign')})` || ''}
`
},
}
}
)