This commit is contained in:
Noe 2023-07-06 09:16:49 +02:00
parent ba9b134f07
commit c0be353f3c
15 changed files with 355 additions and 199 deletions

View File

@ -27,7 +27,7 @@
"defaultMessage": "Create new user" "defaultMessage": "Create new user"
}, },
"customerName": { "customerName": {
"defaultMessage": "Customer name" "defaultMessage": "Customer"
}, },
"email": { "email": {
"defaultMessage": "Email" "defaultMessage": "Email"
@ -35,8 +35,7 @@
"english": { "english": {
"defaultMessage": "English" "defaultMessage": "English"
}, },
"error": { "error": {},
},
"folder": { "folder": {
"defaultMessage": "Folder" "defaultMessage": "Folder"
}, },

View File

@ -9,7 +9,6 @@
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.316.0", "@aws-sdk/client-s3": "^3.316.0",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5", "@emotion/styled": "^11.10.5",
"@minoru/react-dnd-treeview": "^3.4.1", "@minoru/react-dnd-treeview": "^3.4.1",
"@mui/icons-material": "^5.11.0", "@mui/icons-material": "^5.11.0",
@ -3541,6 +3540,7 @@
"version": "11.10.5", "version": "11.10.5",
"resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.10.5.tgz", "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.10.5.tgz",
"integrity": "sha512-TZs6235tCJ/7iF6/rvTaOH4oxQg2gMAcdHemjwLKIjKz4rRuYe1HJ2TQJKnAcRAfOUDdU8XoDadCe1rl72iv8A==", "integrity": "sha512-TZs6235tCJ/7iF6/rvTaOH4oxQg2gMAcdHemjwLKIjKz4rRuYe1HJ2TQJKnAcRAfOUDdU8XoDadCe1rl72iv8A==",
"peer": true,
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@emotion/babel-plugin": "^11.10.5", "@emotion/babel-plugin": "^11.10.5",
@ -27667,6 +27667,7 @@
"version": "11.10.5", "version": "11.10.5",
"resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.10.5.tgz", "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.10.5.tgz",
"integrity": "sha512-TZs6235tCJ/7iF6/rvTaOH4oxQg2gMAcdHemjwLKIjKz4rRuYe1HJ2TQJKnAcRAfOUDdU8XoDadCe1rl72iv8A==", "integrity": "sha512-TZs6235tCJ/7iF6/rvTaOH4oxQg2gMAcdHemjwLKIjKz4rRuYe1HJ2TQJKnAcRAfOUDdU8XoDadCe1rl72iv8A==",
"peer": true,
"requires": { "requires": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@emotion/babel-plugin": "^11.10.5", "@emotion/babel-plugin": "^11.10.5",

View File

@ -4,7 +4,6 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.316.0", "@aws-sdk/client-s3": "^3.316.0",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5", "@emotion/styled": "^11.10.5",
"@minoru/react-dnd-treeview": "^3.4.1", "@minoru/react-dnd-treeview": "^3.4.1",
"@mui/icons-material": "^5.11.0", "@mui/icons-material": "^5.11.0",

View File

@ -47,13 +47,15 @@ const App = () => {
<Container maxWidth="xl" sx={{ marginTop: 2, height: "100vh" }}> <Container maxWidth="xl" sx={{ marginTop: 2, height: "100vh" }}>
<Grid container maxHeight="20vh"> <Grid container maxHeight="20vh">
<Grid item xs={3} container justifyContent="flex-start"> <Grid item xs={3} container justifyContent="flex-start">
<img <img src={innovenergyLogo} alt="innovenergy logo" height="100" />
src={innovenergyLogo}
alt="innovenergy logo"
height="100"
/>
</Grid> </Grid>
<Grid item xs={9} container justifyContent="flex-end" style={{ height: 30 }}> <Grid
item
xs={9}
container
justifyContent="flex-end"
style={{ height: 30 }}
>
<LanguageSelect language={language} setLanguage={setLanguage} /> <LanguageSelect language={language} setLanguage={setLanguage} />
<LogoutButton removeToken={removeToken} /> <LogoutButton removeToken={removeToken} />
</Grid> </Grid>

View File

@ -7,7 +7,10 @@ import { I_Folder } from "../../util/types";
import { GroupContext } from "../Context/GroupContextProvider"; import { GroupContext } from "../Context/GroupContextProvider";
import InnovenergySnackbar from "../InnovenergySnackbar"; import InnovenergySnackbar from "../InnovenergySnackbar";
import InnovenergyButton from "../Layout/InnovenergyButton"; import InnovenergyButton from "../Layout/InnovenergyButton";
import InnovenergyTextfield from "../Layout/InnovenergyTextfield"; import InnovenergyTextfield, {
I_InnovenergyTextfieldProps,
IePropertyGrid,
} from "../Layout/InnovenergyTextfield";
import { UserContext } from "../Context/UserContextProvider"; import { UserContext } from "../Context/UserContextProvider";
interface I_CustomerFormProps { interface I_CustomerFormProps {
@ -54,33 +57,39 @@ const FolderForm = (props: I_CustomerFormProps) => {
}); });
const theme = useTheme(); const theme = useTheme();
const rows: I_InnovenergyTextfieldProps[] = [
{
id: "folder-name-textfield",
disabled: readOnly,
label: intl.formatMessage({
id: "name",
defaultMessage: "Name",
}),
name: "name",
value: formik.values.name,
handleChange: formik.handleChange,
},
{
id: "folder-information-textfield",
disabled: readOnly,
label: intl.formatMessage({
id: "information",
defaultMessage: "Information",
}),
name: "information",
value: formik.values.information,
handleChange: formik.handleChange,
},
];
return ( return (
<> <>
<form onSubmit={formik.handleSubmit}> <form onSubmit={formik.handleSubmit}>
<InnovenergyTextfield <IePropertyGrid rows={rows} />
id="folder-name-textfield"
disabled={readOnly}
label={intl.formatMessage({
id: "name",
defaultMessage: "Name",
})}
name="name"
value={formik.values.name}
handleChange={formik.handleChange}
/>
<InnovenergyTextfield
id="folder-information-textfield"
disabled={readOnly}
label={intl.formatMessage({
id: "information",
defaultMessage: "Information",
})}
name="information"
value={formik.values.information}
handleChange={formik.handleChange}
/>
<Grid container justifyContent="flex-end" sx={{ pt: 1 }}> <Grid container justifyContent="flex-end" sx={{ pt: 1 }}>
{loading && <CircularProgress sx={{color: theme.palette.secondary.main}} />} {loading && (
<CircularProgress sx={{ color: theme.palette.secondary.main }} />
)}
{!readOnly && {!readOnly &&
additionalButtons && additionalButtons &&
additionalButtons.map((button) => button)} additionalButtons.map((button) => button)}

View File

@ -7,7 +7,10 @@ import { I_Installation } from "../../util/types";
import { InstallationContext } from "../Context/InstallationContextProvider"; import { InstallationContext } from "../Context/InstallationContextProvider";
import MoveDialog from "../Groups/Tree/MoveDialog"; import MoveDialog from "../Groups/Tree/MoveDialog";
import InnovenergyButton from "../Layout/InnovenergyButton"; import InnovenergyButton from "../Layout/InnovenergyButton";
import InnovenergyTextfield from "../Layout/InnovenergyTextfield"; import InnovenergyTextfield, {
I_InnovenergyTextfieldProps,
IePropertyGrid,
} from "../Layout/InnovenergyTextfield";
import { UserContext } from "../Context/UserContextProvider"; import { UserContext } from "../Context/UserContextProvider";
import * as Yup from "yup"; import * as Yup from "yup";
@ -73,79 +76,80 @@ const InstallationForm = (props: I_InstallationFormProps) => {
setOpen(false); setOpen(false);
}; };
return ( const rows: I_InnovenergyTextfieldProps[] = [
<form onSubmit={formik.handleSubmit}> {
<InnovenergyTextfield disabled: readOnly,
disabled={readOnly} id: "installation-name-textfield",
id="installation-name-textfield" label: intl.formatMessage({
label={intl.formatMessage({
id: "customerName", id: "customerName",
defaultMessage: "Customer name", defaultMessage: "Customer name",
})} }),
name="name" name: "name",
value={formik.values.name} value: formik.values.name,
handleChange={formik.handleChange} handleChange: formik.handleChange,
helperText={ helperText:
formik.errors.name && formik.touched.name ? formik.errors.name : "" formik.errors.name && formik.touched.name ? formik.errors.name : "",
} error: !!formik.errors.name && formik.touched.name,
error={!!formik.errors.name && formik.touched.name} },
/> {
<InnovenergyTextfield disabled: readOnly,
disabled={readOnly} id: "installation-region-textfield",
id="installation-region-textfield" label: intl.formatMessage({
label={intl.formatMessage({
id: "region", id: "region",
defaultMessage: "Region", defaultMessage: "Region",
})} }),
name="region" name: "region",
value={formik.values.region} value: formik.values.region,
handleChange={formik.handleChange} handleChange: formik.handleChange,
helperText={ helperText:
formik.errors.region && formik.touched.region formik.errors.region && formik.touched.region
? formik.errors.region ? formik.errors.region
: "" : "",
} error: !!formik.errors.region && formik.touched.region,
error={!!formik.errors.region && formik.touched.region} },
/> {
<InnovenergyTextfield disabled: readOnly,
disabled={readOnly} id: "installation-location-textfield",
id="installation-location-textfield" label: intl.formatMessage({
label={intl.formatMessage({
id: "location", id: "location",
defaultMessage: "Location", defaultMessage: "Location",
})} }),
name="location" name: "location",
value={formik.values.location} value: formik.values.location,
handleChange={formik.handleChange} handleChange: formik.handleChange,
helperText={ helperText:
formik.errors.location && formik.touched.location formik.errors.location && formik.touched.location
? formik.errors.location ? formik.errors.location
: "" : "",
} error: !!formik.errors.location && formik.touched.location,
error={!!formik.errors.location && formik.touched.location} },
/> {
<InnovenergyTextfield disabled: readOnly,
disabled={readOnly} id: "installation-country-textfield",
id="installation-country-textfield" label: intl.formatMessage({
label={intl.formatMessage({
id: "country", id: "country",
defaultMessage: "Country", defaultMessage: "Country",
})} }),
name="country" name: "country",
value={formik.values.country} value: formik.values.country,
handleChange={formik.handleChange} handleChange: formik.handleChange,
/> },
<InnovenergyTextfield {
disabled={readOnly} disabled: readOnly,
id="installation-orderNumbers-textfield" id: "installation-orderNumbers-textfield",
label={intl.formatMessage({ label: intl.formatMessage({
id: "orderNumbers", id: "orderNumbers",
defaultMessage: "Order number", defaultMessage: "Order number",
})} }),
name="orderNumbers" name: "orderNumbers",
value={formik.values.orderNumbers} value: formik.values.orderNumbers,
handleChange={formik.handleChange} handleChange: formik.handleChange,
/> },
];
return (
<form onSubmit={formik.handleSubmit}>
<IePropertyGrid rows={rows} />
<Grid container justifyContent="flex-end" sx={{ pt: 1 }}> <Grid container justifyContent="flex-end" sx={{ pt: 1 }}>
{hasMoveButton && !readOnly && <MoveDialog values={values} />} {hasMoveButton && !readOnly && <MoveDialog values={values} />}
{!readOnly && ( {!readOnly && (

View File

@ -1,7 +1,13 @@
import List from "@mui/material/List"; import List from "@mui/material/List";
import ListItemButton from "@mui/material/ListItemButton"; import ListItemButton from "@mui/material/ListItemButton";
import ListItemText from "@mui/material/ListItemText"; import ListItemText from "@mui/material/ListItemText";
import { Alert, CircularProgress, Divider, Grid, useTheme } from "@mui/material"; import {
Alert,
CircularProgress,
Divider,
Grid,
useTheme,
} from "@mui/material";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import useRouteMatch from "../../hooks/useRouteMatch"; import useRouteMatch from "../../hooks/useRouteMatch";
import routes from "../../routes.json"; import routes from "../../routes.json";
@ -45,12 +51,10 @@ const InstallationList = (props: InstallationListProps) => {
routes.installations + routes.list + routes.installation + ":id", routes.installations + routes.list + routes.installation + ":id",
routes.installations + routes.list + routes.liveView + ":id", routes.installations + routes.list + routes.liveView + ":id",
routes.installations + routes.list + routes.log + ":id", routes.installations + routes.list + routes.log + ":id",
]); ]);
const theme = useTheme(); const theme = useTheme();
useEffect(() => { useEffect(() => {
fetchData(); fetchData();
}, [fetchData]); }, [fetchData]);
@ -71,11 +75,12 @@ const InstallationList = (props: InstallationListProps) => {
overflow: "auto", overflow: "auto",
py: 0, py: 0,
mt: 1, mt: 1,
borderRadius: 1.5,
height: height:
routeMatch?.pattern.path === routeMatch?.pattern.path ===
routes.installations + routes.list + routes.log + ":id" routes.installations + routes.list + routes.log + ":id"
? "130px" ? "130px"
: "500px", : "367px",
}} }}
component="nav" component="nav"
aria-labelledby="nested-list-subheader" aria-labelledby="nested-list-subheader"

View File

@ -5,6 +5,7 @@ import routes from "../../routes.json";
import useRouteMatch from "../../hooks/useRouteMatch"; import useRouteMatch from "../../hooks/useRouteMatch";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
import InnovenergyTab from "../Layout/InnovenergyTab"; import InnovenergyTab from "../Layout/InnovenergyTab";
import InnovenergyTabBorder from "../Layout/InnovenergyTab";
import InnovenergyTabs from "components/Layout/InnovenergyTabs"; import InnovenergyTabs from "components/Layout/InnovenergyTabs";
import { useTheme } from "@mui/material"; import { useTheme } from "@mui/material";
import { red } from "@mui/material/colors"; import { red } from "@mui/material/colors";
@ -23,14 +24,12 @@ const InstallationTabs = () => {
if (id) { if (id) {
return ( return (
<Box sx={{ width: "100%", }}> <Box sx={{ width: "100%" }}>
<Box sx={{}}> <Box sx={{}}>
<InnovenergyTabs <InnovenergyTabs
id="installation-tabs" id="installation-tabs"
value={routeMatch?.pattern?.path ?? routes.installation + ":id"} value={routeMatch?.pattern?.path ?? routes.installation + ":id"}
> >
<InnovenergyTab <InnovenergyTab
sx={{ sx={{
"&.Mui-selected": { "&.Mui-selected": {
@ -39,7 +38,8 @@ const InstallationTabs = () => {
borderColor: theme.palette.text.disabled, borderColor: theme.palette.text.disabled,
borderBottom: 0, borderBottom: 0,
mb: -1 / 8, mb: -1 / 8,
}}} },
}}
id={"installation-tab-installation"} id={"installation-tab-installation"}
label={intl.formatMessage({ label={intl.formatMessage({
id: "installation", id: "installation",
@ -52,9 +52,6 @@ const InstallationTabs = () => {
to={routes.installation + id} to={routes.installation + id}
/> />
<InnovenergyTab <InnovenergyTab
sx={{ sx={{
"&.Mui-selected": { "&.Mui-selected": {
@ -63,7 +60,8 @@ const InstallationTabs = () => {
borderColor: theme.palette.text.disabled, borderColor: theme.palette.text.disabled,
borderBottom: 0, borderBottom: 0,
mb: -1 / 8, mb: -1 / 8,
}}} },
}}
id={"installation-tab-liveView"} id={"installation-tab-liveView"}
label={intl.formatMessage({ label={intl.formatMessage({
id: "liveView", id: "liveView",
@ -83,7 +81,8 @@ const InstallationTabs = () => {
borderColor: theme.palette.text.disabled, borderColor: theme.palette.text.disabled,
borderBottom: 0, borderBottom: 0,
mb: -1 / 8, mb: -1 / 8,
}}} },
}}
id={"installation-tab-log"} id={"installation-tab-log"}
label={intl.formatMessage({ label={intl.formatMessage({
id: "log", id: "log",

View File

@ -2,7 +2,6 @@ import { styled, SxProps, Tab, Tabs, Theme, useTheme } from "@mui/material";
import { TabProps } from "@mui/material/Tab/Tab"; import { TabProps } from "@mui/material/Tab/Tab";
import { colors } from "index"; import { colors } from "index";
const InnovenergyTab = (props: any) => { const InnovenergyTab = (props: any) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
@ -36,4 +35,38 @@ const InnovenergyTab = (props: any) => {
); );
}; };
const InnovenergyTabBorder = (props: any) => {
const theme = useTheme();
return (
<Tab
{...props}
disableRipple
sx={{
textTransform: "none",
...props.sx,
bottom: 0,
fontWeight: theme.typography.fontWeightRegular,
fontSize: theme.typography.pxToRem(14),
marginRight: theme.spacing(1),
background: "0 0",
border: "2px solid",
borderColor: "#c0c6d0",
bgcolor: theme.palette.primary.light,
borderTopLeftRadius: "0.3rem",
borderTopRightRadius: "0.3rem",
padding: ".5rem 1rem",
textDecoration: "none",
transition: `color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out`,
"&.Mui-selected": {
color: colors.black,
borderColor: theme.palette.text.disabled,
marginTop: "1px",
bottom: -1,
...(props.sx ? props.sx["&.Mui-selected"] : {}),
},
}}
/>
);
};
export default InnovenergyTab; export default InnovenergyTab;

View File

@ -9,7 +9,6 @@ interface AntTabsProps {
children: ReactNode; children: ReactNode;
} }
const InnovenergyTabs = (props: AntTabsProps) => { const InnovenergyTabs = (props: AntTabsProps) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
@ -31,7 +30,7 @@ const InnovenergyTabs = (props: AntTabsProps) => {
"& .MuiTabs-indicator": { "& .MuiTabs-indicator": {
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
backgroundColor: "transparent", backgroundColor: "red",
}, },
"&.MuiTabs-root": { "&.MuiTabs-root": {
width: "100%", width: "100%",

View File

@ -1,6 +1,18 @@
import { Grid, InputLabel, TextField, useTheme } from "@mui/material"; import {
Grid,
InputLabel,
Paper,
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableRow,
TextField,
useTheme,
} from "@mui/material";
interface I_InnovenergyTextfieldProps { export interface I_InnovenergyTextfieldProps {
id: string; id: string;
label: string; label: string;
value: string; value: string;
@ -13,15 +25,79 @@ interface I_InnovenergyTextfieldProps {
error?: boolean; error?: boolean;
} }
export const IePropertyGrid = (props: {
rows: I_InnovenergyTextfieldProps[];
}) => {
const theme = useTheme();
const findLongestLength = () => {
return (
11 *
props.rows.reduce(
(acc, curr) => (acc > curr.label.length ? acc : curr.label.length),
0
)
);
};
return (
<div style={{ display: "flex", flexDirection: "row" }}>
<div
style={{
display: "flex",
flexDirection: "column",
justifyContent: "space-around",
marginRight: "20px",
}}
>
{props.rows.map((prop) => (
<InputLabel>{prop.label}</InputLabel>
))}
</div>
<div>
{props.rows.map((element) => {
return (
<TextField
color="secondary"
id={element.id}
variant="outlined"
name={element.name}
type={element.type}
fullWidth
sx={{
input: {
bgcolor: "white",
border: 0.5,
borderRadius: 1,
height: 15,
},
my: 0.5,
borderColor: "red",
}}
value={element.value || ""}
onChange={element.handleChange}
InputProps={{
readOnly: element.readOnly,
}}
disabled={element.disabled}
helperText={element.helperText}
error={element.error}
/>
);
})}
</div>
</div>
);
};
const InnovenergyTextfield = (props: I_InnovenergyTextfieldProps) => { const InnovenergyTextfield = (props: I_InnovenergyTextfieldProps) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
<Grid container direction="row" alignItems="center" spacing={2}> <Grid container direction="row" alignItems="center" spacing={2}>
<Grid item xs={2}> <Grid item xs={3}>
<InputLabel>{props.label}</InputLabel> <InputLabel>{props.label}</InputLabel>
</Grid> </Grid>
<Grid item xs={10}> <Grid item xs={9}>
<TextField <TextField
color="secondary" color="secondary"
id={props.id} id={props.id}
@ -36,6 +112,7 @@ const InnovenergyTextfield = (props: I_InnovenergyTextfieldProps) => {
borderRadius: 1, borderRadius: 1,
}, },
my: 0.5, my: 0.5,
borderColor: "red",
}} }}
value={props.value || ""} value={props.value || ""}
onChange={props.handleChange} onChange={props.handleChange}

View File

@ -10,7 +10,6 @@ const ModeButtons = () => {
const routeMatch = useRouteMatch([ const routeMatch = useRouteMatch([
routes.installations + routes.tree + "*", routes.installations + routes.tree + "*",
routes.installations + routes.list + "*", routes.installations + routes.list + "*",
]); ]);
return ( return (
@ -20,21 +19,35 @@ const ModeButtons = () => {
color="primary" color="primary"
value={routeMatch?.pattern?.path} value={routeMatch?.pattern?.path}
exclusive exclusive
sx={{ mb: 1, bgcolor: theme.palette.primary.main,}} sx={{
mb: 1,
bgcolor: theme.palette.primary.light,
}}
size="small" size="small"
> >
<ToggleButton <ToggleButton
color="secondary" sx={{
color: "#707071",
"&.Mui-selected": {
bgcolor: theme.palette.primary.dark,
color: "#707071",
},
}}
id="mode-toggle-button-list" id="mode-toggle-button-list"
value={routes.installations + routes.list + "*"} value={routes.installations + routes.list + "*"}
component={Link} component={Link}
to={routes.list} to={routes.list}
> >
<ListIcon id="mode-toggle-button-list-icon" /> <ListIcon id="mode-toggle-button-list-icon" />
</ToggleButton> </ToggleButton>
<ToggleButton <ToggleButton
color="secondary" sx={{
color: "#707071",
"&.Mui-selected": {
bgcolor: theme.palette.primary.dark,
color: "#707071",
},
}}
id="mode-toggle-button-tree" id="mode-toggle-button-tree"
value={routes.installations + routes.tree + "*"} value={routes.installations + routes.tree + "*"}
component={Link} component={Link}

View File

@ -29,7 +29,8 @@ const NavigationButtons = () => {
borderColor: theme.palette.text.disabled, borderColor: theme.palette.text.disabled,
borderBottom: 0, borderBottom: 0,
mb: -1 / 8, mb: -1 / 8,
}}} },
}}
id="navigation-tab-installations" id="navigation-tab-installations"
value={routes.installations + "*"} value={routes.installations + "*"}
component={Link} component={Link}
@ -49,7 +50,8 @@ const NavigationButtons = () => {
borderColor: theme.palette.text.disabled, borderColor: theme.palette.text.disabled,
borderBottom: 0, borderBottom: 0,
mb: -1 / 8, mb: -1 / 8,
}}} },
}}
id="navigation-tab-users" id="navigation-tab-users"
value={routes.users + "*"} value={routes.users + "*"}
component={Link} component={Link}

View File

@ -1,11 +1,20 @@
import { Alert, CircularProgress, Grid, Snackbar, useTheme } from "@mui/material"; import {
Alert,
CircularProgress,
Grid,
Snackbar,
useTheme,
} from "@mui/material";
import { AxiosError, AxiosResponse } from "axios"; import { AxiosError, AxiosResponse } from "axios";
import { useFormik } from "formik"; import { useFormik } from "formik";
import { useContext, useState } from "react"; import { useContext, useState } from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
import { I_User } from "../../util/user.util"; import { I_User } from "../../util/user.util";
import InnovenergyButton from "../Layout/InnovenergyButton"; import InnovenergyButton from "../Layout/InnovenergyButton";
import InnovenergyTextfield from "../Layout/InnovenergyTextfield"; import InnovenergyTextfield, {
I_InnovenergyTextfieldProps,
IePropertyGrid,
} from "../Layout/InnovenergyTextfield";
import { UserContext } from "../Context/UserContextProvider"; import { UserContext } from "../Context/UserContextProvider";
import { UsersContext } from "../Context/UsersContextProvider"; import { UsersContext } from "../Context/UsersContextProvider";
@ -53,43 +62,49 @@ const UserForm = (props: I_UserFormProps) => {
setOpen(false); setOpen(false);
}; };
return ( const rows: I_InnovenergyTextfieldProps[] = [
<form onSubmit={formik.handleSubmit}> {
<InnovenergyTextfield id: "name-textfield",
id="name-textfield" label: intl.formatMessage({
label={intl.formatMessage({
id: "name", id: "name",
defaultMessage: "Name", defaultMessage: "Name",
})} }),
name="name" name: "name",
value={formik.values.name} value: formik.values.name,
handleChange={formik.handleChange} handleChange: formik.handleChange,
disabled={readOnly} disabled: readOnly,
/> },
<InnovenergyTextfield {
id="email-textfield" id: "email-textfield",
label={intl.formatMessage({ label: intl.formatMessage({
id: "email", id: "email",
defaultMessage: "Email", defaultMessage: "Email",
})} }),
name="email" name: "email",
value={formik.values.email} value: formik.values.email,
handleChange={formik.handleChange} handleChange: formik.handleChange,
disabled={readOnly} disabled: readOnly,
/> },
<InnovenergyTextfield {
id="information-textfield" id: "information-textfield",
label={intl.formatMessage({ label: intl.formatMessage({
id: "Information", id: "Information",
defaultMessage: "Information", defaultMessage: "Information",
})} }),
name="information" name: "information",
value={formik.values.information} value: formik.values.information,
handleChange={formik.handleChange} handleChange: formik.handleChange,
disabled={readOnly} disabled: readOnly,
/> },
];
return (
<form onSubmit={formik.handleSubmit}>
<IePropertyGrid rows={rows} />
<Grid container justifyContent="flex-end" sx={{ pt: 1 }}> <Grid container justifyContent="flex-end" sx={{ pt: 1 }}>
{loading && <CircularProgress sx={{color: theme.palette.secondary.main}} />} {loading && (
<CircularProgress sx={{ color: theme.palette.secondary.main }} />
)}
{currentUser.hasWriteAccess && ( {currentUser.hasWriteAccess && (
<InnovenergyButton type="submit"> <InnovenergyButton type="submit">
<FormattedMessage id="submit" defaultMessage="Submit" /> <FormattedMessage id="submit" defaultMessage="Submit" />

View File

@ -13,20 +13,20 @@ const root = ReactDOM.createRoot(
export const colors = { export const colors = {
black: "#000000", black: "#000000",
blueBlack: '#2b3e54', blueBlack: "#2b3e54",
borderColor: '#c0c6d0', borderColor: "#a8b0be",
background: '#f3f4f7', background: "#f3f4f7",
//change this color in index.css too //change this color in index.css too
greyDark: '#d1d7de', greyDark: "#d1d7de",
greyLight:'#e1e4e7', greyLight: "#e1e4e7",
orangeSelected: '#ffd280', orangeSelected: "#ffd280",
orangeHover: '#ffe4b3', orangeHover: "#ffe4b3",
orangeDark: "#ffc04d", orangeDark: "#ffc04d",
} };
const theme = createTheme({ const theme = createTheme({
components: { components: {
@ -51,7 +51,6 @@ const theme = createTheme({
main: colors.orangeSelected, main: colors.orangeSelected,
light: colors.orangeHover, light: colors.orangeHover,
dark: colors.orangeDark, dark: colors.orangeDark,
}, },
}, },
typography: { typography: {