From e38181a8ae1ff0bd953bed6e04ca98388eaf77c8 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 30 Jul 2020 10:50:12 +0300 Subject: [PATCH] Journal: only show change log, not the items. Was very confusing to people. --- src/Journals/Journal.tsx | 83 ++++------------------------------------ 1 file changed, 7 insertions(+), 76 deletions(-) diff --git a/src/Journals/Journal.tsx b/src/Journals/Journal.tsx index 302fdd4..40e976b 100644 --- a/src/Journals/Journal.tsx +++ b/src/Journals/Journal.tsx @@ -3,35 +3,22 @@ import * as React from 'react'; import IconButton from '@material-ui/core/IconButton'; -import Tab from '@material-ui/core/Tab'; -import Tabs from '@material-ui/core/Tabs'; -import { Theme, withTheme } from '@material-ui/core/styles'; import IconEdit from '@material-ui/icons/Edit'; import IconMembers from '@material-ui/icons/People'; import IconImport from '@material-ui/icons/ImportExport'; -import SearchableAddressBook from '../components/SearchableAddressBook'; -import Contact from '../components/Contact'; -import Calendar from '../components/Calendar'; -import Event from '../components/Event'; -import Task from '../components/Tasks/Task'; -import TaskList from '../components/Tasks/TaskList'; import AppBarOverride from '../widgets/AppBarOverride'; import Container from '../widgets/Container'; import JournalEntries from '../components/JournalEntries'; -import journalView from './journalView'; import ImportDialog from './ImportDialog'; -import { syncEntriesToItemMap, syncEntriesToEventItemMap, syncEntriesToTaskItemMap } from '../journal-processors'; - import { SyncInfo, SyncInfoJournal } from '../SyncGate'; import { Link } from 'react-router-dom'; import { routeResolver } from '../App'; -import { historyPersistor } from '../persist-state-history'; import { CredentialsData, UserInfoData } from '../store'; @@ -43,22 +30,13 @@ interface PropsType { isOwner: boolean; } -interface PropsTypeInner extends PropsType { - theme: Theme; -} - -const JournalAddressBook = journalView(SearchableAddressBook, Contact); -const PersistCalendar = historyPersistor('Calendar')(Calendar); -const JournalCalendar = journalView(PersistCalendar, Event); -const JournalTaskList = journalView(TaskList, Task); - -class Journal extends React.Component { +class Journal extends React.Component { public state: { tab: number; importDialogOpen: boolean; }; - constructor(props: PropsTypeInner) { + constructor(props: PropsType) { super(props); this.importDialogToggle = this.importDialogToggle.bind(this); @@ -69,43 +47,12 @@ class Journal extends React.Component { } public render() { - const { theme, isOwner, syncJournal } = this.props; - let currentTab = this.state.tab; - let journalOnly = false; + const { isOwner, syncJournal } = this.props; const journal = syncJournal.journal; const collectionInfo = syncJournal.collection; const syncEntries = syncJournal.entries; - let itemsTitle: string; - let itemsView: JSX.Element; - if (collectionInfo.type === 'CALENDAR') { - itemsView = ( - ); - itemsTitle = 'Events'; - } else if (collectionInfo.type === 'ADDRESS_BOOK') { - itemsView = - ; - itemsTitle = 'Contacts'; - } else if (collectionInfo.type === 'TASKS') { - itemsView = ( - ); - itemsTitle = 'Tasks'; - } else { - itemsView =
Preview is not supported for this journal type
; - itemsTitle = 'Items'; - journalOnly = true; - } - - currentTab = journalOnly ? 1 : currentTab; - return ( @@ -134,25 +81,9 @@ class Journal extends React.Component { - this.setState({ tab })} - > - - - - {currentTab === 0 && - - {itemsView} - - } - {currentTab === 1 && - - - - } + + + { } } -export default withTheme(Journal); +export default Journal;