rename all enums to plural
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import ChatModel, { ChatMessage } from "./chatModel";
|
||||
import StorageModel, {
|
||||
StorageModelSubPath,
|
||||
StorageModelSubPaths,
|
||||
filePaths,
|
||||
} from "../Global/storageModel";
|
||||
|
||||
@@ -81,7 +81,7 @@ export default class ChatListModel {
|
||||
// load
|
||||
loadChats = (): void => {
|
||||
const chatDir = StorageModel.getPath(
|
||||
StorageModelSubPath.Chat,
|
||||
StorageModelSubPaths.Chat,
|
||||
filePaths.chat.base,
|
||||
);
|
||||
const chatIds = this.storageModel.list(chatDir);
|
||||
|
||||
+16
-16
@@ -15,13 +15,13 @@ import {
|
||||
stringify,
|
||||
} from "../Utility/utility";
|
||||
import StorageModel, {
|
||||
StorageModelSubPath,
|
||||
StorageModelSubPaths,
|
||||
filePaths,
|
||||
} from "../Global/storageModel";
|
||||
import { decryptString, encryptString } from "../Utility/crypto";
|
||||
|
||||
import ChatListModel from "./chatListModel";
|
||||
import { Color } from "../../colors";
|
||||
import { Colors } from "../../colors";
|
||||
import ConnectionModel from "../Global/connectionModel";
|
||||
import SettingsModel from "../Global/settingsModel";
|
||||
import { v4 } from "uuid";
|
||||
@@ -37,7 +37,7 @@ export default class ChatModel {
|
||||
// data
|
||||
id: string;
|
||||
info: ChatInfo;
|
||||
color: Color;
|
||||
color: Colors;
|
||||
|
||||
chatMessageHandlerManager: HandlerManager<ChatMessage> =
|
||||
new HandlerManager();
|
||||
@@ -51,28 +51,28 @@ export default class ChatModel {
|
||||
// paths
|
||||
getBasePath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.Chat,
|
||||
StorageModelSubPaths.Chat,
|
||||
filePaths.chat.chatBase(this.id),
|
||||
);
|
||||
};
|
||||
|
||||
getInfoPath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.Chat,
|
||||
StorageModelSubPaths.Chat,
|
||||
filePaths.chat.info(this.id),
|
||||
);
|
||||
};
|
||||
|
||||
getColorPath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.Chat,
|
||||
StorageModelSubPaths.Chat,
|
||||
filePaths.chat.color(this.id),
|
||||
);
|
||||
};
|
||||
|
||||
getMessageDirPath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.Chat,
|
||||
StorageModelSubPaths.Chat,
|
||||
filePaths.chat.messages(this.id),
|
||||
);
|
||||
};
|
||||
@@ -83,7 +83,7 @@ export default class ChatModel {
|
||||
|
||||
getReactionDirPath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.Chat,
|
||||
StorageModelSubPaths.Chat,
|
||||
filePaths.chat.reactions(this.id),
|
||||
);
|
||||
};
|
||||
@@ -100,7 +100,7 @@ export default class ChatModel {
|
||||
);
|
||||
if (chatMessage == null) return;
|
||||
|
||||
chatMessage.status = ChatMessageStatus.Received;
|
||||
chatMessage.status = ChatMessageStatuses.Received;
|
||||
|
||||
this.addMessage(chatMessage);
|
||||
this.setReadStatus(true);
|
||||
@@ -123,7 +123,7 @@ export default class ChatModel {
|
||||
};
|
||||
|
||||
handleMessageSent = (chatMessage: ChatMessage): void => {
|
||||
chatMessage.status = ChatMessageStatus.Sent;
|
||||
chatMessage.status = ChatMessageStatuses.Sent;
|
||||
this.addMessage(chatMessage);
|
||||
};
|
||||
|
||||
@@ -144,7 +144,7 @@ export default class ChatModel {
|
||||
this.storeInfo();
|
||||
};
|
||||
|
||||
setColor = (color: Color): void => {
|
||||
setColor = (color: Colors): void => {
|
||||
this.color = color;
|
||||
this.storeColor();
|
||||
};
|
||||
@@ -277,7 +277,7 @@ export default class ChatModel {
|
||||
const path: string[] = this.getColorPath();
|
||||
const color: string | null = this.storageModel.read(path);
|
||||
if (!color) {
|
||||
this.color = Color.Standard;
|
||||
this.color = Colors.Standard;
|
||||
} else {
|
||||
this.color = color as any;
|
||||
}
|
||||
@@ -386,7 +386,7 @@ export default class ChatModel {
|
||||
body,
|
||||
dateSent: createTimestamp(),
|
||||
|
||||
status: ChatMessageStatus.Outbox,
|
||||
status: ChatMessageStatuses.Outbox,
|
||||
stringifiedFile: "",
|
||||
};
|
||||
if (fileContent != undefined) {
|
||||
@@ -455,7 +455,7 @@ export interface ChatInfo extends ValidObject {
|
||||
hasUnreadMessages: boolean;
|
||||
}
|
||||
|
||||
export enum ChatMessageStatus {
|
||||
export enum ChatMessageStatuses {
|
||||
Outbox = "outbox",
|
||||
Sent = "sent",
|
||||
Received = "received",
|
||||
@@ -470,7 +470,7 @@ export interface ChatMessage extends ValidObject {
|
||||
body: string;
|
||||
dateSent: string;
|
||||
|
||||
status: ChatMessageStatus;
|
||||
status: ChatMessageStatuses;
|
||||
|
||||
stringifiedFile: string;
|
||||
}
|
||||
@@ -504,7 +504,7 @@ export const ChatMessageReference: ChatMessage = {
|
||||
body: "",
|
||||
dateSent: "",
|
||||
|
||||
status: "" as ChatMessageStatus,
|
||||
status: "" as ChatMessageStatuses,
|
||||
|
||||
stringifiedFile: "",
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ import FileModel, { FileContent, FileModelSubPath } from "./fileModel";
|
||||
|
||||
import CalendarModel from "./calendarModel";
|
||||
import ChatModel from "../Chat/chatModel";
|
||||
import { Color } from "../../colors";
|
||||
import { Colors } from "../../colors";
|
||||
import { HandlerManager } from "../Utility/utility";
|
||||
import SettingsModel from "../Global/settingsModel";
|
||||
import StorageModel from "../Global/storageModel";
|
||||
@@ -96,7 +96,7 @@ export default class BoardsAndTasksModel {
|
||||
BoardsAndTasksModel.createBoardInfoFileContent(
|
||||
v4(),
|
||||
name,
|
||||
Color.Standard,
|
||||
Colors.Standard,
|
||||
);
|
||||
return boardInfoFileContent;
|
||||
};
|
||||
@@ -256,7 +256,7 @@ export default class BoardsAndTasksModel {
|
||||
static createBoardInfoFileContent = (
|
||||
fileId: string,
|
||||
name: string,
|
||||
color: Color,
|
||||
color: Colors,
|
||||
): BoardInfoFileContent => {
|
||||
const fileContent: FileContent<"board-info"> =
|
||||
FileModel.createFileContent(fileId, "board-info");
|
||||
@@ -294,7 +294,7 @@ export enum TaskModelSubPaths {
|
||||
// types
|
||||
export interface BoardInfoFileContent extends FileContent<"board-info"> {
|
||||
name: string;
|
||||
color: Color;
|
||||
color: Colors;
|
||||
}
|
||||
|
||||
export interface TaskFileContent extends FileContent<"task"> {
|
||||
@@ -322,7 +322,7 @@ export const BoardInfoFileContentReference: BoardInfoFileContent = {
|
||||
type: "board-info",
|
||||
|
||||
name: "",
|
||||
color: "" as Color,
|
||||
color: "" as Colors,
|
||||
};
|
||||
|
||||
export const TaskFileContentReference: TaskFileContent = {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { DATA_VERSION, ValidObject } from "../Utility/typeSafety";
|
||||
import StorageModel, {
|
||||
StorageModelSubPath,
|
||||
StorageModelSubPaths,
|
||||
filePaths,
|
||||
} from "../Global/storageModel";
|
||||
import {
|
||||
@@ -27,7 +27,7 @@ export default class FileModel {
|
||||
// paths
|
||||
getBasePath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.Chat,
|
||||
StorageModelSubPaths.Chat,
|
||||
filePaths.chat.files(this.chatModel.id),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { ChatMessage, ChatMessageReference } from "../Chat/chatModel";
|
||||
import { HandlerManager, stringify } from "../Utility/utility";
|
||||
import StorageModel, { StorageModelSubPath, filePaths } from "./storageModel";
|
||||
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
|
||||
import UDNFrontend, { Message } from "udn-frontend";
|
||||
|
||||
export default class ConnectionModel {
|
||||
@@ -55,7 +55,7 @@ export default class ConnectionModel {
|
||||
|
||||
// do not reconnect
|
||||
const reconnectAddressPath: string[] = StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.reconnectAddress,
|
||||
);
|
||||
this.storageModel.remove(reconnectAddressPath);
|
||||
@@ -74,7 +74,7 @@ export default class ConnectionModel {
|
||||
// mailbox
|
||||
getMailboxPath = (address: string): string[] => {
|
||||
const mailboxDirPath = StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.mailboxes,
|
||||
);
|
||||
const mailboxFilePath = [...mailboxDirPath, address];
|
||||
@@ -122,7 +122,7 @@ export default class ConnectionModel {
|
||||
// outbox
|
||||
getOutboxPath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.outbox,
|
||||
);
|
||||
};
|
||||
@@ -192,7 +192,7 @@ export default class ConnectionModel {
|
||||
// storage
|
||||
getPreviousAddressPath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.previousAddresses,
|
||||
);
|
||||
};
|
||||
@@ -204,7 +204,7 @@ export default class ConnectionModel {
|
||||
|
||||
getReconnectAddressPath = (): string[] => {
|
||||
return StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.reconnectAddress,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// this file is responsible for all settings.
|
||||
|
||||
import StorageModel, { StorageModelSubPath, filePaths } from "./storageModel";
|
||||
import StorageModel, { StorageModelSubPaths, filePaths } from "./storageModel";
|
||||
|
||||
export default class SettingsModel {
|
||||
storageModel: StorageModel;
|
||||
@@ -13,7 +13,7 @@ export default class SettingsModel {
|
||||
setName(newValue: string): void {
|
||||
this.username = newValue;
|
||||
const path = StorageModel.getPath(
|
||||
StorageModelSubPath.SettingsModel,
|
||||
StorageModelSubPaths.SettingsModel,
|
||||
filePaths.settingsModel.username,
|
||||
);
|
||||
this.storageModel.write(path, newValue);
|
||||
@@ -22,7 +22,7 @@ export default class SettingsModel {
|
||||
setFirstDayOfWeek(newValue: string): void {
|
||||
this.firstDayOfWeek = newValue;
|
||||
const path = StorageModel.getPath(
|
||||
StorageModelSubPath.SettingsModel,
|
||||
StorageModelSubPaths.SettingsModel,
|
||||
filePaths.settingsModel.firstDayOfWeek,
|
||||
);
|
||||
this.storageModel.write(path, newValue);
|
||||
@@ -31,7 +31,7 @@ export default class SettingsModel {
|
||||
// load
|
||||
loadUsernam(): void {
|
||||
const path = StorageModel.getPath(
|
||||
StorageModelSubPath.SettingsModel,
|
||||
StorageModelSubPaths.SettingsModel,
|
||||
filePaths.settingsModel.username,
|
||||
);
|
||||
const content = this.storageModel.read(path);
|
||||
@@ -40,7 +40,7 @@ export default class SettingsModel {
|
||||
|
||||
loadFirstDayofWeek(): void {
|
||||
const path = StorageModel.getPath(
|
||||
StorageModelSubPath.SettingsModel,
|
||||
StorageModelSubPaths.SettingsModel,
|
||||
filePaths.settingsModel.firstDayOfWeek,
|
||||
);
|
||||
const content = this.storageModel.read(path);
|
||||
|
||||
@@ -212,7 +212,7 @@ export default class StorageModel {
|
||||
};
|
||||
|
||||
static getPath(
|
||||
locationName: StorageModelSubPath,
|
||||
locationName: StorageModelSubPaths,
|
||||
filePath: string[],
|
||||
): string[] {
|
||||
return [DATA_VERSION, locationName, ...filePath];
|
||||
@@ -223,7 +223,7 @@ export default class StorageModel {
|
||||
export type StorageEntry = { [key: string]: StorageEntry };
|
||||
|
||||
// locations
|
||||
export enum StorageModelSubPath {
|
||||
export enum StorageModelSubPaths {
|
||||
Chat = "chat",
|
||||
|
||||
ConnectionModel = "connection",
|
||||
|
||||
+5
-5
@@ -6,7 +6,7 @@ import {
|
||||
} from "../Model/Files/boardsAndTasksModel";
|
||||
import ChatModel, {
|
||||
ChatMessage,
|
||||
ChatMessageStatus,
|
||||
ChatMessageStatuses,
|
||||
} from "../Model/Chat/chatModel";
|
||||
import {
|
||||
getLocalStorageItemAndClear,
|
||||
@@ -114,7 +114,7 @@ export default class v1Upgrader {
|
||||
|
||||
const addMessages = (
|
||||
potentialMessages: any[],
|
||||
status: ChatMessageStatus,
|
||||
status: ChatMessageStatuses,
|
||||
) => {
|
||||
for (const potentialMessage of potentialMessages) {
|
||||
const isV1ChatMessage: boolean = checkMatchesObjectStructure(
|
||||
@@ -139,7 +139,7 @@ export default class v1Upgrader {
|
||||
stringifiedFile: "",
|
||||
};
|
||||
chatModel.addMessage(convertedChatMessage);
|
||||
if (status == ChatMessageStatus.Outbox) {
|
||||
if (status == ChatMessageStatuses.Outbox) {
|
||||
this.connectionModel.sendMessageOrStore(
|
||||
convertedChatMessage,
|
||||
);
|
||||
@@ -147,8 +147,8 @@ export default class v1Upgrader {
|
||||
}
|
||||
};
|
||||
|
||||
addMessages(potentialMessages, ChatMessageStatus.Received);
|
||||
addMessages(potentialMessagesInOutbox, ChatMessageStatus.Outbox);
|
||||
addMessages(potentialMessages, ChatMessageStatuses.Received);
|
||||
addMessages(potentialMessagesInOutbox, ChatMessageStatuses.Outbox);
|
||||
|
||||
// objects
|
||||
const objectsString: string =
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import BoardViewModel, {
|
||||
BoardPageType,
|
||||
BoardPageTypes,
|
||||
} from "../../ViewModel/Pages/boardViewModel";
|
||||
|
||||
import { BoardKanbanPage } from "./boardKanbanPage";
|
||||
@@ -22,10 +22,10 @@ export function BoardPage(boardViewModel: BoardViewModel) {
|
||||
[boardViewModel.selectedPage],
|
||||
() => {
|
||||
switch (boardViewModel.selectedPage.value) {
|
||||
case BoardPageType.Kanban: {
|
||||
case BoardPageTypes.Kanban: {
|
||||
return BoardKanbanPage(boardViewModel);
|
||||
}
|
||||
case BoardPageType.StatusGrid: {
|
||||
case BoardPageTypes.StatusGrid: {
|
||||
return BoardStatusGridPage(boardViewModel);
|
||||
}
|
||||
default: {
|
||||
@@ -102,19 +102,19 @@ export function BoardPage(boardViewModel: BoardViewModel) {
|
||||
{BoardViewToggleButton(
|
||||
translations.chatPage.task.listViewButtonAudioLabel,
|
||||
"view_list",
|
||||
BoardPageType.List,
|
||||
BoardPageTypes.List,
|
||||
boardViewModel,
|
||||
)}
|
||||
{BoardViewToggleButton(
|
||||
translations.chatPage.task.kanbanViewButtonAudioLabel,
|
||||
"view_kanban",
|
||||
BoardPageType.Kanban,
|
||||
BoardPageTypes.Kanban,
|
||||
boardViewModel,
|
||||
)}
|
||||
{BoardViewToggleButton(
|
||||
translations.chatPage.task.statusViewButtonAudioLabel,
|
||||
"grid_view",
|
||||
BoardPageType.StatusGrid,
|
||||
BoardPageTypes.StatusGrid,
|
||||
boardViewModel,
|
||||
)}
|
||||
</span>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import { Color } from "../../colors";
|
||||
import { Colors } from "../../colors";
|
||||
import { ColorPicker } from "../Components/colorPicker";
|
||||
import { DangerousActionButton } from "../Components/dangerousActionButton";
|
||||
import { DeletableListItem } from "../Components/deletableListItem";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import BoardViewModel, {
|
||||
BoardPageType,
|
||||
BoardPageTypes,
|
||||
} from "../../ViewModel/Pages/boardViewModel";
|
||||
|
||||
import { RibbonButton } from "./ribbonButton";
|
||||
@@ -9,7 +9,7 @@ import { RibbonButton } from "./ribbonButton";
|
||||
export function BoardViewToggleButton(
|
||||
label: string,
|
||||
icon: string,
|
||||
page: BoardPageType,
|
||||
page: BoardPageTypes,
|
||||
boardViewModel: BoardViewModel,
|
||||
) {
|
||||
function select() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import { ChatMessageInfoModal } from "../Modals/chatMessageInfoModal";
|
||||
import { ChatMessageStatus } from "../../Model/Chat/chatModel";
|
||||
import { ChatMessageStatuses } from "../../Model/Chat/chatModel";
|
||||
import ChatMessageViewModel from "../../ViewModel/Chat/chatMessageViewModel";
|
||||
import { translations } from "../translations";
|
||||
import { MessageReactionButtonRow } from "./messageReactionButtonRow";
|
||||
@@ -11,11 +11,11 @@ export function ChatMessage(chatMessageViewModel: ChatMessageViewModel) {
|
||||
[chatMessageViewModel.status],
|
||||
() => {
|
||||
switch (chatMessageViewModel.status.value) {
|
||||
case ChatMessageStatus.Outbox:
|
||||
case ChatMessageStatuses.Outbox:
|
||||
return "hourglass_top";
|
||||
case ChatMessageStatus.Sent:
|
||||
case ChatMessageStatuses.Sent:
|
||||
return "check";
|
||||
case ChatMessageStatus.Received:
|
||||
case ChatMessageStatuses.Received:
|
||||
return "done_all";
|
||||
default:
|
||||
return "warning";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import ChatViewModel, {
|
||||
ChatPageType,
|
||||
ChatPageTypes,
|
||||
} from "../../ViewModel/Chat/chatViewModel";
|
||||
|
||||
import { RibbonButton } from "./ribbonButton";
|
||||
@@ -9,7 +9,7 @@ import { RibbonButton } from "./ribbonButton";
|
||||
export function ChatViewToggleButton(
|
||||
label: string,
|
||||
icon: string,
|
||||
page: ChatPageType,
|
||||
page: ChatPageTypes,
|
||||
chatViewModel: ChatViewModel,
|
||||
) {
|
||||
function select() {
|
||||
@@ -22,7 +22,7 @@ export function ChatViewToggleButton(
|
||||
);
|
||||
|
||||
const isHighlighted = new React.State(false);
|
||||
if (page == ChatPageType.Messages) {
|
||||
if (page == ChatPageTypes.Messages) {
|
||||
chatViewModel.hasUnreadMessages.subscribe(
|
||||
(hasUnreadMessages) => (isHighlighted.value = hasUnreadMessages),
|
||||
);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import { Color } from "../../colors";
|
||||
import { Colors } from "../../colors";
|
||||
|
||||
export function ColorPicker(selectedColor: React.State<Color>) {
|
||||
export function ColorPicker(selectedColor: React.State<Colors>) {
|
||||
return (
|
||||
<div class="flex-row gap width-input">
|
||||
{...Object.values(Color).map((color) => {
|
||||
{...Object.values(Colors).map((color) => {
|
||||
const isSelected = React.createProxyState(
|
||||
[selectedColor],
|
||||
() => selectedColor.value == color,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import BoardViewModel, {
|
||||
BoardPageType,
|
||||
BoardPageTypes,
|
||||
} from "../../ViewModel/Pages/boardViewModel";
|
||||
|
||||
export function RibbonButton(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import FileTransferViewModel, {
|
||||
FileTransferModal,
|
||||
FileTransferModals,
|
||||
FileTransferOption,
|
||||
} from "../../ViewModel/Global/fileTransferViewModel";
|
||||
|
||||
@@ -38,7 +38,7 @@ function DirectionSelectionModal(
|
||||
[fileTransferViewModel.presentedModal],
|
||||
() =>
|
||||
fileTransferViewModel.presentedModal.value ==
|
||||
FileTransferModal.DirectionSelection,
|
||||
FileTransferModals.DirectionSelection,
|
||||
);
|
||||
|
||||
const isDisconnected = React.createProxyState(
|
||||
@@ -156,7 +156,7 @@ function FileSelectionModal(fileTransferViewModel: FileTransferViewModel) {
|
||||
[fileTransferViewModel.presentedModal],
|
||||
() =>
|
||||
fileTransferViewModel.presentedModal.value ==
|
||||
FileTransferModal.FileSelection,
|
||||
FileTransferModals.FileSelection,
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -222,7 +222,7 @@ function TransferDataDisplayModal(
|
||||
[fileTransferViewModel.presentedModal],
|
||||
() =>
|
||||
fileTransferViewModel.presentedModal.value ==
|
||||
FileTransferModal.TransferDataDisplay,
|
||||
FileTransferModals.TransferDataDisplay,
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -295,7 +295,7 @@ function TransferDisplayModal(fileTransferViewModel: FileTransferViewModel) {
|
||||
[fileTransferViewModel.presentedModal],
|
||||
() =>
|
||||
fileTransferViewModel.presentedModal.value ==
|
||||
FileTransferModal.TransferDisplay,
|
||||
FileTransferModals.TransferDisplay,
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -361,7 +361,7 @@ function TransferDataInputModal(fileTransferViewModel: FileTransferViewModel) {
|
||||
[fileTransferViewModel.presentedModal],
|
||||
() =>
|
||||
fileTransferViewModel.presentedModal.value ==
|
||||
FileTransferModal.TransferDataInput,
|
||||
FileTransferModals.TransferDataInput,
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -446,7 +446,7 @@ function DataReceptionModal(fileTransferViewModel: FileTransferViewModel) {
|
||||
[fileTransferViewModel.presentedModal],
|
||||
() =>
|
||||
fileTransferViewModel.presentedModal.value ==
|
||||
FileTransferModal.ReceptionDisplay,
|
||||
FileTransferModals.ReceptionDisplay,
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,7 +2,7 @@ import "./homePage.css";
|
||||
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import ChatViewModel, { ChatPageType } from "../ViewModel/Chat/chatViewModel";
|
||||
import ChatViewModel, { ChatPageTypes } from "../ViewModel/Chat/chatViewModel";
|
||||
|
||||
import { CalendarPage } from "./ChatPages/calendarPage";
|
||||
import { ChatViewToggleButton } from "./Components/chatViewToggleButton";
|
||||
@@ -18,13 +18,13 @@ export function ChatPage(chatViewModel: ChatViewModel) {
|
||||
chatViewModel.closeSubPages();
|
||||
|
||||
switch (chatViewModel.selectedPage.value) {
|
||||
case ChatPageType.Settings: {
|
||||
case ChatPageTypes.Settings: {
|
||||
return SettingsPage(chatViewModel.settingsPageViewModel);
|
||||
}
|
||||
case ChatPageType.Tasks: {
|
||||
case ChatPageTypes.Tasks: {
|
||||
return TaskPage(chatViewModel.taskPageViewModel);
|
||||
}
|
||||
case ChatPageType.Calendar: {
|
||||
case ChatPageTypes.Calendar: {
|
||||
return CalendarPage(chatViewModel.calendarViewModel);
|
||||
}
|
||||
default: {
|
||||
@@ -88,25 +88,25 @@ export function ChatPage(chatViewModel: ChatViewModel) {
|
||||
{ChatViewToggleButton(
|
||||
translations.chatPage.pages.calendar,
|
||||
"calendar_month",
|
||||
ChatPageType.Calendar,
|
||||
ChatPageTypes.Calendar,
|
||||
chatViewModel,
|
||||
)}
|
||||
{ChatViewToggleButton(
|
||||
translations.chatPage.pages.tasks,
|
||||
"task_alt",
|
||||
ChatPageType.Tasks,
|
||||
ChatPageTypes.Tasks,
|
||||
chatViewModel,
|
||||
)}
|
||||
{ChatViewToggleButton(
|
||||
translations.chatPage.pages.messages,
|
||||
"forum",
|
||||
ChatPageType.Messages,
|
||||
ChatPageTypes.Messages,
|
||||
chatViewModel,
|
||||
)}
|
||||
{ChatViewToggleButton(
|
||||
translations.chatPage.pages.settings,
|
||||
"settings",
|
||||
ChatPageType.Settings,
|
||||
ChatPageTypes.Settings,
|
||||
chatViewModel,
|
||||
)}
|
||||
</span>
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
ChatMessage,
|
||||
ChatMessageReaction,
|
||||
ChatMessageReactionReference,
|
||||
ChatMessageStatus,
|
||||
ChatMessageStatuses,
|
||||
ReactionSymbols,
|
||||
} from "../../Model/Chat/chatModel";
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class ChatMessageViewModel {
|
||||
sender: string;
|
||||
dateSent: string;
|
||||
body: React.State<string> = new React.State("");
|
||||
status: React.State<ChatMessageStatus | any> = new React.State<any>(
|
||||
status: React.State<ChatMessageStatuses | any> = new React.State<any>(
|
||||
undefined,
|
||||
);
|
||||
sentByUser: boolean;
|
||||
|
||||
@@ -8,12 +8,12 @@ import ChatModel, {
|
||||
ChatMessageReaction,
|
||||
} from "../../Model/Chat/chatModel";
|
||||
import StorageModel, {
|
||||
StorageModelSubPath,
|
||||
StorageModelSubPaths,
|
||||
filePaths,
|
||||
} from "../../Model/Global/storageModel";
|
||||
|
||||
import ChatListViewModel from "./chatListViewModel";
|
||||
import { Color } from "../../colors";
|
||||
import { Colors } from "../../colors";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
import { Entry } from "../../View/Components/option";
|
||||
import MessagePageViewModel from "../Pages/messagePageViewModel";
|
||||
@@ -38,9 +38,9 @@ export default class ChatViewModel {
|
||||
settingsPageViewModel: SettingsPageViewModel;
|
||||
|
||||
// state
|
||||
displayedColor: React.State<Color> = new React.State<any>(Color.Standard);
|
||||
selectedPage: React.State<ChatPageType> = new React.State<any>(
|
||||
ChatPageType.Messages,
|
||||
displayedColor: React.State<Colors> = new React.State<any>(Colors.Standard);
|
||||
selectedPage: React.State<ChatPageTypes> = new React.State<any>(
|
||||
ChatPageTypes.Messages,
|
||||
);
|
||||
|
||||
index: React.State<number> = new React.State(0);
|
||||
@@ -59,12 +59,12 @@ export default class ChatViewModel {
|
||||
|
||||
closeSubPages = (): void => {};
|
||||
|
||||
setColor = (color: Color): void => {
|
||||
setColor = (color: Colors): void => {
|
||||
this.setDisplayedColor(color);
|
||||
this.chatModel.setColor(color);
|
||||
};
|
||||
|
||||
setDisplayedColor = (color: Color): void => {
|
||||
setDisplayedColor = (color: Colors): void => {
|
||||
this.displayedColor.value = color;
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ export default class ChatViewModel {
|
||||
// load
|
||||
loadPageSelection = (): void => {
|
||||
const path: string[] = StorageModel.getPath(
|
||||
StorageModelSubPath.Chat,
|
||||
StorageModelSubPaths.Chat,
|
||||
filePaths.chat.lastUsedPage(this.chatModel.id),
|
||||
);
|
||||
const lastUsedPage: string | null = this.storageModel.read(path);
|
||||
@@ -106,7 +106,7 @@ export default class ChatViewModel {
|
||||
updateReadStatus = (): void => {
|
||||
if (
|
||||
this.chatListViewModel.selectedChat.value == this &&
|
||||
this.selectedPage.value == ChatPageType.Messages
|
||||
this.selectedPage.value == ChatPageTypes.Messages
|
||||
) {
|
||||
this.chatModel.setReadStatus(false);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ export default class ChatViewModel {
|
||||
[this.selectedPage, this.chatListViewModel.selectedChat],
|
||||
() => {
|
||||
if (this.chatListViewModel.selectedChat.value != this) return;
|
||||
if (this.selectedPage.value != ChatPageType.Messages) return;
|
||||
if (this.selectedPage.value != ChatPageTypes.Messages) return;
|
||||
this.setReadStatus(false);
|
||||
},
|
||||
);
|
||||
@@ -194,7 +194,7 @@ export default class ChatViewModel {
|
||||
}
|
||||
|
||||
// types
|
||||
export enum ChatPageType {
|
||||
export enum ChatPageTypes {
|
||||
Settings = "settings",
|
||||
Messages = "messages",
|
||||
Tasks = "tasks",
|
||||
|
||||
@@ -4,7 +4,7 @@ import FileTransferModel, {
|
||||
TransferData,
|
||||
} from "../../Model/Global/fileTransferModel";
|
||||
import StorageModel, {
|
||||
StorageModelSubPath,
|
||||
StorageModelSubPaths,
|
||||
filePaths,
|
||||
} from "../../Model/Global/storageModel";
|
||||
|
||||
@@ -17,7 +17,7 @@ export default class FileTransferViewModel {
|
||||
chatListModel: ChatListModel;
|
||||
|
||||
// state
|
||||
presentedModal: React.State<FileTransferModal | undefined> =
|
||||
presentedModal: React.State<FileTransferModals | undefined> =
|
||||
new React.State<any>(undefined);
|
||||
|
||||
generalFileOptions: React.ListState<FileTransferOption> =
|
||||
@@ -86,14 +86,14 @@ export default class FileTransferViewModel {
|
||||
{
|
||||
label: translations.dataTransferModal.connectionData,
|
||||
path: StorageModel.getPath(
|
||||
StorageModelSubPath.ConnectionModel,
|
||||
StorageModelSubPaths.ConnectionModel,
|
||||
filePaths.connectionModel.previousAddresses,
|
||||
),
|
||||
},
|
||||
{
|
||||
label: translations.dataTransferModal.settingsData,
|
||||
path: StorageModel.getPath(
|
||||
StorageModelSubPath.SettingsModel,
|
||||
StorageModelSubPaths.SettingsModel,
|
||||
[],
|
||||
),
|
||||
},
|
||||
@@ -117,22 +117,22 @@ export default class FileTransferViewModel {
|
||||
|
||||
// view
|
||||
showDirectionSelectionModal = (): void => {
|
||||
this.presentedModal.value = FileTransferModal.DirectionSelection;
|
||||
this.presentedModal.value = FileTransferModals.DirectionSelection;
|
||||
this.getOptions();
|
||||
};
|
||||
|
||||
showFileSelectionModal = (): void => {
|
||||
this.presentedModal.value = FileTransferModal.FileSelection;
|
||||
this.presentedModal.value = FileTransferModals.FileSelection;
|
||||
};
|
||||
|
||||
showTransferDataModal = (): void => {
|
||||
this.presentedModal.value = FileTransferModal.TransferDataDisplay;
|
||||
this.presentedModal.value = FileTransferModals.TransferDataDisplay;
|
||||
this.getTransferData();
|
||||
this.fileTransferModel.prepareToSend();
|
||||
};
|
||||
|
||||
initiateTransfer = (): void => {
|
||||
this.presentedModal.value = FileTransferModal.TransferDisplay;
|
||||
this.presentedModal.value = FileTransferModals.TransferDisplay;
|
||||
this.didNotFinishSending.value = true;
|
||||
this.filePathsSent.clear();
|
||||
|
||||
@@ -148,11 +148,11 @@ export default class FileTransferViewModel {
|
||||
};
|
||||
|
||||
showTransferDataInputModal = (): void => {
|
||||
this.presentedModal.value = FileTransferModal.TransferDataInput;
|
||||
this.presentedModal.value = FileTransferModals.TransferDataInput;
|
||||
};
|
||||
|
||||
prepareReceivingData = (): void => {
|
||||
this.presentedModal.value = FileTransferModal.ReceptionDisplay;
|
||||
this.presentedModal.value = FileTransferModals.ReceptionDisplay;
|
||||
this.filePathsReceived.clear();
|
||||
|
||||
const transferData: TransferData = {
|
||||
@@ -189,7 +189,7 @@ export interface FileTransferOption {
|
||||
path: string[];
|
||||
}
|
||||
|
||||
export enum FileTransferModal {
|
||||
export enum FileTransferModals {
|
||||
DirectionSelection,
|
||||
|
||||
// sending
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "bloatless-react";
|
||||
import ChatModel, { ChatMessage } from "../../Model/Chat/chatModel";
|
||||
import ChatListViewModel from "../Chat/chatListViewModel";
|
||||
import { ChatPageType } from "../Chat/chatViewModel";
|
||||
import { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
|
||||
export default class NotificationViewModel {
|
||||
chatListViewModel: ChatListViewModel;
|
||||
@@ -25,7 +25,7 @@ export default class NotificationViewModel {
|
||||
this.chatListViewModel.selectedChat.value.selectedPage.value;
|
||||
if (
|
||||
notification.chat == currentChat &&
|
||||
currentPage == ChatPageType.Messages
|
||||
currentPage == ChatPageTypes.Messages
|
||||
)
|
||||
return;
|
||||
|
||||
@@ -43,7 +43,7 @@ export default class NotificationViewModel {
|
||||
(chat) => chat.chatModel.info.primaryChannel == notification.chat,
|
||||
);
|
||||
chat.open();
|
||||
chat.selectedPage.value = ChatPageType.Messages;
|
||||
chat.selectedPage.value = ChatPageTypes.Messages;
|
||||
};
|
||||
|
||||
// loop
|
||||
|
||||
@@ -5,8 +5,8 @@ import BoardsAndTasksModel, {
|
||||
TaskFileContent,
|
||||
} from "../../Model/Files/boardsAndTasksModel";
|
||||
|
||||
import ChatViewModel, { ChatPageType } from "../Chat/chatViewModel";
|
||||
import { Color } from "../../colors";
|
||||
import ChatViewModel, { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
import { Colors } from "../../colors";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
import SearchViewModel from "../Utility/searchViewModel";
|
||||
import StorageModel from "../../Model/Global/storageModel";
|
||||
@@ -25,12 +25,12 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
|
||||
// state
|
||||
name: React.State<string> = new React.State("");
|
||||
color: React.State<Color> = new React.State<any>(Color.Standard);
|
||||
color: React.State<Colors> = new React.State<any>(Colors.Standard);
|
||||
|
||||
index: React.State<number> = new React.State(0);
|
||||
|
||||
selectedPage: React.State<BoardPageType> = new React.State<any>(
|
||||
BoardPageType.List,
|
||||
selectedPage: React.State<BoardPageTypes> = new React.State<any>(
|
||||
BoardPageTypes.List,
|
||||
);
|
||||
|
||||
isSelected: React.State<boolean>;
|
||||
@@ -49,15 +49,15 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
};
|
||||
|
||||
getLastUsedBoardPath = (): string[] => {
|
||||
return [...this.getBasePath(), BoardViewModelSubPath.LastUsedView];
|
||||
return [...this.getBasePath(), BoardViewModelSubPaths.LastUsedView];
|
||||
};
|
||||
|
||||
getPreviousSearchesPath = (): string[] => {
|
||||
return [...this.getBasePath(), BoardViewModelSubPath.PreviousSearches];
|
||||
return [...this.getBasePath(), BoardViewModelSubPaths.PreviousSearches];
|
||||
};
|
||||
|
||||
getLastSearchPath = (): string[] => {
|
||||
return [...this.getBasePath(), BoardViewModelSubPath.LastSearch];
|
||||
return [...this.getBasePath(), BoardViewModelSubPaths.LastSearch];
|
||||
};
|
||||
|
||||
// settings
|
||||
@@ -112,7 +112,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
const lastUsedView: string | null = this.storageModel.read(path);
|
||||
if (lastUsedView == null) return;
|
||||
|
||||
this.selectedPage.value = lastUsedView as BoardPageType;
|
||||
this.selectedPage.value = lastUsedView as BoardPageTypes;
|
||||
};
|
||||
|
||||
handleNewSearch = (searchTerm: string): void => {
|
||||
@@ -273,7 +273,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
|
||||
this.color.subscribe(() => {
|
||||
if (this.isSelected.value == false) return;
|
||||
if (this.chatViewModel.selectedPage.value != ChatPageType.Tasks) return;
|
||||
if (this.chatViewModel.selectedPage.value != ChatPageTypes.Tasks) return;
|
||||
this.applyColor();
|
||||
});
|
||||
|
||||
@@ -304,14 +304,14 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
export enum BoardViewModelSubPath {
|
||||
export enum BoardViewModelSubPaths {
|
||||
LastUsedView = "last-used-view",
|
||||
PreviousSearches = "previous-searches",
|
||||
LastSearch = "last-search",
|
||||
}
|
||||
|
||||
// types
|
||||
export enum BoardPageType {
|
||||
export enum BoardPageTypes {
|
||||
List = "list",
|
||||
Kanban = "kanban",
|
||||
StatusGrid = "status-grid",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import ChatViewModel from "../Chat/chatViewModel";
|
||||
import { Color } from "../../colors";
|
||||
import { Colors } from "../../colors";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
|
||||
export default class SettingsPageViewModel {
|
||||
@@ -21,7 +21,7 @@ export default class SettingsPageViewModel {
|
||||
this.shouldShowEncryptionKey.value == true ? "text" : "password",
|
||||
);
|
||||
|
||||
color: React.State<Color> = new React.State<any>(Color.Standard);
|
||||
color: React.State<Colors> = new React.State<any>(Colors.Standard);
|
||||
|
||||
// guards
|
||||
cannotSetPrimaryChannel: React.State<boolean> = React.createProxyState(
|
||||
@@ -74,7 +74,7 @@ export default class SettingsPageViewModel {
|
||||
this.encryptionKeyInput.callSubscriptions();
|
||||
};
|
||||
|
||||
applyColor = (newColor: Color): void => {
|
||||
applyColor = (newColor: Colors): void => {
|
||||
this.chatViewModel.setColor(newColor);
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
export enum Color {
|
||||
export enum Colors {
|
||||
Standard = "standard",
|
||||
Coral = "coral",
|
||||
Yellow = "yellow",
|
||||
|
||||
Reference in New Issue
Block a user