List unsupported journals.

master
Tom Hacohen 7 years ago
parent e17aaaf79d
commit cb28259b24

@ -1,4 +1,5 @@
import * as React from 'react';
const Fragment = (React as any).Fragment;
import { Link } from 'react-router-dom';
import { List, ListItem } from 'material-ui/List';
@ -21,11 +22,19 @@ class JournalList extends React.Component {
render() {
const derived = this.props.etesync.encryptionKey;
const journalMap = this.props.journals.filter((x) => (
// Skip shared journals for now.
!x.key
)).reduce(
const journalMap = this.props.journals.reduce(
(ret, journal) => {
if (journal.key) {
const key = 'UNSUPPORTED';
ret[key] = ret[key] || [];
ret[key].push(
<ListItem
key={journal.uid}
>
{journal.uid.slice(0, 20)}
</ListItem>
);
} else {
let cryptoManager = new EteSync.CryptoManager(derived, journal.uid, journal.version);
let info = journal.getInfo(cryptoManager);
ret[info.type] = ret[info.type] || [];
@ -39,10 +48,13 @@ class JournalList extends React.Component {
</ListItem>
</Link>
);
}
return ret;
},
{ CALENDAR: [],
ADDRESS_BOOK: []});
ADDRESS_BOOK: [],
UNSUPPORTED: [] as Array<JSX.Element>});
const styles = {
paper: {
@ -63,6 +75,15 @@ class JournalList extends React.Component {
<List>
{journalMap.CALENDAR}
</List>
{ journalMap.UNSUPPORTED && (
<Fragment>
<h2>Unsupported</h2>
<List>
{journalMap.UNSUPPORTED}
</List>
</Fragment>
)}
</Paper>
);
}

Loading…
Cancel
Save