reset board zoom on view change, apply cleared search
This commit is contained in:
@@ -12,7 +12,8 @@ export function BoardViewToggleButton(
|
|||||||
key: string,
|
key: string,
|
||||||
) {
|
) {
|
||||||
function select() {
|
function select() {
|
||||||
boardViewModel.selectedPage.value = page;
|
boardViewModel.selectedPage.value = page;
|
||||||
|
boardViewModel.resetPinchZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
const isSelected = React.createProxyState(
|
const isSelected = React.createProxyState(
|
||||||
|
|||||||
@@ -232,11 +232,13 @@ body[showing-chat] #chat-page-wrapper {
|
|||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
|
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#chat-page > div > #main > div > .pane-wrapper > .pane > .toolbar > span {
|
#chat-page > div > #main > div > .pane-wrapper > .pane > .toolbar > span {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#chat-page > div > #main > div > .pane-wrapper > .pane > .toolbar > span.title {
|
#chat-page > div > #main > div > .pane-wrapper > .pane > .toolbar > span.title {
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ export function HomePage(
|
|||||||
) {
|
) {
|
||||||
const greeting = React.createProxyState([settingsViewModel.username], ()=>coreViewModel.translations.homePage.greeting(settingsViewModel.username.value));
|
const greeting = React.createProxyState([settingsViewModel.username], ()=>coreViewModel.translations.homePage.greeting(settingsViewModel.username.value));
|
||||||
|
|
||||||
|
const isChatPlaceholderHidden = React.createProxyState([chatListViewModel.chatMatches, chatListViewModel.chatQuery], ()=>chatListViewModel.chatMatches.value.size > 0 || chatListViewModel.chatQuery.value != "");
|
||||||
|
|
||||||
// sections
|
// sections
|
||||||
const overviewSection = (
|
const overviewSection = (
|
||||||
<div id="overview-section">
|
<div id="overview-section">
|
||||||
@@ -139,6 +141,13 @@ export function HomePage(
|
|||||||
|
|
||||||
{NewItemEntry(coreViewModel, chatListViewModel.chatQuery, chatListViewModel.createChat)}
|
{NewItemEntry(coreViewModel, chatListViewModel.chatQuery, chatListViewModel.createChat)}
|
||||||
|
|
||||||
|
<span
|
||||||
|
class="secondary"
|
||||||
|
toggle:hidden={isChatPlaceholderHidden}
|
||||||
|
>
|
||||||
|
{coreViewModel.translations.homePage.noChatsPlaceholder}
|
||||||
|
</span>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
id="chat-grid"
|
id="chat-grid"
|
||||||
children:append={[
|
children:append={[
|
||||||
|
|||||||
@@ -73,9 +73,7 @@ const englishTranslations = {
|
|||||||
///
|
///
|
||||||
|
|
||||||
typeChat: "chat",
|
typeChat: "chat",
|
||||||
|
noChatsPlaceholder: "No chats",
|
||||||
addChatPlaceholder: "Add chat",
|
|
||||||
addChatButton: "Add chat",
|
|
||||||
},
|
},
|
||||||
|
|
||||||
settings: {
|
settings: {
|
||||||
@@ -450,9 +448,7 @@ export const allTranslations: {
|
|||||||
updateButton: (version: string) => `Aktualisieren: ${version}`,
|
updateButton: (version: string) => `Aktualisieren: ${version}`,
|
||||||
|
|
||||||
typeChat: "Chat",
|
typeChat: "Chat",
|
||||||
|
noChatsPlaceholder: "Keine Chats",
|
||||||
addChatPlaceholder: "Chat hinzufügen",
|
|
||||||
addChatButton: "Chat hinzufügen",
|
|
||||||
},
|
},
|
||||||
|
|
||||||
settings: {
|
settings: {
|
||||||
@@ -658,7 +654,7 @@ export const allTranslations: {
|
|||||||
task: {
|
task: {
|
||||||
noBoardSelected: "Kein Board ausgewählt",
|
noBoardSelected: "Kein Board ausgewählt",
|
||||||
boardNotFound: "Board nicht gefunden",
|
boardNotFound: "Board nicht gefunden",
|
||||||
|
|
||||||
typeBoard: "Board",
|
typeBoard: "Board",
|
||||||
|
|
||||||
closeBoardButtonAudioLabel: "board schließen",
|
closeBoardButtonAudioLabel: "board schließen",
|
||||||
@@ -748,7 +744,7 @@ export const allTranslations: {
|
|||||||
saveButton: "Guardar",
|
saveButton: "Guardar",
|
||||||
setButton: "OK",
|
setButton: "OK",
|
||||||
|
|
||||||
filterOrCreateLabel: (type: string) => `Buscar o crear ${type}`,
|
filterOrCreateLabel: (type: string) => `Buscar o crear ${type}`,
|
||||||
createLabel: (query: string) => `Crear "${query}"`,
|
createLabel: (query: string) => `Crear "${query}"`,
|
||||||
|
|
||||||
reloadAppButton: "Recargar app",
|
reloadAppButton: "Recargar app",
|
||||||
@@ -793,11 +789,9 @@ export const allTranslations: {
|
|||||||
transferDataButton: "Enviar o exportar archivos",
|
transferDataButton: "Enviar o exportar archivos",
|
||||||
|
|
||||||
updateButton: (version: string) => `Actualizar a ${version}`,
|
updateButton: (version: string) => `Actualizar a ${version}`,
|
||||||
|
|
||||||
typeChat: "chat",
|
|
||||||
|
|
||||||
addChatPlaceholder: "Añadir chat",
|
typeChat: "chat",
|
||||||
addChatButton: "Añadir chat",
|
noChatsPlaceholder: "No hay chats",
|
||||||
},
|
},
|
||||||
|
|
||||||
settings: {
|
settings: {
|
||||||
@@ -1004,7 +998,7 @@ export const allTranslations: {
|
|||||||
task: {
|
task: {
|
||||||
noBoardSelected: "Ningún tablero seleccionado",
|
noBoardSelected: "Ningún tablero seleccionado",
|
||||||
boardNotFound: "Tablero no encontrado",
|
boardNotFound: "Tablero no encontrado",
|
||||||
|
|
||||||
typeBoard: "board",
|
typeBoard: "board",
|
||||||
|
|
||||||
closeBoardButtonAudioLabel: "cerrar tablero",
|
closeBoardButtonAudioLabel: "cerrar tablero",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
|||||||
index: React.State<number> = new React.State(0);
|
index: React.State<number> = new React.State(0);
|
||||||
|
|
||||||
selectedPage: React.State<BoardPageTypes> = new React.State<any>(
|
selectedPage: React.State<BoardPageTypes> = new React.State<any>(
|
||||||
BoardPageTypes.List,
|
BoardPageTypes.List,
|
||||||
);
|
);
|
||||||
|
|
||||||
isSelected: React.State<boolean>;
|
isSelected: React.State<boolean>;
|
||||||
@@ -31,331 +31,339 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
|||||||
searchViewModel: SearchViewModel<TaskViewModel>;
|
searchViewModel: SearchViewModel<TaskViewModel>;
|
||||||
searchSuggestions = new React.ListState<string>();
|
searchSuggestions = new React.ListState<string>();
|
||||||
filteredTaskViewModels: React.ListState<TaskViewModel> =
|
filteredTaskViewModels: React.ListState<TaskViewModel> =
|
||||||
new React.ListState();
|
new React.ListState();
|
||||||
isFilterActive: React.State<boolean>;
|
isFilterActive: React.State<boolean>;
|
||||||
|
|
||||||
pinchToZoomData: React.State<PinchToZoomData> = new React.State({
|
pinchToZoomData: React.State<PinchToZoomData> = new React.State({
|
||||||
zoom: 1,
|
zoom: 1,
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
// paths
|
// paths
|
||||||
getBasePath = (): string[] => {
|
getBasePath = (): string[] => {
|
||||||
return [
|
return [
|
||||||
...this.taskPageViewModel.getBoardViewPath(this.boardInfo.fileId),
|
...this.taskPageViewModel.getBoardViewPath(this.boardInfo.fileId),
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
getLastUsedBoardPath = (): string[] => {
|
getLastUsedBoardPath = (): string[] => {
|
||||||
return [...this.getBasePath(), BoardViewModelSubPaths.LastUsedView];
|
return [...this.getBasePath(), BoardViewModelSubPaths.LastUsedView];
|
||||||
};
|
};
|
||||||
|
|
||||||
getPreviousSearchesPath = (): string[] => {
|
getPreviousSearchesPath = (): string[] => {
|
||||||
return [...this.getBasePath(), BoardViewModelSubPaths.PreviousSearches];
|
return [...this.getBasePath(), BoardViewModelSubPaths.PreviousSearches];
|
||||||
};
|
};
|
||||||
|
|
||||||
getLastSearchPath = (): string[] => {
|
getLastSearchPath = (): string[] => {
|
||||||
return [...this.getBasePath(), BoardViewModelSubPaths.LastSearch];
|
return [...this.getBasePath(), BoardViewModelSubPaths.LastSearch];
|
||||||
};
|
};
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
saveSettings = (): void => {
|
saveSettings = (): void => {
|
||||||
const newBoardInfoFileContent: BoardInfoFileContent =
|
const newBoardInfoFileContent: BoardInfoFileContent =
|
||||||
BoardsAndTasksModel.createBoardInfoFileContent(
|
BoardsAndTasksModel.createBoardInfoFileContent(
|
||||||
this.boardInfo.fileId,
|
this.boardInfo.fileId,
|
||||||
this.name.value,
|
this.name.value,
|
||||||
this.color.value,
|
this.color.value,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.taskPageViewModel.updateBoard(newBoardInfoFileContent);
|
this.taskPageViewModel.updateBoard(newBoardInfoFileContent);
|
||||||
};
|
};
|
||||||
|
|
||||||
applyColor = (): void => {
|
applyColor = (): void => {
|
||||||
this.taskPageViewModel.chatViewModel.setDisplayedColor(
|
this.taskPageViewModel.chatViewModel.setDisplayedColor(
|
||||||
this.color.value,
|
this.color.value,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteBoard = (): void => {
|
deleteBoard = (): void => {
|
||||||
this.taskPageViewModel.deleteBoard(this.boardInfo);
|
this.taskPageViewModel.deleteBoard(this.boardInfo);
|
||||||
this.chatViewModel.taskBoardSuggestions.remove(this.boardInfo.fileId);
|
this.chatViewModel.taskBoardSuggestions.remove(this.boardInfo.fileId);
|
||||||
this.close();
|
this.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
createTask = (): void => {
|
createTask = (): void => {
|
||||||
this.createTaskFromBoardId(this.boardInfo.fileId);
|
this.createTaskFromBoardId(this.boardInfo.fileId);
|
||||||
};
|
};
|
||||||
|
|
||||||
handleDropWithinBoard = (category?: string, status?: string): void => {
|
handleDropWithinBoard = (category?: string, status?: string): void => {
|
||||||
const draggedObject: any = this.coreViewModel.draggedObject.value;
|
const draggedObject: any = this.coreViewModel.draggedObject.value;
|
||||||
if (draggedObject instanceof TaskViewModel == false) return;
|
if (draggedObject instanceof TaskViewModel == false) return;
|
||||||
draggedObject.setCategoryAndStatus(category, status);
|
draggedObject.setCategoryAndStatus(category, status);
|
||||||
};
|
};
|
||||||
|
|
||||||
handleDropBetweenBoards = (): void => {
|
handleDropBetweenBoards = (): void => {
|
||||||
const draggedObject: any = this.coreViewModel.draggedObject.value;
|
const draggedObject: any = this.coreViewModel.draggedObject.value;
|
||||||
if (draggedObject instanceof TaskViewModel == false) return;
|
if (draggedObject instanceof TaskViewModel == false) return;
|
||||||
draggedObject.setBoardId(this.boardInfo.fileId);
|
draggedObject.setBoardId(this.boardInfo.fileId);
|
||||||
};
|
};
|
||||||
|
|
||||||
// storage
|
// storage
|
||||||
storeLastUsedView = (): void => {
|
storeLastUsedView = (): void => {
|
||||||
const path: string[] = this.getLastUsedBoardPath();
|
const path: string[] = this.getLastUsedBoardPath();
|
||||||
const lastUsedView: string = this.selectedPage.value;
|
const lastUsedView: string = this.selectedPage.value;
|
||||||
this.coreViewModel.storageModel.write(path, lastUsedView);
|
this.coreViewModel.storageModel.write(path, lastUsedView);
|
||||||
};
|
};
|
||||||
|
|
||||||
restoreLastUsedView = (): void => {
|
restoreLastUsedView = (): void => {
|
||||||
const path: string[] = this.getLastUsedBoardPath();
|
const path: string[] = this.getLastUsedBoardPath();
|
||||||
const lastUsedView: string | null =
|
const lastUsedView: string | null =
|
||||||
this.coreViewModel.storageModel.read(path);
|
this.coreViewModel.storageModel.read(path);
|
||||||
if (lastUsedView == null) return;
|
if (lastUsedView == null) return;
|
||||||
|
|
||||||
this.selectedPage.value = lastUsedView as BoardPageTypes;
|
this.selectedPage.value = lastUsedView as BoardPageTypes;
|
||||||
};
|
};
|
||||||
|
|
||||||
handleNewSearch = (searchTerm: string): void => {
|
handleNewSearch = (searchTerm: string): void => {
|
||||||
const suggestionPath: string[] = [
|
const suggestionPath: string[] = [
|
||||||
...this.getPreviousSearchesPath(),
|
...this.getPreviousSearchesPath(),
|
||||||
searchTerm,
|
searchTerm,
|
||||||
];
|
];
|
||||||
this.coreViewModel.storageModel.write(suggestionPath, "");
|
this.coreViewModel.storageModel.write(suggestionPath, "");
|
||||||
if (!this.searchSuggestions.value.has(searchTerm) && searchTerm != "") {
|
if (!this.searchSuggestions.value.has(searchTerm) && searchTerm != "") {
|
||||||
this.searchSuggestions.add(searchTerm);
|
this.searchSuggestions.add(searchTerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastSearchPath: string[] = this.getLastSearchPath();
|
const lastSearchPath: string[] = this.getLastSearchPath();
|
||||||
this.coreViewModel.storageModel.write(lastSearchPath, searchTerm);
|
this.coreViewModel.storageModel.write(lastSearchPath, searchTerm);
|
||||||
};
|
};
|
||||||
|
|
||||||
handleSearchRemoved = (searchTerm: string): void => {
|
handleSearchRemoved = (searchTerm: string): void => {
|
||||||
const suggestionPath: string[] = [
|
const suggestionPath: string[] = [
|
||||||
...this.getPreviousSearchesPath(),
|
...this.getPreviousSearchesPath(),
|
||||||
searchTerm,
|
searchTerm,
|
||||||
];
|
];
|
||||||
this.coreViewModel.storageModel.remove(suggestionPath);
|
this.coreViewModel.storageModel.remove(suggestionPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
// view
|
// view
|
||||||
showTask = (taskFileContent: TaskFileContent): void => {
|
showTask = (taskFileContent: TaskFileContent): void => {
|
||||||
if (taskFileContent.boardId != this.boardInfo.fileId) {
|
if (taskFileContent.boardId != this.boardInfo.fileId) {
|
||||||
// remove task that was moved to different board
|
// remove task that was moved to different board
|
||||||
this.boardsAndTasksModel.deleteTaskReference(
|
this.boardsAndTasksModel.deleteTaskReference(
|
||||||
this.boardInfo.fileId,
|
this.boardInfo.fileId,
|
||||||
taskFileContent.fileId,
|
taskFileContent.fileId,
|
||||||
);
|
);
|
||||||
this.removeTaskFromView(taskFileContent);
|
this.removeTaskFromView(taskFileContent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const taskViewModel: TaskViewModel = new TaskViewModel(
|
const taskViewModel: TaskViewModel = new TaskViewModel(
|
||||||
this.coreViewModel,
|
this.coreViewModel,
|
||||||
this.chatViewModel,
|
this.chatViewModel,
|
||||||
this.boardsAndTasksModel,
|
this.boardsAndTasksModel,
|
||||||
this,
|
this,
|
||||||
taskFileContent,
|
taskFileContent,
|
||||||
);
|
);
|
||||||
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
|
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
|
||||||
};
|
};
|
||||||
|
|
||||||
removeTaskFromView = (taskFileContent: TaskFileContent): void => {
|
removeTaskFromView = (taskFileContent: TaskFileContent): void => {
|
||||||
this.taskViewModels.remove(taskFileContent.fileId);
|
this.taskViewModels.remove(taskFileContent.fileId);
|
||||||
this.updateIndex();
|
this.updateIndex();
|
||||||
};
|
};
|
||||||
|
|
||||||
select = (): void => {
|
select = (): void => {
|
||||||
this.taskPageViewModel.selectBoard(this);
|
this.taskPageViewModel.selectBoard(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
close = (): void => {
|
close = (): void => {
|
||||||
this.taskPageViewModel.closeBoard();
|
this.taskPageViewModel.closeBoard();
|
||||||
this.taskPageViewModel.storeLastUsedBoard();
|
this.taskPageViewModel.storeLastUsedBoard();
|
||||||
this.taskViewModels.clear();
|
this.taskViewModels.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
showSettings = (): void => {
|
showSettings = (): void => {
|
||||||
this.isPresentingSettingsModal.value = true;
|
this.isPresentingSettingsModal.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
hideSettings = (): void => {
|
hideSettings = (): void => {
|
||||||
this.saveSettings();
|
this.saveSettings();
|
||||||
this.isPresentingSettingsModal.value = false;
|
this.isPresentingSettingsModal.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
showFilterModal = (): void => {
|
showFilterModal = (): void => {
|
||||||
this.isPresentingFilterModal.value = true;
|
this.isPresentingFilterModal.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
hideFilterModal = (): void => {
|
hideFilterModal = (): void => {
|
||||||
this.isPresentingFilterModal.value = false;
|
this.isPresentingFilterModal.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
resetFilter = (): void => {
|
resetFilter = (): void => {
|
||||||
this.searchViewModel.search("");
|
this.searchViewModel.search("");
|
||||||
};
|
};
|
||||||
|
|
||||||
updateIndex = (): void => {
|
updateIndex = (): void => {
|
||||||
const index: number =
|
const index: number =
|
||||||
this.taskPageViewModel.boardIndexManager.getIndex(this);
|
this.taskPageViewModel.boardIndexManager.getIndex(this);
|
||||||
this.index.value = index;
|
this.index.value = index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
resetPinchZoom = (): void => {
|
||||||
|
this.pinchToZoomData.value = {x: 0, y: 0, zoom: 1};
|
||||||
|
}
|
||||||
|
|
||||||
// load
|
// load
|
||||||
preloadData = (): void => {
|
preloadData = (): void => {
|
||||||
this.name.value = this.boardInfo.name;
|
this.name.value = this.boardInfo.name;
|
||||||
this.color.value = this.boardInfo.color;
|
this.color.value = this.boardInfo.color;
|
||||||
};
|
};
|
||||||
|
|
||||||
loadTasks = (): void => {
|
loadTasks = (): void => {
|
||||||
const taskIds: string[] = this.boardsAndTasksModel.listTaskIds(
|
const taskIds: string[] = this.boardsAndTasksModel.listTaskIds(
|
||||||
this.boardInfo.fileId,
|
this.boardInfo.fileId,
|
||||||
);
|
);
|
||||||
for (const taskId of taskIds) {
|
for (const taskId of taskIds) {
|
||||||
if (this.taskViewModels.value.has(taskId)) continue;
|
if (this.taskViewModels.value.has(taskId)) continue;
|
||||||
|
|
||||||
const taskFileContent: TaskFileContent | null =
|
const taskFileContent: TaskFileContent | null =
|
||||||
this.boardsAndTasksModel.getLatestTaskFileContent(taskId);
|
this.boardsAndTasksModel.getLatestTaskFileContent(taskId);
|
||||||
if (taskFileContent == null) continue;
|
if (taskFileContent == null) continue;
|
||||||
|
|
||||||
const taskViewModel: TaskViewModel = new TaskViewModel(
|
const taskViewModel: TaskViewModel = new TaskViewModel(
|
||||||
this.coreViewModel,
|
this.coreViewModel,
|
||||||
this.chatViewModel,
|
this.chatViewModel,
|
||||||
this.boardsAndTasksModel,
|
this.boardsAndTasksModel,
|
||||||
this,
|
this,
|
||||||
taskFileContent,
|
taskFileContent,
|
||||||
);
|
);
|
||||||
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
|
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateTaskIndices();
|
this.updateTaskIndices();
|
||||||
};
|
};
|
||||||
|
|
||||||
loadSearchSuggestions = (): void => {
|
loadSearchSuggestions = (): void => {
|
||||||
const dirPath: string[] = this.getPreviousSearchesPath();
|
const dirPath: string[] = this.getPreviousSearchesPath();
|
||||||
const searches: string[] =
|
const searches: string[] =
|
||||||
this.coreViewModel.storageModel.list(dirPath);
|
this.coreViewModel.storageModel.list(dirPath);
|
||||||
this.searchSuggestions.add(...searches.filter((x) => x != ""));
|
this.searchSuggestions.add(...searches.filter((x) => x != ""));
|
||||||
};
|
};
|
||||||
|
|
||||||
restoreSearch = (): void => {
|
restoreSearch = (): void => {
|
||||||
const lastSearchPath: string[] = this.getLastSearchPath();
|
const lastSearchPath: string[] = this.getLastSearchPath();
|
||||||
const lastSearch: string | null =
|
const lastSearch: string | null =
|
||||||
this.coreViewModel.storageModel.read(lastSearchPath);
|
this.coreViewModel.storageModel.read(lastSearchPath);
|
||||||
if (lastSearch != null) {
|
if (lastSearch != null) {
|
||||||
this.searchViewModel.search(lastSearch);
|
this.searchViewModel.search(lastSearch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
loadData = (): void => {
|
loadData = (): void => {
|
||||||
this.restoreLastUsedView();
|
this.restoreLastUsedView();
|
||||||
this.loadTasks();
|
this.loadTasks();
|
||||||
this.loadSearchSuggestions();
|
this.loadSearchSuggestions();
|
||||||
};
|
};
|
||||||
|
|
||||||
// exit
|
// exit
|
||||||
handleContextClose = (fromHistoryEvent: boolean): void => {
|
handleContextClose = (fromHistoryEvent: boolean): void => {
|
||||||
this.taskPageViewModel.handleBoardClosed(this);
|
this.taskPageViewModel.handleBoardClosed(this);
|
||||||
|
|
||||||
if (!fromHistoryEvent) return;
|
if (!fromHistoryEvent) return;
|
||||||
this.taskPageViewModel.storeLastUsedBoard();
|
this.taskPageViewModel.storeLastUsedBoard();
|
||||||
};
|
};
|
||||||
|
|
||||||
// init
|
// init
|
||||||
constructor(
|
constructor(
|
||||||
public readonly coreViewModel: CoreViewModel,
|
public readonly coreViewModel: CoreViewModel,
|
||||||
public readonly chatViewModel: ChatViewModel,
|
public readonly chatViewModel: ChatViewModel,
|
||||||
public readonly boardsAndTasksModel: BoardsAndTasksModel,
|
public readonly boardsAndTasksModel: BoardsAndTasksModel,
|
||||||
public readonly taskPageViewModel: TaskPageViewModel,
|
public readonly taskPageViewModel: TaskPageViewModel,
|
||||||
public readonly boardInfo: BoardInfoFileContent,
|
public readonly boardInfo: BoardInfoFileContent,
|
||||||
) {
|
) {
|
||||||
super(coreViewModel, chatViewModel, boardsAndTasksModel, "board");
|
super(coreViewModel, chatViewModel, boardsAndTasksModel, "board");
|
||||||
|
|
||||||
// load
|
// load
|
||||||
this.preloadData();
|
this.preloadData();
|
||||||
|
|
||||||
|
// search
|
||||||
|
this.searchViewModel = new SearchViewModel(
|
||||||
|
this.taskViewModels,
|
||||||
|
this.filteredTaskViewModels,
|
||||||
|
TaskViewModel.getStringsForFilter,
|
||||||
|
this.searchSuggestions,
|
||||||
|
);
|
||||||
|
this.searchViewModel.appliedQuery.subscribeSilent((newQuery) => {
|
||||||
|
this.handleNewSearch(newQuery);
|
||||||
|
});
|
||||||
|
this.restoreSearch();
|
||||||
|
this.searchSuggestions.handleRemovals(this.handleSearchRemoved);
|
||||||
|
|
||||||
// subscriptions
|
this.isFilterActive = React.createProxyState(
|
||||||
this.isSelected = React.createProxyState(
|
[this.searchViewModel.appliedQuery],
|
||||||
[this.taskPageViewModel.selectedBoardId],
|
() => this.searchViewModel.appliedQuery.value != "",
|
||||||
() =>
|
);
|
||||||
this.taskPageViewModel.selectedBoardId.value ==
|
|
||||||
this.boardInfo.fileId,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.color.subscribe(() => {
|
// subscriptions
|
||||||
if (this.isSelected.value == false) return;
|
this.isSelected = React.createProxyState(
|
||||||
if (this.chatViewModel.selectedPage.value != ChatPageTypes.Tasks)
|
[this.taskPageViewModel.selectedBoardId],
|
||||||
return;
|
() =>
|
||||||
this.applyColor();
|
this.taskPageViewModel.selectedBoardId.value ==
|
||||||
});
|
this.boardInfo.fileId,
|
||||||
|
);
|
||||||
|
|
||||||
this.selectedPage.subscribeSilent(() => {
|
this.color.subscribe(() => {
|
||||||
this.storeLastUsedView();
|
if (this.isSelected.value == false) return;
|
||||||
});
|
if (this.chatViewModel.selectedPage.value != ChatPageTypes.Tasks)
|
||||||
|
return;
|
||||||
|
this.applyColor();
|
||||||
|
});
|
||||||
|
|
||||||
// handlers
|
this.selectedPage.subscribeSilent(() => {
|
||||||
boardsAndTasksModel.taskHandlerManager.setHandler(
|
this.storeLastUsedView();
|
||||||
this.boardInfo.fileId,
|
});
|
||||||
(taskFileContent: TaskFileContent) => {
|
|
||||||
if (taskFileContent.boardId != this.boardInfo.fileId) return;
|
|
||||||
this.showTask(taskFileContent);
|
|
||||||
this.updateTaskIndices();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// search
|
this.searchViewModel.appliedQuery.subscribeSilent(()=> {
|
||||||
this.searchViewModel = new SearchViewModel(
|
this.resetPinchZoom();
|
||||||
this.taskViewModels,
|
})
|
||||||
this.filteredTaskViewModels,
|
|
||||||
TaskViewModel.getStringsForFilter,
|
|
||||||
this.searchSuggestions,
|
|
||||||
);
|
|
||||||
this.searchViewModel.appliedQuery.subscribeSilent((newQuery) => {
|
|
||||||
this.handleNewSearch(newQuery);
|
|
||||||
});
|
|
||||||
this.restoreSearch();
|
|
||||||
this.searchSuggestions.handleRemovals(this.handleSearchRemoved);
|
|
||||||
|
|
||||||
this.isFilterActive = React.createProxyState(
|
// handlers
|
||||||
[this.searchViewModel.appliedQuery],
|
boardsAndTasksModel.taskHandlerManager.setHandler(
|
||||||
() => this.searchViewModel.appliedQuery.value != "",
|
this.boardInfo.fileId,
|
||||||
);
|
(taskFileContent: TaskFileContent) => {
|
||||||
|
if (taskFileContent.boardId != this.boardInfo.fileId) return;
|
||||||
|
this.showTask(taskFileContent);
|
||||||
|
this.updateTaskIndices();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// keystrokes
|
// keystrokes
|
||||||
this.registerKeyStroke(CommonKeys.Filter, this.showFilterModal);
|
this.registerKeyStroke(CommonKeys.Filter, this.showFilterModal);
|
||||||
this.registerKeyStroke(CommonKeys.Reset, this.resetFilter); //
|
this.registerKeyStroke(CommonKeys.Reset, this.resetFilter); //
|
||||||
this.registerKeyStroke(CommonKeys.CloseOrCancel, this.hideFilterModal);
|
this.registerKeyStroke(CommonKeys.CloseOrCancel, this.hideFilterModal);
|
||||||
this.registerKeyStroke(CommonKeys.Settings, this.showSettings);
|
this.registerKeyStroke(CommonKeys.Settings, this.showSettings);
|
||||||
this.registerKeyStroke(CommonKeys.Apply, this.hideSettings);
|
this.registerKeyStroke(CommonKeys.Apply, this.hideSettings);
|
||||||
this.registerKeyStroke(CommonKeys.Create, this.createTask);
|
this.registerKeyStroke(CommonKeys.Create, this.createTask);
|
||||||
|
|
||||||
this.registerKeyStroke(
|
this.registerKeyStroke(
|
||||||
"j",
|
"j",
|
||||||
() => (this.selectedPage.value = BoardPageTypes.List),
|
() => (this.selectedPage.value = BoardPageTypes.List),
|
||||||
);
|
);
|
||||||
this.registerKeyStroke(
|
this.registerKeyStroke(
|
||||||
"k",
|
"k",
|
||||||
() => (this.selectedPage.value = BoardPageTypes.Kanban),
|
() => (this.selectedPage.value = BoardPageTypes.Kanban),
|
||||||
);
|
);
|
||||||
this.registerKeyStroke(
|
this.registerKeyStroke(
|
||||||
"l",
|
"l",
|
||||||
() => (this.selectedPage.value = BoardPageTypes.StatusGrid),
|
() => (this.selectedPage.value = BoardPageTypes.StatusGrid),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.taskPageViewModel.registerContext(this.boardInfo.fileId, this);
|
this.taskPageViewModel.registerContext(this.boardInfo.fileId, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum BoardViewModelSubPaths {
|
export enum BoardViewModelSubPaths {
|
||||||
LastUsedView = "last-used-view",
|
LastUsedView = "last-used-view",
|
||||||
PreviousSearches = "previous-searches",
|
PreviousSearches = "previous-searches",
|
||||||
LastSearch = "last-search",
|
LastSearch = "last-search",
|
||||||
}
|
}
|
||||||
|
|
||||||
// types
|
// types
|
||||||
export enum BoardPageTypes {
|
export enum BoardPageTypes {
|
||||||
List = "list",
|
List = "list",
|
||||||
Kanban = "kanban",
|
Kanban = "kanban",
|
||||||
StatusGrid = "status-grid",
|
StatusGrid = "status-grid",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import * as React from "../../react";
|
||||||
|
|
||||||
import StorageViewModel from "../Global/storageViewModel";
|
import StorageViewModel from "../Global/storageViewModel";
|
||||||
import SettingsViewModel from "../Global/settingsViewModel";
|
import SettingsViewModel from "../Global/settingsViewModel";
|
||||||
import FileTransferViewModel from "../Global/fileTransferViewModel";
|
import FileTransferViewModel from "../Global/fileTransferViewModel";
|
||||||
@@ -7,26 +9,26 @@ import { CommonKeys } from "../../View/keystrokes";
|
|||||||
|
|
||||||
export default class HomeViewModel extends Context {
|
export default class HomeViewModel extends Context {
|
||||||
constructor(
|
constructor(
|
||||||
public readonly coreViewModel: CoreViewModel,
|
public readonly coreViewModel: CoreViewModel,
|
||||||
public readonly settingsViewModel: SettingsViewModel,
|
public readonly settingsViewModel: SettingsViewModel,
|
||||||
public readonly fileTransferViewModel: FileTransferViewModel,
|
public readonly fileTransferViewModel: FileTransferViewModel,
|
||||||
public readonly storageViewModel: StorageViewModel,
|
public readonly storageViewModel: StorageViewModel,
|
||||||
public readonly connectionViewModel: ConnectionViewModel,
|
public readonly connectionViewModel: ConnectionViewModel,
|
||||||
) {
|
) {
|
||||||
super("home");
|
super("home");
|
||||||
|
|
||||||
this.coreViewModel.context = this;
|
this.coreViewModel.context = this;
|
||||||
|
|
||||||
this.registerKeyStroke(
|
this.registerKeyStroke(
|
||||||
CommonKeys.Settings,
|
CommonKeys.Settings,
|
||||||
this.settingsViewModel.showSettingsModal,
|
this.settingsViewModel.showSettingsModal,
|
||||||
);
|
);
|
||||||
this.registerKeyStroke(
|
this.registerKeyStroke(
|
||||||
"t",
|
"t",
|
||||||
this.fileTransferViewModel.showDirectionSelectionModal,
|
this.fileTransferViewModel.showDirectionSelectionModal,
|
||||||
);
|
);
|
||||||
this.registerKeyStroke("e", this.storageViewModel.showStorageModal);
|
this.registerKeyStroke("e", this.storageViewModel.showStorageModal);
|
||||||
this.registerKeyStroke("x", this.connectionViewModel.disconnect);
|
this.registerKeyStroke("x", this.connectionViewModel.disconnect);
|
||||||
this.registerKeyStroke("c", this.connectionViewModel.connect);
|
this.registerKeyStroke("c", this.connectionViewModel.connect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export default class SearchViewModel<T> {
|
|||||||
|
|
||||||
clear = (): void => {
|
clear = (): void => {
|
||||||
this.searchInput.value = "";
|
this.searchInput.value = "";
|
||||||
|
this.applySearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteSuggestion = (suggestion: string): void => {
|
deleteSuggestion = (suggestion: string): void => {
|
||||||
|
|||||||
Reference in New Issue
Block a user