diff --git a/res/css/views/dialogs/_ExportDialog.scss b/res/css/views/dialogs/_ExportDialog.scss index 69b76221bb..d3af6c843b 100644 --- a/res/css/views/dialogs/_ExportDialog.scss +++ b/res/css/views/dialogs/_ExportDialog.scss @@ -1,22 +1,24 @@ -.mx_ExportDialog_subheading { - font-size: $font-16px; - display: block; - font-family: $font-family; - font-weight: 600; - color: $primary-fg-color; - margin-top: 18px; - margin-bottom: 12px; -} +.mx_ExportDialog { + .mx_ExportDialog_subheading { + font-size: $font-16px; + display: block; + font-family: $font-family; + font-weight: $font-semi-bold; + color: $primary-fg-color; + margin-top: 18px; + margin-bottom: 12px; + } -.mx_ExportDialog .mx_RadioButton > .mx_RadioButton_content { - margin-top: 5px; - margin-bottom: 5px; -} + .mx_RadioButton > .mx_RadioButton_content { + margin-top: 5px; + margin-bottom: 5px; + } -.mx_ExportDialog .mx_Field { - width: 256px; -} + .mx_Field { + width: 256px; + } -.mx_ExportDialog .mx_Field_postfix { - padding: 9px 10px; + .mx_Field_postfix { + padding: 9px 10px; + } } diff --git a/src/components/views/avatars/MemberAvatar.tsx b/src/components/views/avatars/MemberAvatar.tsx index 61723efb21..6015e4f568 100644 --- a/src/components/views/avatars/MemberAvatar.tsx +++ b/src/components/views/avatars/MemberAvatar.tsx @@ -18,12 +18,13 @@ limitations under the License. import React from 'react'; import { RoomMember } from "matrix-js-sdk/src/models/room-member"; import { ResizeMethod } from 'matrix-js-sdk/src/@types/partials'; +import { omit } from "lodash"; + import dis from "../../../dispatcher/dispatcher"; import { Action } from "../../../dispatcher/actions"; import BaseAvatar from "./BaseAvatar"; import { replaceableComponent } from "../../../utils/replaceableComponent"; import { mediaFromMxc } from "../../../customisations/Media"; -import { omit } from "lodash"; interface IProps extends Omit, "name" | "idName" | "url"> { member: RoomMember; diff --git a/src/components/views/dialogs/ExportDialog.tsx b/src/components/views/dialogs/ExportDialog.tsx index a8bb0fd7fa..62fa7b5bc6 100644 --- a/src/components/views/dialogs/ExportDialog.tsx +++ b/src/components/views/dialogs/ExportDialog.tsx @@ -18,6 +18,7 @@ import HTMLExporter from "../../../utils/exportUtils/HtmlExport"; import JSONExporter from "../../../utils/exportUtils/JSONExport"; import PlainTextExporter from "../../../utils/exportUtils/PlainTextExport"; import { useStateCallback } from "../../../hooks/useStateCallback"; +import Exporter from "../../../utils/exportUtils/Exporter"; interface IProps extends IDialogProps { room: Room; @@ -37,8 +38,8 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { const [exportSuccessful, setExportSuccessful] = useState(false); const [Exporter, setExporter] = useStateCallback( null, - async (Exporter: HTMLExporter | PlainTextExporter | JSONExporter) => { - await Exporter?.export().then(() => { + async (exporter: Exporter) => { + await exporter?.export().then(() => { if (!exportCancelled) setExportSuccessful(true); }); }, @@ -115,7 +116,7 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { return { valid: false, feedback: _t("Size must be a number") }; } - if (!(min <= parsedSize && parsedSize <= max)) { + if (min >= parsedSize || parsedSize >= max) { return { valid: false, feedback: _t( @@ -148,7 +149,7 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { }; } - if (!(min <= parsedSize && parsedSize <= max)) { + if (min >= parsedSize || parsedSize >= max) { return { valid: false, feedback: _t( @@ -192,9 +193,9 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { ); }); - let MessageCount = null; + let messageCount = null; if (exportType === exportTypes.LAST_N_MESSAGES) { - MessageCount = ( + messageCount = ( = ({ room, onFinished }) => { ); } - const sizePostFix = {_t("MB")}; + const sizePostFix = { _t("MB") }; - const ExportCancelWarning = ( - -

- {" "} - {_t( - "Are you sure you want to stop exporting your data? If you do, you'll need to start over.", - )}{" "} -

+

{ _t("The export was cancelled successfully") }

+ setCancelWarning(false)} - onPrimaryButtonClick={confirmCanel} + primaryButton={_t("Okay")} + hasCancel={false} + onPrimaryButtonClick={onFinished} />
- ); + } else if (exportSuccessful) { + // Display successful export message + return +

{ _t("Your messages were successfully exported") }

- const ExportSettings = ( + +
+ } else if (!isExporting) { + // Display export settings = ({ room, onFinished }) => { > { exportTypeOptions }
- { MessageCount } + { messageCount } { _t("Size Limit") } @@ -303,46 +315,32 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { onCancel={() => onFinished(false)} /> - ); - - const ExportSuccessful = ( + } else if (displayCancel) { + // Display cancel warning -

{ _t("Your messages were successfully exported") }

- +

+ {_t( + "Are you sure you want to stop exporting your data? If you do, you'll need to start over.", + )} +

setCancelWarning(false)} + onPrimaryButtonClick={confirmCanel} />
- ); - - const ExportCancelSuccess = ( - -

{ _t("The export was cancelled successfully") }

- - -
- ); - - const ExportProgress = ( - = ({ room, onFinished }) => { onPrimaryButtonClick={onCancel} /> - ); - - let componentToDisplay: JSX.Element; - if (exportCancelled) componentToDisplay = ExportCancelSuccess; - else if (exportSuccessful) componentToDisplay = ExportSuccessful; - else if (!isExporting) componentToDisplay = ExportSettings; - else if (displayCancel) componentToDisplay = ExportCancelWarning; - else componentToDisplay = ExportProgress; + } return componentToDisplay; }; diff --git a/src/components/views/elements/EventListSummary.tsx b/src/components/views/elements/EventListSummary.tsx index ef40251dec..665263d19c 100644 --- a/src/components/views/elements/EventListSummary.tsx +++ b/src/components/views/elements/EventListSummary.tsx @@ -77,7 +77,7 @@ const EventListSummary: React.FC = ({ ; } else { const avatars = summaryMembers.map((m, idx) => - ); + ); body = (