import React, { useState } from "react"; import { Room } from "matrix-js-sdk/src"; import { _t } from "../../../languageHandler"; import { IDialogProps } from "./IDialogProps"; import BaseDialog from "./BaseDialog"; import DialogButtons from "../elements/DialogButtons"; import Dropdown from "../elements/Dropdown"; import exportConversationalHistory, { exportFormats, exportTypes, } from "../../../utils/exportUtils/exportUtils"; interface IProps extends IDialogProps { room: Room; } const ExportDialog: React.FC = ({ room, onFinished }) => { const [format, setFormat] = useState("HTML"); const onExportClick = async () => { await exportConversationalHistory( room, exportFormats.PLAIN_TEXT, exportTypes.START_DATE, { startDate: parseInt( new Date("2021.05.20").getTime().toFixed(0), ), attachmentsIncluded: true, maxSize: 7 * 1024 * 1024, // 7 MB }, ); }; const onCancel = () => { onFinished(false); }; const options = Object.keys(exportFormats).map(key => { return
{ exportFormats[key] }
}) return (

{_t( "Select from the options below to export chats from your timeline", )}

{ setFormat(key) }} value={format} label={_t("Export formats")} > { options }
); }; export default ExportDialog;