Skip to content

Commit

Permalink
Merge pull request #1468 from Lumieducation/master
Browse files Browse the repository at this point in the history
v0.7.2
  • Loading branch information
JPSchellenberg authored Apr 19, 2021
2 parents 72650b8 + c8132ee commit 252eca2
Show file tree
Hide file tree
Showing 17 changed files with 422 additions and 244 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Other tools will be added in later versions.

Download the latest version [here](https://github.com/Lumieducation/Lumi/releases/latest).

![Lumi](./docs/img/lumi_flow.png)

It’s built with TypeScript – a [nodejs](https://nodejs.org/) plus [express](https://expressjs.com/) and [socket.io](http://socket.io) server, [React.js](https://reactjs.org/), [Redux](https://redux.js.org/) and [Material-ui](https://www.material-ui.com).
It runs as a [Electron](https://electronjs.org)-Standalone App on Mac OS X, Windows and Linux.

Expand All @@ -17,6 +15,8 @@ It runs as a [Electron](https://electronjs.org)-Standalone App on Mac OS X, Wind
Lumi tries to improve education wherever it is possible by providing a software that connects teachers with their students. But Lumi is in a very early development stage. Every help is appreciated and welcome. You can contribute in many ways. You can help reporting, testing, and detailing bugs, and also test and suggest new features.
Please read [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

We manage the localization of Lumi on [translate-h5p.tk](https://translate-h5p.tk/) in the project [Lumi Education](https://translate-h5p.tk/weblate/projects/lumi-education/). The Weblate installation there makes it easy to add translations into your language. Please read the [guide how to contribute](https://translate-h5p.tk/contributing/) and register on translate-h5p.tk if you're interested in helping out!

Lumi has adopted the code of conduct defined by the Contributor Covenant. It can be read in full [here](./CODE-OF-CONDUCT.md).

### Get in touch
Expand Down
12 changes: 6 additions & 6 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@sentry/react": "6.2.5",
"@testing-library/jest-dom": "5.11.10",
"@testing-library/react": "11.2.6",
"@testing-library/user-event": "13.1.3",
"@testing-library/user-event": "13.1.4",
"@types/jest": "26.0.22",
"@types/node": "14.14.41",
"@types/react": "17.0.3",
Expand All @@ -20,7 +20,7 @@
"i18next": "20.2.1",
"i18next-http-backend": "1.2.1",
"lodash": "4.17.21",
"notistack": "1.0.5",
"notistack": "1.0.6",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "11.8.13",
Expand Down
7 changes: 7 additions & 0 deletions client/src/state/System/SystemAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import superagent from 'superagent';

import { ISystemState } from './SystemTypes';

export async function getSystem(): Promise<ISystemState> {
return (await superagent.get(`/api/v1/system`)).body;
}
37 changes: 37 additions & 0 deletions client/src/state/System/SystemActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as Sentry from '@sentry/browser';

import {
SYSTEM_GET_SYSTEM_REQUEST,
SYSTEM_GET_SYSTEM_ERROR,
SYSTEM_GET_SYSTEM_SUCCESS
} from './SystemTypes';

import * as API from './SystemAPI';

export function getSystem(): any {
return async (dispatch: any) => {
try {
dispatch({
payload: {},
type: SYSTEM_GET_SYSTEM_REQUEST
});

try {
const system = await API.getSystem();

dispatch({
payload: system,
type: SYSTEM_GET_SYSTEM_SUCCESS
});
return system;
} catch (error) {
Sentry.captureException(error);

dispatch({
payload: { error },
type: SYSTEM_GET_SYSTEM_ERROR
});
}
} catch (error) {}
};
}
29 changes: 29 additions & 0 deletions client/src/state/System/SystemReducer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as Sentry from '@sentry/browser';

import {
ISystemActionTypes,
ISystemState,
SYSTEM_GET_SYSTEM_SUCCESS
} from './SystemTypes';

export const initialState: ISystemState = {
platformSupportsUpdates: true
};

export default function settingsReducer(
state: ISystemState = initialState,
action: ISystemActionTypes
): ISystemState {
try {
switch (action.type) {
case SYSTEM_GET_SYSTEM_SUCCESS:
return action.payload;

default:
return state;
}
} catch (error) {
Sentry.captureException(error);
return state;
}
}
32 changes: 32 additions & 0 deletions client/src/state/System/SystemTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export interface IState {
system: ISystemState;
}

export interface ISystemState {
platformSupportsUpdates: boolean;
}

export const SYSTEM_GET_SYSTEM_REQUEST = 'SYSTEM_GET_SYSTEM_REQUEST';
export const SYSTEM_GET_SYSTEM_SUCCESS = 'SYSTEM_GET_SYSTEM_SUCCESS';
export const SYSTEM_GET_SYSTEM_ERROR = 'SYSTEM_GET_SYSTEM_ERROR';

export interface IGetSystemRequestAction {
payload: {};
type: typeof SYSTEM_GET_SYSTEM_REQUEST;
}

export interface IGetSystemSuccessAction {
payload: ISystemState;
type: typeof SYSTEM_GET_SYSTEM_SUCCESS;
}
export interface IGetSystemErrorAction {
payload: {
error: string;
};
type: typeof SYSTEM_GET_SYSTEM_ERROR;
}

export type ISystemActionTypes =
| IGetSystemErrorAction
| IGetSystemRequestAction
| IGetSystemSuccessAction;
13 changes: 10 additions & 3 deletions client/src/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import * as SettingsTypes from './Settings/SettingsTypes';
import SettingsReducer from './Settings/SettingsReducer';
import * as SettingsActions from './Settings/SettingsActions';

import * as SystemTypes from './System/SystemTypes';
import SystemReducer from './System/SystemReducer';
import * as SystemActions from './System/SystemActions';

import RunReducer from './Run/RunReducer';
import * as RunTypes from './Run/RunTypes';
import * as RunActions from './Run/RunActions';
Expand Down Expand Up @@ -48,7 +52,8 @@ const rootReducer = () =>
h5peditor: H5PEditorReducer,
analytics: AnalyticsReducer,
run: RunReducer,
settings: SettingsReducer
settings: SettingsReducer,
system: SystemReducer
});

const store = createStore(
Expand All @@ -62,14 +67,16 @@ export interface IState
NotificationsTypes.IState,
AnalyticsTypes.IState,
SettingsTypes.IState,
RunTypes.IState {}
RunTypes.IState,
SystemTypes.IState {}

export const actions = {
notifications: NotificationsActions,
h5peditor: H5PEditorActions,
analytics: AnalyticsActions,
settings: SettingsActions,
run: RunActions
run: RunActions,
system: SystemActions
};

export const selectors = {
Expand Down
2 changes: 2 additions & 0 deletions client/src/views/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export default function AppContainer() {
}
}
);

dispatch(actions.system.getSystem());
}, [dispatch, i18n]);

return (
Expand Down
39 changes: 23 additions & 16 deletions client/src/views/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import classnames from 'classnames';

import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux';
import { useDispatch, useSelector } from 'react-redux';

import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
import Dialog from '@material-ui/core/Dialog';
Expand Down Expand Up @@ -35,6 +35,7 @@ import AccountSettingsList from './components/Settings/AccountSettingsList';
import SettingsLibraryManagement from './components/Settings/LibraryManagement';
import UpdateSettings from './components/Settings/UpdatesSettings';

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

const drawerWidth = 240;
Expand Down Expand Up @@ -100,6 +101,10 @@ export default function FullScreenDialog() {
const { t } = useTranslation();
const dispatch = useDispatch();

const platformSupportsUpdates = useSelector(
(state: IState) => state.system.platformSupportsUpdates
);

const [section, setSection] = React.useState('general');

const handleClickOpen = () => {
Expand Down Expand Up @@ -164,21 +169,23 @@ export default function FullScreenDialog() {
primary={t('settings.menu.general')}
/>
</ListItem>
<ListItem
button
key="updates"
onClick={() => setSection('updates')}
className={classnames({
[classes.selected]: section === 'updates'
})}
>
<ListItemIcon>
<UpdateIcon />
</ListItemIcon>
<ListItemText
primary={t('settings.menu.updates')}
/>
</ListItem>
{platformSupportsUpdates && (
<ListItem
button
key="updates"
onClick={() => setSection('updates')}
className={classnames({
[classes.selected]: section === 'updates'
})}
>
<ListItemIcon>
<UpdateIcon />
</ListItemIcon>
<ListItemText
primary={t('settings.menu.updates')}
/>
</ListItem>
)}
<ListItem
button
key="h5p-library-administration"
Expand Down
57 changes: 31 additions & 26 deletions client/src/views/components/SetupDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ const DialogActions = withStyles((theme: Theme) => ({
export default function CustomizedDialogs() {
const dispatch = useDispatch();
const settings = useSelector((state: IState) => state.settings);
const platformSupportsUpdates = useSelector(
(state: IState) => state.system.platformSupportsUpdates
);
const classes = useStyles();
const { t } = useTranslation();

Expand Down Expand Up @@ -227,33 +230,35 @@ export default function CustomizedDialogs() {
/>
</ListItemSecondaryAction>
</ListItem>
<ListItem>
<ListItemIcon>
<UpdateIcon />
</ListItemIcon>
<ListItemText
id="switch-list-label-updates"
primary={t('updates.title')}
secondary={t('updates.consent')}
/>
<ListItemSecondaryAction>
<Switch
edge="end"
onChange={() =>
dispatch(
actions.settings.changeSetting({
autoUpdates: !settings.autoUpdates
})
)
}
checked={settings.autoUpdates}
inputProps={{
'aria-labelledby':
'switch-list-label-updates'
}}
{platformSupportsUpdates && (
<ListItem>
<ListItemIcon>
<UpdateIcon />
</ListItemIcon>
<ListItemText
id="switch-list-label-updates"
primary={t('updates.title')}
secondary={t('updates.consent')}
/>
</ListItemSecondaryAction>
</ListItem>
<ListItemSecondaryAction>
<Switch
edge="end"
onChange={() =>
dispatch(
actions.settings.changeSetting({
autoUpdates: !settings.autoUpdates
})
)
}
checked={settings.autoUpdates}
inputProps={{
'aria-labelledby':
'switch-list-label-updates'
}}
/>
</ListItemSecondaryAction>
</ListItem>
)}
<ListItem>
<ListItemIcon>
<TranslateIcon />
Expand Down
Loading

0 comments on commit 252eca2

Please sign in to comment.