List unsupported journals.

master
Tom Hacohen 7 years ago
parent e17aaaf79d
commit cb28259b24

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

Loading…
Cancel
Save