// SPDX-FileCopyrightText: © 2017 EteSync Authors // SPDX-License-Identifier: AGPL-3.0-only import * as React from "react"; import ContactsIcon from "@material-ui/icons/Contacts"; import CalendarTodayIcon from "@material-ui/icons/CalendarToday"; import FormatListBulletedIcon from "@material-ui/icons/FormatListBulleted"; import { List, ListItem } from "../widgets/List"; import AppBarOverride from "../widgets/AppBarOverride"; import Container from "../widgets/Container"; import { CachedCollection } from "../Pim/helpers"; import ColorBox from "../widgets/ColorBox"; import ImportDialog from "./ImportDialog"; interface PropsType { collections: CachedCollection[]; } export default function CollectionImport(props: PropsType) { const [selectedCollection, setSelectedCollection] = React.useState(); const collectionMap = { "etebase.vcard": [], "etebase.vevent": [], "etebase.vtodo": [], }; function colClicked(colUid: string) { const collection = props.collections.find((x) => x.collection.uid === colUid); setSelectedCollection(collection); } for (const col of props.collections) { if (collectionMap[col.metadata.type]) { const colorBox = (col.metadata.color) ? ( ) : undefined; collectionMap[col.metadata.type].push(( colClicked(col.collection.uid)}> {col.metadata.name} )); } } return ( } nestedItems={collectionMap["etebase.vcard"]} /> } nestedItems={collectionMap["etebase.vevent"]} /> } nestedItems={collectionMap["etebase.vtodo"]} /> {selectedCollection && ( setSelectedCollection(undefined)} /> )} ); }