diff --git a/bun.lock b/bun.lock index a83020cc..8f724d7c 100644 --- a/bun.lock +++ b/bun.lock @@ -13,7 +13,7 @@ "primeicons": "^7.0.0", "primevue": "4.2.5", "quill": "^2.0.3", - "systeminformation": "^5.30.4", + "systeminformation": "^5.30.5", "ua-parser-js": "^2.0.8", "vue": "3.4.21", "vue-tippy": "^6.7.1", @@ -32,7 +32,7 @@ "@wasm-fmt/clang-format": "^21.1.8", "autoprefixer": "^10.4.23", "cmake-js": "^7.4.0", - "electron": "^39.2.7", + "electron": "^40.0.0", "electron-builder": "^26.4.0", "electron-conf": "^1.3.0", "electron-updater": "^6.7.3", @@ -42,7 +42,7 @@ "stylelint-config-standard": "^40.0.0", "tailwindcss": "^4.1.18", "tailwindcss-primeui": "^0.6.1", - "tar": "^7.5.2", + "tar": "^7.5.3", "unplugin-vue-components": "^31.0.0", "vite": "7.2.7", }, @@ -630,7 +630,7 @@ "ejs": ["ejs@3.1.10", "", { "dependencies": { "jake": "^10.8.5" }, "bin": { "ejs": "bin/cli.js" } }, "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA=="], - "electron": ["electron@39.2.7", "", { "dependencies": { "@electron/get": "^2.0.0", "@types/node": "^22.7.7", "extract-zip": "^2.0.1" }, "bin": { "electron": "cli.js" } }, "sha512-KU0uFS6LSTh4aOIC3miolcbizOFP7N1M46VTYVfqIgFiuA2ilfNaOHLDS9tCMvwwHRowAsvqBrh9NgMXcTOHCQ=="], + "electron": ["electron@40.0.0", "", { "dependencies": { "@electron/get": "^2.0.0", "@types/node": "^24.9.0", "extract-zip": "^2.0.1" }, "bin": { "electron": "cli.js" } }, "sha512-UyBy5yJ0/wm4gNugCtNPjvddjAknMTuXR2aCHioXicH7aKRKGDBPp4xqTEi/doVcB3R+MN3wfU9o8d/9pwgK2A=="], "electron-builder": ["electron-builder@26.4.0", "", { "dependencies": { "app-builder-lib": "26.4.0", "builder-util": "26.3.4", "builder-util-runtime": "9.5.1", "chalk": "^4.1.2", "ci-info": "^4.2.0", "dmg-builder": "26.4.0", "fs-extra": "^10.1.0", "lazy-val": "^1.0.5", "simple-update-notifier": "2.0.0", "yargs": "^17.6.2" }, "bin": { "electron-builder": "cli.js", "install-app-deps": "install-app-deps.js" } }, "sha512-FCUqvdq2AULL+Db2SUGgjOYTbrgkPxZtCjqIZGnjH9p29pTWyesQqBIfvQBKa6ewqde87aWl49n/WyI/NyUBog=="], @@ -1206,7 +1206,7 @@ "svg-tags": ["svg-tags@1.0.0", "", {}, "sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA=="], - "systeminformation": ["systeminformation@5.30.4", "", { "os": "!aix", "bin": { "systeminformation": "lib/cli.js" } }, "sha512-6Zi6NZRuEnK8Uv8R5s6+iz2NvamrxpYdpxhF7ANpzjlTfDRPQEJJh1cz2Car5KT+L1EWv6zGzECITKTinfL47g=="], + "systeminformation": ["systeminformation@5.30.5", "", { "os": "!aix", "bin": { "systeminformation": "lib/cli.js" } }, "sha512-DpWmpCckhwR3hG+6udb6/aQB7PpiqVnvSljrjbKxNSvTRsGsg7NVE3/vouoYf96xgwMxXFKcS4Ux+cnkFwYM7A=="], "table": ["table@6.9.0", "", { "dependencies": { "ajv": "^8.0.1", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", "strip-ansi": "^6.0.1" } }, "sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A=="], @@ -1216,7 +1216,7 @@ "tapable": ["tapable@2.3.0", "", {}, "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg=="], - "tar": ["tar@7.5.2", "", { "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", "minizlib": "^3.1.0", "yallist": "^5.0.0" } }, "sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg=="], + "tar": ["tar@7.5.3", "", { "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", "minizlib": "^3.1.0", "yallist": "^5.0.0" } }, "sha512-ENg5JUHUm2rDD7IvKNFGzyElLXNjachNLp6RaGf4+JOgxXHkqA+gq81ZAMCUmtMtqBsoU62lcp6S27g1LCYGGQ=="], "temp": ["temp@0.9.4", "", { "dependencies": { "mkdirp": "^0.5.1", "rimraf": "~2.6.2" } }, "sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA=="], @@ -1410,6 +1410,8 @@ "cacache/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], + "cacache/tar": ["tar@7.5.2", "", { "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", "minizlib": "^3.1.0", "yallist": "^5.0.0" } }, "sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg=="], + "cacheable/keyv": ["keyv@5.5.5", "", { "dependencies": { "@keyv/serialize": "^1.1.1" } }, "sha512-FA5LmZVF1VziNc0bIdCSA1IoSVnDCqE8HJIZZv2/W8YmoAM50+tnUgJR/gQZwEeIMleuIOnRnHA/UaZRNeV4iQ=="], "cli-truncate/slice-ansi": ["slice-ansi@3.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", "is-fullwidth-code-point": "^3.0.0" } }, "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ=="], @@ -1432,7 +1434,7 @@ "dmg-license/ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], - "electron/@types/node": ["@types/node@22.19.3", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-1N9SBnWYOJTrNZCdh/yJE+t910Y128BoyY+zBLWhL3r0TYzlTmFdXrPwHL9DyFZmlEXNQQolTZh3KHV31QDhyA=="], + "electron/@types/node": ["@types/node@24.10.4", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg=="], "electron-builder/fs-extra": ["fs-extra@10.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ=="], @@ -1478,6 +1480,8 @@ "mlly/pkg-types": ["pkg-types@1.3.1", "", { "dependencies": { "confbox": "^0.1.8", "mlly": "^1.7.4", "pathe": "^2.0.1" } }, "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ=="], + "node-gyp/tar": ["tar@7.5.2", "", { "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", "minizlib": "^3.1.0", "yallist": "^5.0.0" } }, "sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg=="], + "node-gyp/which": ["which@5.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ=="], "ora/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], @@ -1632,8 +1636,6 @@ "electron-winstaller/fs-extra/universalify": ["universalify@0.1.2", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="], - "electron/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], - "filelist/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], "fs-minipass/minipass/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], diff --git a/package.json b/package.json index 0e5a8bac..fa162038 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "url": "git+https://github.com/opencor/webapp.git" }, "type": "module", - "version": "0.20260116.0", + "version": "0.20260117.0", "scripts": { "archive:web": "bun src/renderer/scripts/archive.web.js", "build": "electron-vite build", @@ -55,7 +55,7 @@ "primeicons": "^7.0.0", "primevue": "4.2.5", "quill": "^2.0.3", - "systeminformation": "^5.30.4", + "systeminformation": "^5.30.5", "ua-parser-js": "^2.0.8", "vue": "3.4.21", "vue-tippy": "^6.7.1" @@ -74,7 +74,7 @@ "@wasm-fmt/clang-format": "^21.1.8", "autoprefixer": "^10.4.23", "cmake-js": "^7.4.0", - "electron": "^39.2.7", + "electron": "^40.0.0", "electron-builder": "^26.4.0", "electron-conf": "^1.3.0", "electron-updater": "^6.7.3", @@ -84,7 +84,7 @@ "stylelint-config-standard": "^40.0.0", "tailwindcss": "^4.1.18", "tailwindcss-primeui": "^0.6.1", - "tar": "^7.5.2", + "tar": "^7.5.3", "unplugin-vue-components": "^31.0.0", "vite": "7.2.7" } diff --git a/src/extern/corsProxy.js b/src/extern/corsProxy.js index f979edca..d2c6e60c 100644 --- a/src/extern/corsProxy.js +++ b/src/extern/corsProxy.js @@ -8,7 +8,7 @@ export default { const url = new URL(request.url); const targetUrl = url.searchParams.get('url'); - if (targetUrl === null) { + if (!targetUrl) { return new Response('Missing "url" query parameter.', { status: 400 }); } diff --git a/src/main/MainMenu.ts b/src/main/MainMenu.ts index 93329105..f058f0d3 100644 --- a/src/main/MainMenu.ts +++ b/src/main/MainMenu.ts @@ -13,9 +13,9 @@ let hasFiles = false; export function enableDisableMainMenu(enable: boolean): void { // Build our menu, if needed. - if (enable && enabledMenu !== null) { + if (enable && enabledMenu) { electron.Menu.setApplicationMenu(enabledMenu); - } else if (!enable && disabledMenu !== null) { + } else if (!enable && disabledMenu) { electron.Menu.setApplicationMenu(disabledMenu); } else { // Some common menu items. @@ -58,7 +58,7 @@ export function enableDisableMainMenu(enable: boolean): void { if (enable) { appSubMenu.push(aboutOpencorMenuItem); - if (checkForUpdatesMenuItem !== null) { + if (checkForUpdatesMenuItem) { appSubMenu.push({ type: 'separator' }); appSubMenu.push(checkForUpdatesMenuItem); } @@ -129,7 +129,7 @@ export function enableDisableMainMenu(enable: boolean): void { enabled: recentFilePaths.length > 0 }); - if (recentFilePaths.length > 0) { + if (recentFilePaths.length) { fileReopenSubMenu.push({ type: 'separator' }); recentFilePaths.forEach((filePath: string) => { @@ -258,7 +258,7 @@ export function enableDisableMainMenu(enable: boolean): void { }); if (!isMacOs()) { - if (checkForUpdatesMenuItem !== null) { + if (checkForUpdatesMenuItem) { helpSubMenu.push({ type: 'separator' }); helpSubMenu.push(checkForUpdatesMenuItem); } @@ -298,13 +298,13 @@ export function enableDisableMainMenu(enable: boolean): void { } export function enableDisableFileCloseAndCloseAllMenuItems(enable: boolean): void { - if (enabledMenu !== null) { + if (enabledMenu) { hasFiles = enable; const fileCloseMenu = enabledMenu.getMenuItemById('fileClose'); const fileCloseAllMenu = enabledMenu.getMenuItemById('fileCloseAll'); - if (fileCloseMenu !== null && fileCloseAllMenu !== null) { + if (fileCloseMenu && fileCloseAllMenu) { fileCloseMenu.enabled = hasFiles; fileCloseAllMenu.enabled = hasFiles; } diff --git a/src/main/MainWindow.ts b/src/main/MainWindow.ts index d071d8c2..9b52f543 100644 --- a/src/main/MainWindow.ts +++ b/src/main/MainWindow.ts @@ -123,7 +123,7 @@ let openedFilePaths: string[] = []; export function filesOpened(filePaths: string[]): void { openedFilePaths = filePaths; - if (filePaths.length === 0) { + if (!filePaths.length) { selectedFilePath = null; } } @@ -201,7 +201,7 @@ export class MainWindow extends ApplicationWindow { // case we filter out all null entries. recentFilePaths = (electronConf.get('app.files.recent') as string[]).filter( - (filePath: string | null) => filePath !== null + (filePath: string | null) => filePath ); updateReopenMenu(recentFilePaths); @@ -222,7 +222,7 @@ export class MainWindow extends ApplicationWindow { commandLine.shift(); - if (!isPackaged() && commandLine.length > 0) { + if (!isPackaged() && commandLine.length) { commandLine.shift(); } } @@ -352,19 +352,19 @@ export class MainWindow extends ApplicationWindow { // reopen. So, we need to wait for the file to be reopened before reopening the next one. reopenFilePathsAndSelectFilePath(): void { - if (this._openedFilePaths.length > 0) { + if (this._openedFilePaths.length) { const filePath = this._openedFilePaths[0]; this.webContents.send('open', filePath); this._openedFilePaths = this._openedFilePaths.slice(1); - if (this._openedFilePaths.length > 0) { + if (this._openedFilePaths.length) { return; } } - if (this._selectedFilePath !== '') { + if (this._selectedFilePath) { this.webContents.send('select', this._selectedFilePath); this._selectedFilePath = ''; @@ -374,7 +374,7 @@ export class MainWindow extends ApplicationWindow { // Handle our command line arguments. isAction(argument: string | undefined): boolean { - if (argument === undefined) { + if (!argument) { return false; } @@ -382,7 +382,7 @@ export class MainWindow extends ApplicationWindow { } handleArguments(commandLine: string[]): void { - if (commandLine.length === 0) { + if (!commandLine.length) { return; } diff --git a/src/main/index.ts b/src/main/index.ts index eb4d6a55..f00bf138 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -73,7 +73,7 @@ if (!electron.app.requestSingleInstanceLock()) { export let mainWindow: MainWindow | null = null; electron.app.on('second-instance', (_event, argv) => { - if (mainWindow !== null) { + if (mainWindow) { if (mainWindow.isMinimized()) { mainWindow.restore(); } @@ -123,7 +123,7 @@ MimeType=x-scheme-handler/${URI_SCHEME}` // Update the desktop database. nodeChildProcess.exec('update-desktop-database ~/.local/share/applications', (error) => { - if (error !== null) { + if (error) { console.error('Failed to update the desktop database:', error); } }); @@ -271,11 +271,9 @@ electron.app // triggering URL. mainWindow = new MainWindow( - triggeringUrl !== null ? [triggeringUrl] : process.argv, + triggeringUrl ? [triggeringUrl] : process.argv, splashScreenWindow, - process.env.ELECTRON_RENDERER_URL !== undefined - ? process.env.ELECTRON_RENDERER_URL - : await startRendererServer() + process.env.ELECTRON_RENDERER_URL ?? (await startRendererServer()) ); }, SHORT_DELAY); }); diff --git a/src/renderer/package.json b/src/renderer/package.json index e651b5c5..969358ae 100644 --- a/src/renderer/package.json +++ b/src/renderer/package.json @@ -39,7 +39,7 @@ }, "./style.css": "./dist/opencor.css" }, - "version": "0.20260116.0", + "version": "0.20260117.0", "scripts": { "build": "vite build", "build:lib": "vite build --config vite.lib.config.ts && cp index.d.ts dist/index.d.ts", diff --git a/src/renderer/src/common/common.ts b/src/renderer/src/common/common.ts index 92b38e06..f1bffcb2 100644 --- a/src/renderer/src/common/common.ts +++ b/src/renderer/src/common/common.ts @@ -79,24 +79,24 @@ export function formatTime(time: number): string { const d = Math.floor((time / (1000 * 60 * 60 * 24)) % 24); let res = ''; - if (d !== 0 || ((h !== 0 || m !== 0 || s !== 0 || ms !== 0) && res !== '')) { - res += `${res === '' ? '' : ' '}${String(d)}d`; + if (d) { + res = `${String(d)}d`; } - if (h !== 0 || ((m !== 0 || s !== 0 || ms !== 0) && res !== '')) { - res += `${res === '' ? '' : ' '}${String(h)}h`; + if (h || ((m || s || ms) && res)) { + res += `${res ? ' ' : ''}${String(h)}h`; } - if (m !== 0 || ((s !== 0 || ms !== 0) && res !== '')) { - res += `${res === '' ? '' : ' '}${String(m)}m`; + if (m || ((s || ms) && res)) { + res += `${res ? ' ' : ''}${String(m)}m`; } - if (s !== 0 || (ms !== 0 && res !== '')) { - res += `${res === '' ? '' : ' '}${String(s)}s`; + if (s || (ms && res)) { + res += `${res ? ' ' : ''}${String(s)}s`; } - if (ms !== 0 || res === '') { - res += `${res === '' ? '' : ' '}${String(ms)}ms`; + if (ms || !res) { + res += `${res ? ' ' : ''}${String(ms)}ms`; } return res; diff --git a/src/renderer/src/common/firebaseConfig.ts b/src/renderer/src/common/firebaseConfig.ts index e734c230..7aef4c98 100644 --- a/src/renderer/src/common/firebaseConfig.ts +++ b/src/renderer/src/common/firebaseConfig.ts @@ -18,7 +18,7 @@ const firebaseEnvVarMap = { export function missingFirebaseKeys(): string[] { function missingFirebaseKey(firebaseValue: unknown): boolean { - return firebaseValue === undefined || firebaseValue === null || firebaseValue === ''; + return !firebaseValue; } return (Object.entries(firebaseEnvVarMap) as Array<[keyof typeof firebaseEnvVarMap, string]>) diff --git a/src/renderer/src/common/gitHubIntegration.ts b/src/renderer/src/common/gitHubIntegration.ts index 53f64d1a..835d9286 100644 --- a/src/renderer/src/common/gitHubIntegration.ts +++ b/src/renderer/src/common/gitHubIntegration.ts @@ -44,7 +44,7 @@ function gitHubAccessTokenEntry(): AsyncEntry | null { export async function deleteGitHubAccessToken(): Promise { const entry = gitHubAccessTokenEntry(); - if (entry === null) { + if (!entry) { return false; } @@ -60,7 +60,7 @@ export async function deleteGitHubAccessToken(): Promise { export async function loadGitHubAccessToken(): Promise { const entry = gitHubAccessTokenEntry(); - if (entry === null) { + if (!entry) { return null; } @@ -76,7 +76,7 @@ export async function loadGitHubAccessToken(): Promise { } export async function saveGitHubAccessToken(token: string): Promise { - if (token.trim() === '') { + if (!token.trim()) { console.warn('Ignoring request to store an empty GitHub access token.'); return false; @@ -84,7 +84,7 @@ export async function saveGitHubAccessToken(token: string): Promise { const entry = gitHubAccessTokenEntry(); - if (entry === null) { + if (!entry) { return false; } diff --git a/src/renderer/src/common/locCommon.ts b/src/renderer/src/common/locCommon.ts index 146d7a53..d6c687a8 100644 --- a/src/renderer/src/common/locCommon.ts +++ b/src/renderer/src/common/locCommon.ts @@ -11,7 +11,7 @@ export function isRemoteFilePath(filePath: string): boolean { export function filePath(fileFilePathOrFileContents: string | Uint8Array | File): string { return fileFilePathOrFileContents instanceof File - ? electronApi !== undefined + ? electronApi ? electronApi.filePath(fileFilePathOrFileContents) : fileFilePathOrFileContents.name : typeof fileFilePathOrFileContents === 'string' @@ -65,7 +65,7 @@ export function file(fileFilePathOrFileContents: string | Uint8Array | File): Pr } return new Promise((resolve, reject) => { - if (electronApi !== undefined) { + if (electronApi) { resolve(new locApi.File(filePath(fileFilePathOrFileContents))); } else { reject(new Error('Local files cannot be opened.')); @@ -111,7 +111,7 @@ export interface ISimulationDataInfo { } export function simulationDataInfo(instanceTask: locApi.SedInstanceTask, name: string): ISimulationDataInfo { - if (name === '') { + if (!name) { return { type: ESimulationDataInfoType.UNKNOWN, index: -1 diff --git a/src/renderer/src/common/rendererServer.ts b/src/renderer/src/common/rendererServer.ts index 6004a912..6098e41d 100644 --- a/src/renderer/src/common/rendererServer.ts +++ b/src/renderer/src/common/rendererServer.ts @@ -14,7 +14,7 @@ let rendererBaseUrl: string | null = null; export async function startRendererServer(): Promise { // If we already have a base URL then return it. - if (rendererBaseUrl !== null) { + if (rendererBaseUrl) { return rendererBaseUrl; } @@ -74,7 +74,7 @@ export async function startRendererServer(): Promise { rendererServer?.listen(0, rendererHost, () => { const addressInfo = rendererServer?.address() as AddressInfo | null; - if (addressInfo?.port !== undefined) { + if (addressInfo?.port) { rendererBaseUrl = `http://${rendererHost}:${addressInfo.port}`; resolve(); @@ -84,7 +84,7 @@ export async function startRendererServer(): Promise { }); }); - if (rendererBaseUrl === null) { + if (!rendererBaseUrl) { throw new Error('Failed to initialise the renderer server.'); } @@ -94,7 +94,7 @@ export async function startRendererServer(): Promise { export async function stopRendererServer(): Promise { // Make sure that we have a server to stop. - if (rendererServer === null) { + if (!rendererServer) { return; } diff --git a/src/renderer/src/common/settings.ts b/src/renderer/src/common/settings.ts index 50014907..6160e838 100644 --- a/src/renderer/src/common/settings.ts +++ b/src/renderer/src/common/settings.ts @@ -42,7 +42,7 @@ class Settings { } load(): void { - if (electronApi !== undefined) { + if (electronApi) { void electronApi.loadSettings().then((settings: ISettings) => { this._settings = settings; @@ -52,7 +52,7 @@ class Settings { try { const raw = window.localStorage.getItem('settings'); - if (raw !== null) { + if (raw) { this._settings = JSON.parse(raw); } } catch (error: unknown) { @@ -66,7 +66,7 @@ class Settings { } save(): void { - if (electronApi !== undefined) { + if (electronApi) { electronApi.saveSettings(this._settings); } else { try { diff --git a/src/renderer/src/common/vueCommon.ts b/src/renderer/src/common/vueCommon.ts index e3eabaab..b0f6ec55 100644 --- a/src/renderer/src/common/vueCommon.ts +++ b/src/renderer/src/common/vueCommon.ts @@ -37,7 +37,7 @@ export const useTheme = vueusecore.createGlobalState(() => { } function setTheme(newTheme: Theme | undefined) { - _theme.value = newTheme === undefined ? 'system' : newTheme; + _theme.value = newTheme ?? 'system'; if (_theme.value === 'light') { isLightMode.value = true; @@ -79,18 +79,18 @@ export function trackedCssVariableName(id: string): string { export function trackElementHeight(id: string): ResizeObserver | undefined { const element = document.getElementById(id); - if (element !== null) { + if (element) { const resizeObserver = new ResizeObserver(() => { let elementHeight = window.getComputedStyle(element).height; - if (elementHeight === '' || elementHeight === 'auto') { + if (!elementHeight || elementHeight === 'auto') { elementHeight = '0px'; } const cssVariableName = trackedCssVariableName(id); const oldElementHeight = document.documentElement.style.getPropertyValue(cssVariableName); - if (oldElementHeight === '' || (elementHeight !== '0px' && oldElementHeight !== elementHeight)) { + if (!oldElementHeight || (elementHeight !== '0px' && oldElementHeight !== elementHeight)) { document.documentElement.style.setProperty(cssVariableName, elementHeight); } }); diff --git a/src/renderer/src/components/ContentsComponent.vue b/src/renderer/src/components/ContentsComponent.vue index 90267436..8ee8f36e 100644 --- a/src/renderer/src/components/ContentsComponent.vue +++ b/src/renderer/src/components/ContentsComponent.vue @@ -2,7 +2,7 @@
- + 0) { + if (activeFile.value === filePath && fileTabs.value.length) { const nextFileTab = fileTabs.value[Math.min(fileTabIndex, fileTabs.value.length - 1)]; - if (nextFileTab !== undefined) { + if (nextFileTab) { selectFile(nextFileTab.file.path()); } } @@ -205,7 +205,7 @@ function closeCurrentFile(): void { } function closeAllFiles(): void { - while (fileTabs.value.length > 0) { + while (fileTabs.value.length) { closeCurrentFile(); } } @@ -265,7 +265,7 @@ vue.onMounted(() => { if (common.isDesktop()) { vueusecore.onKeyStroke((event: KeyboardEvent) => { - if (!props.isActive || !props.uiEnabled || fileTabs.value.length === 0) { + if (!props.isActive || !props.uiEnabled || !fileTabs.value.length) { return; } diff --git a/src/renderer/src/components/MainMenu.vue b/src/renderer/src/components/MainMenu.vue index 3c728601..e5ae941f 100644 --- a/src/renderer/src/components/MainMenu.vue +++ b/src/renderer/src/components/MainMenu.vue @@ -4,7 +4,7 @@
{{ item.label }}
-
+
{{ item.shortcut }}
@@ -149,7 +149,7 @@ const items = [ const menuBar = vue.ref<(vue.ComponentPublicInstance & { hide: () => void }) | null>(null); vue.onMounted(() => { - if (menuBar.value !== null) { + if (menuBar.value) { // Ensure that the menubar never gets the 'p-menubar-mobile' class, which would turn it into a hamburger menu. const menuBarElement = menuBar.value.$el as HTMLElement; diff --git a/src/renderer/src/components/OpenCOR.vue b/src/renderer/src/components/OpenCOR.vue index 8460f41e..96469805 100644 --- a/src/renderer/src/components/OpenCOR.vue +++ b/src/renderer/src/components/OpenCOR.vue @@ -15,10 +15,10 @@ :pt:root:style="{ position: 'absolute' }" :class="compIsActive ? 'visible' : 'invisible'" /> - + - +
- +