add option to clear suggestions

This commit is contained in:
marlon-erler
2024-07-12 22:24:54 +02:00
parent 1a41bcaef6
commit 673fab414b
5 changed files with 63 additions and 8 deletions
+19 -4
View File
@@ -440,6 +440,9 @@
zoomOut: "Zoom Out", zoomOut: "Zoom Out",
zoomIn: "Zoom In", zoomIn: "Zoom In",
repairApp: "Repair App", repairApp: "Repair App",
clearAddresses: "Clear previous connections",
clearCategories: "Clear suggestions for object categories",
clearStatuses: "Clear suggestions for object statuses",
// overview // overview
overview: "Overview", overview: "Overview",
connection: "Connection", connection: "Connection",
@@ -536,6 +539,9 @@
zoomOut: "Alejar", zoomOut: "Alejar",
zoomIn: "Acercar", zoomIn: "Acercar",
repairApp: "Reparar Aplicaci\xF3n", repairApp: "Reparar Aplicaci\xF3n",
clearAddresses: "Borrar conexiones previas",
clearCategories: "Borrar sugerencias para categor\xEDas de objetos",
clearStatuses: "Borrar sugerencias para estados de objetos",
// overview // overview
overview: "Resumen", overview: "Resumen",
connection: "Conexi\xF3n", connection: "Conexi\xF3n",
@@ -630,6 +636,9 @@
zoomOut: "Verkleinern", zoomOut: "Verkleinern",
zoomIn: "Vergr\xF6\xDFern", zoomIn: "Vergr\xF6\xDFern",
repairApp: "App reparieren", repairApp: "App reparieren",
clearAddresses: "Vorherige Verbindungen l\xF6schen",
clearCategories: "Vorschl\xE4ge f\xFCr Objektkategorien l\xF6schen",
clearStatuses: "Vorschl\xE4ge f\xFCr Objektstaten l\xF6schen",
// overview // overview
overview: "\xDCbersicht", overview: "\xDCbersicht",
connection: "Verbindung", connection: "Verbindung",
@@ -640,7 +649,7 @@
encryptionUnavailableMessage: "Lade diese app \xFCber HTTPS, um Nachrichten zu verschl\xFCsseln", encryptionUnavailableMessage: "Lade diese app \xFCber HTTPS, um Nachrichten zu verschl\xFCsseln",
serverAddress: "Serveradresse", serverAddress: "Serveradresse",
serverAddressPlaceholder: "wss://192.168.0.69:3000", serverAddressPlaceholder: "wss://192.168.0.69:3000",
previousConnections: "Vorherige Adressen", previousConnections: "Vorherige Verbindungen",
connectToServer: "Verbinden", connectToServer: "Verbinden",
disconnect: "Trennen", disconnect: "Trennen",
mailbox: "Briefkasten", mailbox: "Briefkasten",
@@ -847,7 +856,7 @@
if (selectedChat.value != this) this.hasUnreadMessages.value = true; if (selectedChat.value != this) this.hasUnreadMessages.value = true;
}; };
handleMessageObject = (messageObject) => { handleMessageObject = (messageObject) => {
this.addObject(messageObject); this.addObject(messageObject, true);
}; };
// sending // sending
sendMessagesInOutbox = () => { sendMessagesInOutbox = () => {
@@ -946,7 +955,7 @@
addObjectContent = (messageObject, content) => { addObjectContent = (messageObject, content) => {
messageObject.contentVersions[content.id] = content; messageObject.contentVersions[content.id] = content;
}; };
addObject = (messageObject) => { addObject = (messageObject, ignoreIfUnchanged = false) => {
const existingObject = this.objects.value.get(messageObject.id); const existingObject = this.objects.value.get(messageObject.id);
if (existingObject) { if (existingObject) {
existingObject.title = messageObject.title; existingObject.title = messageObject.title;
@@ -1266,6 +1275,12 @@
function removeSetDuplicates(listState) { function removeSetDuplicates(listState) {
listState.value = /* @__PURE__ */ new Set([...listState.value]); listState.value = /* @__PURE__ */ new Set([...listState.value]);
} }
function clearCategories() {
usedObjectCategories.clear();
}
function clearStatuses() {
usedObjectStatuses.clear();
}
var zoomStep = 10; var zoomStep = 10;
function zoomOut() { function zoomOut() {
pageZoom.value -= zoomStep; pageZoom.value -= zoomStep;
@@ -2311,7 +2326,7 @@
// src/Views/settingsModal.tsx // src/Views/settingsModal.tsx
function SettingsModal() { function SettingsModal() {
return /* @__PURE__ */ createElement("div", { class: "modal", "toggle:open": isPresentingSettingsModal }, /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("main", null, /* @__PURE__ */ createElement("h2", null, translation.settings), /* @__PURE__ */ createElement("div", { class: "flex-row width-input gap" }, /* @__PURE__ */ createElement("button", { class: "width-100 flex justify-start", "on:click": zoomOut }, /* @__PURE__ */ createElement("span", { class: "icon" }, "zoom_out"), translation.zoomOut), /* @__PURE__ */ createElement("button", { class: "width-100 flex justify-start", "on:click": zoomIn }, /* @__PURE__ */ createElement("span", { class: "icon" }, "zoom_in"), translation.zoomIn)), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("div", { class: "flex-row width-input" }, /* @__PURE__ */ createElement("button", { class: "width-100 flex-1", "on:click": repairApp }, translation.repairApp, /* @__PURE__ */ createElement("span", { class: "icon" }, "handyman")))), /* @__PURE__ */ createElement("button", { class: "width-100", "on:click": toggleSettings }, translation.close, /* @__PURE__ */ createElement("span", { class: "icon" }, "close")))); return /* @__PURE__ */ createElement("div", { class: "modal", "toggle:open": isPresentingSettingsModal }, /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("main", null, /* @__PURE__ */ createElement("h2", null, translation.settings), /* @__PURE__ */ createElement("div", { class: "flex-row width-input gap" }, /* @__PURE__ */ createElement("button", { class: "width-100 flex justify-start", "on:click": zoomOut }, /* @__PURE__ */ createElement("span", { class: "icon" }, "zoom_out"), translation.zoomOut), /* @__PURE__ */ createElement("button", { class: "width-100 flex justify-start", "on:click": zoomIn }, /* @__PURE__ */ createElement("span", { class: "icon" }, "zoom_in"), translation.zoomIn)), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("div", { class: "flex-column width-input" }, /* @__PURE__ */ createElement("button", { class: "width-100 flex-1", "on:click": repairApp }, translation.repairApp, /* @__PURE__ */ createElement("span", { class: "icon" }, "handyman"))), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("div", { class: "flex-column width-input gap" }, /* @__PURE__ */ createElement("button", { class: "width-100 flex-1", "on:click": clearCategories }, translation.clearCategories, /* @__PURE__ */ createElement("span", { class: "icon" }, icons.categoryName)), /* @__PURE__ */ createElement("button", { class: "width-100 flex-1", "on:click": clearStatuses }, translation.clearStatuses, /* @__PURE__ */ createElement("span", { class: "icon" }, icons.status)))), /* @__PURE__ */ createElement("button", { class: "width-100", "on:click": toggleSettings }, translation.close, /* @__PURE__ */ createElement("span", { class: "icon" }, "close"))));
} }
// src/index.tsx // src/index.tsx
+5 -2
View File
@@ -215,7 +215,7 @@ export class Chat {
}; };
handleMessageObject = (messageObject: MessageObject): void => { handleMessageObject = (messageObject: MessageObject): void => {
this.addObject(messageObject); this.addObject(messageObject, true);
}; };
// sending // sending
@@ -348,7 +348,10 @@ export class Chat {
messageObject.contentVersions[content.id] = content; messageObject.contentVersions[content.id] = content;
}; };
addObject = (messageObject: MessageObject): void => { addObject = (
messageObject: MessageObject,
ignoreIfUnchanged: boolean = false
): void => {
const existingObject = this.objects.value.get(messageObject.id); const existingObject = this.objects.value.get(messageObject.id);
if (existingObject) { if (existingObject) {
existingObject.title = messageObject.title; existingObject.title = messageObject.title;
+12
View File
@@ -167,6 +167,18 @@ function removeSetDuplicates(listState: React.ListState<any>) {
listState.value = new Set([...listState.value]); listState.value = new Set([...listState.value]);
} }
export function clearAddresses() {
previousAddresses.clear();
}
export function clearCategories() {
usedObjectCategories.clear();
}
export function clearStatuses() {
usedObjectStatuses.clear();
}
const zoomStep = 10; const zoomStep = 10;
export function zoomOut() { export function zoomOut() {
pageZoom.value -= zoomStep; pageZoom.value -= zoomStep;
+17 -1
View File
@@ -1,6 +1,8 @@
import * as React from "bloatless-react"; import * as React from "bloatless-react";
import { import {
clearCategories,
clearStatuses,
isPresentingSettingsModal, isPresentingSettingsModal,
repairApp, repairApp,
toggleSettings, toggleSettings,
@@ -8,6 +10,7 @@ import {
zoomOut, zoomOut,
} from "../Model/model"; } from "../Model/model";
import { icons } from "../icons";
import { translation } from "../translations"; import { translation } from "../translations";
export function SettingsModal() { export function SettingsModal() {
@@ -30,12 +33,25 @@ export function SettingsModal() {
<hr></hr> <hr></hr>
<div class="flex-row width-input"> <div class="flex-column width-input">
<button class="width-100 flex-1" on:click={repairApp}> <button class="width-100 flex-1" on:click={repairApp}>
{translation.repairApp} {translation.repairApp}
<span class="icon">handyman</span> <span class="icon">handyman</span>
</button> </button>
</div> </div>
<hr></hr>
<div class="flex-column width-input gap">
<button class="width-100 flex-1" on:click={clearCategories}>
{translation.clearCategories}
<span class="icon">{icons.categoryName}</span>
</button>
<button class="width-100 flex-1" on:click={clearStatuses}>
{translation.clearStatuses}
<span class="icon">{icons.status}</span>
</button>
</div>
</main> </main>
<button class="width-100" on:click={toggleSettings}> <button class="width-100" on:click={toggleSettings}>
{translation.close} {translation.close}
+10 -1
View File
@@ -16,6 +16,9 @@ const englishTranslations = {
zoomIn: "Zoom In", zoomIn: "Zoom In",
repairApp: "Repair App", repairApp: "Repair App",
clearAddresses: "Clear previous connections",
clearCategories: "Clear suggestions for object categories",
clearStatuses: "Clear suggestions for object statuses",
// overview // overview
overview: "Overview", overview: "Overview",
@@ -142,6 +145,9 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
zoomIn: "Acercar", zoomIn: "Acercar",
repairApp: "Reparar Aplicación", repairApp: "Reparar Aplicación",
clearAddresses: "Borrar conexiones previas",
clearCategories: "Borrar sugerencias para categorías de objetos",
clearStatuses: "Borrar sugerencias para estados de objetos",
// overview // overview
overview: "Resumen", overview: "Resumen",
@@ -265,6 +271,9 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
zoomIn: "Vergrößern", zoomIn: "Vergrößern",
repairApp: "App reparieren", repairApp: "App reparieren",
clearAddresses: "Vorherige Verbindungen löschen",
clearCategories: "Vorschläge für Objektkategorien löschen",
clearStatuses: "Vorschläge für Objektstaten löschen",
// overview // overview
overview: "Übersicht", overview: "Übersicht",
@@ -281,7 +290,7 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
serverAddress: "Serveradresse", serverAddress: "Serveradresse",
serverAddressPlaceholder: "wss://192.168.0.69:3000", serverAddressPlaceholder: "wss://192.168.0.69:3000",
previousConnections: "Vorherige Adressen", previousConnections: "Vorherige Verbindungen",
connectToServer: "Verbinden", connectToServer: "Verbinden",
disconnect: "Trennen", disconnect: "Trennen",