reset board zoom on view change, apply cleared search
This commit is contained in:
@@ -13,6 +13,7 @@ export function BoardViewToggleButton(
|
||||
) {
|
||||
function select() {
|
||||
boardViewModel.selectedPage.value = page;
|
||||
boardViewModel.resetPinchZoom();
|
||||
}
|
||||
|
||||
const isSelected = React.createProxyState(
|
||||
|
||||
@@ -232,11 +232,13 @@ body[showing-chat] #chat-page-wrapper {
|
||||
overflow-x: auto;
|
||||
|
||||
padding: 0px;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
#chat-page > div > #main > div > .pane-wrapper > .pane > .toolbar > span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
#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 isChatPlaceholderHidden = React.createProxyState([chatListViewModel.chatMatches, chatListViewModel.chatQuery], ()=>chatListViewModel.chatMatches.value.size > 0 || chatListViewModel.chatQuery.value != "");
|
||||
|
||||
// sections
|
||||
const overviewSection = (
|
||||
<div id="overview-section">
|
||||
@@ -139,6 +141,13 @@ export function HomePage(
|
||||
|
||||
{NewItemEntry(coreViewModel, chatListViewModel.chatQuery, chatListViewModel.createChat)}
|
||||
|
||||
<span
|
||||
class="secondary"
|
||||
toggle:hidden={isChatPlaceholderHidden}
|
||||
>
|
||||
{coreViewModel.translations.homePage.noChatsPlaceholder}
|
||||
</span>
|
||||
|
||||
<div
|
||||
id="chat-grid"
|
||||
children:append={[
|
||||
|
||||
@@ -73,9 +73,7 @@ const englishTranslations = {
|
||||
///
|
||||
|
||||
typeChat: "chat",
|
||||
|
||||
addChatPlaceholder: "Add chat",
|
||||
addChatButton: "Add chat",
|
||||
noChatsPlaceholder: "No chats",
|
||||
},
|
||||
|
||||
settings: {
|
||||
@@ -450,9 +448,7 @@ export const allTranslations: {
|
||||
updateButton: (version: string) => `Aktualisieren: ${version}`,
|
||||
|
||||
typeChat: "Chat",
|
||||
|
||||
addChatPlaceholder: "Chat hinzufügen",
|
||||
addChatButton: "Chat hinzufügen",
|
||||
noChatsPlaceholder: "Keine Chats",
|
||||
},
|
||||
|
||||
settings: {
|
||||
@@ -795,9 +791,7 @@ export const allTranslations: {
|
||||
updateButton: (version: string) => `Actualizar a ${version}`,
|
||||
|
||||
typeChat: "chat",
|
||||
|
||||
addChatPlaceholder: "Añadir chat",
|
||||
addChatButton: "Añadir chat",
|
||||
noChatsPlaceholder: "No hay chats",
|
||||
},
|
||||
|
||||
settings: {
|
||||
|
||||
@@ -202,6 +202,10 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
this.index.value = index;
|
||||
};
|
||||
|
||||
resetPinchZoom = (): void => {
|
||||
this.pinchToZoomData.value = {x: 0, y: 0, zoom: 1};
|
||||
}
|
||||
|
||||
// load
|
||||
preloadData = (): void => {
|
||||
this.name.value = this.boardInfo.name;
|
||||
@@ -275,6 +279,24 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
// load
|
||||
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);
|
||||
|
||||
this.isFilterActive = React.createProxyState(
|
||||
[this.searchViewModel.appliedQuery],
|
||||
() => this.searchViewModel.appliedQuery.value != "",
|
||||
);
|
||||
|
||||
// subscriptions
|
||||
this.isSelected = React.createProxyState(
|
||||
[this.taskPageViewModel.selectedBoardId],
|
||||
@@ -294,6 +316,10 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
this.storeLastUsedView();
|
||||
});
|
||||
|
||||
this.searchViewModel.appliedQuery.subscribeSilent(()=> {
|
||||
this.resetPinchZoom();
|
||||
})
|
||||
|
||||
// handlers
|
||||
boardsAndTasksModel.taskHandlerManager.setHandler(
|
||||
this.boardInfo.fileId,
|
||||
@@ -304,24 +330,6 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
},
|
||||
);
|
||||
|
||||
// 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);
|
||||
|
||||
this.isFilterActive = React.createProxyState(
|
||||
[this.searchViewModel.appliedQuery],
|
||||
() => this.searchViewModel.appliedQuery.value != "",
|
||||
);
|
||||
|
||||
// keystrokes
|
||||
this.registerKeyStroke(CommonKeys.Filter, this.showFilterModal);
|
||||
this.registerKeyStroke(CommonKeys.Reset, this.resetFilter); //
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as React from "../../react";
|
||||
|
||||
import StorageViewModel from "../Global/storageViewModel";
|
||||
import SettingsViewModel from "../Global/settingsViewModel";
|
||||
import FileTransferViewModel from "../Global/fileTransferViewModel";
|
||||
|
||||
@@ -40,6 +40,7 @@ export default class SearchViewModel<T> {
|
||||
|
||||
clear = (): void => {
|
||||
this.searchInput.value = "";
|
||||
this.applySearch();
|
||||
};
|
||||
|
||||
deleteSuggestion = (suggestion: string): void => {
|
||||
|
||||
Reference in New Issue
Block a user