From f142b6081a03471a86abc17ee6a049831e08d719 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 15 Oct 2020 09:45:26 +0300 Subject: [PATCH] Update etebase dep and adjust code accordingly. --- package.json | 2 +- src/Collections/Collection.tsx | 2 +- src/Collections/CollectionChangeEntries.tsx | 7 +++---- src/Collections/CollectionEdit.tsx | 16 +++++++++------- src/Collections/CollectionImport.tsx | 7 ++++--- src/Collections/CollectionList.tsx | 7 ++++--- src/Collections/ImportDialog.tsx | 8 ++++---- src/Pim/ItemChangeHistory.tsx | 4 ++-- src/Pim/helpers.tsx | 4 +++- src/WizardPage.tsx | 5 ++--- src/etebase-helpers.ts | 4 ++-- src/sync/SyncManager.ts | 6 +++--- yarn.lock | 8 ++++---- 13 files changed, 42 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 0238ee0..2b4652b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "@material-ui/lab": "^4.0.0-alpha.56", "@material-ui/pickers": "^3.2.10", "@material-ui/styles": "^4.10.0", - "etebase": "^0.14.0", + "etebase": "^0.20.0", "fuse.js": "^5.0.9-beta", "ical.js": "^1.4.0", "immutable": "^4.0.0-rc.12", diff --git a/src/Collections/Collection.tsx b/src/Collections/Collection.tsx index 2b9cdb3..1782e25 100644 --- a/src/Collections/Collection.tsx +++ b/src/Collections/Collection.tsx @@ -48,7 +48,7 @@ class Collection extends React.Component { return ( - + {isAdmin && <> { if (items) { @@ -71,7 +70,7 @@ export default function CollectionChangeEntries(props: PropsType) { }); let changelogRoute = ""; - switch (colType) { + switch (collectionType) { case "etebase.vevent": { changelogRoute = "pim.events._id.log"; break; diff --git a/src/Collections/CollectionEdit.tsx b/src/Collections/CollectionEdit.tsx index 27ffb86..282da22 100644 --- a/src/Collections/CollectionEdit.tsx +++ b/src/Collections/CollectionEdit.tsx @@ -40,19 +40,21 @@ interface FormErrors { export default function CollectionEdit(props: PropsType) { const [errors, setErrors] = React.useState({}); const [showDeleteDialog, setShowDeleteDialog] = React.useState(false); - const [info, setInfo] = React.useState(); + const [colType, setColType] = React.useState(""); + const [info, setInfo] = React.useState(); const [selectedColor, setSelectedColor] = React.useState(""); const etebase = useCredentials()!; React.useEffect(() => { if (props.collection !== undefined) { + setColType(props.collection.collectionType); setInfo(props.collection.metadata); if (props.collection.metadata.color) { setSelectedColor(props.collection.metadata.color); } } else { + setColType("etebase.vcard"); setInfo({ - type: "etebase.vcard", name: "", description: "", }); @@ -98,7 +100,7 @@ export default function CollectionEdit(props: PropsType) { collection = props.collection.collection; await collection.setMeta(meta); } else { - collection = await colMgr.create(meta, ""); + collection = await colMgr.create(colType, meta, ""); } onSave(collection); @@ -111,7 +113,7 @@ export default function CollectionEdit(props: PropsType) { const { collection, onDelete, onCancel } = props; const item = collection?.metadata; - const pageTitle = (item !== undefined) ? item.name : "New Collection"; + const pageTitle = (item !== undefined) ? item.name! : "New Collection"; const styles = { fullWidth: { @@ -130,7 +132,7 @@ export default function CollectionEdit(props: PropsType) { "etebase.vtodo": "Task List", }; let collectionColorBox: React.ReactNode; - switch (info.type) { + switch (colType) { case "etebase.vevent": case "etebase.vtodo": collectionColorBox = ( @@ -156,8 +158,8 @@ export default function CollectionEdit(props: PropsType) {