diff --git a/packages/webapp/lang/en.json b/packages/webapp/lang/en.json index c75a1e8d..0fe6dbf9 100644 --- a/packages/webapp/lang/en.json +++ b/packages/webapp/lang/en.json @@ -86,6 +86,9 @@ "expired.title": { "defaultMessage": "Your session has expired" }, + "export.title": { + "defaultMessage": "Export" + }, "footer.aboutus": { "defaultMessage": "About Us" }, @@ -231,12 +234,18 @@ "map.name": { "defaultMessage": "Name" }, + "maps.choose-file": { + "defaultMessage": "Choose a file" + }, "maps.create-tooltip": { "defaultMessage": "Create a New Map" }, "maps.empty-result": { "defaultMessage": "No matching record found with the current filter criteria." }, + "maps.import-desc": { + "defaultMessage": "Import from other tools" + }, "maps.modified": { "defaultMessage": "Modified" }, diff --git a/packages/webapp/src/compiled-lang/en.json b/packages/webapp/src/compiled-lang/en.json index 724e6a8b..c8244840 100644 --- a/packages/webapp/src/compiled-lang/en.json +++ b/packages/webapp/src/compiled-lang/en.json @@ -173,6 +173,12 @@ "value": "Your session has expired" } ], + "export.title": [ + { + "type": 0, + "value": "Export" + } + ], "footer.aboutus": [ { "type": 0, @@ -461,6 +467,12 @@ "value": "Name" } ], + "maps.choose-file": [ + { + "type": 0, + "value": "Choose a file" + } + ], "maps.create-tooltip": [ { "type": 0, @@ -473,6 +485,12 @@ "value": "No matching record found with the current filter criteria." } ], + "maps.import-desc": [ + { + "type": 0, + "value": "Import from other tools" + } + ], "maps.modified": [ { "type": 0, diff --git a/packages/webapp/src/components/maps-page/action-dispatcher/base-dialog/index.tsx b/packages/webapp/src/components/maps-page/action-dispatcher/base-dialog/index.tsx index b3eee02a..5f5cf3b0 100644 --- a/packages/webapp/src/components/maps-page/action-dispatcher/base-dialog/index.tsx +++ b/packages/webapp/src/components/maps-page/action-dispatcher/base-dialog/index.tsx @@ -18,8 +18,7 @@ export type DialogProps = { const BaseDialog = (props: DialogProps) => { const intl = useIntl(); - const handleOnClose = props.onClose; - const onSubmit = props.onSubmit; + const { onClose, onSubmit } = props; const handleOnSubmit = (e: React.FormEvent) => { e.preventDefault(); @@ -34,7 +33,7 @@ const BaseDialog = (props: DialogProps) => {
@@ -53,7 +52,7 @@ const BaseDialog = (props: DialogProps) => { type="button" color="primary" size="medium" - onClick={handleOnClose} > + onClick={onClose} > {onSubmit ? () : () } diff --git a/packages/webapp/src/components/maps-page/action-dispatcher/export-dialog/index.tsx b/packages/webapp/src/components/maps-page/action-dispatcher/export-dialog/index.tsx new file mode 100644 index 00000000..fa5c4e9e --- /dev/null +++ b/packages/webapp/src/components/maps-page/action-dispatcher/export-dialog/index.tsx @@ -0,0 +1,104 @@ +import React, { useEffect } from "react"; +import { useIntl } from "react-intl"; +import { fetchMapById, SimpleDialogProps } from ".."; +import BaseDialog from "../base-dialog"; +import { FormControl, FormControlLabel, Radio, RadioGroup, Tooltip } from "@material-ui/core"; + + +const ExportDialog = (props: SimpleDialogProps) => { + const intl = useIntl(); + const { mapId, onClose } = props; + const [submit, setSubmit] = React.useState(false); + const [formExportRef, setExportFormRef] = React.useState(); // @Todo: review + const [formTransformtRef, setTransformFormRef] = React.useState(); // @Todo: review + + const [exportFormat, setExportFormat] = React.useState('mm'); + const handleChange = (event) => { + setExportFormat(event.target.value); + }; + + const handleOnClose = (): void => { + onClose(); + }; + + const handleOnSubmit = (event: React.FormEvent): void => { + setSubmit(true); + } + + useEffect(() => { + if (submit) { + // Depending on the type of export. It will require differt POST. + if (exportFormat == 'pdf' || exportFormat == "svg" || exportFormat == "image") { + formTransformtRef.submit(); + } else { + formExportRef.submit(); + } + onClose(); + } + }, [submit]); + + const { map } = fetchMapById(mapId); + return ( +
+ + + + + + {/* SVG Based .... */} + + } label="Image" color="secondary" /> + + + + {/* Non - SVG .... */} + + } label="FREEMIND_EXPORT_FORMAT_09" color="secondary" /> + + + + } label="MINDJET_EXPORT_FORMAT" color="secondary" /> + + + + } label="WISEMAPPING_EXPORT_FORMAT" color="secondary" /> + + + + } label="TXT_EXPORT_FORMAT" color="secondary" /> + + + + } label="XLS_EXPORT_FORMAT" color="secondary" /> + + + + } label="OPEN_OFFICE_EXPORT_FORMAT" color="secondary" /> + + + + + + + {/* Hidden form for the purpose of summit */} + + + + + +
+ + + +
+
+ ); +} + + +export default ExportDialog; \ No newline at end of file diff --git a/packages/webapp/src/components/maps-page/action-dispatcher/index.tsx b/packages/webapp/src/components/maps-page/action-dispatcher/index.tsx index 496f84c7..6ba40152 100644 --- a/packages/webapp/src/components/maps-page/action-dispatcher/index.tsx +++ b/packages/webapp/src/components/maps-page/action-dispatcher/index.tsx @@ -14,6 +14,7 @@ import ImportDialog from './import-dialog'; import PublishDialog from './publish-dialog'; import InfoDialog from './info-dialog'; import DeleteMultiselectDialog from './delete-multiselect-dialog'; +import ExportDialog from './export-dialog'; export type BasicMapInfo = { name: string; @@ -56,7 +57,7 @@ const ActionDispatcher = (props: ActionDialogProps) => { {action === 'publish' && } {action === 'info' && } {action === 'create' && } - + {action === 'export' && } ); }