Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): display a backbutton if not in launchpad #1209

Merged
merged 2 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 13 additions & 79 deletions client/package-lock.json

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

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@lumieducation/h5p-react": "0.1.2",
"@lumieducation/h5p-server": "6.2.0",
"@lumieducation/h5p-server": "7.0.0-alpha.1",
"@lumieducation/xapi-viewer": "1.0.1-alpha.3",
"@material-ui/core": "4.11.3",
"@material-ui/icons": "4.11.2",
Expand Down
93 changes: 25 additions & 68 deletions client/src/views/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import React from 'react';
import { connect } from 'react-redux';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import { bindActionCreators } from 'redux';

import Logger from '../helpers/Logger';

import CssBaseline from '@material-ui/core/CssBaseline';
import { createStyles, Theme, withStyles } from '@material-ui/core/styles';

import AppBar from './components/AppBar';

Expand All @@ -18,71 +15,31 @@ import Launchpad from './Launchpad';

import Websocket from './Websocket';

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

const log = new Logger('container:app');

interface IPassedProps {
classes: any;
}

interface IStateProps extends IPassedProps {}

interface IDispatchProps {}

interface IComponentState {}

interface IProps extends IStateProps, IDispatchProps {}

export class AppContainer extends React.Component<IProps, IComponentState> {
constructor(props: IProps) {
super(props);

this.state = {};
}

public render(): JSX.Element {
log.info(`rendering`);
return (
<div id="app">
<CssBaseline />
<Websocket />
<Router>
<AppBar />
<Switch>
<Route
exact={true}
path="/h5peditor"
component={H5PEditor}
/>
<Route
exact={true}
path="/analytics"
component={Analytics}
/>
<Route path="/" component={Launchpad} />
</Switch>
</Router>
<Notifications />
</div>
);
}
}

const styles = (theme: Theme) => createStyles({});
function mapStateToProps(state: IState, ownProps: IPassedProps): IStateProps {
return {
classes: ownProps.classes
};
export default function AppContaine() {
log.info(`rendering`);
return (
<div id="app">
<CssBaseline />
<Websocket />
<Router>
<AppBar />
<Switch>
<Route
exact={true}
path="/h5peditor"
component={H5PEditor}
/>
<Route
exact={true}
path="/analytics"
component={Analytics}
/>
<Route path="/" component={Launchpad} />
</Switch>
</Router>
<Notifications />
</div>
);
}

function mapDispatchToProps(dispatch: any): IDispatchProps {
return bindActionCreators({}, dispatch);
}

export default withStyles(styles)(
connect<IStateProps, IDispatchProps, IPassedProps, IState>(
mapStateToProps,
mapDispatchToProps
)(AppContainer)
);
44 changes: 7 additions & 37 deletions client/src/views/components/AppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,17 @@ import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';

import AppIcon from '@material-ui/icons/Apps';
import BackIcon from '@material-ui/icons/ArrowBack';

import { Link } from 'react-router-dom';

export default function AppBar(props: {
// closeLeftDrawer?: () => void;
// leftDrawerOpen: boolean;
// openLeftDrawer?: () => void;
}): JSX.Element {
// const { closeLeftDrawer, leftDrawerOpen, openLeftDrawer } = props;
const classes = useStyles();
import { useRouteMatch } from 'react-router-dom';

export default function AppBar(props: {}): JSX.Element {
let match = useRouteMatch();
const classes = useStyles();
return (
<MAppBar
position="fixed"
className={classes.appBar}
// className={clsx(classes.appBar, {
// [classes.appBarShift]: leftDrawerOpen
// })}
>
<MAppBar position="fixed" className={classes.appBar}>
<Toolbar>
<Link
to="/"
Expand All @@ -34,37 +26,15 @@ export default function AppBar(props: {
<IconButton
color="inherit"
aria-label="open drawer"
// onClick={() => {
// track('app_bar', 'click', 'menu_icon');
// if (openLeftDrawer) {
// openLeftDrawer();
// }
// }}
edge="start"
// className={clsx(
// classes.menuButton,
// leftDrawerOpen && classes.hide
// )}
>
<AppIcon />
{match.isExact ? <AppIcon /> : <BackIcon />}
</IconButton>
</Link>
<Typography variant="h6" noWrap={true}>
Lumi
</Typography>
<div className={classes.grow} />
{/* <IconButton
aria-label="report an issue"
color="inherit"
onClick={() => {
if (closeLeftDrawer) {
closeLeftDrawer();
}
Sentry.showReportDialog();
}}
>
<BugReport />
</IconButton> */}
</Toolbar>
</MAppBar>
);
Expand Down
Loading