add method for filtering
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import * as React from "../../react";
|
||||
import ChatViewModel from "./chatViewModel";
|
||||
import SettingsViewModel from "../Global/settingsViewModel";
|
||||
import NotificationViewModel from "../Global/notificationViewModel";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
import ConnectionViewModel from "../Global/connectionViewModel";
|
||||
import * as React from "../../react";
|
||||
import { IndexManager } from "../../Model/Utility/utility";
|
||||
import ChatModel from "../../Model/Chat/chatModel";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "../../react";
|
||||
import MessagePageViewModel from "../Pages/messagePageViewModel";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
import * as React from "../../react";
|
||||
import {
|
||||
ChatMessage,
|
||||
ChatMessageReaction,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from "../../react";
|
||||
import ChatListViewModel from "./chatListViewModel";
|
||||
import TaskPageViewModel from "../Pages/taskPageViewModel";
|
||||
import SettingsPageViewModel from "../Pages/settingsPageViewModel";
|
||||
@@ -10,6 +9,7 @@ import SettingsViewModel from "../Global/settingsViewModel";
|
||||
import NotificationViewModel from "../Global/notificationViewModel";
|
||||
import CoreViewModel, { Context, ContextHost } from "../Global/coreViewModel";
|
||||
import ConnectionViewModel from "../Global/connectionViewModel";
|
||||
import * as React from "../../react";
|
||||
import { Colors } from "../../colors";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import { Entry } from "../../View/Components/option";
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel from "./coreViewModel";
|
||||
import * as React from "../../react";
|
||||
|
||||
export default class ConnectionViewModel {
|
||||
// state
|
||||
@@ -48,7 +48,7 @@ export default class ConnectionViewModel {
|
||||
);
|
||||
}
|
||||
|
||||
this.hideConnectionModal();
|
||||
this.hideConnectionModal();
|
||||
};
|
||||
|
||||
// methods
|
||||
@@ -69,8 +69,8 @@ export default class ConnectionViewModel {
|
||||
this.coreViewModel.connectionModel.removeAddress(address);
|
||||
this.updatePreviousAddresses();
|
||||
|
||||
if (this.previousAddresses.value.size > 0) return;
|
||||
this.hideConnectionModal();
|
||||
if (this.previousAddresses.value.size > 0) return;
|
||||
this.hideConnectionModal();
|
||||
};
|
||||
|
||||
// view
|
||||
|
||||
@@ -40,8 +40,8 @@ export default class CoreViewModel {
|
||||
return;
|
||||
|
||||
while (this.contexts.length > 0) {
|
||||
const currentContext: Context|undefined= this.context;
|
||||
if (!currentContext) return;
|
||||
const currentContext: Context | undefined = this.context;
|
||||
if (!currentContext) return;
|
||||
currentContext.handleContextClose(fromHistoryEvent);
|
||||
this.contextStack.delete(currentContext.contextId);
|
||||
if (currentContext.contextId == contextId) break;
|
||||
@@ -49,9 +49,10 @@ export default class CoreViewModel {
|
||||
};
|
||||
|
||||
handleKeyDown = (e: KeyboardEvent): void => {
|
||||
if (!(e instanceof KeyboardEvent)) return console.trace("NOT A KEY EVENT");
|
||||
if (!(e instanceof KeyboardEvent))
|
||||
return console.trace("NOT A KEY EVENT");
|
||||
if (CoreViewModel.checkIsKeystroke(e) == false) return;
|
||||
console.log(e.key);
|
||||
console.log(e.key);
|
||||
e.preventDefault();
|
||||
const contexts: Context[] = this.contexts;
|
||||
while (contexts.length > 0) {
|
||||
@@ -97,7 +98,7 @@ export default class CoreViewModel {
|
||||
document.body.addEventListener("keydown", this.handleKeyDown);
|
||||
|
||||
window.onpopstate = () => {
|
||||
if (!this.context) return;
|
||||
if (!this.context) return;
|
||||
this.closeContext(this.context.contextId, true);
|
||||
};
|
||||
|
||||
@@ -164,11 +165,10 @@ export class ContextHost<T> extends Context {
|
||||
updateContexts = (): void => {
|
||||
if (this.isOpen == false) return;
|
||||
|
||||
const selection = this.contextSelection;
|
||||
if (!selection) return;
|
||||
const selectedContext: Context | undefined = this.contexts.get(
|
||||
selection
|
||||
);
|
||||
const selection = this.contextSelection;
|
||||
if (!selection) return;
|
||||
const selectedContext: Context | undefined =
|
||||
this.contexts.get(selection);
|
||||
if (!selectedContext) return;
|
||||
if (selectedContext != this.currentContext.value) {
|
||||
this.closeCurrentContext();
|
||||
@@ -178,7 +178,10 @@ export class ContextHost<T> extends Context {
|
||||
this.currentContext.value = selectedContext;
|
||||
};
|
||||
|
||||
constructor(contextDebugDescription: string, public coreViewModel: CoreViewModel) {
|
||||
super(contextDebugDescription);
|
||||
constructor(
|
||||
contextDebugDescription: string,
|
||||
public coreViewModel: CoreViewModel,
|
||||
) {
|
||||
super(contextDebugDescription);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel, { Context } from "./coreViewModel";
|
||||
import * as React from "../../react";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import StorageModel, {
|
||||
StorageModelSubPaths,
|
||||
@@ -54,7 +54,9 @@ export default class FileTransferViewModel extends Context {
|
||||
exportKey: React.State<string> = new React.State("");
|
||||
exportKeyConfirmation: React.State<string> = new React.State("");
|
||||
|
||||
importedFile: React.State<File | undefined> = new React.State<File | undefined>(undefined);
|
||||
importedFile: React.State<File | undefined> = new React.State<
|
||||
File | undefined
|
||||
>(undefined);
|
||||
importedFileString: React.State<string> = new React.State("");
|
||||
importKey: React.State<string> = new React.State("");
|
||||
isImportKeyCorrect: React.State<boolean> = new React.State(true);
|
||||
@@ -139,7 +141,7 @@ export default class FileTransferViewModel extends Context {
|
||||
};
|
||||
|
||||
downloadFile = async (): Promise<void> => {
|
||||
if (this.cannotExport.value == true) return;
|
||||
if (this.cannotExport.value == true) return;
|
||||
const date = new Date().toISOString().split("T")[0];
|
||||
|
||||
const backup: Blob =
|
||||
@@ -158,7 +160,7 @@ export default class FileTransferViewModel extends Context {
|
||||
if (!input) return;
|
||||
if (!(input instanceof HTMLInputElement)) return;
|
||||
|
||||
if (!input.files) return;
|
||||
if (!input.files) return;
|
||||
const file = input.files[0];
|
||||
this.importedFile.value = file;
|
||||
};
|
||||
@@ -171,7 +173,7 @@ export default class FileTransferViewModel extends Context {
|
||||
reader.readAsText(file, "utf8");
|
||||
reader.onload = () => {
|
||||
const result = reader.result;
|
||||
if (!result) return;
|
||||
if (!result) return;
|
||||
this.importedFileString.value = result.toString();
|
||||
this.showImportDecryptDataModal();
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "../../react";
|
||||
import { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
import ChatListViewModel from "../Chat/chatListViewModel";
|
||||
import * as React from "../../react";
|
||||
import ChatModel, { ChatMessage } from "../../Model/Chat/chatModel";
|
||||
|
||||
export default class NotificationViewModel {
|
||||
@@ -35,7 +35,7 @@ export default class NotificationViewModel {
|
||||
};
|
||||
|
||||
openNotification = () => {
|
||||
const notification: Notification|undefined = this.marquee.value;
|
||||
const notification: Notification | undefined = this.marquee.value;
|
||||
if (notification == undefined) return;
|
||||
|
||||
const chat = [
|
||||
@@ -44,7 +44,7 @@ export default class NotificationViewModel {
|
||||
(chat) =>
|
||||
chat.chatModel.unwrappedPrimaryChannel == notification.chat,
|
||||
);
|
||||
if (!chat) return;
|
||||
if (!chat) return;
|
||||
chat.open();
|
||||
chat.openPage(ChatPageTypes.Messages);
|
||||
};
|
||||
@@ -56,8 +56,9 @@ export default class NotificationViewModel {
|
||||
return this.stopLoop();
|
||||
}
|
||||
|
||||
const notification: Notification|undefined = this.messagesInMarquee.shift();
|
||||
if (!notification) return;
|
||||
const notification: Notification | undefined =
|
||||
this.messagesInMarquee.shift();
|
||||
if (!notification) return;
|
||||
this.seenMessageIds.delete(notification.messageId);
|
||||
this.marquee.value = notification;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel, { Context } from "./coreViewModel";
|
||||
import * as React from "../../react";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import { Languages, ThemeSettings } from "../../Model/Global/settingsModel";
|
||||
|
||||
@@ -13,12 +13,12 @@ export default class SettingsViewModel extends Context {
|
||||
requiresReload = new React.State<boolean>(false);
|
||||
|
||||
firstDayOfWeek: React.State<string> = new React.State("0");
|
||||
language: React.State<Languages | string> = new React.State<Languages | string>(
|
||||
Languages.English,
|
||||
);
|
||||
theme: React.State<ThemeSettings | string> = new React.State<ThemeSettings | string>(
|
||||
ThemeSettings.System,
|
||||
);
|
||||
language: React.State<Languages | string> = new React.State<
|
||||
Languages | string
|
||||
>(Languages.English);
|
||||
theme: React.State<ThemeSettings | string> = new React.State<
|
||||
ThemeSettings | string
|
||||
>(ThemeSettings.System);
|
||||
|
||||
// guards
|
||||
cannotSetName: React.State<boolean> = React.createProxyState(
|
||||
@@ -48,121 +48,132 @@ export default class SettingsViewModel extends Context {
|
||||
};
|
||||
|
||||
showModalPage = (page: SettingsModalPages): void => {
|
||||
this.selectedModalPage.value = page;
|
||||
this.selectedModalPage.value = page;
|
||||
};
|
||||
|
||||
// view
|
||||
applyTheme = (): void => {
|
||||
let theme: string = this.theme.value;
|
||||
let theme: string = this.theme.value;
|
||||
|
||||
if (theme == ThemeSettings.Dynamic) {
|
||||
const scene = this.selectDynamicScene();
|
||||
this.setScene(scene);
|
||||
return;
|
||||
}
|
||||
if (theme == ThemeSettings.Dynamic) {
|
||||
const scene = this.selectDynamicScene();
|
||||
this.setScene(scene);
|
||||
return;
|
||||
}
|
||||
|
||||
if (theme == ThemeSettings.System) {
|
||||
theme = SettingsViewModel.getSystemTheme();
|
||||
}
|
||||
if (theme == ThemeSettings.System) {
|
||||
theme = SettingsViewModel.getSystemTheme();
|
||||
}
|
||||
|
||||
if (theme == ThemeSettings.Dark) {
|
||||
this.setScene(DynamicSceneNight);
|
||||
} else {
|
||||
this.setScene(DynamicSceneDay);
|
||||
}
|
||||
if (theme == ThemeSettings.Dark) {
|
||||
this.setScene(DynamicSceneNight);
|
||||
} else {
|
||||
this.setScene(DynamicSceneDay);
|
||||
}
|
||||
};
|
||||
|
||||
selectDynamicScene = (): DynamicScene => {
|
||||
let hour = new Date().getHours();
|
||||
let hour = new Date().getHours();
|
||||
|
||||
if (hour >= 21 || hour <= 6) {
|
||||
return DynamicSceneNight;
|
||||
} else if (hour > 6 && hour < 10) {
|
||||
return DynamicSceneSunrise;
|
||||
} else if (hour < 14) {
|
||||
return DynamicSceneDay;
|
||||
} else if (hour < 17) {
|
||||
return DynamicSceneAfternoon
|
||||
} else {
|
||||
return DynamicSceneSunset
|
||||
}
|
||||
}
|
||||
if (hour >= 21 || hour <= 6) {
|
||||
return DynamicSceneNight;
|
||||
} else if (hour > 6 && hour < 10) {
|
||||
return DynamicSceneSunrise;
|
||||
} else if (hour < 14) {
|
||||
return DynamicSceneDay;
|
||||
} else if (hour < 17) {
|
||||
return DynamicSceneAfternoon;
|
||||
} else {
|
||||
return DynamicSceneSunset;
|
||||
}
|
||||
};
|
||||
|
||||
setScene = (scene: DynamicScene): void => {
|
||||
document.body.style.setProperty("--backdrop-grass-filter", `brightness(${scene.brightness})`);
|
||||
document.body.style.setProperty(
|
||||
"--backdrop-grass-filter",
|
||||
`brightness(${scene.brightness})`,
|
||||
);
|
||||
|
||||
function setSkyColor(tone: 1|2, hue: number, saturation: number, luma: number) {
|
||||
document.body.style.setProperty(`--sky-${tone}`, `hsl(${hue}, ${saturation}%, ${luma}%)`);
|
||||
}
|
||||
setSkyColor(1, scene.hue1, scene.saturation, scene.luma);
|
||||
setSkyColor(2, scene.hue2, scene.saturation - 10, scene.luma-10);
|
||||
function setSkyColor(
|
||||
tone: 1 | 2,
|
||||
hue: number,
|
||||
saturation: number,
|
||||
luma: number,
|
||||
) {
|
||||
document.body.style.setProperty(
|
||||
`--sky-${tone}`,
|
||||
`hsl(${hue}, ${saturation}%, ${luma}%)`,
|
||||
);
|
||||
}
|
||||
setSkyColor(1, scene.hue1, scene.saturation, scene.luma);
|
||||
setSkyColor(2, scene.hue2, scene.saturation - 10, scene.luma - 10);
|
||||
|
||||
document.body.setAttribute("theme", scene.baseTheme);
|
||||
}
|
||||
document.body.setAttribute("theme", scene.baseTheme);
|
||||
};
|
||||
|
||||
// exit
|
||||
close = (): void => {
|
||||
this.coreViewModel.closeContext(this.contextId);
|
||||
this.coreViewModel.closeContext(this.contextId);
|
||||
};
|
||||
|
||||
handleContextClose = (): void => {
|
||||
this.isShowingSettingsModal.value = false;
|
||||
if (this.requiresReload.value == true) {
|
||||
window.location.reload();
|
||||
}
|
||||
this.isShowingSettingsModal.value = false;
|
||||
if (this.requiresReload.value == true) {
|
||||
window.location.reload();
|
||||
}
|
||||
};
|
||||
|
||||
// init
|
||||
constructor(public readonly coreViewModel: CoreViewModel) {
|
||||
super("settings");
|
||||
super("settings");
|
||||
|
||||
this.username.value = coreViewModel.settingsModel.username;
|
||||
this.usernameInput.value = coreViewModel.settingsModel.username;
|
||||
this.firstDayOfWeek.value = coreViewModel.settingsModel.firstDayOfWeek;
|
||||
this.language.value = coreViewModel.settingsModel.language;
|
||||
this.theme.value = coreViewModel.settingsModel.theme;
|
||||
this.username.value = coreViewModel.settingsModel.username;
|
||||
this.usernameInput.value = coreViewModel.settingsModel.username;
|
||||
this.firstDayOfWeek.value = coreViewModel.settingsModel.firstDayOfWeek;
|
||||
this.language.value = coreViewModel.settingsModel.language;
|
||||
this.theme.value = coreViewModel.settingsModel.theme;
|
||||
|
||||
// subscriptions
|
||||
this.firstDayOfWeek.subscribe(this.setFirstDayofWeek);
|
||||
this.language.subscribeSilent((newValue) => {
|
||||
this.coreViewModel.settingsModel.setLanguage(newValue);
|
||||
this.requiresReload.value = true;
|
||||
});
|
||||
this.theme.subscribeSilent((newValue) => {
|
||||
this.coreViewModel.settingsModel.setTheme(newValue);
|
||||
});
|
||||
// subscriptions
|
||||
this.firstDayOfWeek.subscribe(this.setFirstDayofWeek);
|
||||
this.language.subscribeSilent((newValue) => {
|
||||
this.coreViewModel.settingsModel.setLanguage(newValue);
|
||||
this.requiresReload.value = true;
|
||||
});
|
||||
this.theme.subscribeSilent((newValue) => {
|
||||
this.coreViewModel.settingsModel.setTheme(newValue);
|
||||
});
|
||||
|
||||
// set theme
|
||||
this.theme.subscribe(() => {
|
||||
this.applyTheme();
|
||||
});
|
||||
SettingsViewModel.generateThemeMedia().addEventListener("change", () =>
|
||||
this.applyTheme(),
|
||||
);
|
||||
const seconds = new Date().getSeconds();
|
||||
const secondsUntilNewMinute = 60-seconds;
|
||||
setTimeout(() => {
|
||||
setInterval(this.applyTheme, 1000*60);
|
||||
}, secondsUntilNewMinute);
|
||||
// set theme
|
||||
this.theme.subscribe(() => {
|
||||
this.applyTheme();
|
||||
});
|
||||
SettingsViewModel.generateThemeMedia().addEventListener("change", () =>
|
||||
this.applyTheme(),
|
||||
);
|
||||
const seconds = new Date().getSeconds();
|
||||
const secondsUntilNewMinute = 60 - seconds;
|
||||
setTimeout(() => {
|
||||
setInterval(this.applyTheme, 1000 * 60);
|
||||
}, secondsUntilNewMinute);
|
||||
|
||||
// keystrokes
|
||||
this.registerKeyStroke(CommonKeys.CloseOrCancel, this.close);
|
||||
// keystrokes
|
||||
this.registerKeyStroke(CommonKeys.CloseOrCancel, this.close);
|
||||
}
|
||||
|
||||
static generateThemeMedia(): MediaQueryList {
|
||||
return window.matchMedia("(prefers-color-scheme: dark)");
|
||||
return window.matchMedia("(prefers-color-scheme: dark)");
|
||||
}
|
||||
|
||||
static getSystemTheme(): string {
|
||||
const media = SettingsViewModel.generateThemeMedia();
|
||||
return media.matches == true ? ThemeSettings.Dark : ThemeSettings.Light;
|
||||
const media = SettingsViewModel.generateThemeMedia();
|
||||
return media.matches == true ? ThemeSettings.Dark : ThemeSettings.Light;
|
||||
}
|
||||
}
|
||||
|
||||
export enum SettingsModalPages {
|
||||
Appearance,
|
||||
Regional,
|
||||
Info,
|
||||
Regional,
|
||||
Info,
|
||||
}
|
||||
|
||||
export interface DynamicScene {
|
||||
@@ -176,40 +187,40 @@ export interface DynamicScene {
|
||||
export const DynamicSceneNight: DynamicScene = {
|
||||
hue1: 215,
|
||||
hue2: 220,
|
||||
saturation : 50,
|
||||
saturation: 50,
|
||||
luma: 25,
|
||||
brightness: 0.4,
|
||||
baseTheme: ThemeSettings.Dark,
|
||||
}
|
||||
};
|
||||
export const DynamicSceneSunrise: DynamicScene = {
|
||||
hue1: 45,
|
||||
hue2: 190,
|
||||
saturation : 100,
|
||||
saturation: 100,
|
||||
luma: 50,
|
||||
brightness: 1.2,
|
||||
baseTheme: ThemeSettings.Light,
|
||||
}
|
||||
};
|
||||
export const DynamicSceneDay: DynamicScene = {
|
||||
hue1: 190,
|
||||
hue2: 180,
|
||||
saturation : 100,
|
||||
saturation: 100,
|
||||
luma: 70,
|
||||
brightness: 1.4,
|
||||
baseTheme: ThemeSettings.Light,
|
||||
}
|
||||
};
|
||||
export const DynamicSceneAfternoon: DynamicScene = {
|
||||
hue1: 195,
|
||||
hue2: 220,
|
||||
saturation : 100,
|
||||
saturation: 100,
|
||||
luma: 50,
|
||||
brightness: 0.8,
|
||||
baseTheme: ThemeSettings.Light,
|
||||
}
|
||||
};
|
||||
export const DynamicSceneSunset: DynamicScene = {
|
||||
hue1: 20,
|
||||
hue2: 260,
|
||||
saturation : 100,
|
||||
saturation: 100,
|
||||
luma: 50,
|
||||
brightness: 0.4,
|
||||
baseTheme: ThemeSettings.Dark,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel, { Context } from "./coreViewModel";
|
||||
import * as React from "../../react";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import StorageModel, {
|
||||
PATH_COMPONENT_SEPARATOR,
|
||||
|
||||
Binary file not shown.
@@ -1,10 +1,10 @@
|
||||
import * as React from "../../react";
|
||||
import TaskViewModel from "./taskViewModel";
|
||||
import TaskPageViewModel from "./taskPageViewModel";
|
||||
import TaskContainingPageViewModel from "./taskContainingPageViewModel";
|
||||
import SearchViewModel from "../Utility/searchViewModel";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
import ChatViewModel, { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
import * as React from "../../react";
|
||||
import { Colors } from "../../colors";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import BoardsAndTasksModel, {
|
||||
@@ -115,11 +115,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
searchTerm,
|
||||
];
|
||||
this.coreViewModel.storageModel.write(suggestionPath, "");
|
||||
if (
|
||||
!this.searchSuggestions.value.has(
|
||||
searchTerm,
|
||||
) && searchTerm != ""
|
||||
) {
|
||||
if (!this.searchSuggestions.value.has(searchTerm) && searchTerm != "") {
|
||||
this.searchSuggestions.add(searchTerm);
|
||||
}
|
||||
|
||||
@@ -133,7 +129,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
searchTerm,
|
||||
];
|
||||
this.coreViewModel.storageModel.remove(suggestionPath);
|
||||
}
|
||||
};
|
||||
|
||||
// view
|
||||
showTask = (taskFileContent: TaskFileContent): void => {
|
||||
@@ -154,7 +150,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
this,
|
||||
taskFileContent,
|
||||
);
|
||||
console.log("STILL HERE", taskFileContent.fileId);
|
||||
console.log("STILL HERE", taskFileContent.fileId);
|
||||
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
|
||||
};
|
||||
|
||||
@@ -234,7 +230,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
const dirPath: string[] = this.getPreviousSearchesPath();
|
||||
const searches: string[] =
|
||||
this.coreViewModel.storageModel.list(dirPath);
|
||||
this.searchSuggestions.add(...searches.filter(x => x != ""));
|
||||
this.searchSuggestions.add(...searches.filter((x) => x != ""));
|
||||
};
|
||||
|
||||
restoreSearch = (): void => {
|
||||
@@ -307,13 +303,13 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
this.taskViewModels,
|
||||
this.filteredTaskViewModels,
|
||||
TaskViewModel.getStringsForFilter,
|
||||
this.searchSuggestions,
|
||||
this.searchSuggestions,
|
||||
);
|
||||
this.searchViewModel.appliedQuery.subscribeSilent((newQuery) => {
|
||||
this.handleNewSearch(newQuery);
|
||||
});
|
||||
this.restoreSearch();
|
||||
this.searchSuggestions.handleRemovals(this.handleSearchRemoved);
|
||||
this.searchSuggestions.handleRemovals(this.handleSearchRemoved);
|
||||
|
||||
this.isFilterActive = React.createProxyState(
|
||||
[this.searchViewModel.appliedQuery],
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as React from "../../react";
|
||||
import TaskViewModel from "./taskViewModel";
|
||||
import TaskContainingPageViewModel from "./taskContainingPageViewModel";
|
||||
import CoreViewModel from "../Global/coreViewModel";
|
||||
import ChatViewModel, { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
import * as React from "../../react";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import CalendarModel, { MonthGrid } from "../../Model/Files/calendarModel";
|
||||
import BoardsAndTasksModel, {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as React from "../../react";
|
||||
import SearchViewModel from "../Utility/searchViewModel";
|
||||
import CoreViewModel, { Context } from "../Global/coreViewModel";
|
||||
import ChatViewModel, { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
import ChatMessageViewModel from "../Chat/chatMessageViewModel";
|
||||
import * as React from "../../react";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import {
|
||||
ChatMessage,
|
||||
@@ -68,7 +68,9 @@ export default class MessagePageViewModel extends Context {
|
||||
);
|
||||
};
|
||||
|
||||
setReply = (chatMessageViewModel: ChatMessageViewModel|undefined): void => {
|
||||
setReply = (
|
||||
chatMessageViewModel: ChatMessageViewModel | undefined,
|
||||
): void => {
|
||||
this.replyingMessage.value = chatMessageViewModel;
|
||||
this.setFocus();
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "../../react";
|
||||
import CoreViewModel, { Context } from "../Global/coreViewModel";
|
||||
import ChatViewModel, { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
import * as React from "../../react";
|
||||
import { Colors } from "../../colors";
|
||||
|
||||
export default class SettingsPageViewModel extends Context {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "../../react";
|
||||
import TaskViewModel from "./taskViewModel";
|
||||
import CoreViewModel, { Context } from "../Global/coreViewModel";
|
||||
import ChatViewModel from "../Chat/chatViewModel";
|
||||
import * as React from "../../react";
|
||||
import { IndexManager } from "../../Model/Utility/utility";
|
||||
import BoardsAndTasksModel, {
|
||||
TaskFileContent,
|
||||
@@ -21,7 +21,6 @@ export default class TaskContainingPageViewModel extends Context {
|
||||
taskCategorySuggestions: React.ListState<string> = new React.ListState();
|
||||
taskStatusSuggestions: React.ListState<string> = new React.ListState();
|
||||
|
||||
|
||||
// methods
|
||||
createTaskFromBoardId = (boardId: string): void => {
|
||||
const taskFileContent: TaskFileContent =
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as React from "../../react";
|
||||
import BoardViewModel from "./boardViewModel";
|
||||
import CoreViewModel, { ContextHost } from "../Global/coreViewModel";
|
||||
import ChatViewModel, { ChatPageTypes } from "../Chat/chatViewModel";
|
||||
import * as React from "../../react";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import { IndexManager } from "../../Model/Utility/utility";
|
||||
import implementFilter, { IndexManager } from "../../Model/Utility/utility";
|
||||
import BoardsAndTasksModel, {
|
||||
BoardInfoFileContent,
|
||||
} from "../../Model/Files/boardsAndTasksModel";
|
||||
@@ -26,8 +26,9 @@ export default class TaskPageViewModel extends ContextHost<string> {
|
||||
};
|
||||
|
||||
// state
|
||||
newBoardNameInput: React.State<string> = new React.State("");
|
||||
boardQuery: React.State<string> = new React.State("");
|
||||
boardViewModels: React.MapState<BoardViewModel> = new React.MapState();
|
||||
boardMatches: React.ListState<BoardViewModel> = new React.ListState();
|
||||
isShowingBoadList: React.State<boolean> = new React.State(true);
|
||||
selectedBoardId: React.State<string | undefined> = new React.State<any>(
|
||||
undefined,
|
||||
@@ -47,8 +48,8 @@ export default class TaskPageViewModel extends ContextHost<string> {
|
||||
|
||||
// guards
|
||||
cannotCreateBoard: React.State<boolean> = React.createProxyState(
|
||||
[this.newBoardNameInput],
|
||||
() => this.newBoardNameInput.value == "",
|
||||
[this.boardQuery],
|
||||
() => this.boardQuery.value == "",
|
||||
);
|
||||
|
||||
// methods
|
||||
@@ -56,8 +57,8 @@ export default class TaskPageViewModel extends ContextHost<string> {
|
||||
if (this.cannotCreateBoard.value == true) return;
|
||||
|
||||
const boardInfoFileContent: BoardInfoFileContent =
|
||||
this.boardsAndTasksModel.createBoard(this.newBoardNameInput.value);
|
||||
this.newBoardNameInput.value = "";
|
||||
this.boardsAndTasksModel.createBoard(this.boardQuery.value);
|
||||
this.boardQuery.value = "";
|
||||
|
||||
this.showBoardInList(boardInfoFileContent);
|
||||
this.boardsAndTasksModel.updateBoardAndSend(boardInfoFileContent);
|
||||
@@ -177,6 +178,9 @@ export default class TaskPageViewModel extends ContextHost<string> {
|
||||
|
||||
this.chatViewModel = chatViewModel;
|
||||
|
||||
// filter
|
||||
implementFilter(this.boardViewModels, this.boardMatches, this.boardQuery, (board) => board.name.value);
|
||||
|
||||
// context
|
||||
this.chatViewModel.registerContext(ChatPageTypes.Tasks, this);
|
||||
this.selectedBoardId.subscribeSilent(this.updateContexts);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "../../react";
|
||||
import TaskContainingPageViewModel from "./taskContainingPageViewModel";
|
||||
import CoreViewModel, { Context } from "../Global/coreViewModel";
|
||||
import ChatViewModel from "../Chat/chatViewModel";
|
||||
import * as React from "../../react";
|
||||
import { ViewController } from "../../View/viewController";
|
||||
import { CommonKeys } from "../../View/keystrokes";
|
||||
import { localeCompare, padZero } from "../../Model/Utility/utility";
|
||||
@@ -58,7 +58,9 @@ export default class TaskViewModel extends Context {
|
||||
selectedVersionId: React.State<string> = new React.State("");
|
||||
versionIds: React.ListState<string> = new React.ListState();
|
||||
|
||||
isPresentingFullScreenDescription: React.State<boolean> = new React.State(false);
|
||||
isPresentingFullScreenDescription: React.State<boolean> = new React.State(
|
||||
false,
|
||||
);
|
||||
|
||||
// methods
|
||||
dragStart = (event: DragEvent): void => {
|
||||
@@ -99,12 +101,12 @@ export default class TaskViewModel extends Context {
|
||||
};
|
||||
|
||||
openFullscreenDecription = (): void => {
|
||||
this.isPresentingFullScreenDescription.value = true;
|
||||
}
|
||||
this.isPresentingFullScreenDescription.value = true;
|
||||
};
|
||||
|
||||
closeFullscreenDecription = (): void => {
|
||||
this.isPresentingFullScreenDescription.value = false;
|
||||
}
|
||||
this.isPresentingFullScreenDescription.value = false;
|
||||
};
|
||||
|
||||
updateIndex = (): void => {
|
||||
const index: number =
|
||||
@@ -118,7 +120,9 @@ export default class TaskViewModel extends Context {
|
||||
this.category.value,
|
||||
) == false
|
||||
) {
|
||||
this.containingViewModel.taskCategorySuggestions.add(this.category.value);
|
||||
this.containingViewModel.taskCategorySuggestions.add(
|
||||
this.category.value,
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -126,7 +130,9 @@ export default class TaskViewModel extends Context {
|
||||
this.status.value,
|
||||
) == false
|
||||
) {
|
||||
this.containingViewModel.taskStatusSuggestions.add(this.status.value);
|
||||
this.containingViewModel.taskStatusSuggestions.add(
|
||||
this.status.value,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,10 @@ export default class SearchViewModel<T> {
|
||||
[this.searchInput],
|
||||
() => this.searchInput.value == "",
|
||||
);
|
||||
hasNoSuggestions: React.State<boolean> = React.createProxyState([this.suggestions], ()=>this.suggestions.value.size == 0);
|
||||
hasNoSuggestions: React.State<boolean> = React.createProxyState(
|
||||
[this.suggestions],
|
||||
() => this.suggestions.value.size == 0,
|
||||
);
|
||||
|
||||
// methods
|
||||
search = (searchTerm: string): void => {
|
||||
@@ -36,12 +39,12 @@ export default class SearchViewModel<T> {
|
||||
};
|
||||
|
||||
clear = (): void => {
|
||||
this.searchInput.value = "";
|
||||
}
|
||||
this.searchInput.value = "";
|
||||
};
|
||||
|
||||
deleteSuggestion = (suggestion: string): void => {
|
||||
this.suggestions.remove(suggestion);
|
||||
}
|
||||
this.suggestions.remove(suggestion);
|
||||
};
|
||||
|
||||
// init
|
||||
constructor(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "../../react";
|
||||
import TaskViewModel from "../Pages/taskViewModel";
|
||||
import * as React from "../../react";
|
||||
|
||||
export default class TaskPropertyBulkChangeViewModel {
|
||||
taskViewModels: React.ListState<TaskViewModel>;
|
||||
|
||||
Reference in New Issue
Block a user