From 9cf37a0fb499032c4dddbbbbc0ef2dbaab1d5940 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 5 Aug 2020 21:03:45 +0300 Subject: [PATCH] Collections: add a component that views the collection. --- src/Collections/Collection.tsx | 102 +++++++++++++++++++++++++++++++++ src/Collections/Main.tsx | 3 +- 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 src/Collections/Collection.tsx diff --git a/src/Collections/Collection.tsx b/src/Collections/Collection.tsx new file mode 100644 index 0000000..5418ff4 --- /dev/null +++ b/src/Collections/Collection.tsx @@ -0,0 +1,102 @@ +// SPDX-FileCopyrightText: © 2017 EteSync Authors +// SPDX-License-Identifier: AGPL-3.0-only + +import * as React from "react"; +import IconButton from "@material-ui/core/IconButton"; +import IconEdit from "@material-ui/icons/Edit"; +import IconMembers from "@material-ui/icons/People"; +import IconImport from "@material-ui/icons/ImportExport"; + + +import AppBarOverride from "../widgets/AppBarOverride"; +import Container from "../widgets/Container"; + +/* FIXME: +import CollectionEntries from "../components/CollectionEntries"; +import ImportDialog from "./ImportDialog"; + */ + +import { Link } from "react-router-dom"; + +import { routeResolver } from "../App"; + +import { CachedCollection } from "../Pim/helpers"; + +interface PropsType { + collection: CachedCollection; +} + +class Collection extends React.Component { + public state: { + tab: number; + importDialogOpen: boolean; + }; + + constructor(props: PropsType) { + super(props); + + this.importDialogToggle = this.importDialogToggle.bind(this); + this.state = { + tab: 0, + importDialogOpen: false, + }; + } + + public render() { + const { collection, metadata } = this.props.collection; + const isAdmin = true; // FIXME + + return ( + + + {isAdmin && + <> + + + + + + + + } + + + + + + Change entries: TBD + + {/* + + + + + + */} + + ); + } + + private importDialogToggle() { + this.setState((state: any) => ({ importDialogOpen: !state.importDialogOpen })); + } +} + +export default Collection; diff --git a/src/Collections/Main.tsx b/src/Collections/Main.tsx index 44db901..5126818 100644 --- a/src/Collections/Main.tsx +++ b/src/Collections/Main.tsx @@ -15,6 +15,7 @@ import { CachedCollection, getDecryptCollectionsFunction, PimFab } from "../Pim/ import CollectionList from "./CollectionList"; import PageNotFound from "../PageNotFound"; import CollectionEdit from "./CollectionEdit"; +import Collection from "./Collection"; const decryptCollections = getDecryptCollectionsFunction(); @@ -118,7 +119,7 @@ export default function CollectionsMain() { path={routeResolver.getRoute("collections._id")} exact > - Journal view + );