Skip to content

Commit

Permalink
chore: Update releaseType in publishOptions and store schema
Browse files Browse the repository at this point in the history
  • Loading branch information
mohandast52 committed May 30, 2024
1 parent c6897f8 commit 92e4046
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 26 deletions.
3 changes: 1 addition & 2 deletions electron/constants/publishOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
21 changes: 5 additions & 16 deletions electron/store.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
21 changes: 13 additions & 8 deletions frontend/components/Layout/TopBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Typography } from 'antd';
import { useMemo } from 'react';
import styled from 'styled-components';

import { COLOR } from '@/constants';
Expand Down Expand Up @@ -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 (
<TopBarContainer>
<TrafficLights>
Expand All @@ -63,10 +71,7 @@ export const TopBar = () => {
<DisabledLight />
</TrafficLights>

<Text>
Pearl (alpha)
{isStaging(store?.storeState?.appVersion) ? ' (staging)' : ''}
</Text>
<Text>{`Pearl (alpha) ${versionName}`.trim()}</Text>
</TopBarContainer>
);
};
1 change: 1 addition & 0 deletions frontend/types/ElectronApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export type ElectronStore = {
appVersion?: string;
releaseType?: string;
isInitialFunded?: boolean;
firstStakingRewardAchieved?: boolean;
firstRewardNotificationShown?: boolean;
Expand Down

0 comments on commit 92e4046

Please sign in to comment.