From dda24da20435a0d0b701199dfa9769614b50c47b Mon Sep 17 00:00:00 2001 From: Jaiwanth Date: Fri, 13 Aug 2021 08:59:14 +0530 Subject: [PATCH] Add copyright headers --- src/components/views/dialogs/ExportDialog.tsx | 12 ++++++------ src/utils/exportUtils/exportIcons.ts | 16 ++++++++++++++++ src/utils/exportUtils/exportJS.js | 17 +++++++++++++++++ src/utils/exportUtils/exportUtils.ts | 16 ++++++++-------- 4 files changed, 47 insertions(+), 14 deletions(-) diff --git a/src/components/views/dialogs/ExportDialog.tsx b/src/components/views/dialogs/ExportDialog.tsx index 6116faf1e1..d2f1da861a 100644 --- a/src/components/views/dialogs/ExportDialog.tsx +++ b/src/components/views/dialogs/ExportDialog.tsx @@ -54,7 +54,7 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { const [displayCancel, setCancelWarning] = useState(false); const [exportCancelled, setExportCancelled] = useState(false); const [exportSuccessful, setExportSuccessful] = useState(false); - const [Exporter, setExporter] = useStateCallback( + const [exporter, setExporter] = useStateCallback( null, async (exporter: Exporter) => { await exporter?.export().then(() => { @@ -195,7 +195,7 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { }; const confirmCanel = async () => { - await Exporter?.cancelExport().then(() => { + await exporter?.cancelExport().then(() => { setExportCancelled(true); setExporting(false); setExporter(null); @@ -203,14 +203,14 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { }; const exportFormatOptions = Object.keys(ExportFormat).map((format) => ({ - value: format, - label: textForFormat(format), + value: ExportFormat[format], + label: textForFormat(ExportFormat[format]), })); const exportTypeOptions = Object.keys(ExportType).map((type) => { return ( - ); }); diff --git a/src/utils/exportUtils/exportIcons.ts b/src/utils/exportUtils/exportIcons.ts index 181a62848e..7a8264f7e9 100644 --- a/src/utils/exportUtils/exportIcons.ts +++ b/src/utils/exportUtils/exportIcons.ts @@ -1,3 +1,19 @@ +/* +Copyright 2021 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + import trashSVG from "!!raw-loader!../../../res/img/element-icons/trashcan.svg"; import attachSVG from "!!raw-loader!../../../res/img/element-icons/room/composer/attach.svg"; diff --git a/src/utils/exportUtils/exportJS.js b/src/utils/exportUtils/exportJS.js index 9e58c8b99c..e082f88d98 100644 --- a/src/utils/exportUtils/exportJS.js +++ b/src/utils/exportUtils/exportJS.js @@ -1,3 +1,20 @@ +/* +Copyright 2021 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file is raw-imported (imported as plain text) for the export bundle, which is why this is in JS function showToastIfNeeded(replyId) { const el = document.getElementById(replyId); if (!el) { diff --git a/src/utils/exportUtils/exportUtils.ts b/src/utils/exportUtils/exportUtils.ts index 2f6e2c2cbc..139e3a3740 100644 --- a/src/utils/exportUtils/exportUtils.ts +++ b/src/utils/exportUtils/exportUtils.ts @@ -17,19 +17,19 @@ limitations under the License. import { _t } from "../../languageHandler"; export enum ExportFormat { - Html = "HTML", - PlainText = "PLAIN_TEXT", - Json = "JSON", + Html = "Html", + PlainText = "PlainText", + Json = "Json", } export enum ExportType { - Timeline = "TIMELINE", - Beginning = "BEGINNING", - LastNMessages = "LAST_N_MESSAGES", + Timeline = "Timeline", + Beginning = "Beginning", + LastNMessages = "LastNMessages", // START_DATE = "START_DATE", } -export const textForFormat = (format: string): string => { +export const textForFormat = (format: ExportFormat): string => { switch (format) { case ExportFormat.Html: return _t("HTML"); @@ -42,7 +42,7 @@ export const textForFormat = (format: string): string => { } }; -export const textForType = (type: string): string => { +export const textForType = (type: ExportType): string => { switch (type) { case ExportType.Beginning: return _t("From the beginning");