From cb28259b240803fa98c771706c3cb890ab210209 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 7 Dec 2017 01:06:35 +0000 Subject: [PATCH] List unsupported journals. --- src/JournalList.tsx | 55 +++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/src/JournalList.tsx b/src/JournalList.tsx index e29fddb..6377f71 100644 --- a/src/JournalList.tsx +++ b/src/JournalList.tsx @@ -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,28 +22,39 @@ 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) => { - let cryptoManager = new EteSync.CryptoManager(derived, journal.uid, journal.version); - let info = journal.getInfo(cryptoManager); - ret[info.type] = ret[info.type] || []; - ret[info.type].push( - - - {info.displayName} ({journal.uid.slice(0, 5)}) + if (journal.key) { + const key = 'UNSUPPORTED'; + ret[key] = ret[key] || []; + ret[key].push( + + {journal.uid.slice(0, 20)} - - ); + ); + } else { + let cryptoManager = new EteSync.CryptoManager(derived, journal.uid, journal.version); + let info = journal.getInfo(cryptoManager); + ret[info.type] = ret[info.type] || []; + ret[info.type].push( + + + {info.displayName} ({journal.uid.slice(0, 5)}) + + + ); + } + return ret; }, { CALENDAR: [], - ADDRESS_BOOK: []}); + ADDRESS_BOOK: [], + UNSUPPORTED: [] as Array}); const styles = { paper: { @@ -63,6 +75,15 @@ class JournalList extends React.Component { {journalMap.CALENDAR} + + { journalMap.UNSUPPORTED && ( + +

Unsupported

+ + {journalMap.UNSUPPORTED} + +
+ )} ); }