diff --git a/src/Admin/Components/Components/AdminTemplate.js b/src/Admin/Components/Components/AdminTemplate.js index 42be22cd3f334aa5f78e3c991a509b73267a6379..57fc2a2802bfb3c005b421d670465c36e352d1d8 100644 --- a/src/Admin/Components/Components/AdminTemplate.js +++ b/src/Admin/Components/Components/AdminTemplate.js @@ -18,6 +18,7 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React, { useContext } from "react"; import { Store } from 'Store' +import styled from 'styled-components' const Unauthorized = React.lazy(() => import('./Unauthorized')); const AppBarAdmin = React.lazy(() => import('./AppBar')); @@ -33,10 +34,10 @@ const AdminTemplate = (props) => { const roles = [...state.currentUser.roles]; for (let i = 0; i < roles.length; i++) if (roles[i].name === 'admin' || roles[i].name === 'editor') - canUserEdit = true; + canUserEdit = true; } else { - canUserEdit = false; + canUserEdit = false; } return canUserEdit; @@ -44,21 +45,26 @@ const AdminTemplate = (props) => { if (CheckUserPermission()) return ( - <div style={{ backgroundColor: " #D3D3D3" }}> - <AppBarAdmin /> - <div> + <StyledDiv contrast={state.contrast}> + <AppBarAdmin contrast={state.contrast}/> + <div style={{margin: "20px"}}> {props.inner} </div> - </div> + </StyledDiv> ) else return ( - <div style={{ backgroundColor: " #D3D3D3" }}> + <StyledDiv contrast={state.contrast}> <div> - <Unauthorized /> + <Unauthorized contrast={state.contrast}/> </div> - </div> + </StyledDiv> ) } +const StyledDiv = styled.div` + background-color: ${props => props.contrast === "" ? "white" : "black"}; + color: ${props => props.contrast === "" ? "#666" : "white"}; +` + export default AdminTemplate; diff --git a/src/Admin/Components/Components/AppBar.js b/src/Admin/Components/Components/AppBar.js index b596c35f59484e8754b79c68d787feced4011913..c93e8213b9f2b38c98d0759535f572abda73f742 100644 --- a/src/Admin/Components/Components/AppBar.js +++ b/src/Admin/Components/Components/AppBar.js @@ -6,68 +6,87 @@ import AppBar from "@material-ui/core/AppBar"; import { Tab, Tabs } from "@material-ui/core"; import { Link } from 'react-router-dom' import { TabsItens } from '../../Pages/AdminLabelTabs/LabelTabs' +import styled from "styled-components"; function TabPanel(props) { - const { children, value, index, ...other } = props; + const { children, value, index, ...other } = props; - return ( - <div - role="tabpanel" - hidden={value !== index} - id={`nav-tabpanel-${index}`} - aria-labelledby={`nav-tab-${index}`} - {...other} - > - {value === index && ( - <Box p={3}> - <Typography>{children}</Typography> - </Box> - )} - </div> - ); + return ( + <div + role="tabpanel" + hidden={value !== index} + id={`nav-tabpanel-${index}`} + aria-labelledby={`nav-tab-${index}`} + {...other} + > + {value === index && ( + <Box p={3}> + <Typography>{children}</Typography> + </Box> + )} + </div> + ); } TabPanel.propTypes = { - children: PropTypes.node, - index: PropTypes.any.isRequired, - value: PropTypes.any.isRequired, + children: PropTypes.node, + index: PropTypes.any.isRequired, + value: PropTypes.any.isRequired, }; function a11yProps(index) { - return { - id: `nav-tab-${index}`, - "aria-controls": `nav-tabpanel-${index}`, - }; + return { + id: `nav-tab-${index}`, + "aria-controls": `nav-tabpanel-${index}`, + }; } -export default function AppBarAdmin() { - const [value, setValue] = React.useState(0); +export default function AppBarAdmin(props) { + const [value, setValue] = React.useState(0); - const handleChange = (event, newValue) => { - setValue(newValue); - }; + const handleChange = (event, newValue) => { + setValue(newValue); + }; - return ( - <AppBar position="sticky" color="default"> - <Tabs - variant="scrollable" - scrollButtons="on" - value={value} - onChange={handleChange} - aria-label="nav tabs example" - > - { - TabsItens.map((label, index) => ( - <Tab - key={label.href} - label={label.label} - to={label.href} - icon={label.icon} - component={Link} - {...a11yProps(index)} - /> - )) - } - </Tabs> - </AppBar> - ) -} \ No newline at end of file + return ( + <StyledAppBar position="sticky" contrast={props.contrast}> + <Tabs + variant="scrollable" + scrollButtons="on" + value={value} + onChange={handleChange} + aria-label="nav tabs example" + TabIndicatorProps={{style: {background: props.contrast === "" ? "orange" : "yellow"}}} + > + { + TabsItens.map((label, index) => ( + <StyledTab + contrast={props.contrast} + key={label.href} + label={label.label} + to={label.href} + icon={label.icon} + component={Link} + {...a11yProps(index)} + /> + )) + } + </Tabs> + </StyledAppBar> + ) +} + +const StyledTab = styled(Tab)` + svg { + fill: ${props => props.contrast === "" ? "" : "white"} !important; + } + + color: ${props => props.contrast === "" ? "" : "yellow"} !important; + text-decoration: ${props => props.contrast === "" ? "" : "underline yellow"} !important; +` + +const StyledAppBar = styled(AppBar)` + background-color: ${props => props.contrast === "" ? "white" : "black"} !important; + color: ${props => props.contrast === "" ? "#666" : "white"} !important; + border-bottom: 1px solid ${props => props.contrast === "" ? "black" : "white"} !important; + box-shadow: none !important; +` \ No newline at end of file diff --git a/src/Admin/Components/Components/DataCards/ActivityCard.js b/src/Admin/Components/Components/DataCards/ActivityCard.js index 58497e2ebb7bf62d756b1f85d4c5f0c99d2edaec..6cf4be1116eead8b66f6dd76ac77b3597a98ec53 100644 --- a/src/Admin/Components/Components/DataCards/ActivityCard.js +++ b/src/Admin/Components/Components/DataCards/ActivityCard.js @@ -16,15 +16,14 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import moment from 'moment'; // Maerial ui components -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import Button from "@material-ui/core/Button"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; -import { useStyles } from "../../Styles/DataCard"; +import { useStyles, StyledCard } from "../../Styles/DataCard"; import Grid from "@material-ui/core/Grid"; //imports from local files import { GetAData } from "../../../Filters"; @@ -32,7 +31,12 @@ import { getRequest } from '../../../../Components/HelperFunctions/getAxiosConfi import { Link } from 'react-router-dom' import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import { Store } from 'Store' + const ActivityCard = () => { + + const { state } = useContext(Store); + const classes = useStyles(); const [error, setError] = useState(null); //Necessary to consult the API, catch errors @@ -101,11 +105,11 @@ const ActivityCard = () => { ]; return ( - <Card> + <StyledCard contrast={state.contrast}> <CardContent> <Grid container xs={12} justify="space-between" alignItems="center" alignContent="center"> <Grid item> - <Typography className={classes.title} color="inherit" gutterBottom> + <Typography className={classes.title} gutterBottom> {item.id} </Typography> </Grid> @@ -124,16 +128,16 @@ const ActivityCard = () => { <div style={{ height: "1em" }} /> {DATA.map((info, index) => ( <div className={classes.displayColumn} key={index}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> {info.subTitle} </Typography> - <Typography color="textSecondary"> + <Typography> {info.prop === null ? "Sem dados" : info.prop} </Typography> </div> ))} </CardContent> - </Card> + </StyledCard> ); } }; diff --git a/src/Admin/Components/Components/DataCards/CollectionCard.js b/src/Admin/Components/Components/DataCards/CollectionCard.js index a4ef28da2b30bdff799545b79d7936b5415e19ca..402caaf1a7fd186df1c796e5dabaf1528fd8a126 100644 --- a/src/Admin/Components/Components/DataCards/CollectionCard.js +++ b/src/Admin/Components/Components/DataCards/CollectionCard.js @@ -16,15 +16,14 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import moment from 'moment'; // Maerial ui components -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import Button from "@material-ui/core/Button"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; -import { useStyles } from "../../Styles/DataCard"; +import { useStyles, StyledCard } from "../../Styles/DataCard"; import Grid from '@material-ui/core/Grid'; // Icons import EditRoundedIcon from "@material-ui/icons/EditRounded"; @@ -36,7 +35,12 @@ import LoadingSpinner from '../../../../Components/LoadingSpinner'; import SnackBar from '../../../../Components/SnackbarComponent'; import { getRequest, deleteRequest } from '../../../../Components/HelperFunctions/getAxiosConfig'; +import { Store } from 'Store' + const CollectionCard = () => { + + const { state } = useContext(Store); + let history = useHistory() const classes = useStyles(); const urlParams = new URLSearchParams(window.location.search); @@ -148,7 +152,7 @@ const CollectionCard = () => { ]; return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -164,7 +168,7 @@ const CollectionCard = () => { <CardContent> <Grid xs={12} justify="space-between" alignItems="center" container> <Grid item> - <Typography className={classes.title} color="inherit" gutterBottom> + <Typography className={classes.title} gutterBottom> {item.name} </Typography> </Grid> @@ -202,16 +206,16 @@ const CollectionCard = () => { <div style={{ height: "1em" }} /> {DATA.map((info, index) => ( <div className={classes.displayColumn} key={index}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> {info.subTitle} </Typography> - <Typography color="textSecondary"> + <Typography> {info.prop === null ? "Sem dados" : info.prop} </Typography> </div> ))} </CardContent> - </Card> + </StyledCard> ); } }; diff --git a/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js b/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js index 3a4b844e2b53297d42df642af9dbcc37b7c187a2..92512fb2b7c449a0264adf7631cf5a0447d29475 100644 --- a/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js +++ b/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js @@ -16,16 +16,15 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import moment from 'moment'; // Maerial ui components -import Card from "@material-ui/core/Card"; import Grid from "@material-ui/core/Grid"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import Button from "@material-ui/core/Button"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; -import { useStyles } from "../../Styles/DataCard"; +import { useStyles, StyledCard } from "../../Styles/DataCard"; // Icons import EmailRoundedIcon from '@material-ui/icons/EmailRounded'; //imports from local files @@ -34,7 +33,12 @@ import { Link } from 'react-router-dom' import { getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import { Store } from 'Store' + const CommunityQuestions = () => { + + const { state } = useContext(Store); + const classes = useStyles(); const [error, setError] = useState(null); //Necessary to consult the API, catch errors @@ -83,11 +87,11 @@ const CommunityQuestions = () => { subTitle: "Email", prop: item.email ? - <Link to={`/admin/sendEmail/?email=${item.email}`} style={{ textDecoration: 'none' }}> + <Link to={`/admin/sendEmail/?email=${item.email}`} style={state.contrast === "" ? {textDecoration: "none"} : {textDecoration: "yellow underline", color: "yellow"}}> <Button variant='text' - color='primary' - startIcon={<EmailRoundedIcon />} + color='inherit' + startIcon={<EmailRoundedIcon style={{color: state.contrast === "" ? "" : "white"}}/>} > {item.email} </Button> @@ -104,11 +108,11 @@ const CommunityQuestions = () => { ]; return ( - <Card> + <StyledCard contrast={state.contrast}> <CardContent> <Grid direction="row" justify="space-between" alignContent="center" alignItems="center" container> <Grid item> - <Typography className={classes.title} color="inherit" gutterBottom> + <Typography className={classes.title} gutterBottom> {item.name} </Typography> </Grid> @@ -127,16 +131,16 @@ const CommunityQuestions = () => { <div style={{ height: "1em" }} /> {DATA.map((info, index) => ( <div className={classes.displayColumn} key={index}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> {info.subTitle} </Typography> - <Typography color="textSecondary"> + <Typography> {info.prop === null ? "Sem dados" : info.prop} </Typography> </div> ))} </CardContent> - </Card> + </StyledCard> ); } }; diff --git a/src/Admin/Components/Components/DataCards/ComplaintsCard.js b/src/Admin/Components/Components/DataCards/ComplaintsCard.js index 4c3fc1337f6c2a18d26e20b9191f46bfe003ed1a..9530abea0e17ff016f14d599a2d4102e24acd937 100644 --- a/src/Admin/Components/Components/DataCards/ComplaintsCard.js +++ b/src/Admin/Components/Components/DataCards/ComplaintsCard.js @@ -16,10 +16,9 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import moment from 'moment'; // Maerial ui components -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import Button from "@material-ui/core/Button"; @@ -31,7 +30,7 @@ import GetAppRoundedIcon from "@material-ui/icons/GetAppRounded"; import LaunchRoundedIcon from "@material-ui/icons/LaunchRounded"; import RemoveRoundedIcon from "@material-ui/icons/RemoveRounded"; import RestoreRoundedIcon from "@material-ui/icons/RestoreRounded"; -import { useStyles } from "../../Styles/DataCard"; +import { useStyles, StyledCard } from "../../Styles/DataCard"; import Dialog from '@material-ui/core/Dialog'; import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; @@ -47,16 +46,19 @@ import { apiDomain } from '../../../../env'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import SnackBar from '../../../../Components/SnackbarComponent'; import { getRequest, postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import { Store } from 'Store' //styles const PORTAL_MEC = "https://plataformaintegrada.mec.gov.br/"; const CollectionCard = () => { + + const { state } = useContext(Store); + const classes = useStyles(); const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("id"); - const [error, setError] = useState(null); //Necessary to consult the API, catch errors const [isLoaded, setIsLoaded] = useState(false); //Necessary to consult the API, wait until complete const [item, setItem] = useState({}); //Necessary to consult the API, data @@ -133,7 +135,8 @@ const CollectionCard = () => { style={{ textAlign: "center", padding: "0.5em", - backgroundColor: "#FA8072", + backgroundColor: state.contrast === "" ? "#FA8072" : "black", + border: state.contrast === "" ? "" : "1px solid white", fontWeight: "500", color: "#FFFAFA", }} @@ -150,7 +153,8 @@ const CollectionCard = () => { style={{ textAlign: "center", padding: "0.5em", - backgroundColor: "#FF8C00", + backgroundColor: state.contrast === "" ? "#FF8C00" : "black", + border: state.contrast === "" ? "" : "1px solid white", fontWeight: "500", color: "#FFFAFA", }} @@ -165,7 +169,8 @@ const CollectionCard = () => { style={{ textAlign: "center", padding: "0.5em", - backgroundColor: "#228B22", + backgroundColor: state.contrast === "" ? "#228B22" : "black", + border: state.contrast === "" ? "" : "1px solid white", fontWeight: "500", color: "#FFFAFA", }} @@ -287,7 +292,6 @@ const CollectionCard = () => { > <Grid item> <Typography - color="initial" className={classes.subTitle} variant="h6" > @@ -323,7 +327,6 @@ const CollectionCard = () => { > <Grid item> <Typography - color="initial" className={classes.subTitle} variant="h6" > @@ -513,7 +516,8 @@ const CollectionCard = () => { padding: "0.8em", marginBottom: "1em", marginRight: "1em", - backgroundColor: "#D3D3D3", + backgroundColor: state.contrast === "" ? "#D3D3D3" : "black", + border: state.contrast === "" ? "" : "1px solid white", fontSize: 14, }} > @@ -542,10 +546,10 @@ const CollectionCard = () => { ) : null} {importantData.map((info, index) => ( <Grid item className={classes.displayColumn} key={index}> - <Typography color="textPrimary"> + <Typography> {info.subTitle} </Typography> - <Typography color="textSecondary"> + <Typography> {info.prop === null ? "Sem dados" : info.prop} </Typography> </Grid> @@ -668,20 +672,18 @@ const CollectionCard = () => { md={6} xs={12} > - <Card> + <StyledCard contrast={state.contrast}> <CardContent> <Grid container justify="space-between"> <Grid item> <Typography className={classes.title} - color="inherit" gutterBottom > Denuncia: </Typography> <Typography className={classes.title} - color="inherit" gutterBottom > { @@ -708,10 +710,10 @@ const CollectionCard = () => { <div style={{ height: "1em" }} /> {DATA.map((info, index) => ( <div className={classes.displayColumn} key={index}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> {info.subTitle} </Typography> - <Typography color="textSecondary"> + <Typography> {info.prop === null ? "Sem dados" : info.prop} </Typography> </div> @@ -720,7 +722,7 @@ const CollectionCard = () => { { DisplayButtonsArea(item.complainable_type) } - </Card> + </StyledCard> </Grid> <Grid @@ -729,7 +731,7 @@ const CollectionCard = () => { xs={12} > <Grid item> - <Card> + <StyledCard contrast={state.contrast}> <CardContent> <Typography variant="h5" component="h2"> Denúncia #{item.id} @@ -740,13 +742,12 @@ const CollectionCard = () => { <Grid container className={classes.marginTop}> <Grid item> <Typography - color="textSecondary" className={classes.subTitle} variant="h6" > Descrição </Typography> - <Typography color="initial">{item.description}</Typography> + <Typography>{item.description}</Typography> </Grid> </Grid> @@ -759,24 +760,22 @@ const CollectionCard = () => { > <Grid item> <Typography - color="textSecondary" className={classes.subTitle} > Data </Typography> - <Typography color="initial"> + <Typography> {DisplayDate(item.created_at)} </Typography> </Grid> <Grid item> <Typography - color="textSecondary" className={classes.subTitle} > Denunciante </Typography> - <Typography color="initial">{item.user_id}</Typography> + <Typography>{item.user_id}</Typography> </Grid> </Grid> @@ -785,13 +784,12 @@ const CollectionCard = () => { <Grid container className={classes.marginTop}> <Grid item> <Typography - color="textSecondary" className={classes.subTitle} variant="h6" > Motivo </Typography> - <Typography color="initial"> + <Typography> {item.complaint_reason.reason} </Typography> </Grid> @@ -800,23 +798,22 @@ const CollectionCard = () => { <Grid container className={classes.marginTop}> <Grid item> <Typography - color="textSecondary" className={classes.subTitle} variant="h6" > Status </Typography> - <Typography color="initial"> + <Typography> {item.complaint_reason.status} </Typography> </Grid> </Grid> </CardContent> - </Card> + </StyledCard> </Grid> <Grid item className={classes.marginTop}> - <Card> + <StyledCard contrast={state.contrast}> <CardContent> <Typography variant="h5" component="h2"> Ações @@ -825,7 +822,7 @@ const CollectionCard = () => { Actions(item.state, item.complainable_type) } </CardContent> - </Card> + </StyledCard> </Grid> </Grid> diff --git a/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js b/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js index 6f865726bd0e8719e82fc51b7497b9bf6c2df96f..8108385ed928012ca2d71293ffa1299febf366a6 100644 --- a/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js +++ b/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js @@ -16,10 +16,9 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import moment from "moment"; // Maerial ui components -import Card from "@material-ui/core/Card"; import Paper from "@material-ui/core/Paper"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; @@ -27,7 +26,7 @@ import Button from "@material-ui/core/Button"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; import VisibilityIcon from "@material-ui/icons/Visibility"; import EditRoundedIcon from "@material-ui/icons/EditRounded"; -import { useStyles } from "../../Styles/DataCard"; +import { useStyles, StyledCard } from "../../Styles/DataCard"; import DeleteRoundedIcon from "@material-ui/icons/DeleteRounded"; //imports from local files import { GetAData, DeleteFilter } from "../../../Filters"; @@ -41,7 +40,12 @@ import { } from "../../../../Components/HelperFunctions/getAxiosConfig"; import SnackBar from "../../../../Components/SnackbarComponent"; +import { Store } from 'Store' + const CommunityQuestions = () => { + + const { state } = useContext(Store); + const classes = useStyles(); let history = useHistory(); const urlParams = new URLSearchParams(window.location.search); @@ -189,7 +193,9 @@ const CommunityQuestions = () => { padding: "0.8em", marginBottom: "1em", marginRight: "1em", - backgroundColor: "#D3D3D3", + backgroundColor: state.contrast === "" ? "#D3D3D3" : "black", + color: state.contrast === "" ? "black" : "white", + border: state.contrast === "" ? "" : "1px solid white", fontSize: 14, }} > @@ -206,7 +212,7 @@ const CommunityQuestions = () => { ]; return ( - <Card variant="outlined"> + <StyledCard contrast={state.contrast} variant="outlined"> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -233,7 +239,6 @@ const CommunityQuestions = () => { <Grid item> <Typography className={classes.title} - color="inherit" gutterBottom > {item.name} @@ -305,16 +310,16 @@ const CommunityQuestions = () => { {DATA.map((info, index) => ( <div className={classes.displayColumn} key={index}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> {info.subTitle} </Typography> - <Typography color="textSecondary"> + <Typography> {info.prop === null ? "Sem dados" : info.prop} </Typography> </div> ))} </CardContent> - </Card> + </StyledCard> ); } }; diff --git a/src/Admin/Components/Components/DataCards/InstitutionsCard.js b/src/Admin/Components/Components/DataCards/InstitutionsCard.js index 1791b22d4867fcb2338057acccc185d559c98db4..5819713b002c7718b47e686543cbac11b8012e4b 100644 --- a/src/Admin/Components/Components/DataCards/InstitutionsCard.js +++ b/src/Admin/Components/Components/DataCards/InstitutionsCard.js @@ -16,15 +16,14 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import moment from 'moment' // Maerial ui components -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import Button from "@material-ui/core/Button"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; -import { useStyles } from "../../Styles/DataCard"; +import { useStyles, StyledCard } from "../../Styles/DataCard"; import Grid from '@material-ui/core/Grid'; // Icons import EditRoundedIcon from "@material-ui/icons/EditRounded"; @@ -36,7 +35,12 @@ import { Link, useHistory } from 'react-router-dom'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from 'Store' + const InstitutionCard = () => { + + const { state } = useContext(Store); + const classes = useStyles(); let history = useHistory(); const urlParams = new URLSearchParams(window.location.search); @@ -147,7 +151,7 @@ const InstitutionCard = () => { ]; return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -163,7 +167,7 @@ const InstitutionCard = () => { <CardContent> <Grid container xs={12} justify="space-between" alignItems="center" alignContent="center"> <Grid item> - <Typography className={classes.title} color="inherit" gutterBottom> + <Typography className={classes.title} gutterBottom> {item.name} </Typography> </Grid> @@ -201,16 +205,16 @@ const InstitutionCard = () => { <div style={{ height: "1em" }} /> {DATA.map((info, index) => ( <div className={classes.displayColumn} key={index}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> {info.subTitle} </Typography> - <Typography color="textSecondary"> + <Typography> {info.prop === null ? "Sem dados" : info.prop} </Typography> </div> ))} </CardContent> - </Card> + </StyledCard> ); } }; diff --git a/src/Admin/Components/Components/DataCards/NoteVarCard.js b/src/Admin/Components/Components/DataCards/NoteVarCard.js index 7c7b4356f9f174607e330987ee15081724b080e8..95d77f9849fa8faba97373f2531fddc79098299c 100644 --- a/src/Admin/Components/Components/DataCards/NoteVarCard.js +++ b/src/Admin/Components/Components/DataCards/NoteVarCard.js @@ -16,16 +16,15 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import moment from 'moment'; // Maerial ui components -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import Button from "@material-ui/core/Button"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; import Grid from "@material-ui/core/Grid"; -import { useStyles } from "../../Styles/DataCard"; +import { useStyles, StyledCard } from "../../Styles/DataCard"; // Icons import EditRoundedIcon from "@material-ui/icons/EditRounded"; //imports from local files @@ -34,7 +33,12 @@ import { getRequest } from '../../../../Components/HelperFunctions/getAxiosConfi import { Link } from 'react-router-dom'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import { Store } from 'Store' + const NoteCard = () => { + + const { state } = useContext(Store); + const classes = useStyles(); const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("id"); @@ -98,11 +102,11 @@ const NoteCard = () => { ] return ( - <Card> + <StyledCard contrast={state.contrast}> <CardContent> <Grid container xs={12} justify="space-between" alignContent="center" alignItems="center"> <Grid item> - <Typography className={classes.title} color="inherit" gutterBottom> + <Typography className={classes.title} gutterBottom> {item.name} </Typography> </Grid> @@ -131,16 +135,16 @@ const NoteCard = () => { <div style={{height: "1em"}}/> {DATA.map((info, index) => ( <div className={classes.displayColumn} key={index}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> {info.subTitle} </Typography> - <Typography color="textSecondary"> + <Typography> {info.prop === null ? "Sem dados" : info.prop} </Typography> </div> ))} </CardContent> - </Card> + </StyledCard> ); } }; diff --git a/src/Admin/Components/Components/DataCards/RatingCard.js b/src/Admin/Components/Components/DataCards/RatingCard.js index b5f69a53c800dce0324ec0afb274a97ce315fc8e..efe96c2d7a34301cd9d80ce754421e69d60087fa 100644 --- a/src/Admin/Components/Components/DataCards/RatingCard.js +++ b/src/Admin/Components/Components/DataCards/RatingCard.js @@ -16,16 +16,15 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import moment from 'moment'; // Maerial ui components -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import Button from "@material-ui/core/Button"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; import Grid from "@material-ui/core/Grid"; -import { useStyles } from "../../Styles/DataCard"; +import { useStyles, StyledCard } from "../../Styles/DataCard"; // Icons import EditRoundedIcon from "@material-ui/icons/EditRounded"; import DeleteRoundedIcon from "@material-ui/icons/DeleteRounded"; @@ -36,7 +35,12 @@ import { Link, useHistory } from 'react-router-dom'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from 'Store' + const RatingCard = () => { + + const { state } = useContext(Store); + const classes = useStyles(); let history = useHistory(); const urlParams = new URLSearchParams(window.location.search); @@ -135,7 +139,7 @@ const RatingCard = () => { ]; return ( - <Card variant="outlined"> + <StyledCard contrast={state.contrast} variant="outlined"> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -151,7 +155,7 @@ const RatingCard = () => { <CardContent> <Grid container xs={12} justify="space-between" alignItems="center" alignContent="center"> <Grid item> - <Typography className={classes.title} color="inherit" gutterBottom> + <Typography className={classes.title} gutterBottom> {item.name} </Typography> </Grid> @@ -189,16 +193,16 @@ const RatingCard = () => { <div style={{ height: "1em" }} /> {DATA.map((info, index) => ( <div className={classes.displayColumn} key={index}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> {info.subTitle} </Typography> - <Typography color="textSecondary"> + <Typography> {info.prop === null ? "Sem dados" : info.prop} </Typography> </div> ))} </CardContent> - </Card> + </StyledCard> ); } }; diff --git a/src/Admin/Components/Components/DataCards/UserCard.js b/src/Admin/Components/Components/DataCards/UserCard.js index 0e5563ec5de0e6cf27e3c5cac7e295b91fd789e4..203b45cba896a85f03982f16de455bd5e9314696 100644 --- a/src/Admin/Components/Components/DataCards/UserCard.js +++ b/src/Admin/Components/Components/DataCards/UserCard.js @@ -16,10 +16,9 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import moment from 'moment'; // Maerial ui components -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import Button from "@material-ui/core/Button"; @@ -28,7 +27,7 @@ import Grid from "@material-ui/core/Grid"; import RemoveCircleOutlineRoundedIcon from '@material-ui/icons/RemoveCircleOutlineRounded'; import ListRoundedIcon from "@material-ui/icons/ListRounded"; import Chip from '@material-ui/core/Chip'; -import { useStyles } from "../../Styles/DataCard"; +import { useStyles, StyledCard } from "../../Styles/DataCard"; import EmailRoundedIcon from '@material-ui/icons/EmailRounded'; import EditRoundedIcon from '@material-ui/icons/EditRounded'; import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded'; @@ -41,12 +40,16 @@ import { Link, useHistory } from "react-router-dom"; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import SnackBar from '../../../../Components/SnackbarComponent'; import { getRequest, postRequest, deleteRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import { Store } from 'Store' //styles import styled from 'styled-components'; //Image Import import { noAvatar } from "ImportImages.js"; const CollectionCard = () => { + + const { state } = useContext(Store); + let history = useHistory() const classes = useStyles(); const urlParams = new URLSearchParams(window.location.search); @@ -71,7 +74,8 @@ const CollectionCard = () => { style={{ textAlign: "center", padding: "0.5em", - backgroundColor: "#228B22", + backgroundColor: state.contrast === "" ? "#228B22" : "black", + border: state.contrast === "" ? "" : "1px solid white", fontWeight: "500", color: "#FFFAFA", }} @@ -85,7 +89,8 @@ const CollectionCard = () => { style={{ textAlign: "center", padding: "0.5em", - backgroundColor: "#FF8C00", + backgroundColor: state.contrast === "" ? "#FF8C00" : "black", + border: state.contrast === "" ? "" : "1px solid white", fontWeight: "500", color: "#FFFAFA", }} @@ -99,7 +104,8 @@ const CollectionCard = () => { style={{ textAlign: "center", padding: "0.5em", - backgroundColor: "#FA8072", + backgroundColor: state.contrast === "" ? "#FA8072" : "black", + border: state.contrast === "" ? "" : "1px solid white", fontWeight: "500", color: "#FFFAFA", }} @@ -113,7 +119,8 @@ const CollectionCard = () => { style={{ textAlign: "center", padding: "0.5em", - backgroundColor: "#797D7F ", + backgroundColor: state.contrast === "" ? "#797D7F" : "black", + border: state.contrast === "" ? "" : "1px solid white", fontWeight: "500", color: "#FFFAFA", }} @@ -215,13 +222,14 @@ const CollectionCard = () => { ) } - const isBlocked = (state) => { - if (state === "blocked" || state === "banished") + const isBlocked = (stateb) => { + if (stateb === "blocked" || stateb === "banished") return <Paper style={{ textAlign: "center", padding: "0.5em", - backgroundColor: "red", + backgroundColor: state.contrast === "" ? "red" : "black", + border: state.contrast === "" ? "" : "1px solid white", fontWeight: "500", color: "#FFFAFA", }} @@ -230,8 +238,8 @@ const CollectionCard = () => { </Paper> } - const actionsForBlockedUser = (state) => { - if (state === "blocked" || state === "banished") { + const actionsForBlockedUser = (stateb) => { + if (stateb === "blocked" || stateb === "banished") { return ( <Button style={{ width: "100%", marginBottom: "0.5em" }} @@ -244,9 +252,11 @@ const CollectionCard = () => { </Button> ) } - return <Typography color="textSecondary"> - Usuário não bloqueado - </Typography> + return ( + <Typography> + Usuário não bloqueado + </Typography> + ) } const actionsForStateTeacherRequest = (state) => { @@ -288,9 +298,11 @@ const CollectionCard = () => { </Grid> ) } - return <Typography color="textSecondary"> - Usuário não requisitou conta de professor - </Typography> + return ( + <Typography> + Usuário não requisitou conta de professor + </Typography> + ) } const ReactiveUser = () => { @@ -352,13 +364,12 @@ const CollectionCard = () => { md={6} xs={12} > - <Card> + <StyledCard contrast={state.contrast}> <CardContent> <Grid container justify="space-between"> <Grid item xs={12}> <Typography className={classes.title} - color="inherit" gutterBottom > Identificação do usuário @@ -412,24 +423,24 @@ const CollectionCard = () => { </Grid> <Grid item> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Nome </Typography> - <Typography color="textSecondary"> + <Typography> {item.name === null ? "Sem dados" : item.name} </Typography> </div> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Email </Typography> { item.email ? - <Link to={`/admin/sendEmail?email=${item.email}`} style={{ textDecoration: 'none' }}> + <Link to={`/admin/sendEmail?email=${item.email}`} style={state.contrast === "" ? {textDecoration: "none"} : {textDecoration: "yellow underline", color: "yellow"}}> <Button variant='text' - color='primary' - startIcon={<EmailRoundedIcon />} + color='inherit' + startIcon={<EmailRoundedIcon style={{color: state.contrast === "" ? "" : "white"}}/>} > {item.email} </Button> @@ -437,10 +448,10 @@ const CollectionCard = () => { } </div> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Cpf </Typography> - <Typography color="textSecondary"> + <Typography> {item.cpf === null ? "Sem dados" : item.cpf} </Typography> </div> @@ -448,40 +459,40 @@ const CollectionCard = () => { </Grid> <Grid> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Escola </Typography> - <Typography color="textSecondary"> + <Typography> {item.school ? item.school.name : "Sem dados"} </Typography> </div> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Telefone da escola </Typography> - <Typography color="textSecondary"> + <Typography> {item.school ? item.school.phone : "Sem dados"} </Typography> </div> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> UF </Typography> - <Typography color="textSecondary"> + <Typography> {item.school ? item.school.uf : "Sem dados"} </Typography> </div> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Munícipo </Typography> - <Typography color="textSecondary"> + <Typography> {item.school ? item.school.city : "Sem dados"} </Typography> </div> </Grid> </CardContent> - </Card> + </StyledCard> </Grid> <Grid @@ -490,7 +501,7 @@ const CollectionCard = () => { xs={12} > <Grid item> - <Card> + <StyledCard contrast={state.contrast}> <CardContent> <Typography variant="h5" component="h2"> Informações do perfil @@ -505,10 +516,10 @@ const CollectionCard = () => { <Grid container justify="flex-start"> <Grid item> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Descrição </Typography> - <Typography color="textSecondary"> + <Typography> {item.description} </Typography> </div> @@ -517,10 +528,10 @@ const CollectionCard = () => { <Grid container direction="row" justify="space-between" spacing={1} alignItems="center"> <Grid item> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Criado em </Typography> - <Typography color="textSecondary"> + <Typography> {DisplayDate(item.created_at)} </Typography> </div> @@ -528,10 +539,10 @@ const CollectionCard = () => { <Grid item> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Atualizado em </Typography> - <Typography color="textSecondary"> + <Typography> {DisplayDate(item.updated_at)} </Typography> </div> @@ -540,7 +551,7 @@ const CollectionCard = () => { <Grid item> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Permissões </Typography> <Grid container direction="row"> @@ -548,7 +559,7 @@ const CollectionCard = () => { item.roles.map((tag, index) => { return ( <ChipDiv key={index}> - <Chip label={tag.name} /> + <Chip label={tag.name} style={state.contrast === "" ? {backgroundColor: "#ddd", color: "black"} : {backgroundColor: "black", color: "white", border: "1px solid white"}} /> </ChipDiv> ) }) @@ -560,10 +571,10 @@ const CollectionCard = () => { <Grid container direction="row" spacing={1} justify="space-between" alignItems="center"> <Grid item> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Nota </Typography> - <Typography color="textSecondary"> + <Typography> {item.score} </Typography> </div> @@ -571,10 +582,10 @@ const CollectionCard = () => { <Grid item> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Seguidores </Typography> - <Typography color="textSecondary"> + <Typography> {item.follows_count} </Typography> </div> @@ -582,10 +593,10 @@ const CollectionCard = () => { <Grid item> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Likes </Typography> - <Typography color="textSecondary"> + <Typography> {item.likes_count} </Typography> </div> @@ -593,10 +604,10 @@ const CollectionCard = () => { <Grid item> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Objetos educacionais </Typography> - <Typography color="textSecondary"> + <Typography> {item.learning_objects_count} </Typography> </div> @@ -604,10 +615,10 @@ const CollectionCard = () => { <Grid item> <div className={classes.displayColumn}> - <Typography color="initial" className={classes.subTitle}> + <Typography className={classes.subTitle}> Coleções </Typography> - <Typography color="textSecondary"> + <Typography> {item.collections_count} </Typography> </div> @@ -637,7 +648,7 @@ const CollectionCard = () => { </Grid> </Grid> </CardContent> - </Card> + </StyledCard> </Grid> </Grid> </Grid> diff --git a/src/Admin/Components/Components/Inputs/CreateInstitution.js b/src/Admin/Components/Components/Inputs/CreateInstitution.js index a0ba3c1a55a97bc023537d4e7ad0a444a1c0d8ab..9fb01a1d04040609a98618a1d0a126110ce1e56a 100644 --- a/src/Admin/Components/Components/Inputs/CreateInstitution.js +++ b/src/Admin/Components/Components/Inputs/CreateInstitution.js @@ -16,9 +16,8 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState } from 'react'; +import React, { useState, useContext } from 'react'; //imports material ui componets -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; import { Typography, TextField, Button, Grid } from '@material-ui/core'; @@ -28,11 +27,15 @@ import ListRoundedIcon from '@material-ui/icons/ListRounded'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //router import { Link } from 'react-router-dom'; const CreateInstitution = (props) => { + const { state } = useContext(Store); + const [name, setName] = useState('Nova Instituição'); const [description, setDescription] = useState(''); const [adress, setAdress] = useState(''); @@ -184,7 +187,7 @@ const CreateInstitution = (props) => { } ] return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -252,7 +255,7 @@ const CreateInstitution = (props) => { } </Button> </CardAction> - </Card> + </StyledCard> ); } diff --git a/src/Admin/Components/Components/Inputs/CreateLanguage.js b/src/Admin/Components/Components/Inputs/CreateLanguage.js index 5cca9080607862eeaf69737624770700d5649193..22fedb52f6a21781bd35f232c34168555eeb24d3 100644 --- a/src/Admin/Components/Components/Inputs/CreateLanguage.js +++ b/src/Admin/Components/Components/Inputs/CreateLanguage.js @@ -16,9 +16,8 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState } from 'react'; +import React, { useState, useContext } from 'react'; //imports material ui componets -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; import { Typography, TextField, Button, Grid } from '@material-ui/core'; @@ -28,11 +27,15 @@ import ListRoundedIcon from '@material-ui/icons/ListRounded'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //router import { Link } from 'react-router-dom'; const CreateLanguage = (props) => { + const { state } = useContext(Store); + const [name, setName] = useState('Nova linguagem'); const [code, setCode] = useState(''); @@ -161,7 +164,7 @@ const CreateLanguage = (props) => { ] return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -229,7 +232,7 @@ const CreateLanguage = (props) => { } </Button> </CardAction> - </Card> + </StyledCard> ) } diff --git a/src/Admin/Components/Components/Inputs/CreateQuestion.js b/src/Admin/Components/Components/Inputs/CreateQuestion.js index 37f15756862f80b7347edb1e79499b7c0106ead5..30de715800ca3fc2729b4be36c2d05744c27c8c9 100644 --- a/src/Admin/Components/Components/Inputs/CreateQuestion.js +++ b/src/Admin/Components/Components/Inputs/CreateQuestion.js @@ -16,9 +16,8 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState } from 'react'; +import React, { useState, useContext } from 'react'; //imports material ui componets -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; import { Typography, TextField, Button, Grid } from '@material-ui/core'; @@ -29,11 +28,15 @@ import ListRoundedIcon from '@material-ui/icons/ListRounded'; //imports local files import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import SnackBar from '../../../../Components/SnackbarComponent'; +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //router import { Link } from 'react-router-dom'; const CreateQuestion = (props) => { + const { state } = useContext(Store); + const [status, setStatus] = useState(''); const [description, setDescription] = useState(''); @@ -146,7 +149,7 @@ const CreateQuestion = (props) => { ]; return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -163,7 +166,7 @@ const CreateQuestion = (props) => { <Grid container direction='row' justify='space-between' alignContent="center" alignItems="center" xs={12}> <Grid item> <Typography variant='h4'> - Nova question + Nova pergunta </Typography> </Grid> <Grid item> @@ -235,7 +238,7 @@ const CreateQuestion = (props) => { } </Button> </CardAction> - </Card> + </StyledCard> ); } diff --git a/src/Admin/Components/Components/Inputs/CreateRating.js b/src/Admin/Components/Components/Inputs/CreateRating.js index 3837c9e3dbc1eca1b292307af5c5d71046425513..e0c2b7de4de1e3807903843a0491f3557e6b0b3c 100644 --- a/src/Admin/Components/Components/Inputs/CreateRating.js +++ b/src/Admin/Components/Components/Inputs/CreateRating.js @@ -16,9 +16,8 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState } from 'react'; +import React, { useState, useContext } from 'react'; //imports material ui componets -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; import { Typography, TextField, Button, Grid } from '@material-ui/core'; @@ -27,6 +26,8 @@ import AddRoundedIcon from '@material-ui/icons/AddRounded'; import ListRoundedIcon from '@material-ui/icons/ListRounded'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //imports services import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' //router @@ -34,6 +35,8 @@ import {Link} from 'react-router-dom'; const CreateRating = (props) => { + const { state } = useContext(Store); + const [name, setName] = useState('Novo rating'); const [description, setDescription] = useState(''); @@ -158,7 +161,7 @@ const CreateRating = (props) => { ] return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -226,7 +229,7 @@ const CreateRating = (props) => { } </Button> </CardAction> - </Card> + </StyledCard> ); } diff --git a/src/Admin/Components/Components/Inputs/CreateRole.js b/src/Admin/Components/Components/Inputs/CreateRole.js index 421c8174d7bde52a2abed8ae1249c48f4e01c228..61a54e8f645ae38f14e99646a8b8175559a8fe4a 100644 --- a/src/Admin/Components/Components/Inputs/CreateRole.js +++ b/src/Admin/Components/Components/Inputs/CreateRole.js @@ -16,9 +16,8 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState } from 'react'; +import React, { useState, useContext } from 'react'; //imports material ui componets -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; import { Typography, TextField, Button, Grid } from '@material-ui/core'; @@ -28,11 +27,15 @@ import ListRoundedIcon from '@material-ui/icons/ListRounded'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //router import { Link } from 'react-router-dom'; const CreateRole = (props) => { + const { state } = useContext(Store); + const [name, setName] = useState('Nova role'); const [desc, setDesc] = useState(''); @@ -151,7 +154,7 @@ const CreateRole = (props) => { ] return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -219,7 +222,7 @@ const CreateRole = (props) => { } </Button> </CardAction> - </Card> + </StyledCard> ) } diff --git a/src/Admin/Components/Components/Inputs/EditCollection.js b/src/Admin/Components/Components/Inputs/EditCollection.js index 98b7a38f22c073f9f3c6c5c1863253315491b4c7..86a8f9801ff419ba7d9528422b068833dadb8ba8 100644 --- a/src/Admin/Components/Components/Inputs/EditCollection.js +++ b/src/Admin/Components/Components/Inputs/EditCollection.js @@ -16,11 +16,10 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useContext } from 'react'; //imports material ui components import { Typography, TextField, Button, Grid } from '@material-ui/core'; import CircularProgress from '@material-ui/core/CircularProgress'; -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; import ListRoundedIcon from '@material-ui/icons/ListRounded'; @@ -31,6 +30,8 @@ import SnackBar from '../../../../Components/SnackbarComponent'; import { getRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import LoadingSpinner from '../../../../Components/LoadingSpinner'; import { EditFilter, GetAData } from '../../../Filters'; +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //routers import { Link } from 'react-router-dom'; import ClassicEditor from "@ckeditor/ckeditor5-build-classic" @@ -38,6 +39,8 @@ import { CKEditor } from '@ckeditor/ckeditor5-react'; const EditCollection = () => { + const { state } = useContext(Store); + const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("collection"); @@ -169,7 +172,7 @@ const EditCollection = () => { return <LoadingSpinner text="Carregando..." /> } else { return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -265,7 +268,7 @@ const EditCollection = () => { } </Button> </CardAction> - </Card> + </StyledCard> ) } } diff --git a/src/Admin/Components/Components/Inputs/EditEducationalObect.js b/src/Admin/Components/Components/Inputs/EditEducationalObect.js index 0335f596e6b68e99e450818a4b6c8ffa3ece41bc..e3afb26de7e9a6dab8b606a91ee21679c83e737f 100644 --- a/src/Admin/Components/Components/Inputs/EditEducationalObect.js +++ b/src/Admin/Components/Components/Inputs/EditEducationalObect.js @@ -16,14 +16,13 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from 'react'; import PropTypes from "prop-types"; import SwipeableViews from "react-swipeable-views"; import moment from "moment"; //imports material ui components import { Typography, TextField, Button, Grid } from "@material-ui/core"; import CircularProgress from "@material-ui/core/CircularProgress"; -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from "@material-ui/core/CardActions"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; @@ -42,6 +41,8 @@ import { putRequest, } from "../../../../Components/HelperFunctions/getAxiosConfig"; import { EditFilter } from "../../../Filters"; +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //routers import { Link } from "react-router-dom"; import ClassicEditor from "@ckeditor/ckeditor5-build-classic" @@ -61,6 +62,9 @@ const useStyles = makeStyles((theme) => ({ let text; const EditEducationalObject = () => { + + const { state } = useContext(Store); + const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("learnObj"); @@ -429,7 +433,7 @@ const EditEducationalObject = () => { return <LoadingSpinner text="Carregando..." />; } else { return ( - <Card variant="outlined"> + <StyledCard contrast={state.contrast} variant="outlined"> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -606,7 +610,7 @@ const EditEducationalObject = () => { {isLoading ? <CircularProgress size={24} /> : "Salvar"} </Button> </CardAction> - </Card> + </StyledCard> ); } }; diff --git a/src/Admin/Components/Components/Inputs/EditLanguage.js b/src/Admin/Components/Components/Inputs/EditLanguage.js index c0b71d0ac7607fc968c0fd10145c8be363ad947d..84963ec5785a1531b6934a44c2e0fff3b96d1cc7 100644 --- a/src/Admin/Components/Components/Inputs/EditLanguage.js +++ b/src/Admin/Components/Components/Inputs/EditLanguage.js @@ -16,11 +16,10 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useContext } from 'react'; //imports material ui components import { Typography, TextField, Button, Grid, ButtonGroup } from '@material-ui/core'; import CircularProgress from '@material-ui/core/CircularProgress'; -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; import ListRoundedIcon from '@material-ui/icons/ListRounded'; @@ -28,6 +27,8 @@ import SaveIcon from '@material-ui/icons/Save'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //imports services import { getRequest, putRequest, deleteRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData, DeleteFilter } from '../../../Filters'; @@ -37,6 +38,8 @@ import { Link, useHistory } from 'react-router-dom'; const EditLanguage = () => { + const { state } = useContext(Store); + let history = useHistory() const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("language"); @@ -215,7 +218,7 @@ const EditLanguage = () => { return <LoadingSpinner text="Carregando..." /> } else { return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -289,7 +292,7 @@ const EditLanguage = () => { } </Button> </CardAction> - </Card> + </StyledCard> ) } } diff --git a/src/Admin/Components/Components/Inputs/EditRating.js b/src/Admin/Components/Components/Inputs/EditRating.js index e4e08aa1025b55885a18bd257529cfe47e647c31..8fc402de672859fa6a76597ff6b11da5308bdc9f 100644 --- a/src/Admin/Components/Components/Inputs/EditRating.js +++ b/src/Admin/Components/Components/Inputs/EditRating.js @@ -16,11 +16,10 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useContext } from 'react'; //imports material ui components import { Typography, TextField, Button, Grid } from '@material-ui/core'; import CircularProgress from '@material-ui/core/CircularProgress'; -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; import ListRoundedIcon from '@material-ui/icons/ListRounded'; @@ -28,6 +27,8 @@ import SaveIcon from '@material-ui/icons/Save'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //imports services import { getRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData } from '../../../Filters'; @@ -36,6 +37,8 @@ import { Link } from 'react-router-dom'; const EditRating = () => { + const { state } = useContext(Store); + const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("rating"); @@ -194,7 +197,7 @@ const EditRating = () => { return <LoadingSpinner text="Carregando..." /> } else { return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -262,7 +265,7 @@ const EditRating = () => { } </Button> </CardAction> - </Card> + </StyledCard> ) } } diff --git a/src/Admin/Components/Components/Inputs/EditRoles.js b/src/Admin/Components/Components/Inputs/EditRoles.js index c9c49f583904b97a920884d0539c8834cc5d698c..b1d4114ef18305e6bb00209bee75b5798cc1e9d4 100644 --- a/src/Admin/Components/Components/Inputs/EditRoles.js +++ b/src/Admin/Components/Components/Inputs/EditRoles.js @@ -16,11 +16,10 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useContext } from 'react'; //imports material ui components import { Typography, TextField, Button, Grid } from '@material-ui/core'; import CircularProgress from '@material-ui/core/CircularProgress'; -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; import ListRoundedIcon from '@material-ui/icons/ListRounded'; @@ -30,6 +29,8 @@ import DeleteRoundedIcon from "@material-ui/icons/DeleteRounded"; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //imports services import { getRequest, putRequest, deleteRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData, DeleteFilter } from '../../../Filters'; @@ -37,6 +38,9 @@ import { EditFilter, GetAData, DeleteFilter } from '../../../Filters'; import { Link, useHistory } from 'react-router-dom'; const EditLanguage = () => { + + const { state } = useContext(Store); + let history = useHistory() const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("role"); @@ -208,7 +212,7 @@ const EditLanguage = () => { return <LoadingSpinner text="Carregando..." /> } else { return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -282,7 +286,7 @@ const EditLanguage = () => { } </Button> </CardAction> - </Card> + </StyledCard> ) } } diff --git a/src/Admin/Components/Components/Inputs/EditUser.js b/src/Admin/Components/Components/Inputs/EditUser.js index d0953435a8c1565451e85f4ca468fe14d83392fb..48f8ead0c66c6a2ed4a399825182189ec9e803a5 100644 --- a/src/Admin/Components/Components/Inputs/EditUser.js +++ b/src/Admin/Components/Components/Inputs/EditUser.js @@ -16,11 +16,10 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useContext } from 'react'; //imports material ui components import { Typography, TextField, Button, Grid } from '@material-ui/core'; import CircularProgress from '@material-ui/core/CircularProgress'; -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; import ListRoundedIcon from '@material-ui/icons/ListRounded'; @@ -35,6 +34,8 @@ import MenuItem from '@material-ui/core/MenuItem'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //imports services import { getRequest, putRequest, deleteRequest, postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData } from '../../../Filters'; @@ -56,6 +57,9 @@ const useStyles = makeStyles((theme) => ({ })); const EditUser = () => { + + const { state } = useContext(Store); + const classes = useStyles(); let history = useHistory(); @@ -466,7 +470,7 @@ const EditUser = () => { return <LoadingSpinner text="Carregando..." /> } else { return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -601,7 +605,7 @@ const EditUser = () => { </Button> } </CardAction> - </Card> + </StyledCard> ) } } diff --git a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js index 874879d4c095fd1e9cfeee7279d7898621106081..078e4345fad994dc7064067f6b94d1db85fb3b3a 100644 --- a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js +++ b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js @@ -16,12 +16,11 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useContext } from 'react'; //imports material ui components import { TextField, Button } from '@material-ui/core'; import CircularProgress from '@material-ui/core/CircularProgress'; import SaveIcon from '@material-ui/icons/Save'; -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; @@ -29,6 +28,8 @@ import Grid from "@material-ui/core/Grid"; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //imports services import { putRequest, getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData } from '../../../Filters'; @@ -37,6 +38,8 @@ import { Link } from 'react-router-dom'; const EditInstitution = () => { + const { state } = useContext(Store); + const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("institution"); @@ -218,7 +221,7 @@ const EditInstitution = () => { return <LoadingSpinner text="Carregando..." /> } else { return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -293,7 +296,7 @@ const EditInstitution = () => { </div> </CardContent> - </Card> + </StyledCard> ); } } diff --git a/src/Admin/Components/Components/Inputs/NoteVarInputs.js b/src/Admin/Components/Components/Inputs/NoteVarInputs.js index 96b951f99289e01ce4f3d6dc0a7e2a3db44678f9..2437fe36891da904d9871bc3563fd3a99e33df20 100644 --- a/src/Admin/Components/Components/Inputs/NoteVarInputs.js +++ b/src/Admin/Components/Components/Inputs/NoteVarInputs.js @@ -16,12 +16,11 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useContext } from 'react'; //imports material ui components import { TextField, Button } from '@material-ui/core'; import CircularProgress from '@material-ui/core/CircularProgress'; import SaveIcon from '@material-ui/icons/Save'; -import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; @@ -29,6 +28,8 @@ import Grid from '@material-ui/core/Grid'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import { StyledCard } from "../../../Components/Styles/DataCard"; +import { Store } from 'Store' //imports services import { getRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData } from '../../../Filters'; @@ -37,6 +38,8 @@ import { Link } from 'react-router-dom'; const NoteVarInputs = () => { + const { state } = useContext(Store); + const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("id"); @@ -222,7 +225,7 @@ const NoteVarInputs = () => { return <LoadingSpinner text="Carregando..." /> } else { return ( - <Card> + <StyledCard contrast={state.contrast}> <SnackBar severity={snackInfo.icon} text={snackInfo.message} @@ -295,7 +298,7 @@ const NoteVarInputs = () => { </div> </CardContent> - </Card> + </StyledCard> ) } } diff --git a/src/Admin/Components/Components/MobileComponents/MobilePageHeader.js b/src/Admin/Components/Components/MobileComponents/MobilePageHeader.js index f3520c9f12319310eba1544dd60d551aa001a29e..fdc09e14d505d71d969f5a22a2211592a5347264 100644 --- a/src/Admin/Components/Components/MobileComponents/MobilePageHeader.js +++ b/src/Admin/Components/Components/MobileComponents/MobilePageHeader.js @@ -16,17 +16,20 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React from "react"; +import React, { useContext } from "react"; import Paper from "@material-ui/core/Paper" import Grid from "@material-ui/core/Grid" import Button from "@material-ui/core/Button" import Typography from "@material-ui/core/Typography" import CircularProgress from "@material-ui/core/CircularProgress" +import styled from 'styled-components' +import { Store } from 'Store' const MobilePageHeader = (props) => { + const { state } = useContext(Store); return ( - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> + <Paper style={{marginBottom: "2em", marginTop: "2em", marginLeft: "1em", marginRight: "1em"}}> + <StyledGrid contrast={state.contrast} container spacing={3} direction="row" alignItems="center"> <Grid item xs={12}> <Typography variant="h4">{props.title}</Typography> </Grid> @@ -52,10 +55,17 @@ const MobilePageHeader = (props) => { })} </Grid> </Grid> - </Grid> + </StyledGrid> {props.children} </Paper> ) } +const StyledGrid = styled(Grid)` + background-color: ${props => props.contrast === "" ? "white" : "black"}; + color: ${props => props.contrast === "" ? "#666" : "white"}; + border: 1px solid ${props => props.contrast === "" ? "#666" : "white"}; + border-radius: 10px; +` + export default MobilePageHeader; \ No newline at end of file diff --git a/src/Admin/Components/Components/PageHeader.js b/src/Admin/Components/Components/PageHeader.js index beef3c04f372e78dec96dbe82d252e787555e7e9..8a1bad3752e1049ab922d157d705b058dc44eb01 100644 --- a/src/Admin/Components/Components/PageHeader.js +++ b/src/Admin/Components/Components/PageHeader.js @@ -16,17 +16,20 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React from "react"; +import React, { useContext } from "react"; import Paper from "@material-ui/core/Paper" import Grid from "@material-ui/core/Grid" import Button from "@material-ui/core/Button" import Typography from "@material-ui/core/Typography" import CircularProgress from "@material-ui/core/CircularProgress" +import styled from 'styled-components' +import { Store } from 'Store' const PageHeader = (props) => { + const { state } = useContext(Store); return ( - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> + <Paper style={{marginBottom: "2em", marginTop: "2em", marginLeft: "1em", marginRight: "1em"}}> + <StyledGrid contrast={state.contrast} container spacing={3} direction="row" alignItems="center"> <Grid item xs={6}> <Typography variant="h4">{props.title}</Typography> </Grid> @@ -38,24 +41,40 @@ const PageHeader = (props) => { {props.actions.map((act, index) => { return ( <Grid item key={act.name}> - <Button + <StyledButton + contrast={state.contrast} variant="contained" - color="secondary" disabled={act.isLoading} onClick={act.func} startIcon={act.icon} > - {act.isLoading ? <CircularProgress size={24} /> : act.name} - </Button> + <div style={state.contrast === "" ? {color: "white"} : {color: "yellow"}}> + {act.isLoading ? <CircularProgress size={24} /> : act.name} + </div> + </StyledButton> </Grid> ) })} </Grid> </Grid> - </Grid> + </StyledGrid> {props.children} </Paper> ) } +const StyledGrid = styled(Grid)` + background-color: ${props => props.contrast === "" ? "white" : "black"}; + color: ${props => props.contrast === "" ? "#666" : "white"}; + border: 1px solid ${props => props.contrast === "" ? "#666" : "white"}; + border-radius: 10px; +` + +const StyledButton = styled(Button)` + background-color: ${props => props.contrast === "" ? "#ff7f00" : "black"} !important; + color: white !important; + text-decoration: ${props => props.contrast === "" ? "none" : "underline yellow"} !important; + border: 1px solid ${props => props.contrast === "" ? "" : "white"} !important; +` + export default PageHeader; \ No newline at end of file diff --git a/src/Admin/Components/Components/Unauthorized.js b/src/Admin/Components/Components/Unauthorized.js index 3408a5761c77534efe53f7bbb2dbe6303709eca2..558f3422190d8e72c8d15d075c3167cf7ac03e0a 100644 --- a/src/Admin/Components/Components/Unauthorized.js +++ b/src/Admin/Components/Components/Unauthorized.js @@ -16,19 +16,17 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, {useState, useContext} from 'react'; +import React, {useState} from 'react'; import SnackBar from '../../../Components/SnackbarComponent'; import { Link } from 'react-router-dom'; import styled from "styled-components"; -import { Store } from '../../../Store' -const Unauthorized = () => { - const { state } = useContext(Store); +const Unauthorized = (props) => { const [openSnack, setOpenSnack] = useState(true); return ( - <ContentDiv contrast={state.contrast} style={{ textAlign: 'center' }}> + <ContentDiv contrast={props.contrast} style={{ textAlign: 'center' }}> <SnackBar severity='warning' text='Você não tem as permissões necessárias' diff --git a/src/Admin/Components/Components/Welcome.js b/src/Admin/Components/Components/Welcome.js index 47e4f942e27534ce052b96183368b931c9fb77b1..4780d2bda753710d1612bc56c1da37c5805d84ca 100644 --- a/src/Admin/Components/Components/Welcome.js +++ b/src/Admin/Components/Components/Welcome.js @@ -21,8 +21,8 @@ import {Styles} from '../Styles/WelcomeStyle'; // This file is a component that says welcome to the user -const Welcome = () => { - const classes = Styles(); +const Welcome = (props) => { + const classes = Styles(props.contrast); return( <div style={classes.welcomeContainer}> <p style={classes.welcomeTitle}> @@ -34,5 +34,8 @@ const Welcome = () => { </div> ); } - +/* + <div style={props.contrast === "" ? classes.welcomeContainer : classes.welcomeContainerContrast}> + <p style={props.contrast === "" ? classes.welcomeTitle : classes.welcomeTitleContrast}> +*/ export default Welcome; \ No newline at end of file diff --git a/src/Admin/Components/Styles/DataCard.js b/src/Admin/Components/Styles/DataCard.js index 17083da50639dd57f55aaedbfd45f1f9a825735c..f0f98c0766472f195f8b2ddf7a028ac383b62316 100644 --- a/src/Admin/Components/Styles/DataCard.js +++ b/src/Admin/Components/Styles/DataCard.js @@ -16,7 +16,9 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ +import Card from "@material-ui/core/Card"; import { makeStyles } from "@material-ui/core/styles"; +import styled from 'styled-components' const useStyles = makeStyles({ table: { @@ -53,4 +55,10 @@ const useStyles = makeStyles({ } }); -export { useStyles }; \ No newline at end of file +const StyledCard = styled(Card)` + background-color: ${props => props.contrast === "" ? "white" : "black"} !important; + color: ${props => props.contrast === "" ? "#666" : "white"} !important; + border: 1px solid ${props => props.contrast === "" ? "#666" : "white"} !important; +` + +export { useStyles, StyledCard }; \ No newline at end of file diff --git a/src/Admin/Components/Styles/WelcomeStyle.js b/src/Admin/Components/Styles/WelcomeStyle.js index 11364da864132b3ad83519ac3eaff9704ac81b7d..508848db03916b7b6ad12010329ba07f13e85e9f 100644 --- a/src/Admin/Components/Styles/WelcomeStyle.js +++ b/src/Admin/Components/Styles/WelcomeStyle.js @@ -16,12 +16,11 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -const Styles = () => ({ +const Styles = (contrast) => ({ welcomeContainer : { - padding : '1em 1em', - borderRadius : '22px', - backgroundColor : 'white', - boxShadow : '2px 2px 1px #A9A9A9' + padding: '1em', + borderRadius : '10px', + border: `1px solid ${contrast === "" ? "#666" : "white"}` }, welcomeTitle : { fontWeight : 'bold', diff --git a/src/Admin/Pages/Pages/SubPages/Activity.js b/src/Admin/Pages/Pages/SubPages/Activity.js index c87c1b25fd2b7ce07aac8c36adf11909a794cd9a..379d99019d1728d5c9570e55ee6eb153c1e709a0 100644 --- a/src/Admin/Pages/Pages/SubPages/Activity.js +++ b/src/Admin/Pages/Pages/SubPages/Activity.js @@ -215,7 +215,6 @@ const Activity = () => { > {showFilter ? ( <> - <div style={{ height: "1em" }}></div> <div style={{ alignSelf: "flex-end" }}> <TextField @@ -240,8 +239,6 @@ const Activity = () => { ) : null} </MobilePageHeader> - <div style={{ height: "2em" }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton @@ -295,7 +292,6 @@ const Activity = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -340,7 +336,6 @@ const Activity = () => { > {showFilter ? ( <> - <div style={{ height: "1em" }}></div> <div style={{ alignSelf: "flex-end" }}> <TextField @@ -365,8 +360,6 @@ const Activity = () => { ) : null} </PageHeader> - <div style={{ height: "2em" }}></div> - <TableData top={TOP_LABELS}> <TableBody> {items.map((row, index) => diff --git a/src/Admin/Pages/Pages/SubPages/AproveTeacher.js b/src/Admin/Pages/Pages/SubPages/AproveTeacher.js index dca8669260e3795ccc28c98d97ce9eea5e9c6b28..84df27d4bd40a90fa95c4daf810b35b8d79fc79d 100644 --- a/src/Admin/Pages/Pages/SubPages/AproveTeacher.js +++ b/src/Admin/Pages/Pages/SubPages/AproveTeacher.js @@ -397,7 +397,6 @@ const AproveTeacher = () => { > {showFilter ? ( <> - <div style={{ height: "1em" }}></div> {showFilter ? ( <Grid container @@ -451,8 +450,6 @@ const AproveTeacher = () => { ) : null} </MobilePageHeader> - <div style={{ height: "2em" }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton> @@ -538,7 +535,6 @@ const AproveTeacher = () => { > Recusar </Button> - <div style={{ height: "0.5em" }} /> <Button variant="contained" color="primary" @@ -559,7 +555,6 @@ const AproveTeacher = () => { } ]} /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -606,7 +601,6 @@ const AproveTeacher = () => { > {showFilter ? ( <> - <div style={{ height: "1em" }}></div> {showFilter ? ( <Grid container @@ -660,8 +654,6 @@ const AproveTeacher = () => { ) : null} </PageHeader> - <div style={{ height: "2em" }}></div> - <Grid xs={12} container> <TableData top={TOP_LABELS} @@ -733,7 +725,6 @@ const AproveTeacher = () => { > Recusar </Button> - <div style={{ height: "0.5em" }} /> <Button variant="contained" color="primary" diff --git a/src/Admin/Pages/Pages/SubPages/BlockedUsers.js b/src/Admin/Pages/Pages/SubPages/BlockedUsers.js index ba077fdae792fd4eb6c7d6a4cc9a7362631e877d..7915870fa7aec7c90c69ad31fb2954af582f31ef 100644 --- a/src/Admin/Pages/Pages/SubPages/BlockedUsers.js +++ b/src/Admin/Pages/Pages/SubPages/BlockedUsers.js @@ -297,8 +297,6 @@ const BlockedUsers = () => { </Grid> </MobilePageHeader> - <div style={{ height: '2em' }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton> @@ -376,7 +374,6 @@ const BlockedUsers = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -431,8 +428,6 @@ const BlockedUsers = () => { </Grid> </PageHeader> - <div style={{ height: '2em' }}></div> - <TableData top={topTable} onIconPressed={cleanArrayAndInvert} diff --git a/src/Admin/Pages/Pages/SubPages/Collections.js b/src/Admin/Pages/Pages/SubPages/Collections.js index dd15cbaefc69bf3b14657d8c13393f05b9c0edf0..feec6ec26d0616e0c3a74940883ed10436a3bb22 100644 --- a/src/Admin/Pages/Pages/SubPages/Collections.js +++ b/src/Admin/Pages/Pages/SubPages/Collections.js @@ -16,7 +16,7 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState, useContext } from "react"; import moment from "moment"; //imports from local files import TableData from "../../../Components/Components/Table"; @@ -44,560 +44,563 @@ import FilterListRoundedIcon from "@material-ui/icons/FilterListRounded"; import VisibilityIcon from "@material-ui/icons/Visibility"; import DeleteIcon from "@material-ui/icons/Delete"; import { - deleteRequest, - getRequest, + deleteRequest, + getRequest, } from "../../../../Components/HelperFunctions/getAxiosConfig"; //routers import { Link } from "react-router-dom"; import styled from 'styled-components' +import { Store } from 'Store' + const StyledTableCell = withStyles((theme) => ({ - head: { - backgroundColor: theme.palette.common.black, - color: theme.palette.common.white, - }, - body: { - fontSize: 14, - }, + head: { + backgroundColor: theme.palette.common.black, + color: theme.palette.common.white, + }, + body: { + fontSize: 14, + }, }))(TableCell); const StyledTableRow = withStyles((theme) => ({ - root: { - "&:nth-of-type(odd)": { - backgroundColor: theme.palette.action.hover, + root: { + "&:nth-of-type(odd)": { + backgroundColor: theme.palette.action.hover, + }, }, - }, }))(TableRow); const Collections = () => { - const ADD_ONE_LENGHT = [""]; - const TOP_LABELS = [ - "NOME", - "DESCRIÇÃO", - "DONO(A)", - "CRIAÇÃO", - "ATUALIZAÇÃO", - "PRIVACIDADE", - "VISUALIZAR", - "DELETAR", - ]; //Labels from Table - - const WINDOW_WIDTH = window.innerWidth; - - const [error, setError] = useState(null); //Necessary to consult the API, catch errors - const [isLoaded, setIsLoaded] = useState(false); //Necessary to consult the API, wait until complete - const [items, setItems] = useState([]); //Necessary to consult the API, data - - const [isLoadingMoreItems, setIsLoadingMoreItems] = useState(false); //controlls the state of loadind more data - - const [showFilter, setShowFilter] = useState(false); - const [valueOfSearch, setValueOfSearch] = useState("") - const [search, setSearch] = useState(""); - const [currPage, setCurrPage] = useState(0) - - const [openAlertDialog, setOpenAlertDialog] = useState(false); - const [deleteItem, setDeleteItem] = useState({}); //Delete Item - const [isLoadingToDelete, setIsLoadingToDelete] = useState(null); - const [option, setOption] = useState(); //labels of the text field 'to' - - const [snackInfo, setSnackInfo] = useState({ - message: "", - icon: "", - open: false, - color: "", - }); - - const privacyOptions = [ - { name: "private", value: "Privado" }, - { name: "public", value: "Público" } - ]; - - - //handle snack info - const HandleSnack = (message, state, icon, color) => { - setSnackInfo({ - message: message, - icon: icon, - open: state, - color: color, + + const { state } = useContext(Store) + + const ADD_ONE_LENGHT = [""]; + const TOP_LABELS = [ + "NOME", + "DESCRIÇÃO", + "DONO(A)", + "CRIAÇÃO", + "ATUALIZAÇÃO", + "PRIVACIDADE", + "VISUALIZAR", + "DELETAR", + ]; //Labels from Table + + const WINDOW_WIDTH = window.innerWidth; + + const [error, setError] = useState(null); //Necessary to consult the API, catch errors + const [isLoaded, setIsLoaded] = useState(false); //Necessary to consult the API, wait until complete + const [items, setItems] = useState([]); //Necessary to consult the API, data + + const [isLoadingMoreItems, setIsLoadingMoreItems] = useState(false); //controlls the state of loadind more data + + const [showFilter, setShowFilter] = useState(false); + const [valueOfSearch, setValueOfSearch] = useState("") + const [search, setSearch] = useState(""); + const [currPage, setCurrPage] = useState(0) + + const [openAlertDialog, setOpenAlertDialog] = useState(false); + const [deleteItem, setDeleteItem] = useState({}); //Delete Item + const [isLoadingToDelete, setIsLoadingToDelete] = useState(null); + const [option, setOption] = useState(); //labels of the text field 'to' + + const [snackInfo, setSnackInfo] = useState({ + message: "", + icon: "", + open: false, + color: "", }); - }; - - //Defines which row must show the circular progress - const HandleStateCircularProgress = (i) => { - setIsLoadingToDelete(i); - }; - - //Called when user want to delete one institution - async function DeleteHandler() { - const id = deleteItem.id; - HandleStateAlertDialog(null); - deleteRequest( - DeleteFilter("collections", id), - (data) => { - if (data.errors) - HandleSnack("Ocorreu algum erro", true, "warning", "#FA8072"); - else { - HandleSnack( - "A Coleção foi deletada com sucesso", - true, - "success", - "#228B22" - ); - setCurrPage(0) - HandleStateCircularProgress(null); - removeItemFromList(id); - } - }, - (error) => { - HandleSnack("Ocorreu algum erro", true, "warning", "#FA8072"); - HandleStateCircularProgress(null); - } - ); - } - - //Controlls the state of the Alert Dialog - const HandleStateAlertDialog = (i) => { - const obj = { ...items[i] }; - setDeleteItem(obj); - setOpenAlertDialog(!openAlertDialog); - }; - - // handle change of privacy - const handleChange = (e) => { - setOption(e.target.value); - }; - - const HandleSearch = (e) => { - setValueOfSearch(e.target.value) - } - - const DisplayDate = (date) => { - const convertedData = moment.utc(date); - return moment(convertedData) - .format("LLL") - .toString(); - }; - - const buildUrl = (privacyOpt, name) => { - if (privacyOpt && name) - return Url("collections", `"privacy" : "${privacyOpt}", "name" : "${name}"`, currPage, "DESC") - else if (privacyOpt) - return Url("collections", `"privacy" : "${privacyOpt}"`, currPage, "DESC") - else if (name) - return Url("collections", `"name" : "${name}"`, currPage, "DESC") - else - return Url("collections", "", currPage, "DESC") - } - - const removeItemFromList = (itemId) => { - let index = -1; - for (let i = 0; i < items.length; i++) { - const element = items[i]; - if (element.id === itemId) { - index = i - break - } + + const privacyOptions = [ + { name: "private", value: "Privado" }, + { name: "public", value: "Público" } + ]; + + + //handle snack info + const HandleSnack = (message, state, icon, color) => { + setSnackInfo({ + message: message, + icon: icon, + open: state, + color: color, + }); + }; + + //Defines which row must show the circular progress + const HandleStateCircularProgress = (i) => { + setIsLoadingToDelete(i); + }; + + //Called when user want to delete one institution + async function DeleteHandler() { + const id = deleteItem.id; + HandleStateAlertDialog(null); + deleteRequest( + DeleteFilter("collections", id), + (data) => { + if (data.errors) + HandleSnack("Ocorreu algum erro", true, "warning", "#FA8072"); + else { + HandleSnack( + "A Coleção foi deletada com sucesso", + true, + "success", + "#228B22" + ); + setCurrPage(0) + HandleStateCircularProgress(null); + removeItemFromList(id); + } + }, + (error) => { + HandleSnack("Ocorreu algum erro", true, "warning", "#FA8072"); + HandleStateCircularProgress(null); + } + ); } - if (index !== -1) { - const cpyItems = [...items] - cpyItems.splice(index, 1) - setItems(cpyItems) + + //Controlls the state of the Alert Dialog + const HandleStateAlertDialog = (i) => { + const obj = { ...items[i] }; + setDeleteItem(obj); + setOpenAlertDialog(!openAlertDialog); + }; + + // handle change of privacy + const handleChange = (e) => { + setOption(e.target.value); + }; + + const HandleSearch = (e) => { + setValueOfSearch(e.target.value) } - } - - useEffect(() => { - if (currPage === 0) - setIsLoaded(false) - else - setIsLoadingMoreItems(true) - getRequest( - buildUrl(option, search), - (data, header) => { - const arrData = [...data] - if (arrData.length === 0) { - HandleSnack('Não há mais dados para serem carregados', true, 'warning', '#FFC125') - } else { - const arrItems = [...items] - if (currPage === 0) { - setItems(arrData.concat(ADD_ONE_LENGHT)) - } - else { - arrItems.pop(); //Deleting the last position, that was used to display the button of load more items - const arrResult = arrItems.concat(arrData) - setItems(arrResult.concat(ADD_ONE_LENGHT)) - } - } - setIsLoaded(true) - setIsLoadingMoreItems(false) - }, - (error) => { - HandleSnack('Erro ao carregar os dados', true, 'warning', '#FA8072') - setIsLoadingMoreItems(false) - setIsLoaded(true) - setError(true) - } - ) - }, [currPage, search, option]) - - useEffect(() => { - setCurrPage(0) - setOption() - setSearch("") - setValueOfSearch("") - }, [showFilter]) - - if (error) { - return <div>Error: {error.message}</div>; - } else if (!isLoaded) { - return <LoadingSpinner text="Carregando..." />; - } else { - if (WINDOW_WIDTH <= 1024) { - return ( - <> - <SnackBar - severity={snackInfo.icon} - text={snackInfo.message} - snackbarOpen={snackInfo.open} - color={snackInfo.color} - handleClose={() => - setSnackInfo({ - message: "", - icon: "", - open: false, - color: "", - }) + + const DisplayDate = (date) => { + const convertedData = moment.utc(date); + return moment(convertedData) + .format("LLL") + .toString(); + }; + + const buildUrl = (privacyOpt, name) => { + if (privacyOpt && name) + return Url("collections", `"privacy" : "${privacyOpt}", "name" : "${name}"`, currPage, "DESC") + else if (privacyOpt) + return Url("collections", `"privacy" : "${privacyOpt}"`, currPage, "DESC") + else if (name) + return Url("collections", `"name" : "${name}"`, currPage, "DESC") + else + return Url("collections", "", currPage, "DESC") + } + + const removeItemFromList = (itemId) => { + let index = -1; + for (let i = 0; i < items.length; i++) { + const element = items[i]; + if (element.id === itemId) { + index = i + break } - /> - <AlertDialog - open={openAlertDialog} - OnDelete={DeleteHandler} - deleteItem={deleteItem} - HandleClose={() => { - setOpenAlertDialog(false); - HandleStateCircularProgress(null); - }} - /> - <MobilePageHeader - title="Coleções" - actions={[ - { - name: "Atualizar", - isLoading: false, - func: () => { - setCurrPage(0) - }, - icon: <UpdateRoundedIcon /> - }, - { - name: "Filtrar", - isLoading: false, - func: () => { - setShowFilter(!showFilter); - }, - icon: <FilterListRoundedIcon /> - } - ]} - > - {showFilter ? ( - <> - <div style={{ height: "1em" }}></div> - - <Grid - container - alignItems="center" - alignContent="center" - xs={12} - direction="row" - justify="space-between" - > - <Grid item> - <TextField - select - label="Filtro" - value={option} - onChange={handleChange} - helperText="Por favor, selecione uma das opções" - > - {privacyOptions.map((option, index) => ( - <MenuItem - key={option.value} - value={option.name} - name={option.value} - > - {option.value} - </MenuItem> - ))} - </TextField> - </Grid> - - <Grid item> - <TextField - label="Pesquisa" - value={valueOfSearch} - helperText="Ao digitar, tire o foco do campo de texto" - onChange={(event) => HandleSearch(event)} - onBlur={(event) => setSearch(event.target.value)} - ></TextField> - </Grid> - </Grid> - </> - ) : null} - </MobilePageHeader> - - <div style={{ height: "2em" }}></div> - - {items.map((row, index) => - index === items.length - 1 ? ( - <StyledDivButton - key={new Date().toISOString() + row.created_at} - > - <Button - color="primary" - variant="text" - // disabled={isLoadingMoreItems} - startIcon={<AddRoundedIcon />} - disabled={isLoadingMoreItems} - onClick={() => { - setCurrPage(currPage + 1) - }} - > - {isLoadingMoreItems ? ( - <CircularProgress size={24} /> - ) : ( - "Carregar mais itens" - )} - </Button> - </StyledDivButton> - ) : ( - <> - <MobileList - key={new Date().toISOString() + row.created_at} - title={row.name} - subtitle={row.privacy} - backColor={"#e81f4f"} - avatar={<PeopleRoundedIcon />} - href={`/admin/Collection?collection=${row.id}`} - reset={() => { - - }} - data={ - [ - { - title: "ID", - subtitle: row.id - - }, - { - title: "Dono(a)", - subtitle: row.owner ? row.owner.name : "Sem dados" - - }, - { - title: "Criado em", - subtitle: DisplayDate(row.created_at) - }, - { - title: "Atualizado em", - subtitle: DisplayDate(row.updated_at) - }, - { - title: "Deletar", - subtitle: - <Button - variant="contained" - color="secondary" - onClick={() => { - HandleStateAlertDialog(index); - HandleStateCircularProgress(index); - }} - startIcon={<DeleteIcon />} - > - Deletar - </Button> - } - ] - } - /> - <div style={{ height: "0.5em" }} /> - </> - ) - )} - </> - ); + } + if (index !== -1) { + const cpyItems = [...items] + cpyItems.splice(index, 1) + setItems(cpyItems) + } } - else { - return ( - <> - <SnackBar - severity={snackInfo.icon} - text={snackInfo.message} - snackbarOpen={snackInfo.open} - color={snackInfo.color} - handleClose={() => - setSnackInfo({ - message: "", - icon: "", - open: false, - color: "", - }) + + useEffect(() => { + if (currPage === 0) + setIsLoaded(false) + else + setIsLoadingMoreItems(true) + getRequest( + buildUrl(option, search), + (data, header) => { + const arrData = [...data] + if (arrData.length === 0) { + HandleSnack('Não há mais dados para serem carregados', true, 'warning', '#FFC125') + } else { + const arrItems = [...items] + if (currPage === 0) { + setItems(arrData.concat(ADD_ONE_LENGHT)) + } + else { + arrItems.pop(); //Deleting the last position, that was used to display the button of load more items + const arrResult = arrItems.concat(arrData) + setItems(arrResult.concat(ADD_ONE_LENGHT)) + } + } + setIsLoaded(true) + setIsLoadingMoreItems(false) + }, + (error) => { + HandleSnack('Erro ao carregar os dados', true, 'warning', '#FA8072') + setIsLoadingMoreItems(false) + setIsLoaded(true) + setError(true) } - /> - - <PageHeader - title="Coleções" - actions={[ - { - name: "Atualizar", - isLoading: false, - func: () => { - setCurrPage(0) - }, - icon: <UpdateRoundedIcon /> - }, - { - name: "Filtrar", - isLoading: false, - func: () => { - setShowFilter(!showFilter); - }, - icon: <FilterListRoundedIcon /> - } - ]} - > - {showFilter ? ( - <> - <div style={{ height: "1em" }}></div> - - <Grid - container - alignItems="center" - alignContent="center" - xs={12} - direction="row" - justify="space-between" - > - <Grid item> - <TextField - select - label="Filtro" - value={option} - onChange={handleChange} - helperText="Por favor, selecione uma das opções" - > - {privacyOptions.map((option, index) => ( - <MenuItem - key={option.value} - value={option.name} - name={option.value} - > - {option.value} - </MenuItem> - ))} - </TextField> - </Grid> - - <Grid item> - <TextField - label="Pesquisa" - value={valueOfSearch} - helperText="Ao digitar, tire o foco do campo de texto" - onChange={(event) => HandleSearch(event)} - onBlur={(event) => setSearch(event.target.value)} - ></TextField> - </Grid> - </Grid> - </> - ) : null} - </PageHeader> - - <div style={{ height: "2em" }}></div> - - <TableData top={TOP_LABELS}> - <TableBody> - {items.map((row, index) => - index === items.length - 1 ? ( - <StyledTableRow key={new Date().toISOString() + row.created_at}> - <StyledTableCell> - <Button - color="primary" - variant="text" - // disabled={isLoadingMoreItems} - startIcon={<AddRoundedIcon />} - disabled={isLoadingMoreItems} - onClick={() => { - setCurrPage(currPage + 1) - }} - > - {isLoadingMoreItems ? ( - <CircularProgress size={24} /> - ) : ( - "Carregar mais itens" - )} - </Button> - </StyledTableCell> - </StyledTableRow> - ) : ( - <StyledTableRow key={new Date().toISOString() + index}> - <StyledTableCell component="th" scope="row"> - {row.name} - </StyledTableCell> - <StyledTableCell align="right"> - <div - dangerouslySetInnerHTML={{ __html: row.description }} - ></div> - </StyledTableCell> - <StyledTableCell align="right"> - {row.owner ? row.owner.name : "Sem dados"} - </StyledTableCell> - <StyledTableCell align="right"> - {DisplayDate(row.created_at)} - </StyledTableCell> - <StyledTableCell align="right"> - {DisplayDate(row.updated_at)} - </StyledTableCell> - <StyledTableCell align="right">{row.privacy}</StyledTableCell> - <StyledTableCell align="right"> - <Link to={`/admin/Collection?collection=${row.id}`}> - <IconButton> - <VisibilityIcon style={{ fill: "#00bcd4" }} /> - </IconButton> - </Link> - </StyledTableCell> - <StyledTableCell align="right"> - {isLoadingToDelete === index ? ( - <CircularProgress size={24} color="primary" /> - ) : ( - <IconButton - onClick={() => { - HandleStateAlertDialog(index); - HandleStateCircularProgress(index); - }} + ) + }, [currPage, search, option]) + + useEffect(() => { + setCurrPage(0) + setOption() + setSearch("") + setValueOfSearch("") + }, [showFilter]) + + return ( + <StyledContent contrast={state.contrast}> + { + error ? ( + <div>Error: {error.message}</div> + ) + : + ( + !isLoaded ? ( + <LoadingSpinner text="Carregando..." /> + ) + : + ( + WINDOW_WIDTH <= 1024 ? ( + <> + <SnackBar + severity={snackInfo.icon} + text={snackInfo.message} + snackbarOpen={snackInfo.open} + color={snackInfo.color} + handleClose={() => + setSnackInfo({ + message: "", + icon: "", + open: false, + color: "", + }) + } + /> + <AlertDialog + open={openAlertDialog} + OnDelete={DeleteHandler} + deleteItem={deleteItem} + HandleClose={() => { + setOpenAlertDialog(false); + HandleStateCircularProgress(null); + }} + /> + <MobilePageHeader + title="Coleções" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} > - <DeleteIcon style={{ fill: "#FF0000" }} /> - </IconButton> - )} - </StyledTableCell> - </StyledTableRow> - ) - )} - </TableBody> - </TableData> - - {/* This alert will be displayed if the user click to delete an institution */} - <AlertDialog - open={openAlertDialog} - OnDelete={DeleteHandler} - deleteItem={deleteItem} - HandleClose={() => { - setOpenAlertDialog(false); - HandleStateCircularProgress(null); - }} - /> - </> - ); - } - } + {showFilter ? ( + <> + <Grid + container + alignItems="center" + alignContent="center" + xs={12} + direction="row" + justify="space-between" + > + <Grid item> + <TextField + select + label="Filtro" + value={option} + onChange={handleChange} + helperText="Por favor, selecione uma das opções" + > + {privacyOptions.map((option, index) => ( + <MenuItem + key={option.value} + value={option.name} + name={option.value} + > + {option.value} + </MenuItem> + ))} + </TextField> + </Grid> + + <Grid item> + <TextField + label="Pesquisa" + value={valueOfSearch} + helperText="Ao digitar, tire o foco do campo de texto" + onChange={(event) => HandleSearch(event)} + onBlur={(event) => setSearch(event.target.value)} + ></TextField> + </Grid> + </Grid> + </> + ) : null} + </MobilePageHeader> + + {items.map((row, index) => + index === items.length - 1 ? ( + <StyledDivButton + key={new Date().toISOString() + row.created_at} + > + <Button + color="primary" + variant="text" + // disabled={isLoadingMoreItems} + startIcon={<AddRoundedIcon />} + disabled={isLoadingMoreItems} + onClick={() => { + setCurrPage(currPage + 1) + }} + > + {isLoadingMoreItems ? ( + <CircularProgress size={24} /> + ) : ( + "Carregar mais itens" + )} + </Button> + </StyledDivButton> + ) : ( + <> + <MobileList + key={new Date().toISOString() + row.created_at} + title={row.name} + subtitle={row.privacy} + backColor={"#e81f4f"} + avatar={<PeopleRoundedIcon />} + href={`/admin/Collection?collection=${row.id}`} + reset={() => { + + }} + data={ + [ + { + title: "ID", + subtitle: row.id + }, + { + title: "Dono(a)", + subtitle: row.owner ? row.owner.name : "Sem dados" + }, + { + title: "Criado em", + subtitle: DisplayDate(row.created_at) + }, + { + title: "Atualizado em", + subtitle: DisplayDate(row.updated_at) + }, + { + title: "Deletar", + subtitle: + <Button + variant="contained" + color="secondary" + onClick={() => { + HandleStateAlertDialog(index); + HandleStateCircularProgress(index); + }} + startIcon={<DeleteIcon />} + > + Deletar + </Button> + } + ] + } + /> + </> + ) + )} + </> + ) + : + ( + <> + <SnackBar + severity={snackInfo.icon} + text={snackInfo.message} + snackbarOpen={snackInfo.open} + color={snackInfo.color} + handleClose={() => + setSnackInfo({ + message: "", + icon: "", + open: false, + color: "", + }) + } + /> + + <PageHeader + title="Coleções" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > + {showFilter ? ( + <> + <Grid + container + alignItems="center" + alignContent="center" + xs={12} + direction="row" + justify="space-between" + > + <Grid item> + <TextField + select + label="Filtro" + value={option} + onChange={handleChange} + helperText="Por favor, selecione uma das opções" + > + {privacyOptions.map((option, index) => ( + <MenuItem + key={option.value} + value={option.name} + name={option.value} + > + {option.value} + </MenuItem> + ))} + </TextField> + </Grid> + + <Grid item> + <TextField + label="Pesquisa" + value={valueOfSearch} + helperText="Ao digitar, tire o foco do campo de texto" + onChange={(event) => HandleSearch(event)} + onBlur={(event) => setSearch(event.target.value)} + /> + </Grid> + </Grid> + </> + ) : null} + </PageHeader> + + <TableData top={TOP_LABELS}> + <TableBody> + {items.map((row, index) => + index === items.length - 1 ? ( + <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableCell> + <Button + color="primary" + variant="text" + // disabled={isLoadingMoreItems} + startIcon={<AddRoundedIcon />} + disabled={isLoadingMoreItems} + onClick={() => { + setCurrPage(currPage + 1) + }} + > + {isLoadingMoreItems ? ( + <CircularProgress size={24} /> + ) : ( + "Carregar mais itens" + )} + </Button> + </StyledTableCell> + </StyledTableRow> + ) : ( + <StyledTableRow key={new Date().toISOString() + index}> + <StyledTableCell component="th" scope="row"> + {row.name} + </StyledTableCell> + <StyledTableCell align="right"> + <div + dangerouslySetInnerHTML={{ __html: row.description }} + ></div> + </StyledTableCell> + <StyledTableCell align="right"> + {row.owner ? row.owner.name : "Sem dados"} + </StyledTableCell> + <StyledTableCell align="right"> + {DisplayDate(row.created_at)} + </StyledTableCell> + <StyledTableCell align="right"> + {DisplayDate(row.updated_at)} + </StyledTableCell> + <StyledTableCell align="right">{row.privacy}</StyledTableCell> + <StyledTableCell align="right"> + <Link to={`/admin/Collection?collection=${row.id}`}> + <IconButton> + <VisibilityIcon style={{ fill: "#00bcd4" }} /> + </IconButton> + </Link> + </StyledTableCell> + <StyledTableCell align="right"> + {isLoadingToDelete === index ? ( + <CircularProgress size={24} color="primary" /> + ) : ( + <IconButton + onClick={() => { + HandleStateAlertDialog(index); + HandleStateCircularProgress(index); + }} + > + <DeleteIcon style={{ fill: "#FF0000" }} /> + </IconButton> + )} + </StyledTableCell> + </StyledTableRow> + ) + )} + </TableBody> + </TableData> + + {/* This alert will be displayed if the user click to delete an institution */} + <AlertDialog + open={openAlertDialog} + OnDelete={DeleteHandler} + deleteItem={deleteItem} + HandleClose={() => { + setOpenAlertDialog(false); + HandleStateCircularProgress(null); + }} + /> + </> + ) + ) + ) + } + </StyledContent> + ); }; export default Collections; @@ -608,3 +611,7 @@ const StyledDivButton = styled(Paper)` align-items : center; ` +const StyledContent = styled.div` + background-color: ${props => props.contrast === "" ? "white" : "black"} !important; + color: ${props => props.contrast === "" ? "#666" : "white"}; +` \ No newline at end of file diff --git a/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js b/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js index 4c93b941127ab8009536a7ada106ca0791ffec23..3d71db8d7e97e68df1ccf58c9c5477b37c3ae34a 100644 --- a/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js +++ b/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js @@ -298,8 +298,6 @@ const CommunityQuestion = () => { ) : null} </MobilePageHeader> - <div style={{ height: "2em" }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton @@ -362,7 +360,6 @@ const CommunityQuestion = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -451,8 +448,6 @@ const CommunityQuestion = () => { ) : null} </PageHeader> - <div style={{ height: "2em" }}></div> - <TableData top={TOP_LABELS} onIconPressed={cleanArrayAndInvert}> <TableBody> {items.map((row, index) => diff --git a/src/Admin/Pages/Pages/SubPages/Complaints.js b/src/Admin/Pages/Pages/SubPages/Complaints.js index d03514dc91f170cd84c4807e42c5f4d643de036e..ee359ffca8aefbefd04ebad8318b19a18269af23 100644 --- a/src/Admin/Pages/Pages/SubPages/Complaints.js +++ b/src/Admin/Pages/Pages/SubPages/Complaints.js @@ -382,8 +382,6 @@ const Complaints = () => { ) : null} </MobilePageHeader> - <div style={{ height: "2em" }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton @@ -440,7 +438,6 @@ const Complaints = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -541,8 +538,6 @@ const Complaints = () => { ) : null} </PageHeader> - <div style={{ height: "2em" }}></div> - <Grid xs={12} container> <TableData top={TOP_LABELS} diff --git a/src/Admin/Pages/Pages/SubPages/EducationalObjects.js b/src/Admin/Pages/Pages/SubPages/EducationalObjects.js index 69d0dfc326b54a0f970a6e98e905dddff7f0f41f..3218221c627a340d550915c256788ce82e628dea 100644 --- a/src/Admin/Pages/Pages/SubPages/EducationalObjects.js +++ b/src/Admin/Pages/Pages/SubPages/EducationalObjects.js @@ -362,8 +362,6 @@ const EducationalObjects = () => { </MobilePageHeader> {/************** End of the header **************/} - <div style={{ height: "2em" }}></div> - {/************** Start of display data in table **************/} {items.map((row, index) => index === items.length - 1 ? ( @@ -434,7 +432,6 @@ const EducationalObjects = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -504,8 +501,6 @@ const EducationalObjects = () => { </PageHeader> {/************** End of the header **************/} - <div style={{ height: "2em" }}></div> - {/************** Start of display data in table **************/} <TableData top={TOP_TABLE}> <TableBody> diff --git a/src/Admin/Pages/Pages/SubPages/Inframe.js b/src/Admin/Pages/Pages/SubPages/Inframe.js index f2979dbbda1405d86d73cd8bd1a51da35167a685..9fec9f16a467f2a015348cca6b0df63ea9a60915 100644 --- a/src/Admin/Pages/Pages/SubPages/Inframe.js +++ b/src/Admin/Pages/Pages/SubPages/Inframe.js @@ -16,24 +16,42 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React from 'react'; +import React, { useContext } from 'react'; import Welcome from '../../../Components/Components/Welcome'; +import { Store } from 'Store' +import styled from 'styled-components' + const IframeComponent = () => { + const { state } = useContext(Store) + return ( - <div> - <Welcome /> + <StyledDiv contrast={state.contrast}> + <Welcome contrast={state.contrast}/> <div style={{ height: '1em' }}></div> - <iframe + <StyledIframe title="Métricas portal MEC" src='https://metabase.c3sl.ufpr.br/public/dashboard/8ada315d-b8df-4b18-b7fb-d06b0ac64623' height='800px' width='100%' // allowTransparency={true} frameBorder={0} + contrast={state.contrast} > - </iframe> - </div> + </StyledIframe> + </StyledDiv> ) } + +const StyledDiv = styled.div` + background-color: ${props => props.contrast === "" ? "white" : "black"}; + color: ${props => props.contrast === "" ? "#666" : "white"}; +` + +const StyledIframe = styled.iframe` + background-color: ${props => props.contrast === "" ? "white" : "black"}; + color: ${props => props.contrast === "" ? "#666" : "white"}; + border: 1px solid ${props => props.contrast === "" ? "#666" : "white"}; +` + export default IframeComponent; diff --git a/src/Admin/Pages/Pages/SubPages/Institutions.js b/src/Admin/Pages/Pages/SubPages/Institutions.js index 7f713b9e4f42d42c906092fc0c3e1baccbdb1080..baf583e7d5c5d7f2732d3caf6a6693fe66bde698 100644 --- a/src/Admin/Pages/Pages/SubPages/Institutions.js +++ b/src/Admin/Pages/Pages/SubPages/Institutions.js @@ -370,8 +370,6 @@ const Institutions = () => { </MobilePageHeader> {/************** End of the header **************/} - <div style={{ height: "2em" }}></div> - {/************** Start of display data in table **************/} {items.map((row, index) => index === items.length - 1 ? ( @@ -441,7 +439,6 @@ const Institutions = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -520,8 +517,6 @@ const Institutions = () => { </PageHeader> {/************** End of the header **************/} - <div style={{ height: "2em" }}></div> - {/************** Start of display data in table **************/} <TableData top={topTable} onIconPressed={cleanArrayAndInvert}> <TableBody> diff --git a/src/Admin/Pages/Pages/SubPages/Languages.js b/src/Admin/Pages/Pages/SubPages/Languages.js index c38ac1e1015d1ad352f23e597ee85240c4e28a2c..84ced080bdb0b344afaf05e5930ef75fa0417915 100644 --- a/src/Admin/Pages/Pages/SubPages/Languages.js +++ b/src/Admin/Pages/Pages/SubPages/Languages.js @@ -246,8 +246,6 @@ const Languages = () => { > </MobilePageHeader> - <div style={{ height: '2em' }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton key={new Date().toISOString() + row.created_at}> @@ -304,7 +302,6 @@ const Languages = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -350,8 +347,6 @@ const Languages = () => { > </PageHeader> - <div style={{ height: '2em' }}></div> - <TableData top={TOP_LABELS} onIconPressed={cleanArrayAndInvert} diff --git a/src/Admin/Pages/Pages/SubPages/NoteVariables.js b/src/Admin/Pages/Pages/SubPages/NoteVariables.js index 1ad35f99a8c2a8c5a7e8340acfbd1d9551ec5473..4f2c6c3c47e992ed72b94ed4353bf690b2776535 100644 --- a/src/Admin/Pages/Pages/SubPages/NoteVariables.js +++ b/src/Admin/Pages/Pages/SubPages/NoteVariables.js @@ -178,8 +178,6 @@ const NoteVariables = () => { > </MobilePageHeader> - <div style={{ height: '2em' }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton key={new Date().toISOString() + row.created_at}> @@ -230,7 +228,6 @@ const NoteVariables = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -267,8 +264,6 @@ const NoteVariables = () => { > </PageHeader> - <div style={{ height: '2em' }}></div> - <TableData top={topTable} onIconPressed={cleanArrayAndInvert} diff --git a/src/Admin/Pages/Pages/SubPages/Permissions.js b/src/Admin/Pages/Pages/SubPages/Permissions.js index 787ac0de2893aeaa4107d7c57d3ef43935fe78dd..f0456fd617657b528b7294b6c053a1a38bd13f81 100644 --- a/src/Admin/Pages/Pages/SubPages/Permissions.js +++ b/src/Admin/Pages/Pages/SubPages/Permissions.js @@ -250,8 +250,6 @@ const UserPermissions = () => { > </MobilePageHeader> - <div style={{ height: '2em' }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton key={new Date().toISOString() + row.created_at}> @@ -307,7 +305,6 @@ const UserPermissions = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -353,8 +350,6 @@ const UserPermissions = () => { > </PageHeader> - <div style={{ height: '2em' }}></div> - <TableData top={TOP_LABELS} onIconPressed={cleanArrayAndInvert} diff --git a/src/Admin/Pages/Pages/SubPages/Questions.js b/src/Admin/Pages/Pages/SubPages/Questions.js index ca32e0cd11a506134b40c2801dde53209d615cb2..078cda4cfa404af856a9adde5670744d13471471 100644 --- a/src/Admin/Pages/Pages/SubPages/Questions.js +++ b/src/Admin/Pages/Pages/SubPages/Questions.js @@ -248,8 +248,6 @@ const Questions = () => { > </MobilePageHeader> - <div style={{ height: '2em' }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton @@ -314,7 +312,6 @@ const Questions = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -360,8 +357,6 @@ const Questions = () => { > </PageHeader> - <div style={{ height: '2em' }}></div> - <TableData top={TOP_LABELS} onIconPressed={cleanArrayAndInvert} diff --git a/src/Admin/Pages/Pages/SubPages/Rating.js b/src/Admin/Pages/Pages/SubPages/Rating.js index 22d57d409dfe56f9b649f36c9ad4b67d10cd923c..24b861b0b67f479dc906f51f19fc4d3629349cc6 100644 --- a/src/Admin/Pages/Pages/SubPages/Rating.js +++ b/src/Admin/Pages/Pages/SubPages/Rating.js @@ -247,8 +247,6 @@ const Ratings = () => { > </MobilePageHeader> - <div style={{ height: '2em' }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton key={new Date().toISOString() + row.created_at}> @@ -305,7 +303,6 @@ const Ratings = () => { ] } /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -350,8 +347,6 @@ const Ratings = () => { > </PageHeader> - <div style={{ height: '2em' }}></div> - <TableData top={topTable} onIconPressed={cleanArrayAndInvert} diff --git a/src/Admin/Pages/Pages/SubPages/SendEmail.js b/src/Admin/Pages/Pages/SubPages/SendEmail.js index aff09bc843ce63f5238516695dd3887398987756..a5a4a940cd3457e64f6753e68f43c9774f03e02a 100644 --- a/src/Admin/Pages/Pages/SubPages/SendEmail.js +++ b/src/Admin/Pages/Pages/SubPages/SendEmail.js @@ -18,12 +18,14 @@ You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -import React from 'react'; -import Card from "@material-ui/core/Card"; +import React, { useContext } from 'react'; import CardContent from "@material-ui/core/CardContent"; import { makeStyles } from "@material-ui/core/styles"; import { Typography } from '@material-ui/core'; import EmailInputs from '../../../Components/Components/Inputs/EmailInputs'; +import { StyledCard } from "../../../Components/Styles/DataCard"; + +import { Store } from 'Store' const useStyles = makeStyles({ root: { @@ -56,12 +58,15 @@ const useStyles = makeStyles({ const SendEmail = ({ match }) => { + + const { state } = useContext(Store); + const classes = useStyles(); const urlParams = new URLSearchParams(window.location.search); const email = urlParams.get("email"); return ( - <Card> + <StyledCard contrast={state.contrast}> <CardContent> <Typography className={classes.title} @@ -70,9 +75,9 @@ const SendEmail = ({ match }) => { > Enviar email </Typography> - <EmailInputs email={email} /> + <EmailInputs email={email} contrast={state.contrast}/> </CardContent> - </Card> + </StyledCard> ); } diff --git a/src/Admin/Pages/Pages/SubPages/Users.js b/src/Admin/Pages/Pages/SubPages/Users.js index dfb320d805bed3ad175195bbef2eaf886140bff5..e13ad9d6b965424308b25af2d75f392f1637cec6 100644 --- a/src/Admin/Pages/Pages/SubPages/Users.js +++ b/src/Admin/Pages/Pages/SubPages/Users.js @@ -320,8 +320,6 @@ const Users = () => { } </MobilePageHeader> - <div style={{ height: '2em' }}></div> - {items.map((row, index) => index === items.length - 1 ? ( <StyledDivButton key={new Date().toISOString() + row.created_at}> @@ -411,7 +409,6 @@ const Users = () => { ]} /> - <div style={{ height: "0.5em" }} /> </> ) )} @@ -488,8 +485,6 @@ const Users = () => { } </PageHeader> - <div style={{ height: '2em' }}></div> - <TableData top={topTable} onIconPressed={cleanArrayAndInvert} diff --git a/src/App.js b/src/App.js index 23a3cab87eba75ef46bc2c40f85ed5bc894e08f1..c7574a07696e8e420b92c0063360a4635885d68f 100644 --- a/src/App.js +++ b/src/App.js @@ -182,10 +182,10 @@ export default function App() { <> {!awaitTest && <React.Suspense fallback={<LoadingScreen/>}> - <BrowserRouter history={piwik.connectToHistory(customHistory)}> - {/*<BrowserRouter>*/} + {/*<BrowserRouter history={piwik.connectToHistory(customHistory)}>*/} + <BrowserRouter> <ContrastBar/> - <Header /> + <Header/> <div style={{ backgroundImage: @@ -465,12 +465,12 @@ export default function App() { return <AdminTemplate inner={<SendEmail />}/> }} /> - <Route path='*' component={PageNotFound} /> + <Route path='*' component={PageNotFound}/> </Switch> {!hideFooter && ( <div id="Rodape_scroll"> - <EcFooter contrast={state.contrast} /> - <GNUAGPLfooter contrast={state.contrast} /> + <EcFooter contrast={state.contrast}/> + <GNUAGPLfooter contrast={state.contrast}/> </div> )} </BrowserRouter> diff --git a/src/Components/LoadingSpinner.js b/src/Components/LoadingSpinner.js index e25599746e6ffcf88f3f7746a13724d303e7df4b..391a5086eb1cc642b7e001ce15c9fc5a8908f776 100644 --- a/src/Components/LoadingSpinner.js +++ b/src/Components/LoadingSpinner.js @@ -1,11 +1,17 @@ -import React from 'react'; +import React, { useContext } from 'react'; +import { Store } from 'Store' + import LoadingGif from '../img/loading_busca.gif' -const LoadingSpinner = (props) => ( - <div style={{ display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center" }}> - <img alt="" src={LoadingGif} /> - <span style={props.contrast === "" ? { textTransform: "uppercase" } : { textTransform: "uppercase", color: "white" }}>{props.text}</span> - </div> -); +const LoadingSpinner = (props) => { + const { state } = useContext(Store); + + return ( + <div style={{ display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", backgroundColor: "inherit" }}> + <img alt="" src={LoadingGif} /> + <span style={state.contrast === "" ? { textTransform: "uppercase" } : { textTransform: "uppercase", color: "white" }}>{props.text}</span> + </div> + ) +} export default LoadingSpinner;