PascalCasing for enums

This commit is contained in:
Jaiwanth 2021-07-27 00:00:52 +05:30
parent b91309be82
commit 9771f4d6c4
6 changed files with 36 additions and 36 deletions

View file

@ -17,7 +17,7 @@ limitations under the License.
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { Room } from "matrix-js-sdk/src/models/room";
import { MatrixClientPeg } from "../../MatrixClientPeg";
import { IExportOptions, exportTypes } from "./exportUtils";
import { IExportOptions, ExportTypes } from "./exportUtils";
import { decryptFile } from "../DecryptFile";
import { mediaFromContent } from "../../customisations/Media";
import { formatFullDateNoDay } from "../../DateUtils";
@ -38,7 +38,7 @@ export default abstract class Exporter {
protected constructor(
protected room: Room,
protected exportType: exportTypes,
protected exportType: ExportTypes,
protected exportOptions: IExportOptions,
protected exportProgressRef: MutableRefObject<HTMLParagraphElement>,
) {
@ -114,10 +114,10 @@ export default abstract class Exporter {
protected getLimit(): number {
let limit: number;
switch (this.exportType) {
case exportTypes.LAST_N_MESSAGES:
case ExportTypes.LAST_N_MESSAGES:
limit = this.exportOptions.numberOfMessages;
break;
case exportTypes.TIMELINE:
case ExportTypes.TIMELINE:
limit = 40;
break;
default:
@ -162,7 +162,7 @@ export default abstract class Exporter {
events.push(mxEv);
}
this.updateProgress(
("Fetched " + events.length + " events ") + (this.exportType === exportTypes.LAST_N_MESSAGES
("Fetched " + events.length + " events ") + (this.exportType === ExportTypes.LAST_N_MESSAGES
? `out of ${this.exportOptions.numberOfMessages}`
: "so far"),
);

View file

@ -33,7 +33,7 @@ import BaseAvatar from "../../components/views/avatars/BaseAvatar";
import exportCSS from "./exportCSS";
import exportJS from "./exportJS";
import exportIcons from "./exportIcons";
import { exportTypes } from "./exportUtils";
import { ExportTypes } from "./exportUtils";
import { IExportOptions } from "./exportUtils";
import MatrixClientContext from "../../contexts/MatrixClientContext";
@ -45,7 +45,7 @@ export default class HTMLExporter extends Exporter {
constructor(
room: Room,
exportType: exportTypes,
exportType: ExportTypes,
exportOptions: IExportOptions,
exportProgressRef: MutableRefObject<HTMLParagraphElement>,
) {

View file

@ -19,7 +19,7 @@ import { Room } from "matrix-js-sdk/src/models/room";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { formatFullDateNoDay, formatFullDateNoDayNoTime } from "../../DateUtils";
import { haveTileForEvent } from "../../components/views/rooms/EventTile";
import { exportTypes } from "./exportUtils";
import { ExportTypes } from "./exportUtils";
import { IExportOptions } from "./exportUtils";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { MutableRefObject } from "react";
@ -30,7 +30,7 @@ export default class JSONExporter extends Exporter {
constructor(
room: Room,
exportType: exportTypes,
exportType: ExportTypes,
exportOptions: IExportOptions,
exportProgressRef: MutableRefObject<HTMLParagraphElement>,
) {

View file

@ -20,7 +20,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { formatFullDateNoDay } from "../../DateUtils";
import { _t } from "../../languageHandler";
import { haveTileForEvent } from "../../components/views/rooms/EventTile";
import { exportTypes } from "./exportUtils";
import { ExportTypes } from "./exportUtils";
import { IExportOptions } from "./exportUtils";
import { textForEvent } from "../../TextForEvent";
import { MutableRefObject } from "react";
@ -31,7 +31,7 @@ export default class PlainTextExporter extends Exporter {
constructor(
room: Room,
exportType: exportTypes,
exportType: ExportTypes,
exportOptions: IExportOptions,
exportProgressRef: MutableRefObject<HTMLParagraphElement>,
) {

View file

@ -16,37 +16,37 @@ limitations under the License.
import { _t } from "../../languageHandler";
export enum exportFormats {
export enum ExportFormats {
HTML = "HTML",
PLAIN_TEXT = "PLAIN_TEXT",
JSON = "JSON",
}
export enum exportTypes {
export enum ExportTypes {
TIMELINE = "TIMELINE",
BEGINNING = "BEGINNING",
// START_DATE = "START_DATE",
LAST_N_MESSAGES = "LAST_N_MESSAGES",
// START_DATE = "START_DATE",
}
export const textForFormat = (format: string): string => {
switch (format) {
case exportFormats.HTML:
case ExportFormats.HTML:
return _t("HTML");
case exportFormats.JSON:
case ExportFormats.JSON:
return _t("JSON");
case exportFormats.PLAIN_TEXT:
case ExportFormats.PLAIN_TEXT:
return _t("Plain Text");
}
};
export const textForType = (type: string): string => {
switch (type) {
case exportTypes.BEGINNING:
case ExportTypes.BEGINNING:
return _t("From the beginning");
case exportTypes.LAST_N_MESSAGES:
case ExportTypes.LAST_N_MESSAGES:
return _t("Specify a number of messages");
case exportTypes.TIMELINE:
case ExportTypes.TIMELINE:
return _t("Current Timeline");
// case exportTypes.START_DATE:
// return _t("From a specific date");