diff --git a/src/View/ChatPages/taskPage.tsx b/src/View/ChatPages/taskPage.tsx index b5eec35e..8bfaf078 100644 --- a/src/View/ChatPages/taskPage.tsx +++ b/src/View/ChatPages/taskPage.tsx @@ -67,7 +67,7 @@ export function TaskPage( on:enter={taskPageViewModel.createBoard} placeholder={ coreViewModel.translations.general - .filterOrCreateLabel + .filterOrCreateLabel(coreViewModel.translations.chatPage.task.typeBoard) } > diff --git a/src/View/Components/chatEntry.tsx b/src/View/Components/chatEntry.tsx index ff28ce64..6f5a792a 100644 --- a/src/View/Components/chatEntry.tsx +++ b/src/View/Components/chatEntry.tsx @@ -4,7 +4,7 @@ import ChatViewModel from "../../ViewModel/Chat/chatViewModel"; export function ChatEntry(chatViewModel: ChatViewModel) { const view = (
+ {NewItemEntry(coreViewModel, chatListViewModel.chatQuery, chatListViewModel.createChat)} +
diff --git a/src/View/translations.ts b/src/View/translations.ts index db73d17a..fbdf1606 100644 --- a/src/View/translations.ts +++ b/src/View/translations.ts @@ -22,7 +22,7 @@ const englishTranslations = { saveButton: "Save", setButton: "Set", - filterOrCreateLabel: "Search or create", + filterOrCreateLabel: (type: string) => `Search or create ${type}`, createLabel: (query: string) => `Create "${query}"`, reloadAppButton: "Reload App", @@ -72,7 +72,8 @@ const englishTranslations = { /// - addChatAudioLabel: "name of new chat", + typeChat: "chat", + addChatPlaceholder: "Add chat", addChatButton: "Add chat", }, @@ -292,6 +293,8 @@ const englishTranslations = { noBoardSelected: "No board selected", boardNotFound: "Board not found", + typeBoard: "board", + /// closeBoardButtonAudioLabel: "close board", @@ -400,7 +403,7 @@ export const allTranslations: { saveButton: "Speichern", setButton: "OK", - filterOrCreateLabel: "Suchen oder erstellen", + filterOrCreateLabel: (type: string) => `${type} suchen oder erstellen`, createLabel: (query: string) => `"${query}" erstellen`, reloadAppButton: "Neu laden", @@ -445,8 +448,9 @@ export const allTranslations: { transferDataButton: "Daten übertragen", updateButton: (version: string) => `Aktualisieren: ${version}`, + + typeChat: "Chat", - addChatAudioLabel: "Name des neuen Chats", addChatPlaceholder: "Chat hinzufügen", addChatButton: "Chat hinzufügen", }, @@ -654,6 +658,8 @@ export const allTranslations: { task: { noBoardSelected: "Kein Board ausgewählt", boardNotFound: "Board nicht gefunden", + + typeBoard: "Board", closeBoardButtonAudioLabel: "board schließen", toggleBoardButtonAudioLabel: "board-liste ein/ausblenden", @@ -742,7 +748,7 @@ export const allTranslations: { saveButton: "Guardar", setButton: "OK", - filterOrCreateLabel: "Buscar o crear", + filterOrCreateLabel: (type: string) => `Buscar o crear ${type}`, createLabel: (query: string) => `Crear "${query}"`, reloadAppButton: "Recargar app", @@ -787,8 +793,9 @@ export const allTranslations: { transferDataButton: "Enviar o exportar archivos", updateButton: (version: string) => `Actualizar a ${version}`, + + typeChat: "chat", - addChatAudioLabel: "nombre del nuevo chat", addChatPlaceholder: "Añadir chat", addChatButton: "Añadir chat", }, @@ -997,6 +1004,8 @@ export const allTranslations: { task: { noBoardSelected: "Ningún tablero seleccionado", boardNotFound: "Tablero no encontrado", + + typeBoard: "board", closeBoardButtonAudioLabel: "cerrar tablero", toggleBoardButtonAudioLabel: diff --git a/src/ViewModel/Chat/chatListViewModel.ts b/src/ViewModel/Chat/chatListViewModel.ts index 3ac29d3c..76da14bf 100644 --- a/src/ViewModel/Chat/chatListViewModel.ts +++ b/src/ViewModel/Chat/chatListViewModel.ts @@ -5,7 +5,7 @@ import CoreViewModel from "../Global/coreViewModel"; import ContactListViewModel from "../Global/contactViewModel"; import ConnectionViewModel from "../Global/connectionViewModel"; import * as React from "../../react"; -import { IndexManager } from "../../Model/Utility/utility"; +import implementFilter, { IndexManager } from "../../Model/Utility/utility"; import ChatModel from "../../Model/Chat/chatModel"; export default class ChatListViewModel { @@ -18,8 +18,9 @@ export default class ChatListViewModel { ); // state - newChatPrimaryChannel: React.State = new React.State(""); + chatQuery: React.State = new React.State(""); chatViewModels: React.ListState = new React.ListState(); + chatMatches: React.ListState = new React.ListState(); selectedChat: React.State = new React.State( undefined, @@ -27,17 +28,17 @@ export default class ChatListViewModel { // guards cannotCreateChat = React.createProxyState( - [this.newChatPrimaryChannel], - () => this.newChatPrimaryChannel.value == "", + [this.chatQuery], + () => this.chatQuery.value == "", ); // methods createChat = (): void => { const chatModel: ChatModel = this.coreViewModel.chatListModel.createChat( - this.newChatPrimaryChannel.value, + this.chatQuery.value, ); - this.newChatPrimaryChannel.value = ""; + this.chatQuery.value = ""; const chatViewModel: ChatViewModel = this.createChatViewModel(chatModel); @@ -107,6 +108,8 @@ export default class ChatListViewModel { ); this.loadChats(); + + implementFilter(this.chatViewModels, this.chatMatches, this.chatQuery, chat => chat.chatModel.info.name) } // utility