move zoom to settings dialog, add button to repair app
This commit is contained in:
Vendored
+38
-9
@@ -434,8 +434,12 @@
|
|||||||
close: "Close",
|
close: "Close",
|
||||||
discard: "Discard",
|
discard: "Discard",
|
||||||
rename: "Rename",
|
rename: "Rename",
|
||||||
zoomOut: "zoom out",
|
// settings
|
||||||
zoomIn: "zoom in",
|
settings: "Settings",
|
||||||
|
showSettings: "Show settings",
|
||||||
|
zoomOut: "Zoom Out",
|
||||||
|
zoomIn: "Zoom In",
|
||||||
|
repairApp: "Repair App",
|
||||||
// overview
|
// overview
|
||||||
overview: "Overview",
|
overview: "Overview",
|
||||||
connection: "Connection",
|
connection: "Connection",
|
||||||
@@ -526,8 +530,12 @@
|
|||||||
close: "Cerrar",
|
close: "Cerrar",
|
||||||
discard: "Descartar",
|
discard: "Descartar",
|
||||||
rename: "Renombrar",
|
rename: "Renombrar",
|
||||||
zoomOut: "alejar",
|
// settings
|
||||||
zoomIn: "acercar",
|
settings: "Configuraci\xF3n",
|
||||||
|
showSettings: "Mostrar configuraci\xF3n",
|
||||||
|
zoomOut: "Alejar",
|
||||||
|
zoomIn: "Acercar",
|
||||||
|
repairApp: "Reparar Aplicaci\xF3n",
|
||||||
// overview
|
// overview
|
||||||
overview: "Resumen",
|
overview: "Resumen",
|
||||||
connection: "Conexi\xF3n",
|
connection: "Conexi\xF3n",
|
||||||
@@ -616,8 +624,12 @@
|
|||||||
close: "Schlie\xDFen",
|
close: "Schlie\xDFen",
|
||||||
discard: "Verwerfen",
|
discard: "Verwerfen",
|
||||||
rename: "Umbenennen",
|
rename: "Umbenennen",
|
||||||
zoomOut: "verkleinern",
|
// settings
|
||||||
zoomIn: "vergr\xF6\xDFern",
|
settings: "Einstellungen",
|
||||||
|
showSettings: "Einstellungen anzeigen",
|
||||||
|
zoomOut: "Verkleinern",
|
||||||
|
zoomIn: "Vergr\xF6\xDFern",
|
||||||
|
repairApp: "App reparieren",
|
||||||
// overview
|
// overview
|
||||||
overview: "\xDCbersicht",
|
overview: "\xDCbersicht",
|
||||||
connection: "Verbindung",
|
connection: "Verbindung",
|
||||||
@@ -937,8 +949,8 @@
|
|||||||
addObject = (messageObject) => {
|
addObject = (messageObject) => {
|
||||||
const existingObject = this.objects.value.get(messageObject.id);
|
const existingObject = this.objects.value.get(messageObject.id);
|
||||||
if (existingObject) {
|
if (existingObject) {
|
||||||
|
let didChangeObject = existingObject.title != messageObject.title;
|
||||||
existingObject.title = messageObject.title;
|
existingObject.title = messageObject.title;
|
||||||
let didChangeObject = false;
|
|
||||||
Object.values(messageObject.contentVersions).forEach((content) => {
|
Object.values(messageObject.contentVersions).forEach((content) => {
|
||||||
if (existingObject.contentVersions[content.id]) return;
|
if (existingObject.contentVersions[content.id]) return;
|
||||||
this.addObjectContent(existingObject, content);
|
this.addObjectContent(existingObject, content);
|
||||||
@@ -1239,12 +1251,24 @@
|
|||||||
[outboxItemCount],
|
[outboxItemCount],
|
||||||
() => outboxItemCount.value == 0 ? "success" : "warning"
|
() => outboxItemCount.value == 0 ? "success" : "warning"
|
||||||
);
|
);
|
||||||
|
var isPresentingSettingsModal = new State(false);
|
||||||
var isEncryptionAvailable = window.crypto.subtle != void 0;
|
var isEncryptionAvailable = window.crypto.subtle != void 0;
|
||||||
var senderName = restoreState("sender-name", "");
|
var senderName = restoreState("sender-name", "");
|
||||||
var pageZoom = restoreState("page-zoom", 100);
|
var pageZoom = restoreState("page-zoom", 100);
|
||||||
pageZoom.subscribe(() => {
|
pageZoom.subscribe(() => {
|
||||||
document.body.style.zoom = `${pageZoom.value}%`;
|
document.body.style.zoom = `${pageZoom.value}%`;
|
||||||
});
|
});
|
||||||
|
function toggleSettings() {
|
||||||
|
isPresentingSettingsModal.value = !isPresentingSettingsModal.value;
|
||||||
|
}
|
||||||
|
function repairApp() {
|
||||||
|
removeSetDuplicates(previousAddresses);
|
||||||
|
removeSetDuplicates(usedObjectCategories);
|
||||||
|
removeSetDuplicates(usedObjectStatuses);
|
||||||
|
}
|
||||||
|
function removeSetDuplicates(listState) {
|
||||||
|
listState.value = /* @__PURE__ */ new Set([...listState.value]);
|
||||||
|
}
|
||||||
var zoomStep = 10;
|
var zoomStep = 10;
|
||||||
function zoomOut() {
|
function zoomOut() {
|
||||||
pageZoom.value -= zoomStep;
|
pageZoom.value -= zoomStep;
|
||||||
@@ -2285,10 +2309,15 @@
|
|||||||
|
|
||||||
// src/Tabs/overviewTab.tsx
|
// src/Tabs/overviewTab.tsx
|
||||||
function OverviewTab() {
|
function OverviewTab() {
|
||||||
return /* @__PURE__ */ createElement("article", { id: "settings-tab", "toggle:connected": isConnected }, /* @__PURE__ */ createElement("header", null, translation.overview, /* @__PURE__ */ createElement("span", null, /* @__PURE__ */ createElement("button", { "on:click": zoomOut, "aria-label": translation.zoomOut }, /* @__PURE__ */ createElement("span", { class: "icon" }, "zoom_out")), /* @__PURE__ */ createElement("button", { "on:click": zoomIn, "aria-label": translation.zoomIn }, /* @__PURE__ */ createElement("span", { class: "icon" }, "zoom_in")))), /* @__PURE__ */ createElement("div", { class: "flex-column large-gap" }, /* @__PURE__ */ createElement("div", { class: "tile error flex-no", "toggle:hidden": isEncryptionAvailable }, /* @__PURE__ */ createElement("span", { class: "icon" }, "warning"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("b", null, translation.encryptionUnavailableTitle), /* @__PURE__ */ createElement("span", { class: "secondary" }, translation.encryptionUnavailableMessage))), PersonalSection(), ConnectionSection(), ChatListSection()));
|
return /* @__PURE__ */ createElement("article", { id: "settings-tab", "toggle:connected": isConnected }, /* @__PURE__ */ createElement("header", null, translation.overview, /* @__PURE__ */ createElement("button", { "aria-label": translation.showSettings, "on:click": toggleSettings }, /* @__PURE__ */ createElement("span", { class: "icon" }, "settings"))), /* @__PURE__ */ createElement("div", { class: "flex-column large-gap" }, /* @__PURE__ */ createElement("div", { class: "tile error flex-no", "toggle:hidden": isEncryptionAvailable }, /* @__PURE__ */ createElement("span", { class: "icon" }, "warning"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("b", null, translation.encryptionUnavailableTitle), /* @__PURE__ */ createElement("span", { class: "secondary" }, translation.encryptionUnavailableMessage))), PersonalSection(), ConnectionSection(), ChatListSection()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// src/Views/settingsModal.tsx
|
||||||
|
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"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// src/index.tsx
|
// src/index.tsx
|
||||||
document.querySelector("main").append(OverviewTab(), MessageTab());
|
document.querySelector("main").append(OverviewTab(), MessageTab(), SettingsModal());
|
||||||
document.querySelector("main").classList.add("split");
|
document.querySelector("main").classList.add("split");
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ export const outboxTextStyle = React.createProxyState([outboxItemCount], () =>
|
|||||||
);
|
);
|
||||||
|
|
||||||
// MISC
|
// MISC
|
||||||
|
export const isPresentingSettingsModal = new React.State(false);
|
||||||
export const isEncryptionAvailable = window.crypto.subtle != undefined;
|
export const isEncryptionAvailable = window.crypto.subtle != undefined;
|
||||||
export const senderName = React.restoreState("sender-name", "");
|
export const senderName = React.restoreState("sender-name", "");
|
||||||
export const pageZoom = React.restoreState("page-zoom", 100);
|
export const pageZoom = React.restoreState("page-zoom", 100);
|
||||||
@@ -152,6 +153,20 @@ pageZoom.subscribe(() => {
|
|||||||
document.body.style.zoom = `${pageZoom.value}%`;
|
document.body.style.zoom = `${pageZoom.value}%`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export function toggleSettings() {
|
||||||
|
isPresentingSettingsModal.value = !isPresentingSettingsModal.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function repairApp() {
|
||||||
|
removeSetDuplicates(previousAddresses);
|
||||||
|
removeSetDuplicates(usedObjectCategories);
|
||||||
|
removeSetDuplicates(usedObjectStatuses);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeSetDuplicates(listState: React.ListState<any>) {
|
||||||
|
listState.value = new Set([...listState.value]);
|
||||||
|
}
|
||||||
|
|
||||||
const zoomStep = 10;
|
const zoomStep = 10;
|
||||||
export function zoomOut() {
|
export function zoomOut() {
|
||||||
pageZoom.value -= zoomStep;
|
pageZoom.value -= zoomStep;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as React from "bloatless-react";
|
import * as React from "bloatless-react";
|
||||||
|
|
||||||
import { isConnected, isEncryptionAvailable, zoomIn, zoomOut } from "../Model/model";
|
import { isConnected, isEncryptionAvailable, toggleSettings, zoomIn, zoomOut } from "../Model/model";
|
||||||
|
|
||||||
import { ChatListSection } from "../Views/Overview/chatListSection";
|
import { ChatListSection } from "../Views/Overview/chatListSection";
|
||||||
import { ConnectionSection } from "../Views/Overview/connectionSection";
|
import { ConnectionSection } from "../Views/Overview/connectionSection";
|
||||||
@@ -12,14 +12,9 @@ export function OverviewTab() {
|
|||||||
<article id="settings-tab" toggle:connected={isConnected}>
|
<article id="settings-tab" toggle:connected={isConnected}>
|
||||||
<header>
|
<header>
|
||||||
{translation.overview}
|
{translation.overview}
|
||||||
<span>
|
<button aria-label={translation.showSettings} on:click={toggleSettings}>
|
||||||
<button on:click={zoomOut} aria-label={translation.zoomOut}>
|
<span class="icon">settings</span>
|
||||||
<span class="icon">zoom_out</span>
|
|
||||||
</button>
|
</button>
|
||||||
<button on:click={zoomIn} aria-label={translation.zoomIn}>
|
|
||||||
<span class="icon">zoom_in</span>
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="flex-column large-gap">
|
<div class="flex-column large-gap">
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import * as React from "bloatless-react";
|
||||||
|
|
||||||
|
import {
|
||||||
|
isPresentingSettingsModal,
|
||||||
|
repairApp,
|
||||||
|
toggleSettings,
|
||||||
|
zoomIn,
|
||||||
|
zoomOut,
|
||||||
|
} from "../Model/model";
|
||||||
|
|
||||||
|
import { translation } from "../translations";
|
||||||
|
|
||||||
|
export function SettingsModal() {
|
||||||
|
return (
|
||||||
|
<div class="modal" toggle:open={isPresentingSettingsModal}>
|
||||||
|
<div>
|
||||||
|
<main>
|
||||||
|
<h2>{translation.settings}</h2>
|
||||||
|
|
||||||
|
<div class="flex-row width-input gap">
|
||||||
|
<button class="width-100 flex justify-start" on:click={zoomOut}>
|
||||||
|
<span class="icon">zoom_out</span>
|
||||||
|
{translation.zoomOut}
|
||||||
|
</button>
|
||||||
|
<button class="width-100 flex justify-start" on:click={zoomIn}>
|
||||||
|
<span class="icon">zoom_in</span>
|
||||||
|
{translation.zoomIn}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr></hr>
|
||||||
|
|
||||||
|
<div class="flex-row width-input">
|
||||||
|
<button class="width-100 flex-1" on:click={repairApp}>
|
||||||
|
{translation.repairApp}
|
||||||
|
<span class="icon">handyman</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<button class="width-100" on:click={toggleSettings}>
|
||||||
|
{translation.close}
|
||||||
|
<span class="icon">close</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
+4
-1
@@ -2,6 +2,9 @@ import "./styles.css";
|
|||||||
|
|
||||||
import { MessageTab } from "./Tabs/messageTab";
|
import { MessageTab } from "./Tabs/messageTab";
|
||||||
import { OverviewTab } from "./Tabs/overviewTab";
|
import { OverviewTab } from "./Tabs/overviewTab";
|
||||||
|
import { SettingsModal } from "./Views/settingsModal";
|
||||||
|
|
||||||
document.querySelector("main")!.append(OverviewTab(), MessageTab());
|
document
|
||||||
|
.querySelector("main")!
|
||||||
|
.append(OverviewTab(), MessageTab(), SettingsModal());
|
||||||
document.querySelector("main")!.classList.add("split");
|
document.querySelector("main")!.classList.add("split");
|
||||||
+24
-6
@@ -8,8 +8,14 @@ const englishTranslations = {
|
|||||||
discard: "Discard",
|
discard: "Discard",
|
||||||
rename: "Rename",
|
rename: "Rename",
|
||||||
|
|
||||||
zoomOut: "zoom out",
|
// settings
|
||||||
zoomIn: "zoom in",
|
settings: "Settings",
|
||||||
|
showSettings: "Show settings",
|
||||||
|
|
||||||
|
zoomOut: "Zoom Out",
|
||||||
|
zoomIn: "Zoom In",
|
||||||
|
|
||||||
|
repairApp: "Repair App",
|
||||||
|
|
||||||
// overview
|
// overview
|
||||||
overview: "Overview",
|
overview: "Overview",
|
||||||
@@ -128,8 +134,14 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
|
|||||||
discard: "Descartar",
|
discard: "Descartar",
|
||||||
rename: "Renombrar",
|
rename: "Renombrar",
|
||||||
|
|
||||||
zoomOut: "alejar",
|
// settings
|
||||||
zoomIn: "acercar",
|
settings: "Configuración",
|
||||||
|
showSettings: "Mostrar configuración",
|
||||||
|
|
||||||
|
zoomOut: "Alejar",
|
||||||
|
zoomIn: "Acercar",
|
||||||
|
|
||||||
|
repairApp: "Reparar Aplicación",
|
||||||
|
|
||||||
// overview
|
// overview
|
||||||
overview: "Resumen",
|
overview: "Resumen",
|
||||||
@@ -245,8 +257,14 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
|
|||||||
discard: "Verwerfen",
|
discard: "Verwerfen",
|
||||||
rename: "Umbenennen",
|
rename: "Umbenennen",
|
||||||
|
|
||||||
zoomOut: "verkleinern",
|
// settings
|
||||||
zoomIn: "vergrößern",
|
settings: "Einstellungen",
|
||||||
|
showSettings: "Einstellungen anzeigen",
|
||||||
|
|
||||||
|
zoomOut: "Verkleinern",
|
||||||
|
zoomIn: "Vergrößern",
|
||||||
|
|
||||||
|
repairApp: "App reparieren",
|
||||||
|
|
||||||
// overview
|
// overview
|
||||||
overview: "Übersicht",
|
overview: "Übersicht",
|
||||||
|
|||||||
Reference in New Issue
Block a user