add type annotations, improve ui
This commit is contained in:
Vendored
+9
-3
@@ -2246,7 +2246,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// src/ViewModel/Global/coreViewModel.ts
|
// src/ViewModel/Global/coreViewModel.ts
|
||||||
var CoreViewModel = class {
|
var CoreViewModel = class _CoreViewModel {
|
||||||
// init
|
// init
|
||||||
constructor(storageModel2, settingsModel2, connectionModel2, chatListModel2, fileTransferModel2) {
|
constructor(storageModel2, settingsModel2, connectionModel2, chatListModel2, fileTransferModel2) {
|
||||||
this.storageModel = storageModel2;
|
this.storageModel = storageModel2;
|
||||||
@@ -2275,6 +2275,7 @@
|
|||||||
this.logContexts();
|
this.logContexts();
|
||||||
};
|
};
|
||||||
this.handleKeyDown = (e) => {
|
this.handleKeyDown = (e) => {
|
||||||
|
if (_CoreViewModel.checkIsKeystroke(e) == false) return;
|
||||||
const contexts = this.contexts;
|
const contexts = this.contexts;
|
||||||
while (contexts.length > 0) {
|
while (contexts.length > 0) {
|
||||||
const currentContext = contexts.pop();
|
const currentContext = contexts.pop();
|
||||||
@@ -3192,6 +3193,7 @@
|
|||||||
this.color.value
|
this.color.value
|
||||||
);
|
);
|
||||||
this.taskPageViewModel.updateBoard(newBoardInfoFileContent);
|
this.taskPageViewModel.updateBoard(newBoardInfoFileContent);
|
||||||
|
this.taskPageViewModel.selectBoard(this);
|
||||||
};
|
};
|
||||||
this.applyColor = () => {
|
this.applyColor = () => {
|
||||||
this.taskPageViewModel.chatViewModel.setDisplayedColor(
|
this.taskPageViewModel.chatViewModel.setDisplayedColor(
|
||||||
@@ -3370,8 +3372,10 @@
|
|||||||
() => this.searchViewModel.appliedQuery.value != ""
|
() => this.searchViewModel.appliedQuery.value != ""
|
||||||
);
|
);
|
||||||
this.registerKeyStroke("=" /* Filter */, this.showFilterModal);
|
this.registerKeyStroke("=" /* Filter */, this.showFilterModal);
|
||||||
this.registerKeyStroke("backspace" /* CloseOrCancel */, this.hideFilterModal);
|
|
||||||
this.registerKeyStroke("-" /* Reset */, this.resetFilter);
|
this.registerKeyStroke("-" /* Reset */, this.resetFilter);
|
||||||
|
this.registerKeyStroke("backspace" /* CloseOrCancel */, this.hideFilterModal);
|
||||||
|
this.registerKeyStroke("," /* Settings */, this.showSettings);
|
||||||
|
this.registerKeyStroke("enter" /* Apply */, this.hideSettings);
|
||||||
this.taskPageViewModel.registerContext(this.boardInfo.fileId, this);
|
this.taskPageViewModel.registerContext(this.boardInfo.fileId, this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -4584,7 +4588,7 @@
|
|||||||
return /* @__PURE__ */ createElement("div", { id: "message-page" }, /* @__PURE__ */ createElement("div", { class: "pane-wrapper" }, /* @__PURE__ */ createElement("div", { class: "pane" }, /* @__PURE__ */ createElement("div", { class: "toolbar" }, /* @__PURE__ */ createElement("span", { class: "title" }, coreViewModel2.translations.chatPage.message.messagesHeadline), /* @__PURE__ */ createElement("span", null, /* @__PURE__ */ createElement(
|
return /* @__PURE__ */ createElement("div", { id: "message-page" }, /* @__PURE__ */ createElement("div", { class: "pane-wrapper" }, /* @__PURE__ */ createElement("div", { class: "pane" }, /* @__PURE__ */ createElement("div", { class: "toolbar" }, /* @__PURE__ */ createElement("span", { class: "title" }, coreViewModel2.translations.chatPage.message.messagesHeadline), /* @__PURE__ */ createElement("span", null, /* @__PURE__ */ createElement(
|
||||||
"button",
|
"button",
|
||||||
{
|
{
|
||||||
class: "ghost",
|
class: "ghost inset-outline",
|
||||||
"on:click": messagePageViewModel.showFilterModal,
|
"on:click": messagePageViewModel.showFilterModal,
|
||||||
"aria-label": coreViewModel2.translations.chatPage.message.filterMessagesButtonAudioLabel,
|
"aria-label": coreViewModel2.translations.chatPage.message.filterMessagesButtonAudioLabel,
|
||||||
"toggle:selected": messagePageViewModel.isFilterActive
|
"toggle:selected": messagePageViewModel.isFilterActive
|
||||||
@@ -4927,6 +4931,7 @@
|
|||||||
|
|
||||||
// src/View/Modals/boardSettingsModal.tsx
|
// src/View/Modals/boardSettingsModal.tsx
|
||||||
function BoardSettingsModal(coreViewModel2, boardViewModel) {
|
function BoardSettingsModal(coreViewModel2, boardViewModel) {
|
||||||
|
boardViewModel.isPresentingSettingsModal.subscribe(setFocusWithDelay);
|
||||||
return /* @__PURE__ */ createElement(
|
return /* @__PURE__ */ createElement(
|
||||||
"div",
|
"div",
|
||||||
{
|
{
|
||||||
@@ -4936,6 +4941,7 @@
|
|||||||
/* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("main", null, /* @__PURE__ */ createElement("h2", null, coreViewModel2.translations.chatPage.task.boardSettingsHeadline), /* @__PURE__ */ createElement("label", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "label"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, coreViewModel2.translations.chatPage.task.boardNameInputLabel), /* @__PURE__ */ createElement(
|
/* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("main", null, /* @__PURE__ */ createElement("h2", null, coreViewModel2.translations.chatPage.task.boardSettingsHeadline), /* @__PURE__ */ createElement("label", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "label"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, coreViewModel2.translations.chatPage.task.boardNameInputLabel), /* @__PURE__ */ createElement(
|
||||||
"input",
|
"input",
|
||||||
{
|
{
|
||||||
|
id: "focused",
|
||||||
"on:enter": boardViewModel.saveSettings,
|
"on:enter": boardViewModel.saveSettings,
|
||||||
"bind:value": boardViewModel.name
|
"bind:value": boardViewModel.name
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export default class ChatListModel {
|
|||||||
channel: string,
|
channel: string,
|
||||||
fn: (chatModel: ChatModel) => void,
|
fn: (chatModel: ChatModel) => void,
|
||||||
): void => {
|
): void => {
|
||||||
const allChannels = channel.split("/");
|
const allChannels: string[] = channel.split("/");
|
||||||
|
|
||||||
for (const chatModel of this.chatModels) {
|
for (const chatModel of this.chatModels) {
|
||||||
for (const channel of allChannels) {
|
for (const channel of allChannels) {
|
||||||
|
|||||||
@@ -165,10 +165,10 @@ export default class ChatModel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getNameAndChannel = (): [string, string] | false => {
|
getNameAndChannel = (): [string, string] | false => {
|
||||||
const senderName = this.settingsModel.username;
|
const senderName: string = this.settingsModel.username;
|
||||||
if (senderName == "") return false;
|
if (senderName == "") return false;
|
||||||
|
|
||||||
const allChannels = [this.info.primaryChannel];
|
const allChannels: string[] = [this.info.primaryChannel];
|
||||||
for (const secondaryChannel of this.info.secondaryChannels) {
|
for (const secondaryChannel of this.info.secondaryChannels) {
|
||||||
allChannels.push(secondaryChannel);
|
allChannels.push(secondaryChannel);
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ export default class ChatModel {
|
|||||||
stringifiedFile: "",
|
stringifiedFile: "",
|
||||||
};
|
};
|
||||||
if (fileContent != undefined) {
|
if (fileContent != undefined) {
|
||||||
const stringifiedFile = stringify(fileContent);
|
const stringifiedFile: string = stringify(fileContent);
|
||||||
chatMessage.stringifiedFile = stringifiedFile;
|
chatMessage.stringifiedFile = stringifiedFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,7 +412,8 @@ export default class ChatModel {
|
|||||||
content: ReactionSymbols,
|
content: ReactionSymbols,
|
||||||
isDeleting: boolean,
|
isDeleting: boolean,
|
||||||
): ChatMessageReaction => {
|
): ChatMessageReaction => {
|
||||||
const fileContent = FileModel.createFileContent(v4(), "reaction");
|
const fileContent: FileContent<"reaction"> =
|
||||||
|
FileModel.createFileContent(v4(), "reaction");
|
||||||
const reaction: ChatMessageReaction = {
|
const reaction: ChatMessageReaction = {
|
||||||
...fileContent,
|
...fileContent,
|
||||||
fileId: ChatModel.createMessageReactionId(messageId, sender),
|
fileId: ChatModel.createMessageReactionId(messageId, sender),
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export default class CalendarModel {
|
|||||||
date.setMonth(month - 1);
|
date.setMonth(month - 1);
|
||||||
date.setFullYear(year);
|
date.setFullYear(year);
|
||||||
|
|
||||||
const firstWeekdayOfMonth = date.getDay();
|
const firstWeekdayOfMonth: number = date.getDay();
|
||||||
const firstDayOfWeekSetting: number = parseInt(
|
const firstDayOfWeekSetting: number = parseInt(
|
||||||
this.settingsModel.firstDayOfWeek,
|
this.settingsModel.firstDayOfWeek,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export default class ConnectionModel {
|
|||||||
StorageModelSubPaths.ConnectionModel,
|
StorageModelSubPaths.ConnectionModel,
|
||||||
filePaths.connectionModel.mailboxes,
|
filePaths.connectionModel.mailboxes,
|
||||||
);
|
);
|
||||||
const mailboxFilePath = [...mailboxDirPath, address];
|
const mailboxFilePath: string[] = [...mailboxDirPath, address];
|
||||||
return mailboxFilePath;
|
return mailboxFilePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -26,22 +26,22 @@ export default class SettingsModel {
|
|||||||
setName = (newValue: string): void => {
|
setName = (newValue: string): void => {
|
||||||
this.username = newValue;
|
this.username = newValue;
|
||||||
this.storeSetting("username", newValue);
|
this.storeSetting("username", newValue);
|
||||||
}
|
};
|
||||||
|
|
||||||
setFirstDayOfWeek = (newValue: string): void => {
|
setFirstDayOfWeek = (newValue: string): void => {
|
||||||
this.firstDayOfWeek = newValue;
|
this.firstDayOfWeek = newValue;
|
||||||
this.storeSetting("firstDayOfWeek", newValue);
|
this.storeSetting("firstDayOfWeek", newValue);
|
||||||
}
|
};
|
||||||
|
|
||||||
setLanguage = (newValue: string): void => {
|
setLanguage = (newValue: string): void => {
|
||||||
this.language = newValue;
|
this.language = newValue;
|
||||||
this.storeSetting("language", newValue);
|
this.storeSetting("language", newValue);
|
||||||
}
|
};
|
||||||
|
|
||||||
setTheme = (newValue: string): void => {
|
setTheme = (newValue: string): void => {
|
||||||
this.theme = newValue;
|
this.theme = newValue;
|
||||||
this.storeSetting("theme", newValue);
|
this.storeSetting("theme", newValue);
|
||||||
}
|
};
|
||||||
|
|
||||||
// load
|
// load
|
||||||
private readSetting = (
|
private readSetting = (
|
||||||
@@ -52,27 +52,27 @@ export default class SettingsModel {
|
|||||||
filePaths.settingsModel[pathName],
|
filePaths.settingsModel[pathName],
|
||||||
);
|
);
|
||||||
return this.storageModel.read(path);
|
return this.storageModel.read(path);
|
||||||
}
|
};
|
||||||
|
|
||||||
loadUsername = (): void => {
|
loadUsername = (): void => {
|
||||||
const content = this.readSetting("username");
|
const content: string | null = this.readSetting("username");
|
||||||
this.username = content ?? "";
|
this.username = content ?? "";
|
||||||
}
|
};
|
||||||
|
|
||||||
loadFirstDayofWeek = (): void => {
|
loadFirstDayofWeek = (): void => {
|
||||||
const content = this.readSetting("firstDayOfWeek");
|
const content: string | null = this.readSetting("firstDayOfWeek");
|
||||||
this.firstDayOfWeek = content ?? "0";
|
this.firstDayOfWeek = content ?? "0";
|
||||||
}
|
};
|
||||||
|
|
||||||
loadLanguage = (): void => {
|
loadLanguage = (): void => {
|
||||||
const content = this.readSetting("language");
|
const content: string | null = this.readSetting("language");
|
||||||
this.language = content ?? SettingsModel.getSystemLanguage();
|
this.language = content ?? SettingsModel.getSystemLanguage();
|
||||||
}
|
};
|
||||||
|
|
||||||
loadTheme = (): void => {
|
loadTheme = (): void => {
|
||||||
const content = this.readSetting("theme");
|
const content: string | null = this.readSetting("theme");
|
||||||
this.theme = content ?? ThemeSettings.System;
|
this.theme = content ?? ThemeSettings.System;
|
||||||
}
|
};
|
||||||
|
|
||||||
// init
|
// init
|
||||||
constructor(storageModel: StorageModel) {
|
constructor(storageModel: StorageModel) {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export function MessagePage(
|
|||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<button
|
<button
|
||||||
class="ghost"
|
class="ghost inset-outline"
|
||||||
on:click={messagePageViewModel.showFilterModal}
|
on:click={messagePageViewModel.showFilterModal}
|
||||||
aria-label={
|
aria-label={
|
||||||
coreViewModel.translations.chatPage.message
|
coreViewModel.translations.chatPage.message
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ import BoardViewModel from "../../ViewModel/Pages/boardViewModel";
|
|||||||
import { ColorPicker } from "../Components/colorPicker";
|
import { ColorPicker } from "../Components/colorPicker";
|
||||||
import { DangerousActionButton } from "../Components/dangerousActionButton";
|
import { DangerousActionButton } from "../Components/dangerousActionButton";
|
||||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||||
|
import { setFocusWithDelay } from "../utility";
|
||||||
|
|
||||||
export function BoardSettingsModal(
|
export function BoardSettingsModal(
|
||||||
coreViewModel: CoreViewModel,
|
coreViewModel: CoreViewModel,
|
||||||
boardViewModel: BoardViewModel,
|
boardViewModel: BoardViewModel,
|
||||||
) {
|
) {
|
||||||
|
boardViewModel.isPresentingSettingsModal.subscribe(setFocusWithDelay);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class="modal"
|
class="modal"
|
||||||
@@ -33,6 +36,7 @@ export function BoardSettingsModal(
|
|||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
<input
|
<input
|
||||||
|
id="focused"
|
||||||
on:enter={boardViewModel.saveSettings}
|
on:enter={boardViewModel.saveSettings}
|
||||||
bind:value={boardViewModel.name}
|
bind:value={boardViewModel.name}
|
||||||
></input>
|
></input>
|
||||||
|
|||||||
@@ -450,7 +450,9 @@ function TransferDataInputModal(
|
|||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
<input
|
<input
|
||||||
on:enter={fileTransferViewModel.prepareReceivingData}
|
on:enter={
|
||||||
|
fileTransferViewModel.prepareReceivingData
|
||||||
|
}
|
||||||
bind:value={
|
bind:value={
|
||||||
fileTransferViewModel.receivingTransferChannel
|
fileTransferViewModel.receivingTransferChannel
|
||||||
}
|
}
|
||||||
@@ -468,7 +470,9 @@ function TransferDataInputModal(
|
|||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
<input
|
<input
|
||||||
on:enter={fileTransferViewModel.prepareReceivingData}
|
on:enter={
|
||||||
|
fileTransferViewModel.prepareReceivingData
|
||||||
|
}
|
||||||
bind:value={
|
bind:value={
|
||||||
fileTransferViewModel.receivingTransferKey
|
fileTransferViewModel.receivingTransferKey
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export function SearchModal<T>(
|
|||||||
<h2>{headline}</h2>
|
<h2>{headline}</h2>
|
||||||
<div class="flex-row width-input">
|
<div class="flex-row width-input">
|
||||||
<input
|
<input
|
||||||
id="focused"
|
id="focused"
|
||||||
placeholder={
|
placeholder={
|
||||||
coreViewModel.translations.general.searchLabel
|
coreViewModel.translations.general.searchLabel
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -11,7 +11,9 @@ export function reload() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function setFocus() {
|
export function setFocus() {
|
||||||
const focusedInModal = document.querySelector(".modal[open] #focused") as HTMLElement;
|
const focusedInModal = document.querySelector(
|
||||||
|
".modal[open] #focused",
|
||||||
|
) as HTMLElement;
|
||||||
if (focusedInModal) return focusedInModal.focus();
|
if (focusedInModal) return focusedInModal.focus();
|
||||||
document.getElementById("focused")?.focus();
|
document.getElementById("focused")?.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ export default class ChatListViewModel {
|
|||||||
loadChats = (): void => {
|
loadChats = (): void => {
|
||||||
this.chatViewModels.clear();
|
this.chatViewModels.clear();
|
||||||
for (const chatModel of this.coreViewModel.chatListModel.chatModels.values()) {
|
for (const chatModel of this.coreViewModel.chatListModel.chatModels.values()) {
|
||||||
const chatViewModel = this.createChatViewModel(chatModel);
|
const chatViewModel: ChatViewModel =
|
||||||
|
this.createChatViewModel(chatModel);
|
||||||
this.trackChat(chatViewModel);
|
this.trackChat(chatViewModel);
|
||||||
}
|
}
|
||||||
this.updateIndices();
|
this.updateIndices();
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ export default class ChatMessageViewModel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let count = 0;
|
let count: number = 0;
|
||||||
switch (content) {
|
switch (content) {
|
||||||
case ReactionSymbols.ThumbsUp: {
|
case ReactionSymbols.ThumbsUp: {
|
||||||
count = this.reactionsThumbsUpCount.value;
|
count = this.reactionsThumbsUpCount.value;
|
||||||
|
|||||||
@@ -210,7 +210,9 @@ export default class ChatViewModel extends ContextHost<ChatPageTypes> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// context
|
// context
|
||||||
this.chatListViewModel.selectedChat.subscribeSilent(this.updateContexts);
|
this.chatListViewModel.selectedChat.subscribeSilent(
|
||||||
|
this.updateContexts,
|
||||||
|
);
|
||||||
this.selectedPage.subscribeSilent(this.updateContexts);
|
this.selectedPage.subscribeSilent(this.updateContexts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,9 +34,14 @@ export default class CoreViewModel {
|
|||||||
this.logContexts();
|
this.logContexts();
|
||||||
}
|
}
|
||||||
closeContext = (contextId: string): void => {
|
closeContext = (contextId: string): void => {
|
||||||
if (!this.contexts.map(context=>context.contextId).includes(contextId)) return;
|
if (
|
||||||
|
!this.contexts
|
||||||
|
.map((context) => context.contextId)
|
||||||
|
.includes(contextId)
|
||||||
|
)
|
||||||
|
return;
|
||||||
while (this.contexts.length > 0) {
|
while (this.contexts.length > 0) {
|
||||||
const currentContext = this.context;
|
const currentContext: Context = this.context;
|
||||||
this.contextStack.delete(currentContext.contextId);
|
this.contextStack.delete(currentContext.contextId);
|
||||||
if (currentContext.contextId == contextId) break;
|
if (currentContext.contextId == contextId) break;
|
||||||
}
|
}
|
||||||
@@ -44,9 +49,10 @@ export default class CoreViewModel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handleKeyDown = (e: KeyboardEvent): void => {
|
handleKeyDown = (e: KeyboardEvent): void => {
|
||||||
const contexts = this.contexts;
|
if (CoreViewModel.checkIsKeystroke(e) == false) return;
|
||||||
|
const contexts: Context[] = this.contexts;
|
||||||
while (contexts.length > 0) {
|
while (contexts.length > 0) {
|
||||||
const currentContext = contexts.pop();
|
const currentContext: Context | undefined = contexts.pop();
|
||||||
if (!currentContext) contexts;
|
if (!currentContext) contexts;
|
||||||
const isHandled: boolean = currentContext.handleKeystroke(e);
|
const isHandled: boolean = currentContext.handleKeystroke(e);
|
||||||
if (isHandled == true) break;
|
if (isHandled == true) break;
|
||||||
@@ -90,7 +96,9 @@ export class Context {
|
|||||||
keystrokes = new Map<string, () => void>();
|
keystrokes = new Map<string, () => void>();
|
||||||
|
|
||||||
handleKeystroke = (e: KeyboardEvent): boolean => {
|
handleKeystroke = (e: KeyboardEvent): boolean => {
|
||||||
const fn = this.keystrokes.get(e.key.toLowerCase());
|
const fn: (() => void) | undefined = this.keystrokes.get(
|
||||||
|
e.key.toLowerCase(),
|
||||||
|
);
|
||||||
if (!fn) return false;
|
if (!fn) return false;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
fn();
|
fn();
|
||||||
@@ -122,7 +130,9 @@ export class ContextHost<T> extends Context {
|
|||||||
|
|
||||||
closeContext = (): void => {
|
closeContext = (): void => {
|
||||||
if (this.currentContext.value) {
|
if (this.currentContext.value) {
|
||||||
this.coreViewModel.closeContext(this.currentContext.value.contextId);
|
this.coreViewModel.closeContext(
|
||||||
|
this.currentContext.value.contextId,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
this.currentContext.value = undefined;
|
this.currentContext.value = undefined;
|
||||||
};
|
};
|
||||||
@@ -130,11 +140,13 @@ export class ContextHost<T> extends Context {
|
|||||||
updateContexts = (): void => {
|
updateContexts = (): void => {
|
||||||
if (this.isOpen == false) return;
|
if (this.isOpen == false) return;
|
||||||
|
|
||||||
const selectedContext = this.contexts.get(this.contextSelection);
|
const selectedContext: Context | undefined = this.contexts.get(
|
||||||
|
this.contextSelection,
|
||||||
|
);
|
||||||
if (!selectedContext) return;
|
if (!selectedContext) return;
|
||||||
if (selectedContext != this.currentContext.value) {
|
if (selectedContext != this.currentContext.value) {
|
||||||
this.closeContext();
|
this.closeContext();
|
||||||
};
|
}
|
||||||
|
|
||||||
this.coreViewModel.logContexts();
|
this.coreViewModel.logContexts();
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ export default class NotificationViewModel {
|
|||||||
|
|
||||||
// main
|
// main
|
||||||
showNotification = (message: ChatMessage): void => {
|
showNotification = (message: ChatMessage): void => {
|
||||||
const notification = NotificationViewModel.createNotification(message);
|
const notification: Notification =
|
||||||
|
NotificationViewModel.createNotification(message);
|
||||||
if (this.seenMessageIds.has(message.id)) return;
|
if (this.seenMessageIds.has(message.id)) return;
|
||||||
|
|
||||||
const currentChat =
|
const currentChat =
|
||||||
@@ -32,7 +33,7 @@ export default class NotificationViewModel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
openNotification = () => {
|
openNotification = () => {
|
||||||
const notification = this.marquee.value;
|
const notification: Notification = this.marquee.value;
|
||||||
if (notification == undefined) return;
|
if (notification == undefined) return;
|
||||||
|
|
||||||
const chat = [
|
const chat = [
|
||||||
@@ -51,7 +52,7 @@ export default class NotificationViewModel {
|
|||||||
return this.stopLoop();
|
return this.stopLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
const notification = this.messagesInMarquee.shift();
|
const notification: Notification = this.messagesInMarquee.shift();
|
||||||
this.seenMessageIds.delete(notification.messageId);
|
this.seenMessageIds.delete(notification.messageId);
|
||||||
this.marquee.value = notification;
|
this.marquee.value = notification;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export default class SettingsViewModel extends Context {
|
|||||||
|
|
||||||
// view
|
// view
|
||||||
applyTheme = (): void => {
|
applyTheme = (): void => {
|
||||||
let theme = this.theme.value;
|
let theme: string = this.theme.value;
|
||||||
if (theme == ThemeSettings.System) {
|
if (theme == ThemeSettings.System) {
|
||||||
theme = SettingsViewModel.getSystemTheme();
|
theme = SettingsViewModel.getSystemTheme();
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,10 @@ export default class SettingsViewModel extends Context {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// keystrokes
|
// keystrokes
|
||||||
this.registerKeyStroke(CommonKeys.CloseOrCancel, this.hideSettingsModal);
|
this.registerKeyStroke(
|
||||||
|
CommonKeys.CloseOrCancel,
|
||||||
|
this.hideSettingsModal,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static generateThemeMedia(): MediaQueryList {
|
static generateThemeMedia(): MediaQueryList {
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ export default class StorageViewModel extends Context {
|
|||||||
|
|
||||||
// methods
|
// methods
|
||||||
getSelectedItemContent = (): string => {
|
getSelectedItemContent = (): string => {
|
||||||
const path = StorageModel.stringToPathComponents(
|
const path: string[] = StorageModel.stringToPathComponents(
|
||||||
this.selectedPath.value,
|
this.selectedPath.value,
|
||||||
);
|
);
|
||||||
const content = this.coreViewModel.storageModel.read(path);
|
const content: string | undefined =
|
||||||
|
this.coreViewModel.storageModel.read(path);
|
||||||
return (
|
return (
|
||||||
(content ?? this.coreViewModel.translations.storage.notAFile) ||
|
(content ?? this.coreViewModel.translations.storage.notAFile) ||
|
||||||
this.coreViewModel.translations.storage.contentEmpty
|
this.coreViewModel.translations.storage.contentEmpty
|
||||||
@@ -35,7 +36,7 @@ export default class StorageViewModel extends Context {
|
|||||||
};
|
};
|
||||||
|
|
||||||
deleteSelectedItem = (): void => {
|
deleteSelectedItem = (): void => {
|
||||||
const path = StorageModel.stringToPathComponents(
|
const path: string[] = StorageModel.stringToPathComponents(
|
||||||
this.selectedPath.value,
|
this.selectedPath.value,
|
||||||
);
|
);
|
||||||
this.lastDeletedItemPath.value = this.selectedPath.value;
|
this.lastDeletedItemPath.value = this.selectedPath.value;
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
|||||||
this.color.value,
|
this.color.value,
|
||||||
);
|
);
|
||||||
this.taskPageViewModel.updateBoard(newBoardInfoFileContent);
|
this.taskPageViewModel.updateBoard(newBoardInfoFileContent);
|
||||||
|
|
||||||
|
this.taskPageViewModel.selectBoard(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
applyColor = (): void => {
|
applyColor = (): void => {
|
||||||
@@ -305,8 +307,10 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
|||||||
|
|
||||||
// keystrokes
|
// keystrokes
|
||||||
this.registerKeyStroke(CommonKeys.Filter, this.showFilterModal);
|
this.registerKeyStroke(CommonKeys.Filter, this.showFilterModal);
|
||||||
this.registerKeyStroke(CommonKeys.CloseOrCancel, this.hideFilterModal);
|
|
||||||
this.registerKeyStroke(CommonKeys.Reset, this.resetFilter);
|
this.registerKeyStroke(CommonKeys.Reset, this.resetFilter);
|
||||||
|
this.registerKeyStroke(CommonKeys.CloseOrCancel, this.hideFilterModal);
|
||||||
|
this.registerKeyStroke(CommonKeys.Settings, this.showSettings);
|
||||||
|
this.registerKeyStroke(CommonKeys.Apply, this.hideSettings);
|
||||||
|
|
||||||
this.taskPageViewModel.registerContext(this.boardInfo.fileId, this);
|
this.taskPageViewModel.registerContext(this.boardInfo.fileId, this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default class TaskPageViewModel extends ContextHost<string> {
|
|||||||
getBasePath = (): string[] => {
|
getBasePath = (): string[] => {
|
||||||
return [...this.boardsAndTasksModel.getViewPath()];
|
return [...this.boardsAndTasksModel.getViewPath()];
|
||||||
};
|
};
|
||||||
getBoardViewPath = (boardId): string[] => {
|
getBoardViewPath = (boardId: string): string[] => {
|
||||||
return [...this.getBasePath(), boardId];
|
return [...this.getBasePath(), boardId];
|
||||||
};
|
};
|
||||||
getLastUsedBoardPath = (): string[] => {
|
getLastUsedBoardPath = (): string[] => {
|
||||||
|
|||||||
@@ -18,16 +18,16 @@ export default class TaskViewModel extends Context {
|
|||||||
// util
|
// util
|
||||||
get sortingString(): string {
|
get sortingString(): string {
|
||||||
const splitDate: string[] = this.date.value.split("-");
|
const splitDate: string[] = this.date.value.split("-");
|
||||||
const year = padZero(splitDate[0], 4);
|
const year: string = padZero(splitDate[0], 4);
|
||||||
const month = padZero(splitDate[1], 2);
|
const month: string = padZero(splitDate[1], 2);
|
||||||
const date = padZero(splitDate[2], 2);
|
const date: string = padZero(splitDate[2], 2);
|
||||||
|
|
||||||
const splitTime: string[] = this.time.value.split(":");
|
const splitTime: string[] = this.time.value.split(":");
|
||||||
const hour = padZero(splitTime[0], 2);
|
const hour: string = padZero(splitTime[0], 2);
|
||||||
const minute = padZero(splitTime[1], 2);
|
const minute: string = padZero(splitTime[1], 2);
|
||||||
|
|
||||||
const priorityNumber = parseInt(this.priority.value);
|
const priorityNumber: number = parseInt(this.priority.value);
|
||||||
const invertedPriority = 100 - priorityNumber;
|
const invertedPriority: number = 100 - priorityNumber;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
year +
|
year +
|
||||||
@@ -168,7 +168,9 @@ export default class TaskViewModel extends Context {
|
|||||||
loadVersionIds = (): void => {
|
loadVersionIds = (): void => {
|
||||||
const versionIds: string[] =
|
const versionIds: string[] =
|
||||||
this.boardsAndTasksModel.listTaskVersionIds(this.task.fileId);
|
this.boardsAndTasksModel.listTaskVersionIds(this.task.fileId);
|
||||||
const sortedVersionIds = versionIds.sort(localeCompare).reverse();
|
const sortedVersionIds: string[] = versionIds
|
||||||
|
.sort(localeCompare)
|
||||||
|
.reverse();
|
||||||
this.versionIds.clear();
|
this.versionIds.clear();
|
||||||
this.versionIds.add(...sortedVersionIds);
|
this.versionIds.add(...sortedVersionIds);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user