From 974d8d4470be8a9ae6364f6a54bdcc00e9f21dfe Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 16:53:12 +0530 Subject: [PATCH 01/14] chore: Refactor electron/update.js for better readability --- electron/update.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/electron/update.js b/electron/update.js index d31153f2..512e3ca5 100644 --- a/electron/update.js +++ b/electron/update.js @@ -2,16 +2,11 @@ const { publishOptions } = require('./constants/publishOptions'); const electronUpdater = require('electron-updater'); const electronLogger = require('electron-log'); -const macUpdater = new electronUpdater.MacUpdater({ - ...publishOptions, - private: false, -}); +const macUpdater = new electronUpdater.MacUpdater({ ...publishOptions }); macUpdater.logger = electronLogger; -macUpdater.setFeedURL({ - ...publishOptions, -}); +macUpdater.setFeedURL({ ...publishOptions }); macUpdater.autoDownload = true; macUpdater.autoInstallOnAppQuit = true; From af77fbabeff17526f72173a057ae0a003aefa64d Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 17:08:05 +0530 Subject: [PATCH 02/14] chore: Update package.json with new ordering --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 61458279..af038e14 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,10 @@ { "author": "Valory AG", + "main": "electron/main.js", + "name": "olas-operate-app", + "productName": "Pearl", + "private": true, + "version": "0.1.0-rc26", "dependencies": { "@ant-design/cssinjs": "^1.18.4", "@ant-design/icons": "^5.3.0", @@ -36,10 +41,6 @@ "net": "^1.0.2", "prettier": "^3.2.5" }, - "main": "electron/main.js", - "name": "olas-operate-app", - "productName": "Pearl", - "private": true, "scripts": { "build:frontend": "cd frontend && yarn build && rm -rf ../electron/.next && cp -r .next ../electron/.next && rm -rf ../electron/public && cp -r public ../electron/public", "dev:backend": "poetry run python operate/cli.py", @@ -53,6 +54,5 @@ "test:frontend": "cd frontend && yarn test", "start": "electron .", "build": "rm -rf dist/ && electron-builder build" - }, - "version": "0.1.0-rc26" + } } From b8a978e75031534f15fcddfb9ecff2bb628729f3 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 20:38:40 +0530 Subject: [PATCH 03/14] chore: Update .env.example and build.js for IS_STAGING variables --- .env.example | 3 ++- build.js | 8 ++++---- electron/constants/publishOptions.js | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 5f8e0789..f6a88375 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ FORK_URL= NODE_ENV= +DEV_RPC= STAKING_TEST_KEYS_PATH= -DEV_RPC= \ No newline at end of file +IS_STAGING= diff --git a/build.js b/build.js index 29e953fc..a5059c95 100644 --- a/build.js +++ b/build.js @@ -1,6 +1,6 @@ const dotenv = require('dotenv'); const build = require('electron-builder').build; -const {publishOptions} = require('./electron/constants/publishOptions'); +const { publishOptions } = require('./electron/constants/publishOptions'); dotenv.config(); @@ -24,7 +24,7 @@ const main = async () => { target: [ { target: 'default', - arch: ['x64','arm64'], + arch: ['x64', 'arm64'], }, ], publish: publishOptions, @@ -35,11 +35,11 @@ const main = async () => { entitlements: 'electron/entitlements.mac.plist', entitlementsInherit: 'electron/entitlements.mac.plist', notarize: { - teamId: process.env.APPLETEAMID + teamId: process.env.APPLETEAMID, }, }, }, }); }; -main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e)); \ No newline at end of file +main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e)); diff --git a/electron/constants/publishOptions.js b/electron/constants/publishOptions.js index 1ecbc1d4..3c57fb66 100644 --- a/electron/constants/publishOptions.js +++ b/electron/constants/publishOptions.js @@ -2,10 +2,11 @@ const publishOptions = { provider: 'github', owner: 'valory-xyz', repo: 'olas-operate-app', - releaseType: 'release', token: process.env.GH_TOKEN, private: false, publishAutoUpdate: true, + releaseType: process.env.IS_STAGING === 'true' ? 'prerelease' : 'release', + channel: process.env.IS_STAGING === 'true' ? 'alpha' : 'latest', }; module.exports = { publishOptions }; From a052ccaee02f8488d7555be99ce21faefb4ee03a Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 21:23:38 +0530 Subject: [PATCH 04/14] feat: Add IS_STAGING variable to production environment configuration --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9737db6c..55ac2dc4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,6 +63,7 @@ jobs: env: NODE_ENV: production DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/ + IS_STAGING: ${{ secrets.IS_STAGING || 'false' }} FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/ - run: rm -rf /dist - name: "Build, notarize, publish" From 657a7c322560dc937a451247e0fae3adb5563be8 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 21:36:56 +0530 Subject: [PATCH 05/14] chore: Fix typo in electron/install.js and add a comment for 'Version' --- electron/install.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/electron/install.js b/electron/install.js index 5b9a8873..b8a40eea 100644 --- a/electron/install.js +++ b/electron/install.js @@ -7,6 +7,11 @@ const process = require('process'); const { spawnSync } = require('child_process'); const Docker = require('dockerode'); +/** + * current version of the pearl release + * - use "rc" for release candidate, for example "0.1.0rc26" + * - use "alpha" for alpha release, for example "0.1.0alpha26" + */ const Version = '0.1.0rc26'; const OperateDirectory = `${os.homedir()}/.operate`; const VenvDir = `${OperateDirectory}/venv`; @@ -46,7 +51,7 @@ function appendLog(log) { function runCmdUnix(command, options) { fs.appendFileSync( OperateInstallationLog, - `Runninng ${command} with options ${JSON.stringify(options)}`, + `Running ${command} with options ${JSON.stringify(options)}`, { encoding: 'utf-8' }, ); let bin = getBinPath(command); From 38cbeb6fc70ce36601dd15606d6489f794553dea Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 23:28:08 +0530 Subject: [PATCH 06/14] feat: Add appVersion to electron store and display it in TopBar --- electron/main.js | 5 ++++- electron/store.js | 20 +++++++++++++++----- frontend/components/Layout/TopBar.tsx | 8 +++++++- frontend/types/ElectronApi.ts | 1 + 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/electron/main.js b/electron/main.js index 7035d0ea..90fbd568 100644 --- a/electron/main.js +++ b/electron/main.js @@ -256,7 +256,10 @@ const createMainWindow = () => { mainWindow.hide(); }); - setupStoreIpc(ipcMain, mainWindow); + const storeInitialValues = { + appVersion: app.getVersion(), + }; + setupStoreIpc(ipcMain, mainWindow, storeInitialValues); if (isDev) { mainWindow.webContents.openDevTools(); diff --git a/electron/store.js b/electron/store.js index 91cde5be..e9efd1ee 100644 --- a/electron/store.js +++ b/electron/store.js @@ -1,5 +1,9 @@ // set schema to validate store data -const schema = { +const defaultSchema = { + appVersion: { + type: 'string', + default: '', + }, isInitialFunded: { type: 'boolean', default: false, @@ -14,14 +18,20 @@ const schema = { }, }; -const setupStoreIpc = async (ipcChannel, mainWindow) => { +const setupStoreIpc = async (ipcChannel, mainWindow, storeInitialValues) => { const Store = (await import('electron-store')).default; - /** @type import Store from 'electron-store' */ - const store = new Store({ - schema, + // set default values for store + const schema = Object.assign({}, defaultSchema); + Object.keys(schema).forEach((key) => { + if (storeInitialValues[key] !== undefined) { + schema[key].default = storeInitialValues[key]; + } }); + /** @type import Store from 'electron-store' */ + const store = new Store({ schema }); + store.onDidAnyChange((data) => { if (mainWindow?.webContents) mainWindow.webContents.send('store-changed', data); diff --git a/frontend/components/Layout/TopBar.tsx b/frontend/components/Layout/TopBar.tsx index a98b2636..dd12ec11 100644 --- a/frontend/components/Layout/TopBar.tsx +++ b/frontend/components/Layout/TopBar.tsx @@ -3,6 +3,7 @@ import styled from 'styled-components'; import { COLOR } from '@/constants'; import { useElectronApi } from '@/hooks/useElectronApi'; +import { useStore } from '@/hooks/useStore'; const { Text } = Typography; @@ -48,6 +49,8 @@ const TopBarContainer = styled.div` export const TopBar = () => { const electronApi = useElectronApi(); + const store = useStore(); + return ( @@ -56,7 +59,10 @@ export const TopBar = () => { - Pearl (alpha) + + Pearl (alpha) + {store?.storeState?.appVersion?.includes('rc') ? ' (staging)' : ''} + ); }; diff --git a/frontend/types/ElectronApi.ts b/frontend/types/ElectronApi.ts index 221b0000..3a5df5c9 100644 --- a/frontend/types/ElectronApi.ts +++ b/frontend/types/ElectronApi.ts @@ -1,4 +1,5 @@ export type ElectronStore = { + appVersion?: string; isInitialFunded?: boolean; firstStakingRewardAchieved?: boolean; firstRewardNotificationShown?: boolean; From 06608150a185067c30abc5aee5d37d1cbd1721ce Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Thu, 30 May 2024 05:23:04 +0530 Subject: [PATCH 07/14] feat: Update electron updater to automatically update to all channels --- electron/update.js | 5 ++++- frontend/components/Layout/TopBar.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/electron/update.js b/electron/update.js index 512e3ca5..b975e5ee 100644 --- a/electron/update.js +++ b/electron/update.js @@ -2,7 +2,10 @@ const { publishOptions } = require('./constants/publishOptions'); const electronUpdater = require('electron-updater'); const electronLogger = require('electron-log'); -const macUpdater = new electronUpdater.MacUpdater({ ...publishOptions }); +const macUpdater = new electronUpdater.MacUpdater({ + ...publishOptions, + channels: ['latest', 'beta', 'alpha'], // automatically update to all channels +}); macUpdater.logger = electronLogger; diff --git a/frontend/components/Layout/TopBar.tsx b/frontend/components/Layout/TopBar.tsx index dd12ec11..fa9d6328 100644 --- a/frontend/components/Layout/TopBar.tsx +++ b/frontend/components/Layout/TopBar.tsx @@ -61,7 +61,7 @@ export const TopBar = () => { Pearl (alpha) - {store?.storeState?.appVersion?.includes('rc') ? ' (staging)' : ''} + {store?.storeState?.appVersion?.includes('rc') ? '' : ' (staging)'} ); From c6897f872862b34b26fca6bcdcc1672ee07868a2 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Thu, 30 May 2024 15:25:22 +0530 Subject: [PATCH 08/14] chore: Update electron/install.js and TopBar.tsx for app version display and staging indicator --- electron/install.js | 4 ++-- frontend/components/Layout/TopBar.tsx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/electron/install.js b/electron/install.js index b8a40eea..2a5c8586 100644 --- a/electron/install.js +++ b/electron/install.js @@ -9,8 +9,8 @@ const Docker = require('dockerode'); /** * current version of the pearl release - * - use "rc" for release candidate, for example "0.1.0rc26" - * - use "alpha" for alpha release, for example "0.1.0alpha26" + * - use "" (nothing as a suffix) for latest release candidate, for example "0.1.0rc26" + * - use "alpha" for alpha release, for example "0.1.0rc26-alpha" */ const Version = '0.1.0rc26'; const OperateDirectory = `${os.homedir()}/.operate`; diff --git a/frontend/components/Layout/TopBar.tsx b/frontend/components/Layout/TopBar.tsx index fa9d6328..b16321cb 100644 --- a/frontend/components/Layout/TopBar.tsx +++ b/frontend/components/Layout/TopBar.tsx @@ -47,6 +47,10 @@ const TopBarContainer = styled.div` -webkit-app-region: drag; `; +const isStaging = (version?: string) => { + return !!version && (version.includes('alpha') || version.includes('beta')); +}; + export const TopBar = () => { const electronApi = useElectronApi(); const store = useStore(); @@ -61,7 +65,7 @@ export const TopBar = () => { Pearl (alpha) - {store?.storeState?.appVersion?.includes('rc') ? '' : ' (staging)'} + {isStaging(store?.storeState?.appVersion) ? ' (staging)' : ''} ); From 92e40467cb053eee91b5e3a447b12caa170a1238 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Thu, 30 May 2024 22:43:42 +0530 Subject: [PATCH 09/14] chore: Update releaseType in publishOptions and store schema --- electron/constants/publishOptions.js | 3 +-- electron/store.js | 21 +++++---------------- frontend/components/Layout/TopBar.tsx | 21 +++++++++++++-------- frontend/types/ElectronApi.ts | 1 + 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/electron/constants/publishOptions.js b/electron/constants/publishOptions.js index 3c57fb66..196f5be0 100644 --- a/electron/constants/publishOptions.js +++ b/electron/constants/publishOptions.js @@ -5,8 +5,7 @@ const publishOptions = { token: process.env.GH_TOKEN, private: false, publishAutoUpdate: true, - releaseType: process.env.IS_STAGING === 'true' ? 'prerelease' : 'release', - channel: process.env.IS_STAGING === 'true' ? 'alpha' : 'latest', + releaseType: process.env.IS_STAGING === 'true' ? 'draft' : 'release', }; module.exports = { publishOptions }; diff --git a/electron/store.js b/electron/store.js index e9efd1ee..4b06cfff 100644 --- a/electron/store.js +++ b/electron/store.js @@ -1,21 +1,10 @@ // set schema to validate store data const defaultSchema = { - appVersion: { - type: 'string', - default: '', - }, - isInitialFunded: { - type: 'boolean', - default: false, - }, - firstStakingRewardAchieved: { - type: 'boolean', - default: false, - }, - firstRewardNotificationShown: { - type: 'boolean', - default: false, - }, + appVersion: { type: 'string', default: '' }, + releaseType: { type: 'string', default: '' }, + isInitialFunded: { type: 'boolean', default: false }, + firstStakingRewardAchieved: { type: 'boolean', default: false }, + firstRewardNotificationShown: { type: 'boolean', default: false }, }; const setupStoreIpc = async (ipcChannel, mainWindow, storeInitialValues) => { diff --git a/frontend/components/Layout/TopBar.tsx b/frontend/components/Layout/TopBar.tsx index b16321cb..d9e7be9c 100644 --- a/frontend/components/Layout/TopBar.tsx +++ b/frontend/components/Layout/TopBar.tsx @@ -1,4 +1,5 @@ import { Typography } from 'antd'; +import { useMemo } from 'react'; import styled from 'styled-components'; import { COLOR } from '@/constants'; @@ -47,14 +48,21 @@ const TopBarContainer = styled.div` -webkit-app-region: drag; `; -const isStaging = (version?: string) => { - return !!version && (version.includes('alpha') || version.includes('beta')); -}; - export const TopBar = () => { const electronApi = useElectronApi(); const store = useStore(); + const versionName = useMemo(() => { + const releaseType = store?.storeState?.releaseType; + if (releaseType === 'draft') return ' (staging)'; + + const appVersion = store?.storeState?.appVersion; + if (!appVersion) return ''; + if (appVersion.includes('alpha')) return ''; // TODO + if (appVersion.includes('beta')) return ''; // TODO + return ''; + }, [store?.storeState?.appVersion, store?.storeState?.releaseType]); + return ( @@ -63,10 +71,7 @@ export const TopBar = () => { - - Pearl (alpha) - {isStaging(store?.storeState?.appVersion) ? ' (staging)' : ''} - + {`Pearl (alpha) ${versionName}`.trim()} ); }; diff --git a/frontend/types/ElectronApi.ts b/frontend/types/ElectronApi.ts index 3a5df5c9..ab1937e9 100644 --- a/frontend/types/ElectronApi.ts +++ b/frontend/types/ElectronApi.ts @@ -1,5 +1,6 @@ export type ElectronStore = { appVersion?: string; + releaseType?: string; isInitialFunded?: boolean; firstStakingRewardAchieved?: boolean; firstRewardNotificationShown?: boolean; From afe5407af3018ae683fde45587df97dc49ba2d75 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Thu, 30 May 2024 22:55:10 +0530 Subject: [PATCH 10/14] chore: Update releaseType in publishOptions and store schema --- electron/main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/electron/main.js b/electron/main.js index 90fbd568..00700f01 100644 --- a/electron/main.js +++ b/electron/main.js @@ -258,6 +258,7 @@ const createMainWindow = () => { const storeInitialValues = { appVersion: app.getVersion(), + releaseType: process.env.IS_STAGING ? 'draft' : 'release', }; setupStoreIpc(ipcMain, mainWindow, storeInitialValues); From b2f88082a7622267cb249da1f3e8cd9a942f8685 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Fri, 31 May 2024 19:53:48 +0530 Subject: [PATCH 11/14] chore: Update IS_STAGING variable in production environment configuration --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55ac2dc4..9f3c75da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: env: NODE_ENV: production DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/ - IS_STAGING: ${{ secrets.IS_STAGING || 'false' }} + IS_STAGING: ${{ contains(github.ref, '.dev') }} FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/ - run: rm -rf /dist - name: "Build, notarize, publish" From 3d3b70ed2a10c0f7b9815cbb2c55e8efb1fa5606 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Fri, 31 May 2024 19:54:16 +0530 Subject: [PATCH 12/14] chore: Update IS_STAGING variable in production environment configuration --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f3c75da..0deab94b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: env: NODE_ENV: production DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/ - IS_STAGING: ${{ contains(github.ref, '.dev') }} + IS_STAGING: ${{ contains(github.ref, 'staging') }} FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/ - run: rm -rf /dist - name: "Build, notarize, publish" From 9f7aaf2cfc7d551a42caf19ba52d8ba21eb06770 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Mon, 3 Jun 2024 16:04:14 +0530 Subject: [PATCH 13/14] chore: Update publishOptions releaseType to 'draft' in electron/constants/publishOptions.js and update olas-operate-middleware version to '0.1.0rc26' in electron/install.js --- electron/constants/publishOptions.js | 2 +- electron/install.js | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/electron/constants/publishOptions.js b/electron/constants/publishOptions.js index 196f5be0..60529d28 100644 --- a/electron/constants/publishOptions.js +++ b/electron/constants/publishOptions.js @@ -5,7 +5,7 @@ const publishOptions = { token: process.env.GH_TOKEN, private: false, publishAutoUpdate: true, - releaseType: process.env.IS_STAGING === 'true' ? 'draft' : 'release', + releaseType: 'draft', }; module.exports = { publishOptions }; diff --git a/electron/install.js b/electron/install.js index 2a5c8586..1b54e6e4 100644 --- a/electron/install.js +++ b/electron/install.js @@ -12,7 +12,7 @@ const Docker = require('dockerode'); * - use "" (nothing as a suffix) for latest release candidate, for example "0.1.0rc26" * - use "alpha" for alpha release, for example "0.1.0rc26-alpha" */ -const Version = '0.1.0rc26'; +const OlasMiddlewareVersion = '0.1.0rc26'; const OperateDirectory = `${os.homedir()}/.operate`; const VenvDir = `${OperateDirectory}/venv`; const VersionFile = `${OperateDirectory}/version.txt`; @@ -83,7 +83,7 @@ function runSudoUnix(command, options) { if (!bin) { throw new Error(`Command ${command} not found`); } - return new Promise(function (resolve, reject) { + return new Promise(function (resolve, _reject) { sudo.exec( `${bin} ${options}`, SudoOptions, @@ -162,7 +162,7 @@ function installOperatePackageUnix(path) { '-m', 'pip', 'install', - `olas-operate-middleware==${Version}`, + `olas-operate-middleware==${OlasMiddlewareVersion}`, ]); } @@ -172,7 +172,7 @@ function reInstallOperatePackageUnix(path) { '-m', 'pip', 'install', - `olas-operate-middleware==${Version}`, + `olas-operate-middleware==${OlasMiddlewareVersion}`, '--force-reinstall', ]); } @@ -182,11 +182,11 @@ function installOperateCli(path) { if (fs.existsSync(installPath)) { fs.rmSync(installPath); } - return new Promise((resolve, reject) => { + return new Promise((resolve, _reject) => { fs.copyFile( `${OperateDirectory}/venv/bin/operate`, installPath, - function (error, stdout, stderr) { + function (error, _stdout, _stderr) { resolve(!error); }, ); @@ -197,7 +197,7 @@ function createDirectory(path) { if (fs.existsSync(path)) { return; } - return new Promise((resolve, reject) => { + return new Promise((resolve, _reject) => { fs.mkdir(path, { recursive: true }, (error) => { resolve(!error); }); @@ -205,15 +205,15 @@ function createDirectory(path) { } function writeVersion() { - fs.writeFileSync(VersionFile, Version); + fs.writeFileSync(VersionFile, OlasMiddlewareVersion); } function versionBumpRequired() { if (!fs.existsSync(VersionFile)) { return true; } - const version = fs.readFileSync(VersionFile).toString(); - return version != Version; + const olasMiddlewareVersionInFile = fs.readFileSync(VersionFile).toString(); + return olasMiddlewareVersionInFile != OlasMiddlewareVersion; } function removeLogFile() { @@ -270,7 +270,9 @@ async function setupDarwin(ipcChannel) { console.log(appendLog('Checking if upgrade is required')); if (versionBumpRequired()) { - console.log(appendLog(`Upgrading pearl daemon to ${Version}`)); + console.log( + appendLog(`Upgrading pearl daemon to ${OlasMiddlewareVersion}`), + ); reInstallOperatePackageUnix(OperateDirectory); writeVersion(); removeLogFile(); @@ -327,7 +329,9 @@ async function setupUbuntu(ipcChannel) { console.log(appendLog('Checking if upgrade is required')); if (versionBumpRequired()) { - console.log(appendLog(`Upgrading pearl daemon to ${Version}`)); + console.log( + appendLog(`Upgrading pearl daemon to ${OlasMiddlewareVersion}`), + ); reInstallOperatePackageUnix(OperateDirectory); writeVersion(); removeLogFile(); From b9cbf284a7f6bedbfd0756ad5f2a0b32629dcb48 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Mon, 3 Jun 2024 16:09:18 +0530 Subject: [PATCH 14/14] chore: Update environmentName in store schema and TopBar component --- electron/main.js | 3 +-- electron/store.js | 3 +-- frontend/components/Layout/TopBar.tsx | 15 ++------------- frontend/types/ElectronApi.ts | 3 +-- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/electron/main.js b/electron/main.js index 00700f01..7b9d06a1 100644 --- a/electron/main.js +++ b/electron/main.js @@ -257,8 +257,7 @@ const createMainWindow = () => { }); const storeInitialValues = { - appVersion: app.getVersion(), - releaseType: process.env.IS_STAGING ? 'draft' : 'release', + environmentName: process.env.IS_STAGING ? 'staging' : '', }; setupStoreIpc(ipcMain, mainWindow, storeInitialValues); diff --git a/electron/store.js b/electron/store.js index 4b06cfff..5577decf 100644 --- a/electron/store.js +++ b/electron/store.js @@ -1,7 +1,6 @@ // set schema to validate store data const defaultSchema = { - appVersion: { type: 'string', default: '' }, - releaseType: { type: 'string', default: '' }, + environmentName: { type: 'string', default: '' }, isInitialFunded: { type: 'boolean', default: false }, firstStakingRewardAchieved: { type: 'boolean', default: false }, firstRewardNotificationShown: { type: 'boolean', default: false }, diff --git a/frontend/components/Layout/TopBar.tsx b/frontend/components/Layout/TopBar.tsx index d9e7be9c..c36f3054 100644 --- a/frontend/components/Layout/TopBar.tsx +++ b/frontend/components/Layout/TopBar.tsx @@ -1,5 +1,4 @@ import { Typography } from 'antd'; -import { useMemo } from 'react'; import styled from 'styled-components'; import { COLOR } from '@/constants'; @@ -51,17 +50,7 @@ const TopBarContainer = styled.div` export const TopBar = () => { const electronApi = useElectronApi(); const store = useStore(); - - const versionName = useMemo(() => { - const releaseType = store?.storeState?.releaseType; - if (releaseType === 'draft') return ' (staging)'; - - const appVersion = store?.storeState?.appVersion; - if (!appVersion) return ''; - if (appVersion.includes('alpha')) return ''; // TODO - if (appVersion.includes('beta')) return ''; // TODO - return ''; - }, [store?.storeState?.appVersion, store?.storeState?.releaseType]); + const envName = store?.storeState?.environmentName; return ( @@ -71,7 +60,7 @@ export const TopBar = () => { - {`Pearl (alpha) ${versionName}`.trim()} + {`Pearl (alpha) ${envName ? `(${envName})` : ''}`.trim()} ); }; diff --git a/frontend/types/ElectronApi.ts b/frontend/types/ElectronApi.ts index ab1937e9..2f586a0d 100644 --- a/frontend/types/ElectronApi.ts +++ b/frontend/types/ElectronApi.ts @@ -1,6 +1,5 @@ export type ElectronStore = { - appVersion?: string; - releaseType?: string; + environmentName?: string; isInitialFunded?: boolean; firstStakingRewardAchieved?: boolean; firstRewardNotificationShown?: boolean;