From a5d39a18a7986eafeaa6e2f1ddab5d306df030d4 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 8 Aug 2023 13:18:27 +0500 Subject: [PATCH] web: allow custom app title --- apps/web/src/global.d.ts | 1 + apps/web/src/utils/dom.ts | 4 ++-- apps/web/vite.config.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/src/global.d.ts b/apps/web/src/global.d.ts index 577b62edd..94be6907c 100644 --- a/apps/web/src/global.d.ts +++ b/apps/web/src/global.d.ts @@ -29,6 +29,7 @@ declare global { var IS_TESTING: boolean; var PLATFORM: "web" | "desktop"; var IS_BETA: boolean; + var APP_TITLE: string; interface Window { os?: () => NodeJS.Platform | "mas"; diff --git a/apps/web/src/utils/dom.ts b/apps/web/src/utils/dom.ts index 06cd83747..3e31276c6 100644 --- a/apps/web/src/utils/dom.ts +++ b/apps/web/src/utils/dom.ts @@ -18,6 +18,6 @@ along with this program. If not, see . */ export const setDocumentTitle = (title?: string) => { - if (!title) document.title = "Notesnook"; - else document.title = `${title} - Notesnook`; + if (!title) document.title = APP_TITLE; + else document.title = `${title} - ${APP_TITLE}`; }; diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index eae6f70cf..e26912b83 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -64,6 +64,7 @@ export default defineConfig({ } }, define: { + APP_TITLE: `"${isThemeBuilder ? "Notesnook Theme Builder" : "Notesnook"}"`, GIT_HASH: `"${gitHash}"`, APP_VERSION: `"${appVersion}"`, PUBLIC_URL: `"${process.env.PUBLIC_URL || ""}"`,