Newer
Older
import React, { useState } from "react";

William Enright
committed
import General from "./General";
import AppBar from "@mui/material/AppBar";
import Tabs from "@mui/material/Tabs";
import Tab from "@mui/material/Tab";
import Typography from "@mui/material/Typography";
import Box from "@mui/material/Box";
import { infoColor } from "assets/jss/material-dashboard-react.js";
import MuiAlert from "@mui/material/Alert";
return (
<div
role="tabpanel"
hidden={value !== index}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
{...other}
>
{value === index && (
<Box p={3}>
<Typography component="div">{children}</Typography>
children: PropTypes.node,
index: PropTypes.any.isRequired,
value: PropTypes.any.isRequired,
return {
id: `simple-tab-${index}`,
"aria-controls": `simple-tabpanel-${index}`,
};
return <MuiAlert elevation={6} variant="filled" {...props} />;
export default function Settings() {
const [value, setValue] = useState(0);
const [error, setError] = useState(false);
const [severity, setSeverity] = useState("error");
const [errorMessage, setErrorMessage] = useState("Test");
const handleChange = (event, newValue) => {
setValue(newValue);
};
if (!auth.hasAdminScope()) {
return (
<div>
<h4>
{i18next.t(
"you_are_not_allowed_to_access_this_section",
"You are not allowed to access this section. Please contact your administrator to get administrator privileges."
)}
<div>
<AppBar position="static" style={{ background: infoColor[0] }}>
<Tabs
value={value}
onChange={handleChange}
aria-label="simple tabs example"
>

William Enright
committed
<Tab label={i18next.t("general", "General")} {...a11yProps(0)} />
<Tab
label={i18next.t("subscription", "Subscription")}
{...a11yProps(1)}
/>

William Enright
committed
<General
username="admin"
setError={setError}
setErrorMessage={setErrorMessage}
setSeverity={setSeverity}
/>
</TabPanel>
<TabPanel value={value} index={1}>
<Subscription
setError={setError}
setErrorMessage={setErrorMessage}
setSeverity={setSeverity}
/>
</TabPanel>
{error && errorMessage && (
<Alert severity={severity}>{errorMessage}</Alert>
)}
</div>