Skip to content

Commit

Permalink
feat(prereleases): allow prereleases to test future features (#1548)
Browse files Browse the repository at this point in the history
* feat(prereleases): allow prereleases to test future features

* test(lint): fix linting
  • Loading branch information
JPSchellenberg committed May 21, 2021
1 parent 6065a85 commit 7210e62
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 53 deletions.
3 changes: 2 additions & 1 deletion client/src/state/Settings/SettingsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export const initialState: ISettingsState = {
autoUpdates: false,
language: 'en',
email: '',
token: ''
token: '',
allowPrerelease: false
};

export default function settingsReducer(
Expand Down
1 change: 1 addition & 0 deletions client/src/state/Settings/SettingsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ISettingsState {
language: string;
email: string;
token: string;
allowPrerelease: boolean;
}

export const SETTINGS_GET_SETTINGS_REQUEST = 'SETTINGS_GET_SETTINGS_REQUEST';
Expand Down
108 changes: 58 additions & 50 deletions client/src/views/Launchpad.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { useDispatch } from 'react-redux';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory } from 'react-router-dom';
import { History } from 'history';

Expand All @@ -19,6 +19,7 @@ import { useTranslation } from 'react-i18next';
import MainSection from './components/MainSection';
import { Link } from 'react-router-dom';

import { IState } from '../state';
import { track } from '../state/track/actions';

declare var window: {
Expand Down Expand Up @@ -63,6 +64,9 @@ export default function Launchpad() {
const { t } = useTranslation();
const dispatch = useDispatch();
const history = useHistory();
const allowPrerelease = useSelector(
(state: IState) => state.settings.allowPrerelease
);

window.h = history;

Expand Down Expand Up @@ -207,57 +211,61 @@ export default function Launchpad() {
</CardActions>
</Card>
</Grid>
<Grid item xs={4}>
<Card id="launchpad-run" className={classes.card}>
<Link
to="/run"
style={{
color: 'inherit',
textDecoration: 'inherit'
}}
>
<CardActionArea>
<CardMedia
className={classes.media}
title="Lumi Run"
>
<RunIcon
className={classes.analyticsIcon}
/>
</CardMedia>
<CardContent>
<Typography
gutterBottom
variant="h5"
component="h2"
{allowPrerelease && (
<Grid item xs={4}>
<Card id="launchpad-run" className={classes.card}>
<Link
to="/run"
style={{
color: 'inherit',
textDecoration: 'inherit'
}}
>
<CardActionArea>
<CardMedia
className={classes.media}
title="Lumi Run"
>
Lumi Run
</Typography>
<Typography
variant="body2"
color="textSecondary"
component="p"
<RunIcon
className={
classes.analyticsIcon
}
/>
</CardMedia>
<CardContent>
<Typography
gutterBottom
variant="h5"
component="h2"
>
Lumi Run (Beta)
</Typography>
<Typography
variant="body2"
color="textSecondary"
component="p"
>
{t('run.description')}
</Typography>
</CardContent>
</CardActionArea>
</Link>
<CardActions>
<Button size="small" color="primary">
<Link
to="/run"
style={{
color: 'inherit',
textDecoration: 'inherit'
}}
>
{t('run.description')}
</Typography>
</CardContent>
</CardActionArea>
</Link>
<CardActions>
<Button size="small" color="primary">
<Link
to="/run"
style={{
color: 'inherit',
textDecoration: 'inherit'
}}
>
{t('analytics.startPage.start')}
</Link>
</Button>
</CardActions>
</Card>
</Grid>
{t('analytics.startPage.start')}
</Link>
</Button>
</CardActions>
</Card>
</Grid>
)}
</Grid>
</MainSection>
</div>
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/components/RunSetupDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default function RunSetupDialog(props: IRunSetupDialogProps) {
open={open}
>
<DialogTitle id="customized-dialog-title" onClose={onClose}>
Lumi Run
Lumi Run (Beta)
</DialogTitle>
<DialogContent dividers>
<Typography gutterBottom>{t('run.description')}</Typography>
Expand Down
28 changes: 28 additions & 0 deletions client/src/views/components/Settings/GeneralSettingsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import BugReportIcon from '@material-ui/icons/BugReport';
import InsertChartIcon from '@material-ui/icons/InsertChart';

import TranslateIcon from '@material-ui/icons/Translate';
import UpdateIcon from '@material-ui/icons/Update';

import { actions, IState } from '../../../state';
import LanguageList from './LanguageList';
Expand Down Expand Up @@ -95,6 +96,33 @@ export default function SettingsGeneralSettingsList() {
/>
</ListItemSecondaryAction>
</ListItem>
<ListItem>
<ListItemIcon>
<UpdateIcon />
</ListItemIcon>
<ListItemText
id="switch-list-label-updates"
primary={t('prerelease.title')}
secondary={t('prerelease.description')}
/>
<ListItemSecondaryAction>
<Switch
edge="end"
onChange={() =>
dispatch(
actions.settings.changeSetting({
allowPrerelease: !settings.allowPrerelease
})
)
}
checked={settings.allowPrerelease}
inputProps={{
'aria-labelledby':
'switch-list-label-prerelease-updates'
}}
/>
</ListItemSecondaryAction>
</ListItem>
<ListItem>
<ListItemIcon>
<TranslateIcon />
Expand Down
4 changes: 4 additions & 0 deletions locales/lumi/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
},
"messages": { "econnrefused": "Connection Refused" }
},
"prerelease": {
"title": "Prerelease Features",
"description": "Enable experimental features before they are released"
},
"auth": {
"set_email": "Set Email",
"email": "Email",
Expand Down
3 changes: 2 additions & 1 deletion server/src/boot/defaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export default {
autoUpdates: false,
language: 'en',
email: '',
token: ''
token: '',
allowPrerelease: false
};
1 change: 1 addition & 0 deletions server/src/settingsCache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
interface ISettingsState {
allowPrerelease: boolean;
autoUpdates: boolean;
bugTracking: boolean;
email: string;
Expand Down
3 changes: 3 additions & 0 deletions server/src/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SocketIO from 'socket.io';
import * as Sentry from '@sentry/electron';
import fsExtra from 'fs-extra';
import IServerConfig from './IServerConfig';
import settingsCache from './settingsCache';

let updateAvailable: boolean = false;
let updating: boolean = false;
Expand Down Expand Up @@ -31,6 +32,8 @@ export default async function boot(
websocket: SocketIO.Server,
serverConfig: IServerConfig
): Promise<void> {
autoUpdater.allowPrerelease = settingsCache.getSettings().allowPrerelease;

autoUpdater.on('update-downloaded', async () => {
updateAvailable = true;

Expand Down

0 comments on commit 7210e62

Please sign in to comment.