2021-01-09 12:32:17 +01:00
|
|
|
import { Container } from "@material-ui/core";
|
2020-12-31 11:36:23 +01:00
|
|
|
import QuestionList from "./QuestionList";
|
|
|
|
import CategoryList from "./CategoryList";
|
2021-01-09 12:32:17 +01:00
|
|
|
import { Copyright } from "./Copyright";
|
2020-12-31 11:36:23 +01:00
|
|
|
import React from "react";
|
2021-01-09 12:32:17 +01:00
|
|
|
import { makeStyles } from "@material-ui/core/styles";
|
2021-02-08 00:00:12 +01:00
|
|
|
import { Route, Switch } from "react-router-dom";
|
|
|
|
import QuestionAnswerIcon from "@material-ui/icons/QuestionAnswer";
|
|
|
|
import PeopleIcon from "@material-ui/icons/People";
|
|
|
|
import { MenuOption } from "./MainMenu";
|
|
|
|
import { PersonRoutes } from "./Main";
|
2021-03-30 18:24:41 +02:00
|
|
|
import { UserManagement } from "./UserManagement";
|
2021-06-20 10:49:43 +02:00
|
|
|
import { InfoRounded } from "@material-ui/icons";
|
|
|
|
import { EditInformation } from "./EditInformation";
|
2020-12-31 11:36:23 +01:00
|
|
|
|
|
|
|
const useStyles = makeStyles((theme) => ({
|
|
|
|
container: {
|
|
|
|
paddingTop: theme.spacing(4),
|
|
|
|
paddingBottom: theme.spacing(4),
|
2021-01-09 12:32:17 +01:00
|
|
|
flexDirection: "column",
|
2020-12-31 11:36:23 +01:00
|
|
|
},
|
|
|
|
}));
|
|
|
|
|
2021-02-08 00:00:12 +01:00
|
|
|
interface EditorRoutes extends PersonRoutes {
|
|
|
|
question: MenuOption;
|
|
|
|
userManagement: MenuOption;
|
2021-06-20 10:49:43 +02:00
|
|
|
editInformation: MenuOption;
|
2021-02-08 00:00:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export const editorRoutes: EditorRoutes = {
|
|
|
|
question: {
|
|
|
|
title: "Fragen bearbeiten",
|
|
|
|
path: "/",
|
|
|
|
icon: <QuestionAnswerIcon />,
|
|
|
|
},
|
|
|
|
userManagement: {
|
|
|
|
title: "Benutzer verwalten",
|
|
|
|
path: "/benutzer",
|
|
|
|
icon: <PeopleIcon />,
|
|
|
|
},
|
2021-06-20 10:49:43 +02:00
|
|
|
editInformation: {
|
|
|
|
title: "Infos bearbeiten",
|
|
|
|
path: "/edit",
|
|
|
|
icon: <InfoRounded />,
|
|
|
|
},
|
2021-02-08 00:00:12 +01:00
|
|
|
};
|
|
|
|
|
2021-06-13 12:17:44 +02:00
|
|
|
interface HomePageEditorProps {
|
|
|
|
loggedInUserRowId: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function HomePageEditor(props: HomePageEditorProps): React.ReactElement {
|
2020-12-31 11:36:23 +01:00
|
|
|
const classes = useStyles();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Container maxWidth="lg" className={classes.container}>
|
2021-02-08 00:00:12 +01:00
|
|
|
<Switch>
|
|
|
|
<Route exact path={editorRoutes.question.path}>
|
|
|
|
<QuestionList />
|
|
|
|
<CategoryList />
|
|
|
|
</Route>
|
|
|
|
<Route path={editorRoutes.userManagement.path}>
|
2021-06-13 12:17:44 +02:00
|
|
|
<UserManagement loggedInPersonRowId={props.loggedInUserRowId} />
|
2021-02-08 00:00:12 +01:00
|
|
|
</Route>
|
2021-06-20 10:49:43 +02:00
|
|
|
<Route path={editorRoutes.editInformation.path}>
|
|
|
|
<EditInformation loggedInPersonRowId={props.loggedInUserRowId} />
|
|
|
|
</Route>
|
2021-02-08 00:00:12 +01:00
|
|
|
</Switch>
|
2021-01-09 12:32:17 +01:00
|
|
|
<Copyright />
|
2020-12-31 11:36:23 +01:00
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
}
|