add method for filtering
This commit is contained in:
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,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user