reset board zoom on view change, apply cleared search

This commit is contained in:
marlon-erler
2026-09-30 17:25:18 +02:00
parent 6079227356
commit 24610af08e
7 changed files with 244 additions and 227 deletions
@@ -13,6 +13,7 @@ export function BoardViewToggleButton(
) { ) {
function select() { function select() {
boardViewModel.selectedPage.value = page; boardViewModel.selectedPage.value = page;
boardViewModel.resetPinchZoom();
} }
const isSelected = React.createProxyState( const isSelected = React.createProxyState(
+2
View File
@@ -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 {
+9
View File
@@ -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={[
+3 -9
View File
@@ -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: {
@@ -795,9 +791,7 @@ export const allTranslations: {
updateButton: (version: string) => `Actualizar a ${version}`, updateButton: (version: string) => `Actualizar a ${version}`,
typeChat: "chat", typeChat: "chat",
noChatsPlaceholder: "No hay chats",
addChatPlaceholder: "Añadir chat",
addChatButton: "Añadir chat",
}, },
settings: { settings: {
+26 -18
View File
@@ -202,6 +202,10 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
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;
@@ -275,6 +279,24 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
// 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);
this.isFilterActive = React.createProxyState(
[this.searchViewModel.appliedQuery],
() => this.searchViewModel.appliedQuery.value != "",
);
// subscriptions // subscriptions
this.isSelected = React.createProxyState( this.isSelected = React.createProxyState(
[this.taskPageViewModel.selectedBoardId], [this.taskPageViewModel.selectedBoardId],
@@ -294,6 +316,10 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
this.storeLastUsedView(); this.storeLastUsedView();
}); });
this.searchViewModel.appliedQuery.subscribeSilent(()=> {
this.resetPinchZoom();
})
// handlers // handlers
boardsAndTasksModel.taskHandlerManager.setHandler( boardsAndTasksModel.taskHandlerManager.setHandler(
this.boardInfo.fileId, 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 // 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); //
+2
View File
@@ -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";
+1
View File
@@ -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 => {