remember previous object filters, improve translations

This commit is contained in:
Marlon Erler
2024-07-17 17:22:16 +00:00
parent 0069462034
commit d650f09fe0
5 changed files with 71 additions and 13 deletions
+12 -5
View File
@@ -156,6 +156,13 @@ pageZoom.subscribe(() => {
document.body.style.webkitTextSizeAdjust = `${pageZoom.value}%`;
});
export const usedObjectCategories =
React.restoreListState<string>("object-categories");
export const usedObjectStatuses =
React.restoreListState<string>("object-statuses");
export const previousObjectSearches =
React.restoreListState<string>("object-searches");
export function toggleSettings() {
isPresentingSettingsModal.value = !isPresentingSettingsModal.value;
}
@@ -165,6 +172,7 @@ export function repairApp() {
removeSetDuplicates(previousAddresses);
removeSetDuplicates(usedObjectCategories);
removeSetDuplicates(usedObjectStatuses);
removeSetDuplicates(previousObjectSearches);
}
function mapSetToLowercase(listState: React.ListState<string>) {
@@ -191,6 +199,10 @@ export function clearStatuses() {
usedObjectStatuses.clear();
}
export function clearObjectSearches() {
previousObjectSearches.clear();
}
const zoomStep = 10;
export function zoomOut() {
pageZoom.value -= zoomStep;
@@ -199,11 +211,6 @@ export function zoomIn() {
pageZoom.value += zoomStep;
}
export const usedObjectCategories =
React.restoreListState<string>("object-categories");
export const usedObjectStatuses =
React.restoreListState<string>("object-statuses");
// CHAT
export const chats = new React.ListState<Chat>();
export const chatIds = React.restoreListState<string>("chat-ids");
+12
View File
@@ -10,6 +10,8 @@ import { ObjectGridView } from "./objectGridView";
import { StatusView } from "./statusView";
import { icons } from "../../icons";
import { translation } from "../../translations";
import { previousObjectSearches } from "../../Model/model";
import { stringToOptionTag } from "../../utility";
export const viewTypes = {
all: [translation.viewAll, "grid_view"],
@@ -61,6 +63,7 @@ export function ObjectPane(chat: Chat) {
function applyFilter() {
appliedFilter.value = filterInput.value;
previousObjectSearches.add(appliedFilter.value);
const allObjects = [...chat.objects.value.values()];
allObjects.forEach((object, i) => {
@@ -198,7 +201,16 @@ export function ObjectPane(chat: Chat) {
bind:value={filterInput}
on:enter={applyFilter}
placeholder={translation.searchPlaceholder}
list="object-searches"
></input>
<datalist
hidden
id="object-searches"
children:append={[
previousObjectSearches,
stringToOptionTag,
]}
></datalist>
</div>
</label>
</div>
+8
View File
@@ -3,6 +3,7 @@ import * as React from "bloatless-react";
import {
clearAddresses,
clearCategories,
clearObjectSearches,
clearStatuses,
isPresentingSettingsModal,
repairApp,
@@ -56,6 +57,13 @@ export function SettingsModal() {
<span class="icon">{icons.status}</span>
{translation.clearStatuses}
</button>
<button
class="tile width-100 flex-1"
on:click={clearObjectSearches}
>
<span class="icon">search</span>
{translation.clearObjectFilters}
</button>
</div>
</main>
<button class="width-100" on:click={toggleSettings}>
+5 -2
View File
@@ -21,6 +21,7 @@ const englishTranslations = {
clearAddresses: "Clear previous connections",
clearCategories: "Clear suggestions for object categories",
clearStatuses: "Clear suggestions for object statuses",
clearObjectFilters: "Clear object filters",
// overview
overview: "Overview",
@@ -160,6 +161,7 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
clearAddresses: "Borrar conexiones previas",
clearCategories: "Borrar sugerencias para categorías de objetos",
clearStatuses: "Borrar sugerencias para estados de objetos",
clearObjectFilters: "Borrar filtros de objetos",
// overview
overview: "Resumen",
@@ -172,7 +174,7 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
encryptionUnavailableTitle: "Cifrado no disponible",
encryptionUnavailableMessage:
"Obtén esta aplicación a traves de HTTPS o continúa sin cifrado",
"Obtén esta aplicación a través de HTTPS o continúa sin cifrado",
serverAddress: "Dirección del servidor",
serverAddressPlaceholder: "wss://192.168.0.69:3000",
@@ -238,7 +240,7 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
showObjects: "mostrar objetos",
createObject: "añadir nuevo objeto",
untitledObject: "Sin Título",
untitledObject: "Sin título",
filterObjects: "Filtrar objetos",
searchTitle: "Buscar",
@@ -296,6 +298,7 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
clearAddresses: "Vorherige Verbindungen löschen",
clearCategories: "Vorschläge für Objektkategorien löschen",
clearStatuses: "Vorschläge für Objektstaten löschen",
clearObjectFilters: "Objektfilter löschen",
// overview
overview: "Übersicht",