add type annotations, improve ui

This commit is contained in:
marlon-erler
2026-04-13 11:23:17 +00:00
parent 537592fae9
commit 6dff4a74eb
21 changed files with 100 additions and 57 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ export default class ChatListModel {
channel: string,
fn: (chatModel: ChatModel) => void,
): void => {
const allChannels = channel.split("/");
const allChannels: string[] = channel.split("/");
for (const chatModel of this.chatModels) {
for (const channel of allChannels) {
+5 -4
View File
@@ -165,10 +165,10 @@ export default class ChatModel {
};
getNameAndChannel = (): [string, string] | false => {
const senderName = this.settingsModel.username;
const senderName: string = this.settingsModel.username;
if (senderName == "") return false;
const allChannels = [this.info.primaryChannel];
const allChannels: string[] = [this.info.primaryChannel];
for (const secondaryChannel of this.info.secondaryChannels) {
allChannels.push(secondaryChannel);
}
@@ -388,7 +388,7 @@ export default class ChatModel {
stringifiedFile: "",
};
if (fileContent != undefined) {
const stringifiedFile = stringify(fileContent);
const stringifiedFile: string = stringify(fileContent);
chatMessage.stringifiedFile = stringifiedFile;
}
@@ -412,7 +412,8 @@ export default class ChatModel {
content: ReactionSymbols,
isDeleting: boolean,
): ChatMessageReaction => {
const fileContent = FileModel.createFileContent(v4(), "reaction");
const fileContent: FileContent<"reaction"> =
FileModel.createFileContent(v4(), "reaction");
const reaction: ChatMessageReaction = {
...fileContent,
fileId: ChatModel.createMessageReactionId(messageId, sender),
+1 -1
View File
@@ -71,7 +71,7 @@ export default class CalendarModel {
date.setMonth(month - 1);
date.setFullYear(year);
const firstWeekdayOfMonth = date.getDay();
const firstWeekdayOfMonth: number = date.getDay();
const firstDayOfWeekSetting: number = parseInt(
this.settingsModel.firstDayOfWeek,
);
+1 -1
View File
@@ -75,7 +75,7 @@ export default class ConnectionModel {
StorageModelSubPaths.ConnectionModel,
filePaths.connectionModel.mailboxes,
);
const mailboxFilePath = [...mailboxDirPath, address];
const mailboxFilePath: string[] = [...mailboxDirPath, address];
return mailboxFilePath;
};
+13 -13
View File
@@ -26,22 +26,22 @@ export default class SettingsModel {
setName = (newValue: string): void => {
this.username = newValue;
this.storeSetting("username", newValue);
}
};
setFirstDayOfWeek = (newValue: string): void => {
this.firstDayOfWeek = newValue;
this.storeSetting("firstDayOfWeek", newValue);
}
};
setLanguage = (newValue: string): void => {
this.language = newValue;
this.storeSetting("language", newValue);
}
};
setTheme = (newValue: string): void => {
this.theme = newValue;
this.storeSetting("theme", newValue);
}
};
// load
private readSetting = (
@@ -52,27 +52,27 @@ export default class SettingsModel {
filePaths.settingsModel[pathName],
);
return this.storageModel.read(path);
}
};
loadUsername = (): void => {
const content = this.readSetting("username");
const content: string | null = this.readSetting("username");
this.username = content ?? "";
}
};
loadFirstDayofWeek = (): void => {
const content = this.readSetting("firstDayOfWeek");
const content: string | null = this.readSetting("firstDayOfWeek");
this.firstDayOfWeek = content ?? "0";
}
};
loadLanguage = (): void => {
const content = this.readSetting("language");
const content: string | null = this.readSetting("language");
this.language = content ?? SettingsModel.getSystemLanguage();
}
};
loadTheme = (): void => {
const content = this.readSetting("theme");
const content: string | null = this.readSetting("theme");
this.theme = content ?? ThemeSettings.System;
}
};
// init
constructor(storageModel: StorageModel) {