From 0e81f086c069c239e9cd56d58eb0578a1668a81b Mon Sep 17 00:00:00 2001
From: Jin <22962980+JYC333@users.noreply.github.com>
Date: Mon, 3 Mar 2025 21:22:33 +0100
Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20(ts)=20port=20about=20d?=
=?UTF-8?q?ialog?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../widgets/dialogs/{about.js => about.ts} | 37 +++++++++++++------
1 file changed, 25 insertions(+), 12 deletions(-)
rename src/public/app/widgets/dialogs/{about.js => about.ts} (77%)
diff --git a/src/public/app/widgets/dialogs/about.js b/src/public/app/widgets/dialogs/about.ts
similarity index 77%
rename from src/public/app/widgets/dialogs/about.js
rename to src/public/app/widgets/dialogs/about.ts
index 918e725af..f77f67372 100644
--- a/src/public/app/widgets/dialogs/about.js
+++ b/src/public/app/widgets/dialogs/about.ts
@@ -5,6 +5,15 @@ import openService from "../../services/open.js";
import server from "../../services/server.js";
import utils from "../../services/utils.js";
+interface AppInfo {
+ appVersion: string;
+ dbVersion: number;
+ syncVersion: number;
+ buildDate: string;
+ buildRevision: string;
+ dataDirectory: string;
+}
+
const TPL = `
@@ -35,12 +44,10 @@ const TPL = `
${t("about.build_date")} |
|
-
${t("about.build_revision")} |
- |
+ |
-
${t("about.data_directory")} |
|
@@ -59,7 +66,14 @@ const TPL = `
`;
export default class AboutDialog extends BasicWidget {
- doRender() {
+ private $appVersion!: JQuery;
+ private $dbVersion!: JQuery;
+ private $syncVersion!: JQuery;
+ private $buildDate!: JQuery;
+ private $buildRevision!: JQuery;
+ private $dataDirectory!: JQuery;
+
+ doRender(): void {
this.$widget = $(TPL);
this.$appVersion = this.$widget.find(".app-version");
this.$dbVersion = this.$widget.find(".db-version");
@@ -69,12 +83,12 @@ export default class AboutDialog extends BasicWidget {
this.$dataDirectory = this.$widget.find(".data-directory");
}
- async refresh() {
- const appInfo = await server.get("app-info");
+ async refresh(): Promise {
+ const appInfo = await server.get("app-info");
this.$appVersion.text(appInfo.appVersion);
- this.$dbVersion.text(appInfo.dbVersion);
- this.$syncVersion.text(appInfo.syncVersion);
+ this.$dbVersion.text(appInfo.dbVersion.toString());
+ this.$syncVersion.text(appInfo.syncVersion.toString());
this.$buildDate.text(formatDateTime(appInfo.buildDate));
this.$buildRevision.text(appInfo.buildRevision);
this.$buildRevision.attr("href", `https://github.com/TriliumNext/Notes/commit/${appInfo.buildRevision}`);
@@ -84,9 +98,9 @@ export default class AboutDialog extends BasicWidget {
href: "#",
class: "tn-link",
text: appInfo.dataDirectory
- })
+ }).prop("outerHTML")
);
- this.$dataDirectory.find("a").on("click", (event) => {
+ this.$dataDirectory.find("a").on("click", (event: JQuery.ClickEvent) => {
event.preventDefault();
openService.openDirectory(appInfo.dataDirectory);
});
@@ -95,9 +109,8 @@ export default class AboutDialog extends BasicWidget {
}
}
- async openAboutDialogEvent() {
+ async openAboutDialogEvent(): Promise {
await this.refresh();
-
utils.openDialog(this.$widget);
}
}