diff --git a/package-lock.json b/package-lock.json index 968b369cb5fe6dedc05daea768db458d2c3e4cf3..5fdb31796f1799db9b5ed5b01b469464a961da40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11285,9 +11285,9 @@ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" }, "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" }, "path-to-regexp": { "version": "1.8.0", @@ -17491,9 +17491,9 @@ } }, "url-parse": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz", - "integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz", + "integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==", "requires": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" diff --git a/package.json b/package.json index e772e41cc80ac4ce0055060dd66958aea4bd59a3..b2d7301750402498b1c650e4656e05ddc5146d43 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ }, "scripts": { "analyze": "NODE_PATH=src/ source-map-explorer 'build/static/js/*.js'", - "start": "NODE_PATH=src/ PORT=5000 react-scripts start watch", + "start": "NODE_PATH=src/ PORT=4000 react-scripts start watch", "build": "NODE_PATH=src/ react-scripts build", "test": "NODE_PATH=src/ react-scripts test", "eject": "NODE_PATH=src/ react-scripts eject" diff --git a/src/Admin/Components/Components/AdminTemplate.js b/src/Admin/Components/Components/AdminTemplate.js index 42be22cd3f334aa5f78e3c991a509b73267a6379..e0affe5c4b124d0f81166da51626efac58575d62 100644 --- a/src/Admin/Components/Components/AdminTemplate.js +++ b/src/Admin/Components/Components/AdminTemplate.js @@ -46,7 +46,7 @@ const AdminTemplate = (props) => { return ( <div style={{ backgroundColor: " #D3D3D3" }}> <AppBarAdmin /> - <div> + <div style={{ padding: "2em" }}> {props.inner} </div> </div> @@ -54,7 +54,7 @@ const AdminTemplate = (props) => { else return ( <div style={{ backgroundColor: " #D3D3D3" }}> - <div> + <div style={{ padding: "2em" }}> <Unauthorized /> </div> </div> diff --git a/src/Admin/Components/Components/DataCards/ActivityCard.js b/src/Admin/Components/Components/DataCards/ActivityCard.js index 58497e2ebb7bf62d756b1f85d4c5f0c99d2edaec..915df2f99fdb31c17741d362555721f14a3753f9 100644 --- a/src/Admin/Components/Components/DataCards/ActivityCard.js +++ b/src/Admin/Components/Components/DataCards/ActivityCard.js @@ -68,6 +68,7 @@ const ActivityCard = () => { } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." /> } else { + console.log(item) const DATA = [ { subTitle: "ID", diff --git a/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js b/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js index 3a4b844e2b53297d42df642af9dbcc37b7c187a2..b8ae952c3dabc4ff4c7fd73ceb45a6d3123972b1 100644 --- a/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js +++ b/src/Admin/Components/Components/DataCards/CommunityQuestionCard.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, { 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"; @@ -30,11 +30,14 @@ import { useStyles } from "../../Styles/DataCard"; import EmailRoundedIcon from '@material-ui/icons/EmailRounded'; //imports from local files import { GetAData } from "../../../Filters"; +import { Store } from '../../../../Store'; import { Link } from 'react-router-dom' +import Unauthorized from "../Unauthorized"; import { getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import LoadingSpinner from '../../../../Components/LoadingSpinner'; const CommunityQuestions = () => { + const { state } = useContext(Store); const classes = useStyles(); const [error, setError] = useState(null); //Necessary to consult the API, catch errors @@ -48,6 +51,22 @@ const CommunityQuestions = () => { .toString(); }; + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + useEffect(() => { const urlParams = new URLSearchParams(window.location.search); const query = urlParams.get("question"); @@ -69,7 +88,7 @@ const CommunityQuestions = () => { return <div>Houve um erro</div>; } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." /> - } else { + } else if (CheckUserPermission()) { const DATA = [ { subTitle: "ID", @@ -138,7 +157,7 @@ const CommunityQuestions = () => { </CardContent> </Card> ); - } + } else return <Unauthorized /> }; export default CommunityQuestions; diff --git a/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js b/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js index 6f865726bd0e8719e82fc51b7497b9bf6c2df96f..08a8f3255e1015758e98373e8c2d7e25c70cd05e 100644 --- a/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js +++ b/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js @@ -116,6 +116,7 @@ const CommunityQuestions = () => { } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." />; } else { + console.log(item); const DATA = [ { subTitle: "ID", diff --git a/src/Admin/Components/Components/Inputs/CreateInstitution.js b/src/Admin/Components/Components/Inputs/CreateInstitution.js index a0ba3c1a55a97bc023537d4e7ad0a444a1c0d8ab..378c0960b36556a71709978fed512c03db48a9ba 100644 --- a/src/Admin/Components/Components/Inputs/CreateInstitution.js +++ b/src/Admin/Components/Components/Inputs/CreateInstitution.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, { 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"; @@ -27,11 +27,14 @@ import AddRoundedIcon from '@material-ui/icons/AddRounded'; import ListRoundedIcon from '@material-ui/icons/ListRounded'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from '../../../../Store'; import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import Unauthorized from '../Unauthorized'; //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(''); @@ -98,6 +101,23 @@ const CreateInstitution = (props) => { }) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + + //Handle submit async function onSubmit() { setIsLoading(true) @@ -183,77 +203,80 @@ const CreateInstitution = (props) => { onChange: (event) => CountryHandler(event) } ] - return ( - <Card> - <SnackBar - severity={snackInfo.icon} - text={snackInfo.message} - snackbarOpen={snackInfo.open} - color={snackInfo.color} - handleClose={() => setSnackInfo({ - message: '', - icon: '', - open: false, - color: '' - })} - /> - <CardContent> - <Grid container direction='row' justify='space-between' alignContent="center" alignItems="center" xs={12}> - <Grid item> - <Typography variant='h4'> - {name} - </Typography> - </Grid> - <Grid item> - <Link style={{ textDecoration: 'none' }} to={'/admin/institutions'}> - <Button - onClick={props.BackToList} - startIcon={<ListRoundedIcon />} - variant='outlined' - color='primary' - > - Listar - </Button> - </Link> + + if (CheckUserPermission()) { + return ( + <Card> + <SnackBar + severity={snackInfo.icon} + text={snackInfo.message} + snackbarOpen={snackInfo.open} + color={snackInfo.color} + handleClose={() => setSnackInfo({ + message: '', + icon: '', + open: false, + color: '' + })} + /> + <CardContent> + <Grid container direction='row' justify='space-between' alignContent="center" alignItems="center" xs={12}> + <Grid item> + <Typography variant='h4'> + {name} + </Typography> + </Grid> + <Grid item> + <Link style={{ textDecoration: 'none' }} to={'/admin/institutions'}> + <Button + onClick={props.BackToList} + startIcon={<ListRoundedIcon />} + variant='outlined' + color='primary' + > + Listar + </Button> + </Link> + </Grid> </Grid> - </Grid> - <div style={{ height: '1em' }}></div> + <div style={{ height: '1em' }}></div> - <form style={{ display: 'flex', flexDirection: 'column' }}> - {fields.map((field, index) => ( - <TextField - key={index} - required={field.required} - error={field.error} - helperText={field.error ? field.errorMessage : ''} - style={{ width: '250px', marginBottom: '1em' }} - label={field.label} - value={field.value} - onChange={field.onChange} - type="search" - multiline={true} - /> - ))} - </form> - </CardContent> - <CardAction> - <Button - onClick={() => { - onSubmit(); - }} - variant="contained" - color="primary" - disabled={isLoading} - startIcon={isLoading ? null : <AddRoundedIcon />} - > - { - isLoading ? <CircularProgress size={24} /> : 'Adicionar' - } - </Button> - </CardAction> - </Card> - ); + <form style={{ display: 'flex', flexDirection: 'column' }}> + {fields.map((field, index) => ( + <TextField + key={index} + required={field.required} + error={field.error} + helperText={field.error ? field.errorMessage : ''} + style={{ width: '250px', marginBottom: '1em' }} + label={field.label} + value={field.value} + onChange={field.onChange} + type="search" + multiline={true} + /> + ))} + </form> + </CardContent> + <CardAction> + <Button + onClick={() => { + onSubmit(); + }} + variant="contained" + color="primary" + disabled={isLoading} + startIcon={isLoading ? null : <AddRoundedIcon />} + > + { + isLoading ? <CircularProgress size={24} /> : 'Adicionar' + } + </Button> + </CardAction> + </Card> + ); + } else return <Unauthorized /> } export default CreateInstitution; \ No newline at end of file diff --git a/src/Admin/Components/Components/Inputs/CreateLanguage.js b/src/Admin/Components/Components/Inputs/CreateLanguage.js index 5cca9080607862eeaf69737624770700d5649193..c9a6590184ea0695d365aa6a58e3119c5dfa4051 100644 --- a/src/Admin/Components/Components/Inputs/CreateLanguage.js +++ b/src/Admin/Components/Components/Inputs/CreateLanguage.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, { 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"; @@ -27,11 +27,14 @@ import AddRoundedIcon from '@material-ui/icons/AddRounded'; import ListRoundedIcon from '@material-ui/icons/ListRounded'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from '../../../../Store'; import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' //router import { Link } from 'react-router-dom'; +import Unauthorized from '../Unauthorized'; const CreateLanguage = (props) => { + const { state } = useContext(Store); const [name, setName] = useState('Nova linguagem'); const [code, setCode] = useState(''); @@ -87,6 +90,22 @@ const CreateLanguage = (props) => { }) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + //Handle submit async function onSubmit() { setIsLoading(true) @@ -160,77 +179,79 @@ const CreateLanguage = (props) => { } ] - return ( - <Card> - <SnackBar - severity={snackInfo.icon} - text={snackInfo.message} - snackbarOpen={snackInfo.open} - color={snackInfo.color} - handleClose={() => setSnackInfo({ - message: '', - icon: '', - open: false, - color: '' - })} - /> - <CardContent> - <Grid container direction='row' justify='space-between' alignItems="center" alignContent="center" xs={12}> - <Grid item> - <Typography variant='h4'> - {name} - </Typography> + if (CheckUserPermission()) { + return ( + <Card> + <SnackBar + severity={snackInfo.icon} + text={snackInfo.message} + snackbarOpen={snackInfo.open} + color={snackInfo.color} + handleClose={() => setSnackInfo({ + message: '', + icon: '', + open: false, + color: '' + })} + /> + <CardContent> + <Grid container direction='row' justify='space-between' alignItems="center" alignContent="center" xs={12}> + <Grid item> + <Typography variant='h4'> + {name} + </Typography> + </Grid> + <Grid item> + <Link to={'/admin/languages'} style={{ textDecoration: 'none' }}> + <Button + onClick={props.BackToList} + startIcon={<ListRoundedIcon />} + variant='outlined' + color='primary' + > + Listar + </Button> + </Link> + </Grid> </Grid> - <Grid item> - <Link to={'/admin/languages'} style={{ textDecoration: 'none' }}> - <Button - onClick={props.BackToList} - startIcon={<ListRoundedIcon />} - variant='outlined' - color='primary' - > - Listar - </Button> - </Link> - </Grid> - </Grid> - - <div style={{ height: '1em' }}></div> - - <form style={{ display: 'flex', flexDirection: 'column' }}> - {fields.map((field, index) => ( - <TextField - key={index} - required={field.required} - error={field.error} - helperText={field.error ? field.errorMessage : ''} - style={{ width: '250px', marginBottom: '1em' }} - label={field.label} - value={field.value} - onChange={field.onChange} - type="search" - multiline={true} - /> - ))} - </form> - </CardContent> - <CardAction> - <Button - onClick={() => { - onSubmit(); - }} - variant="contained" - color="primary" - disabled={isLoading} - startIcon={isLoading ? null : <AddRoundedIcon />} - > - { - isLoading ? <CircularProgress size={24} /> : 'Adicionar' - } - </Button> - </CardAction> - </Card> - ) + + <div style={{ height: '1em' }}></div> + + <form style={{ display: 'flex', flexDirection: 'column' }}> + {fields.map((field, index) => ( + <TextField + key={index} + required={field.required} + error={field.error} + helperText={field.error ? field.errorMessage : ''} + style={{ width: '250px', marginBottom: '1em' }} + label={field.label} + value={field.value} + onChange={field.onChange} + type="search" + multiline={true} + /> + ))} + </form> + </CardContent> + <CardAction> + <Button + onClick={() => { + onSubmit(); + }} + variant="contained" + color="primary" + disabled={isLoading} + startIcon={isLoading ? null : <AddRoundedIcon />} + > + { + isLoading ? <CircularProgress size={24} /> : 'Adicionar' + } + </Button> + </CardAction> + </Card> + ) + } else return <Unauthorized /> } export default CreateLanguage; \ No newline at end of file diff --git a/src/Admin/Components/Components/Inputs/CreateQuestion.js b/src/Admin/Components/Components/Inputs/CreateQuestion.js index 37f15756862f80b7347edb1e79499b7c0106ead5..89fd3f856e7b8cee4760048d3913723a9c24c129 100644 --- a/src/Admin/Components/Components/Inputs/CreateQuestion.js +++ b/src/Admin/Components/Components/Inputs/CreateQuestion.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, { 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"; @@ -27,12 +27,15 @@ import AddRoundedIcon from '@material-ui/icons/AddRounded'; import MenuItem from "@material-ui/core/MenuItem"; import ListRoundedIcon from '@material-ui/icons/ListRounded'; //imports local files +import { Store } from '../../../../Store'; import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import Unauthorized from '../Unauthorized'; import SnackBar from '../../../../Components/SnackbarComponent'; //router import { Link } from 'react-router-dom'; const CreateQuestion = (props) => { + const { state } = useContext(Store); const [status, setStatus] = useState(''); const [description, setDescription] = useState(''); @@ -77,6 +80,23 @@ const CreateQuestion = (props) => { }) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + + //Handle submit async function onSubmit() { if (!isEmpty(description)) { @@ -120,6 +140,7 @@ const CreateQuestion = (props) => { const handleChange = (e) => { const value = e.target.value; setStatus(value); + console.log(status) }; // Fields @@ -145,98 +166,100 @@ const CreateQuestion = (props) => { }, ]; - return ( - <Card> - <SnackBar - severity={snackInfo.icon} - text={snackInfo.message} - snackbarOpen={snackInfo.open} - color={snackInfo.color} - handleClose={() => setSnackInfo({ - message: '', - icon: '', - open: false, - color: '' - })} - /> - <CardContent> - <Grid container direction='row' justify='space-between' alignContent="center" alignItems="center" xs={12}> - <Grid item> - <Typography variant='h4'> - Nova question - </Typography> - </Grid> - <Grid item> - <Link to={'/admin/Questions'} style={{ textDecoration: 'none' }}> - <Button - onClick={props.BackToList} - startIcon={<ListRoundedIcon />} - variant='outlined' - color='primary' - > - Listar - </Button> - </Link> - </Grid> - </Grid> - - <div style={{ height: '1em' }}></div> - - <form style={{ display: 'flex', flexDirection: 'column' }}> - <> - <TextField - select - label="Status" - value={status ? status : ""} - style={{ width: '250px', marginBottom: '1em' }} - onChange={handleChange} - > - {STATUS_OPTIONS.map((option, index) => ( - <MenuItem - key={option.value} - value={option.value} - style={option.value === status ? { color: 'blue' } : { color: 'black' }} + if (CheckUserPermission()) { + return ( + <Card> + <SnackBar + severity={snackInfo.icon} + text={snackInfo.message} + snackbarOpen={snackInfo.open} + color={snackInfo.color} + handleClose={() => setSnackInfo({ + message: '', + icon: '', + open: false, + color: '' + })} + /> + <CardContent> + <Grid container direction='row' justify='space-between' alignContent="center" alignItems="center" xs={12}> + <Grid item> + <Typography variant='h4'> + Nova question + </Typography> + </Grid> + <Grid item> + <Link to={'/admin/Questions'} style={{ textDecoration: 'none' }}> + <Button + onClick={props.BackToList} + startIcon={<ListRoundedIcon />} + variant='outlined' + color='primary' > - { - option.label - } - </MenuItem> - ))} - </TextField> - {fields.map((field, index) => ( + Listar + </Button> + </Link> + </Grid> + </Grid> + + <div style={{ height: '1em' }}></div> + + <form style={{ display: 'flex', flexDirection: 'column' }}> + <> <TextField - key={index} - required={field.required} - error={field.error} - helperText={field.error ? field.errorMessage : ''} + select + label="Status" + value={status ? status : ""} style={{ width: '250px', marginBottom: '1em' }} - label={field.label} - value={field.value} - onChange={field.onChange} - type="search" - multiline={true} - /> - ))} - </> - </form> - </CardContent> - <CardAction> - <Button - onClick={() => { - onSubmit(); - }} - variant="contained" - color="primary" - disabled={isLoading} - startIcon={isLoading ? null : <AddRoundedIcon />} - > - { - isLoading ? <CircularProgress size={24} /> : 'Adicionar' - } - </Button> - </CardAction> - </Card> - ); + onChange={handleChange} + > + {STATUS_OPTIONS.map((option, index) => ( + <MenuItem + key={option.value} + value={option.value} + style={option.value === status ? { color: 'blue' } : { color: 'black' }} + > + { + option.label + } + </MenuItem> + ))} + </TextField> + {fields.map((field, index) => ( + <TextField + key={index} + required={field.required} + error={field.error} + helperText={field.error ? field.errorMessage : ''} + style={{ width: '250px', marginBottom: '1em' }} + label={field.label} + value={field.value} + onChange={field.onChange} + type="search" + multiline={true} + /> + ))} + </> + </form> + </CardContent> + <CardAction> + <Button + onClick={() => { + onSubmit(); + }} + variant="contained" + color="primary" + disabled={isLoading} + startIcon={isLoading ? null : <AddRoundedIcon />} + > + { + isLoading ? <CircularProgress size={24} /> : 'Adicionar' + } + </Button> + </CardAction> + </Card> + ); + } else return <Unauthorized /> } export default CreateQuestion; \ No newline at end of file diff --git a/src/Admin/Components/Components/Inputs/CreateRating.js b/src/Admin/Components/Components/Inputs/CreateRating.js index 3837c9e3dbc1eca1b292307af5c5d71046425513..3a8907f9faed11a37027e592577703cfc8a88d59 100644 --- a/src/Admin/Components/Components/Inputs/CreateRating.js +++ b/src/Admin/Components/Components/Inputs/CreateRating.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, { 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"; @@ -26,13 +26,16 @@ import CircularProgress from '@material-ui/core/CircularProgress'; import AddRoundedIcon from '@material-ui/icons/AddRounded'; import ListRoundedIcon from '@material-ui/icons/ListRounded'; //imports local files +import { Store } from '../../../../Store'; import SnackBar from '../../../../Components/SnackbarComponent'; //imports services import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' //router import {Link} from 'react-router-dom'; +import Unauthorized from '../Unauthorized'; const CreateRating = (props) => { + const { state } = useContext(Store); const [name, setName] = useState('Novo rating'); const [description, setDescription] = useState(''); @@ -93,6 +96,22 @@ const CreateRating = (props) => { }) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + //Handle submit async function onSubmit() { setIsLoading(true) @@ -157,77 +176,79 @@ const CreateRating = (props) => { } ] - return ( - <Card> - <SnackBar - severity={snackInfo.icon} - text={snackInfo.message} - snackbarOpen={snackInfo.open} - color={snackInfo.color} - handleClose={() => setSnackInfo({ - message: '', - icon: '', - open: false, - color: '' - })} - /> - <CardContent> - <Grid container direction='row' justify='space-between' alignItems="center" alignContent="center" xs={12}> - <Grid item> - <Typography variant='h4'> - {name} - </Typography> - </Grid> - <Grid item> - <Link to={'/admin/Ratings'} style={{textDecoration: 'none'}}> - <Button - onClick={props.BackToList} - startIcon={<ListRoundedIcon />} - variant='outlined' - color='primary' - > - Listar - </Button> - </Link> + if(CheckUserPermission()) { + return ( + <Card> + <SnackBar + severity={snackInfo.icon} + text={snackInfo.message} + snackbarOpen={snackInfo.open} + color={snackInfo.color} + handleClose={() => setSnackInfo({ + message: '', + icon: '', + open: false, + color: '' + })} + /> + <CardContent> + <Grid container direction='row' justify='space-between' alignItems="center" alignContent="center" xs={12}> + <Grid item> + <Typography variant='h4'> + {name} + </Typography> + </Grid> + <Grid item> + <Link to={'/admin/Ratings'} style={{textDecoration: 'none'}}> + <Button + onClick={props.BackToList} + startIcon={<ListRoundedIcon />} + variant='outlined' + color='primary' + > + Listar + </Button> + </Link> + </Grid> </Grid> - </Grid> - - <div style={{ height: '1em' }}></div> - - <form style={{ display: 'flex', flexDirection: 'column' }}> - {fields.map((field, index) => ( - <TextField - key={index} - required={field.required} - error={field.error} - helperText={field.error ? field.errorMessage : ''} - style={{ width: '250px', marginBottom: '1em' }} - label={field.label} - value={field.value} - onChange={field.onChange} - type="search" - multiline={true} - /> - ))} - </form> - </CardContent> - <CardAction> - <Button - onClick={() => { - onSubmit(); - }} - variant="contained" - color="primary" - disabled={isLoading} - startIcon={isLoading ? null : <AddRoundedIcon />} - > - { - isLoading ? <CircularProgress size={24} /> : 'Adicionar' - } - </Button> - </CardAction> - </Card> - ); + + <div style={{ height: '1em' }}></div> + + <form style={{ display: 'flex', flexDirection: 'column' }}> + {fields.map((field, index) => ( + <TextField + key={index} + required={field.required} + error={field.error} + helperText={field.error ? field.errorMessage : ''} + style={{ width: '250px', marginBottom: '1em' }} + label={field.label} + value={field.value} + onChange={field.onChange} + type="search" + multiline={true} + /> + ))} + </form> + </CardContent> + <CardAction> + <Button + onClick={() => { + onSubmit(); + }} + variant="contained" + color="primary" + disabled={isLoading} + startIcon={isLoading ? null : <AddRoundedIcon />} + > + { + isLoading ? <CircularProgress size={24} /> : 'Adicionar' + } + </Button> + </CardAction> + </Card> + ); + } else return <Unauthorized/> } export default CreateRating; \ No newline at end of file diff --git a/src/Admin/Components/Components/Inputs/CreateRole.js b/src/Admin/Components/Components/Inputs/CreateRole.js index 421c8174d7bde52a2abed8ae1249c48f4e01c228..94afb02479f83a1f9830f659c77d478247a62c26 100644 --- a/src/Admin/Components/Components/Inputs/CreateRole.js +++ b/src/Admin/Components/Components/Inputs/CreateRole.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, { 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"; @@ -27,11 +27,14 @@ import AddRoundedIcon from '@material-ui/icons/AddRounded'; import ListRoundedIcon from '@material-ui/icons/ListRounded'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from '../../../../Store'; import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' //router import { Link } from 'react-router-dom'; +import Unauthorized from '../Unauthorized'; const CreateRole = (props) => { + const { state } = useContext(Store); const [name, setName] = useState('Nova role'); const [desc, setDesc] = useState(''); @@ -87,6 +90,23 @@ const CreateRole = (props) => { }) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + + //Handle submit async function onSubmit() { setIsLoading(true) @@ -150,77 +170,79 @@ const CreateRole = (props) => { } ] - return ( - <Card> - <SnackBar - severity={snackInfo.icon} - text={snackInfo.message} - snackbarOpen={snackInfo.open} - color={snackInfo.color} - handleClose={() => setSnackInfo({ - message: '', - icon: '', - open: false, - color: '' - })} - /> - <CardContent> - <Grid container direction='row' justify='space-between' alignItems="center" alignContent="center" xs={12}> - <Grid item> - <Typography variant='h4'> - {name} - </Typography> - </Grid> - <Grid item> - <Link to={'/admin/permissions'} style={{ textDecoration: 'none' }}> - <Button - onClick={props.BackToList} - startIcon={<ListRoundedIcon />} - variant='outlined' - color='primary' - > - Listar - </Button> - </Link> + if (CheckUserPermission()) { + return ( + <Card> + <SnackBar + severity={snackInfo.icon} + text={snackInfo.message} + snackbarOpen={snackInfo.open} + color={snackInfo.color} + handleClose={() => setSnackInfo({ + message: '', + icon: '', + open: false, + color: '' + })} + /> + <CardContent> + <Grid container direction='row' justify='space-between' alignItems="center" alignContent="center" xs={12}> + <Grid item> + <Typography variant='h4'> + {name} + </Typography> + </Grid> + <Grid item> + <Link to={'/admin/permissions'} style={{ textDecoration: 'none' }}> + <Button + onClick={props.BackToList} + startIcon={<ListRoundedIcon />} + variant='outlined' + color='primary' + > + Listar + </Button> + </Link> + </Grid> </Grid> - </Grid> - - <div style={{ height: '1em' }}></div> - - <form style={{ display: 'flex', flexDirection: 'column' }}> - {fields.map((field, index) => ( - <TextField - key={index} - required={field.required} - error={field.error} - helperText={field.error ? field.errorMessage : ''} - style={{ width: '250px', marginBottom: '1em' }} - label={field.label} - value={field.value} - onChange={field.onChange} - type="search" - multiline={true} - /> - ))} - </form> - </CardContent> - <CardAction> - <Button - onClick={() => { - onSubmit(); - }} - variant="contained" - color="primary" - disabled={isLoading} - startIcon={isLoading ? null : <AddRoundedIcon />} - > - { - isLoading ? <CircularProgress size={24} /> : 'Adicionar' - } - </Button> - </CardAction> - </Card> - ) + + <div style={{ height: '1em' }}></div> + + <form style={{ display: 'flex', flexDirection: 'column' }}> + {fields.map((field, index) => ( + <TextField + key={index} + required={field.required} + error={field.error} + helperText={field.error ? field.errorMessage : ''} + style={{ width: '250px', marginBottom: '1em' }} + label={field.label} + value={field.value} + onChange={field.onChange} + type="search" + multiline={true} + /> + ))} + </form> + </CardContent> + <CardAction> + <Button + onClick={() => { + onSubmit(); + }} + variant="contained" + color="primary" + disabled={isLoading} + startIcon={isLoading ? null : <AddRoundedIcon />} + > + { + isLoading ? <CircularProgress size={24} /> : 'Adicionar' + } + </Button> + </CardAction> + </Card> + ) + } else return <Unauthorized /> } export default CreateRole; \ No newline at end of file diff --git a/src/Admin/Components/Components/Inputs/EditCollection.js b/src/Admin/Components/Components/Inputs/EditCollection.js index 98b7a38f22c073f9f3c6c5c1863253315491b4c7..13aabcf16dac0ebc5f77ca965b60cfa6b5508395 100644 --- a/src/Admin/Components/Components/Inputs/EditCollection.js +++ b/src/Admin/Components/Components/Inputs/EditCollection.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, { 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'; @@ -28,7 +28,9 @@ import SaveIcon from '@material-ui/icons/Save'; import MenuItem from "@material-ui/core/MenuItem"; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; +import Unauthorized from '../Unauthorized'; import { getRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import { Store } from '../../../../Store'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import { EditFilter, GetAData } from '../../../Filters'; //routers @@ -37,7 +39,7 @@ import ClassicEditor from "@ckeditor/ckeditor5-build-classic" import { CKEditor } from '@ckeditor/ckeditor5-react'; const EditCollection = () => { - + const { state } = useContext(Store); const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("collection"); @@ -105,6 +107,7 @@ const EditCollection = () => { const handleChange = (e) => { const value = e.target.value; setPrivacy(value); + console.log(privacy) }; // Handle snack infos @@ -117,6 +120,22 @@ const EditCollection = () => { }) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + const onSubmit = async () => { setIsLoading(true) const api = EditFilter('collections', id) @@ -167,7 +186,7 @@ const EditCollection = () => { return <div> Houve um erro... </div> } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." /> - } else { + } else if (CheckUserPermission()) { return ( <Card> <SnackBar @@ -267,7 +286,7 @@ const EditCollection = () => { </CardAction> </Card> ) - } + } else return <Unauthorized /> } export default EditCollection; \ No newline at end of file diff --git a/src/Admin/Components/Components/Inputs/EditEducationalObect.js b/src/Admin/Components/Components/Inputs/EditEducationalObect.js index 0335f596e6b68e99e450818a4b6c8ffa3ece41bc..5996383029e0fc08a2b770c8fe7aa32a6b6f2b9e 100644 --- a/src/Admin/Components/Components/Inputs/EditEducationalObect.js +++ b/src/Admin/Components/Components/Inputs/EditEducationalObect.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, { 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"; @@ -36,6 +36,8 @@ import Box from "@material-ui/core/Box"; import SaveIcon from "@material-ui/icons/Save"; //imports local files import SnackBar from "../../../../Components/SnackbarComponent"; +import { Store } from "../../../../Store"; +import Unauthorized from "../Unauthorized"; import LoadingSpinner from "../../../../Components/LoadingSpinner"; import { fetchAllRequest, @@ -61,6 +63,7 @@ const useStyles = makeStyles((theme) => ({ let text; const EditEducationalObject = () => { + const { state } = useContext(Store); const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("learnObj"); @@ -259,6 +262,7 @@ const EditEducationalObject = () => { "language_ids": languagesID, }, }; + console.log(text) putRequest( api, body, @@ -378,6 +382,21 @@ const EditEducationalObject = () => { }, ]; + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === "admin" || roles[i].name === "editor") + canUserEdit = true; + } else { + canUserEdit = false; + } + + return canUserEdit; + }; + useEffect(() => { const urls = [ `/learning_objects/${id}`, @@ -427,7 +446,7 @@ const EditEducationalObject = () => { return <div> Houve um erro... </div>; } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." />; - } else { + } else if (CheckUserPermission()) { return ( <Card variant="outlined"> <SnackBar @@ -608,7 +627,7 @@ const EditEducationalObject = () => { </CardAction> </Card> ); - } + } else return <Unauthorized />; }; export default EditEducationalObject; diff --git a/src/Admin/Components/Components/Inputs/EditLanguage.js b/src/Admin/Components/Components/Inputs/EditLanguage.js index c0b71d0ac7607fc968c0fd10145c8be363ad947d..44df71ceed76a2846983700ced3f66f60143e7e4 100644 --- a/src/Admin/Components/Components/Inputs/EditLanguage.js +++ b/src/Admin/Components/Components/Inputs/EditLanguage.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, { 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'; @@ -27,6 +27,7 @@ import ListRoundedIcon from '@material-ui/icons/ListRounded'; import SaveIcon from '@material-ui/icons/Save'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from '../../../../Store'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; //imports services import { getRequest, putRequest, deleteRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' @@ -34,9 +35,10 @@ import { EditFilter, GetAData, DeleteFilter } from '../../../Filters'; import DeleteRoundedIcon from "@material-ui/icons/DeleteRounded"; //routers import { Link, useHistory } from 'react-router-dom'; +import Unauthorized from '../Unauthorized'; const EditLanguage = () => { - + const { state } = useContext(Store); let history = useHistory() const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("language"); @@ -145,6 +147,23 @@ const EditLanguage = () => { }) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + + const onSubmit = async () => { setIsLoading(true) const api = EditFilter('languages', id) @@ -213,7 +232,7 @@ const EditLanguage = () => { return <div> Houve um erro... </div> } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." /> - } else { + } else if (CheckUserPermission()) { return ( <Card> <SnackBar @@ -291,7 +310,7 @@ const EditLanguage = () => { </CardAction> </Card> ) - } + } else return <Unauthorized /> } export default EditLanguage; \ No newline at end of file diff --git a/src/Admin/Components/Components/Inputs/EditRating.js b/src/Admin/Components/Components/Inputs/EditRating.js index e4e08aa1025b55885a18bd257529cfe47e647c31..1b8e0e6fd7c2c054f389dd7f62316778c4aebfa1 100644 --- a/src/Admin/Components/Components/Inputs/EditRating.js +++ b/src/Admin/Components/Components/Inputs/EditRating.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, { 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'; @@ -27,15 +27,17 @@ import ListRoundedIcon from '@material-ui/icons/ListRounded'; import SaveIcon from '@material-ui/icons/Save'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from '../../../../Store'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; //imports services import { getRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData } from '../../../Filters'; //routers import { Link } from 'react-router-dom'; +import Unauthorized from '../Unauthorized'; const EditRating = () => { - + const { state } = useContext(Store); const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("rating"); @@ -129,6 +131,23 @@ const EditRating = () => { }) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + + const onSubmit = async () => { setIsLoading(true) if (!isEmpty(name) && !isEmpty(description)) { @@ -192,7 +211,7 @@ const EditRating = () => { return <div> Houve um erro... </div> } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." /> - } else { + } else if (CheckUserPermission()) { return ( <Card> <SnackBar @@ -264,7 +283,7 @@ const EditRating = () => { </CardAction> </Card> ) - } + } else return <Unauthorized /> } export default EditRating; \ No newline at end of file diff --git a/src/Admin/Components/Components/Inputs/EditRoles.js b/src/Admin/Components/Components/Inputs/EditRoles.js index c9c49f583904b97a920884d0539c8834cc5d698c..4b3aa488a8d6f8d2334d29a55680b49ed8020787 100644 --- a/src/Admin/Components/Components/Inputs/EditRoles.js +++ b/src/Admin/Components/Components/Inputs/EditRoles.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, { 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'; @@ -29,14 +29,17 @@ import ButtonGroup from "@material-ui/core/ButtonGroup"; import DeleteRoundedIcon from "@material-ui/icons/DeleteRounded"; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from '../../../../Store'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; //imports services import { getRequest, putRequest, deleteRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData, DeleteFilter } from '../../../Filters'; //routers import { Link, useHistory } from 'react-router-dom'; +import Unauthorized from '../Unauthorized'; const EditLanguage = () => { + const { state } = useContext(Store); let history = useHistory() const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("role"); @@ -122,6 +125,23 @@ const EditLanguage = () => { }, ] + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + + const onSubmit = async () => { setIsLoading(true) const api = EditFilter('roles', id) @@ -206,7 +226,7 @@ const EditLanguage = () => { return <div> Houve um erro... </div> } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." /> - } else { + } else if (CheckUserPermission()) { return ( <Card> <SnackBar @@ -284,7 +304,7 @@ const EditLanguage = () => { </CardAction> </Card> ) - } + } else return <Unauthorized /> } export default EditLanguage; \ No newline at end of file diff --git a/src/Admin/Components/Components/Inputs/EditUser.js b/src/Admin/Components/Components/Inputs/EditUser.js index d0953435a8c1565451e85f4ca468fe14d83392fb..fe9a61c8931170c9685afa20e5a1ac118d569511 100644 --- a/src/Admin/Components/Components/Inputs/EditUser.js +++ b/src/Admin/Components/Components/Inputs/EditUser.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, { 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'; @@ -34,12 +34,14 @@ import AddRoundedIcon from '@material-ui/icons/AddRounded'; import MenuItem from '@material-ui/core/MenuItem'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from '../../../../Store'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; //imports services import { getRequest, putRequest, deleteRequest, postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData } from '../../../Filters'; //routers import { Link, useHistory } from 'react-router-dom'; +import Unauthorized from '../Unauthorized'; const useStyles = makeStyles((theme) => ({ root: { @@ -58,7 +60,7 @@ const useStyles = makeStyles((theme) => ({ const EditUser = () => { const classes = useStyles(); let history = useHistory(); - + const { state } = useContext(Store) const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("id"); @@ -260,6 +262,22 @@ const EditUser = () => { }) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + const handleDelete = (chipToDelete) => () => { const currRolesList = [...rolesList]; currRolesList.push({ @@ -464,7 +482,7 @@ const EditUser = () => { return <div> Houve um erro... </div> } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." /> - } else { + } else if (CheckUserPermission()) { return ( <Card> <SnackBar @@ -603,7 +621,7 @@ const EditUser = () => { </CardAction> </Card> ) - } + } else return <Unauthorized /> } export default EditUser; diff --git a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js index 874879d4c095fd1e9cfeee7279d7898621106081..ca1ea9dfb454b6cf7275e47b33f9b6da8cd2b212 100644 --- a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js +++ b/src/Admin/Components/Components/Inputs/IntitutionsInputs.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, { 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'; @@ -27,7 +27,9 @@ import Typography from "@material-ui/core/Typography"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; import Grid from "@material-ui/core/Grid"; //imports local files +import Unauthorized from '../Unauthorized'; import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from '../../../../Store'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; //imports services import { putRequest, getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' @@ -36,7 +38,7 @@ import { EditFilter, GetAData } from '../../../Filters'; import { Link } from 'react-router-dom'; const EditInstitution = () => { - + const { state } = useContext(Store); const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("institution"); @@ -107,6 +109,22 @@ const EditInstitution = () => { }) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + //Handle submit async function onSubmit() { setIsLoading(true) @@ -216,7 +234,7 @@ const EditInstitution = () => { return <div> Erro... </div> } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." /> - } else { + } else if (CheckUserPermission()) { return ( <Card> <SnackBar @@ -295,6 +313,8 @@ const EditInstitution = () => { </CardContent> </Card> ); + } else { + return <Unauthorized /> } } diff --git a/src/Admin/Components/Components/Inputs/NoteVarInputs.js b/src/Admin/Components/Components/Inputs/NoteVarInputs.js index 96b951f99289e01ce4f3d6dc0a7e2a3db44678f9..3c1542ec851b700c0b53755592659fd2a7f9cd21 100644 --- a/src/Admin/Components/Components/Inputs/NoteVarInputs.js +++ b/src/Admin/Components/Components/Inputs/NoteVarInputs.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, { 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'; @@ -28,15 +28,17 @@ import ListRoundedIcon from "@material-ui/icons/ListRounded"; import Grid from '@material-ui/core/Grid'; //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; +import { Store } from '../../../../Store'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; //imports services import { getRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData } from '../../../Filters'; //Routers import { Link } from 'react-router-dom'; +import Unauthorized from '../Unauthorized'; const NoteVarInputs = () => { - + const { state } = useContext(Store); const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get("id"); @@ -200,6 +202,23 @@ const NoteVarInputs = () => { ) } + const CheckUserPermission = () => { + let canUserEdit = false; + + if (state.userIsLoggedIn) { + const roles = [...state.currentUser.roles]; + for (let i = 0; i < roles.length; i++) + if (roles[i].name === 'admin' || roles[i].name === 'editor') + canUserEdit = true; + } + else { + canUserEdit = false; + } + + return canUserEdit; + } + + useEffect(() => { getRequest( GetAData("scores", id), @@ -220,7 +239,7 @@ const NoteVarInputs = () => { return <div>Houve um erro...</div> } else if (!isLoaded) { return <LoadingSpinner text="Carregando..." /> - } else { + } else if (CheckUserPermission()) { return ( <Card> <SnackBar @@ -297,7 +316,7 @@ const NoteVarInputs = () => { </CardContent> </Card> ) - } + } else return <Unauthorized /> } export default NoteVarInputs; \ No newline at end of file diff --git a/src/Admin/Components/Components/Unauthorized.js b/src/Admin/Components/Components/Unauthorized.js index 3408a5761c77534efe53f7bbb2dbe6303709eca2..245a219b46f516a8d6fe7ce5d4ec2a89852f2590 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 [openSnack, setOpenSnack] = useState(true); return ( - <ContentDiv contrast={state.contrast} style={{ textAlign: 'center' }}> + <div style={{ textAlign: 'center' }}> <SnackBar severity='warning' text='Você não tem as permissões necessárias' @@ -50,25 +48,17 @@ const Unauthorized = () => { </Link> </StyledDiv> </> - </ContentDiv> + </div> ); } -const ContentDiv = styled('div')` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; - a { - color: ${props => props.contrast === "" ? "" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline yellow"} !important; - } -` - const StyledDiv = styled('div')` width: 100%; - padding-top: 70px; - padding-bottom: 70px; + margin-top: 70px; + margin-bottom: 70px; justify-content : space-evenly; display: flex; + color: #757575; text-align:center; ` diff --git a/src/App.css b/src/App.css index d1221de16c65dce52cbe42f07a3c5df3e587d3b1..c8cb4a80e14ae5f66c4f7f4a0466a424679d2da9 100644 --- a/src/App.css +++ b/src/App.css @@ -16,44 +16,3 @@ 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/>.*/ -.ContrastBackColor { - background-color: black !important; -} - -.BackColor { - background-color: white !important; -} - -.ContrastText{ - color: white !important; -} - -.Text{ - color: #666 !important; -} - -.ContrastTextColor { - color: white !important; -} - -.ContrastLinkColor { - color: yellow !important; - text-decoration: underline !important; - cursor: pointer; -} - -.ContrastIconColor { - color: white !important; -} - -.ContrastBorder { - border: 1px solid white !important; -} - -.Border { - border: 1px solid #666 !important; -} - -.MuiListNoPadding { - padding: 0 !important; -} diff --git a/src/App.js b/src/App.js index 458d25ce50e9ecb17b2ea597faee729f85112dd5..c06b1193cd2e0348f52a3c485fa5d15d7a643cba 100644 --- a/src/App.js +++ b/src/App.js @@ -23,8 +23,6 @@ import { Store } from './Store' import LoadingSpinner from './Components/LoadingSpinner'; import { BrowserRouter, Switch, Route, Redirect } from "react-router-dom"; import createBrowserHistory from 'history/createBrowserHistory' -import './App.css'; -import ContrastBar from './Components/Accessibility/ContrastBar'; const AdminTemplate = React.lazy(() => import('./Admin/Components/Components/AdminTemplate')); const Header = React.lazy(() => import("./Components/Header")); @@ -34,7 +32,6 @@ const EcFooter = React.lazy(() => import("./Components/EcFooter")); const GNUAGPLfooter = React.lazy(() => import("./Components/AGPLFooter")); const UserPage = React.lazy(() => import("./Pages/UserPage")); const UserTerms = React.lazy(() => import("./Pages/UserTerms")); -const SummarizedUserTerms = React.lazy(() => import("./Pages/SummarizedUserTerms")); const Contact = React.lazy(() => import("./Pages/Contact")); const AboutPage = React.lazy(() => import("./Pages/AboutPage")); const HelpCenter = React.lazy(() => import("./Pages/HelpCenter")); @@ -101,25 +98,6 @@ const EditRole = React.lazy(() => import("./Admin/Components/Components/Inputs/E const CreateRole = React.lazy(() => import("./Admin/Components/Components/Inputs/CreateRole")); const BlockedUser = React.lazy(() => import("./Admin/Pages/Pages/SubPages/BlockedUsers")); -async function supportsWebp() { - if (!createImageBitmap) return false; - - const webpData = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='; - const blob = await fetch(webpData).then(r => r.blob()); - return createImageBitmap(blob).then(() => true, () => false); -} - -const LoadingScreen = () => ( - <div style={{ - position: "absolute", - top: "50%", - left: "50%", - transform: "translate(-50%, -50%)" - }}> - <LoadingSpinner/> - </div> -); - export default function App() { // eslint-disable-next-line const { state, dispatch } = useContext(Store); @@ -131,7 +109,15 @@ export default function App() { siteId: 5 }); const customHistory = createBrowserHistory() - + + async function supportsWebp() { + if (!createImageBitmap) return false; + + const webpData = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='; + const blob = await fetch(webpData).then(r => r.blob()); + return createImageBitmap(blob).then(() => true, () => false); + } + async function testWebpSupport() { if(await supportsWebp()) { localStorage.setItem('webpSupport', 'True'); @@ -156,10 +142,6 @@ export default function App() { testWebpSupport(); }, []); - useEffect(() => { - state.contrast === "" ? document.body.style.backgroundColor = "white" : document.body.style.backgroundColor = "black" - }, [ state.contrast ]); - useEffect(() => { const setWindowSize = () => { dispatch({ @@ -176,305 +158,312 @@ export default function App() { return () => window.removeEventListener("resize", setWindowSize); }, [window.innerWidth, window.innerHeight]); - return ( - // add piwik later - // history={piwik.connectToHistory(customHistory)} - <> - {!awaitTest && - <React.Suspense fallback={<LoadingScreen/>}> - <BrowserRouter> - <ContrastBar/> - <Header /> - <div - style={{ - backgroundImage: - "linear-gradient(to right,#ff7f00,#e81f4f,#673ab7,#00bcd4)", - height: "5px", - }} - ></div> - <link - href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap" - rel="stylesheet" - /> - <div id="Conteudo_scroll"></div> - <Switch style={state.contrast === "" ? {backgroundColor: "white"} : {backgroundColor: "black"}}> - <Redirect from="/home" to="/" /> - <Route path="/" exact={true} component={Home} /> - <Route path="/busca" component={Search} /> - <Route path="/perfil" component={UserPage} /> - <Route path="/editarperfil" component={EditProfilePage} /> - <Route path="/recurso/:recursoId" component={ResourcePage} /> - <Route path="/termos-publicar-recurso" component={TermsPage} /> - <Route path="/permission" component={PublicationPermissionsPage} /> - {/*<Route path="termos-de-uso#publicacoes-de-usuario" component={}*/} - <Route path="/ajuda" component={HelpCenter} /> - <Route path="/contato" component={Contact} /> - <Route path="/termos-resumido" component={SummarizedUserTerms} /> - <Route path="/termos" component={UserTerms} /> - <Route path="/sobre" component={AboutPage} /> - <Route path="/mapa-site" component={SiteMap} /> - <Route path="/acessibilidade" component={Accessibility} /> - <Route path="/publicando-recurso" component={TabResoursePub} /> - <Route path="/encontrando-recurso" component={TabResourseFind} /> - <Route path="/participando-da-rede" component={TabNetPart} /> - <Route path="/gerenciando-conta" component={TabManageAc} /> - <Route path="/plataforma-mec" component={TabPlataformaMEC} /> - <Route path="/recuperar-senha/alterar-senha" component={ChangePasswordPage} /> - <Route path="/recuperar-senha" component={PasswordRecoveryPage} /> - <Route path="/usuario-publico/:userId" component={PublicUserPage} /> - <Route - path="/editar-recurso/:recursoId" - component={EditLearningObjectPage} - /> - <Route path="/professor" component={PageProfessor} /> - <Route path="/upload" component={UploadPage} /> - <Route path="/loja" component={ItemStore} /> - <Route path="/colecao-do-usuario/:id" component={CollectionPage} /> - <Route path="/colecao" component={FormationMaterialPage} /> - <Route path="/topico" component={FormationMaterialPage} /> - <Route path="/iframe-colecao" component={FormationMaterialIframe} /> - <Route path="/material-formacao" component={MaterialPage} /> - - <Route - path="/admin/home" - exact={true} - render={() => { - return <AdminTemplate inner={<Inframe/>}/> - }} - /> - <Route - path="/admin/institutions" - render={() => { - return <AdminTemplate inner={<Institution />}/> - }} - /> - <Route - path="/admin/institution" - render={() => { - return <AdminTemplate inner={<InstitutionCard />}/> - }} - /> - <Route - path="/admin/institutionEdit" - render={() => { - return <AdminTemplate inner={<InstitutionsInput />}/> - }} - /> - <Route - path="/admin/InstitutionCreate" - render={() => { - return <AdminTemplate inner={<CreateInstitution />}/> - }} - /> - <Route - path="/admin/noteVars" - render={() => { - return <AdminTemplate inner={<NoteVariables />}/> - }} - /> - <Route - path="/admin/noteVar" - render={() => { - return <AdminTemplate inner={<NoteVarCard />}/> - }} - /> - <Route - path="/admin/noteVarEdit" - render={() => { - return <AdminTemplate inner={<NoteVarInputs />}/> - }} - /> - <Route - path="/admin/languages" - render={() => { - return <AdminTemplate inner={<Languages />}/> - }} - /> - <Route - path="/admin/languageEdit" - render={() => { - return <AdminTemplate inner={<EditLanguage />}/> - }} - /> - <Route - path="/admin/languageCreate" - render={() => { - return <AdminTemplate inner={<CreateLanguage />}/> - }} - /> - <Route - path="/admin/CommunityQuestions" - render={() => { - return <AdminTemplate inner={<CommunityQuestions />}/> - }} - /> - <Route - path="/admin/CommunityQuestion" - render={() => { - return <AdminTemplate inner={<CommunityCard />}/> - }} - /> - <Route - path="/admin/Collections" - render={() => { - return <AdminTemplate inner={<Collections />}/> - }} - /> - <Route - path="/admin/Collection" - render={() => { - return <AdminTemplate inner={<CollectionCard />}/> - }} - /> - <Route - path="/admin/EditCollection" - render={() => { - return <AdminTemplate inner={<EditCollection />}/> - }} - /> - <Route - path="/admin/Ratings" - render={() => { - return <AdminTemplate inner={<Ratings />}/> - }} - /> - <Route - path="/admin/Rating" - render={() => { - return <AdminTemplate inner={<RatingCard />}/> - }} - /> - <Route - path="/admin/EditRating" - render={() => { - return <AdminTemplate inner={<EditRating />}/> - }} - /> - <Route - path="/admin/CreateRating" - render={() => { - return <AdminTemplate inner={<CreateRating />}/> - }} - /> - <Route - path="/admin/Questions" - render={() => { - return <AdminTemplate inner={<Questions />}/> - }} - /> - <Route - path="/admin/CreateQuestion" - render={() => { - return <AdminTemplate inner={<CreateQuestions />}/> - }} - /> - <Route - path="/admin/activities" - render={() => { - return <AdminTemplate inner={<Activity />}/> - }} - /> - <Route - path="/admin/activity" - render={() => { - return <AdminTemplate inner={<ActivityCard />}/> - }} - /> - <Route - path="/admin/learningObjects" - render={() => { - return <AdminTemplate inner={<EducationalObject />}/> - }} - /> - <Route - path="/admin/learningObject" - render={() => { - return <AdminTemplate inner={<EducationalObjectCard />}/> - }} - /> - <Route - path="/admin/learningObjectEdit" - render={() => { - return <AdminTemplate inner={<EducationalObjectEdit />}/> - }} - /> - <Route - path="/admin/complaints" - render={() => { - return <AdminTemplate inner={<Complaints />}/> - }} - /> - <Route - path="/admin/complaint" - render={() => { - return <AdminTemplate inner={<ComplaintCard />}/> - }} - /> - <Route - path="/admin/users/teacher_requests" - render={() => { - return <AdminTemplate inner={<AproveTeacher />}/> - }} - /> - <Route - path="/admin/usersList" - render={() => { - return <AdminTemplate inner={<UserList />}/> - }} - /> - <Route - path="/admin/user" - render={() => { - return <AdminTemplate inner={<UserCard />}/> - }} - /> - <Route - path="/admin/EditUser" - render={() => { - return <AdminTemplate inner={<EditUser />}/> - }} - /> - <Route - path="/admin/permissions" - render={() => { - return <AdminTemplate inner={<UserPermissions />}/> - }} - /> - <Route - path="/admin/EditPermissions" - render={() => { - return <AdminTemplate inner={<EditRole />}/> - }} - /> - <Route - path="/admin/CreateRole" - render={() => { - return <AdminTemplate inner={<CreateRole />}/> - }} - /> - <Route - path="/admin/BlockedUsers" - render={() => { - return <AdminTemplate inner={<BlockedUser />}/> - }} - /> - <Route - path="/admin/sendEmail" - render={() => { - return <AdminTemplate inner={<SendEmail />}/> - }} - /> - <Route path='*' component={PageNotFound} /> - </Switch> - {!hideFooter && ( - <div id="Rodape_scroll"> - <EcFooter contrast={state.contrast} /> - <GNUAGPLfooter contrast={state.contrast} /> - </div> - )} - </BrowserRouter> - </React.Suspense> - } - </> + const LoadingScreen = () => ( + <div style={{ + position: "absolute", + top: "50%", + left: "50%", + transform: "translate(-50%, -50%)" + }}> + <LoadingSpinner/> + </div> ); + + return ( + // add piwik later + // history={piwik.connectToHistory(customHistory)} + <> + {!awaitTest && + <React.Suspense fallback={<LoadingScreen/>}> + <BrowserRouter> + <Header /> + <div + style={{ + backgroundImage: + "linear-gradient(to right,#ff7f00,#e81f4f,#673ab7,#00bcd4)", + height: "5px", + }} + ></div> + <link + href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap" + rel="stylesheet" + /> + <Switch> + <Redirect from="/home" to="/" /> + <Route path="/" exact={true} component={Home} /> + <Route path="/busca" component={Search} /> + <Route path="/perfil" component={UserPage} /> + <Route path="/editarperfil" component={EditProfilePage} /> + <Route path="/recurso/:recursoId" component={ResourcePage} /> + <Route path="/termos-publicar-recurso" component={TermsPage} /> + <Route path="/permission" component={PublicationPermissionsPage} /> + {/*<Route path="termos-de-uso#publicacoes-de-usuario" component={}*/} + <Route path="/ajuda" component={HelpCenter} /> + <Route path="/contato" component={Contact} /> + <Route path="/termos" component={UserTerms} /> + <Route path="/sobre" component={AboutPage} /> + <Route path="/mapa-site" component={SiteMap} /> + <Route path="/acessibilidade" component={Accessibility} /> + <Route path="/publicando-recurso" component={TabResoursePub} /> + <Route path="/encontrando-recurso" component={TabResourseFind} /> + <Route path="/participando-da-rede" component={TabNetPart} /> + <Route path="/gerenciando-conta" component={TabManageAc} /> + <Route path="/plataforma-mec" component={TabPlataformaMEC} /> + <Route path="/recuperar-senha/alterar-senha" component={ChangePasswordPage} /> + <Route path="/recuperar-senha" component={PasswordRecoveryPage} /> + <Route path="/usuario-publico/:userId" component={PublicUserPage} /> + <Route + path="/editar-recurso/:recursoId" + component={EditLearningObjectPage} + /> + <Route path="/professor" component={PageProfessor} /> + <Route path="/upload" component={UploadPage} /> + <Route path="/loja" component={ItemStore} /> + <Route path="/colecao-do-usuario/:id" component={CollectionPage} /> + <Route path="/colecao" component={FormationMaterialPage} /> + <Route path="/topico" component={FormationMaterialPage} /> + <Route path="/iframe-colecao" component={FormationMaterialIframe} /> + <Route path="/material-formacao" component={MaterialPage} /> + + <Route + path="/admin/home" + exact={true} + render={() => { + return <AdminTemplate inner={<Inframe/>}/> + }} + /> + <Route + path="/admin/institutions" + render={() => { + return <AdminTemplate inner={<Institution />}/> + }} + /> + <Route + path="/admin/institution" + render={() => { + return <AdminTemplate inner={<InstitutionCard />}/> + }} + /> + <Route + path="/admin/institutionEdit" + render={() => { + return <AdminTemplate inner={<InstitutionsInput />}/> + }} + /> + <Route + path="/admin/InstitutionCreate" + render={() => { + return <AdminTemplate inner={<CreateInstitution />}/> + }} + /> + <Route + path="/admin/noteVars" + render={() => { + return <AdminTemplate inner={<NoteVariables />}/> + }} + /> + <Route + path="/admin/noteVar" + render={() => { + return <AdminTemplate inner={<NoteVarCard />}/> + }} + /> + <Route + path="/admin/noteVarEdit" + render={() => { + return <AdminTemplate inner={<NoteVarInputs />}/> + }} + /> + <Route + path="/admin/languages" + render={() => { + return <AdminTemplate inner={<Languages />}/> + }} + /> + <Route + path="/admin/languageEdit" + render={() => { + return <AdminTemplate inner={<EditLanguage />}/> + }} + /> + <Route + path="/admin/languageCreate" + render={() => { + return <AdminTemplate inner={<CreateLanguage />}/> + }} + /> + <Route + path="/admin/CommunityQuestions" + render={() => { + return <AdminTemplate inner={<CommunityQuestions />}/> + }} + /> + <Route + path="/admin/CommunityQuestion" + render={() => { + return <AdminTemplate inner={<CommunityCard />}/> + }} + /> + <Route + path="/admin/Collections" + render={() => { + return <AdminTemplate inner={<Collections />}/> + }} + /> + <Route + path="/admin/Collection" + render={() => { + return <AdminTemplate inner={<CollectionCard />}/> + }} + /> + <Route + path="/admin/EditCollection" + render={() => { + return <AdminTemplate inner={<EditCollection />}/> + }} + /> + <Route + path="/admin/Ratings" + render={() => { + return <AdminTemplate inner={<Ratings />}/> + }} + /> + <Route + path="/admin/Rating" + render={() => { + return <AdminTemplate inner={<RatingCard />}/> + }} + /> + <Route + path="/admin/EditRating" + render={() => { + return <AdminTemplate inner={<EditRating />}/> + }} + /> + <Route + path="/admin/CreateRating" + render={() => { + return <AdminTemplate inner={<CreateRating />}/> + }} + /> + <Route + path="/admin/Questions" + render={() => { + return <AdminTemplate inner={<Questions />}/> + }} + /> + <Route + path="/admin/CreateQuestion" + render={() => { + return <AdminTemplate inner={<CreateQuestions />}/> + }} + /> + <Route + path="/admin/activities" + render={() => { + return <AdminTemplate inner={<Activity />}/> + }} + /> + <Route + path="/admin/activity" + render={() => { + return <AdminTemplate inner={<ActivityCard />}/> + }} + /> + <Route + path="/admin/learningObjects" + render={() => { + return <AdminTemplate inner={<EducationalObject />}/> + }} + /> + <Route + path="/admin/learningObject" + render={() => { + return <AdminTemplate inner={<EducationalObjectCard />}/> + }} + /> + <Route + path="/admin/learningObjectEdit" + render={() => { + return <AdminTemplate inner={<EducationalObjectEdit />}/> + }} + /> + <Route + path="/admin/complaints" + render={() => { + return <AdminTemplate inner={<Complaints />}/> + }} + /> + <Route + path="/admin/complaint" + render={() => { + return <AdminTemplate inner={<ComplaintCard />}/> + }} + /> + <Route + path="/admin/users/teacher_requests" + render={() => { + return <AdminTemplate inner={<AproveTeacher />}/> + }} /> + <Route + path="/admin/usersList" + render={() => { + return <AdminTemplate inner={<UserList />}/> + }} + /> + <Route + path="/admin/user" + render={() => { + return <AdminTemplate inner={<UserCard />}/> + }} + /> + <Route + path="/admin/EditUser" + render={() => { + return <AdminTemplate inner={<EditUser />}/> + }} + /> + <Route + path="/admin/permissions" + render={() => { + return <AdminTemplate inner={<UserPermissions />}/> + }} + /> + <Route + path="/admin/EditPermissions" + render={() => { + return <AdminTemplate inner={<EditRole />}/> + }} + /> + <Route + path="/admin/CreateRole" + render={() => { + return <AdminTemplate inner={<CreateRole />}/> + }} + /> + <Route + path="/admin/BlockedUsers" + render={() => { + return <AdminTemplate inner={<BlockedUser />}/> + }} + /> + <Route + path="/admin/sendEmail" + render={() => { + return <AdminTemplate inner={<SendEmail />}/> + }} + /> + <Route path='*' component={PageNotFound} /> + </Switch> + {!hideFooter && ( + <div> + <EcFooter /> + <GNUAGPLfooter /> + </div> + )} + </BrowserRouter> + </React.Suspense> + } + </> + ); } \ No newline at end of file diff --git a/src/Components/AGPLFooter.js b/src/Components/AGPLFooter.js index 7058ac741049dfc38423689e9b70a269558d2fb8..f4633420764b97b958081c2af3d47551bb07825a 100644 --- a/src/Components/AGPLFooter.js +++ b/src/Components/AGPLFooter.js @@ -29,20 +29,10 @@ const grayFooter={ paddingTop: "20px", paddingBottom: "10px" }; - -const blackFooter={ - backgroundColor: "black", - color: "white", - textAlign: "center", - display: "block", - paddingTop: "20px", - paddingBottom: "10px" -}; - class AGPLFooter extends Component{ render(){ return( - <div style={this.props.contrast === '' ? grayFooter : blackFooter}> + <div style={grayFooter}> <Container> <Row justify="around"> <Col md={1}> diff --git a/src/Components/AboutCarousel.js b/src/Components/AboutCarousel.js index a3c1bf7f2202909df37870322405e58c02225d2c..204e5de622de184e6217f53d835a6f899bfd90a0 100644 --- a/src/Components/AboutCarousel.js +++ b/src/Components/AboutCarousel.js @@ -19,7 +19,7 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React from 'react'; import "react-responsive-carousel/lib/styles/carousel.min.css"; -import { Carousel } from "react-responsive-carousel"; +import { Carousel } from 'react-responsive-carousel'; import styled from 'styled-components'; import "./AboutCarousel.css" @@ -71,56 +71,56 @@ const CarouselAbout = styled(Carousel)` text-align: center; display: block; margin: auto; - /* padding-inline: 235px */ + // padding-inline: 235px } } ` -function AboutCarousel({ contrast }) { +function AboutCarousel(props) { return ( <div id={"You-Can-Caroussel"}> - <CarouselAbout showThumbs={true} - showStatus={false} - showIndicators={false} - interval={8000} - transitionTime={1000} - autoPlay - infiniteLoop + <CarouselAbout showThumbs= {true} + showStatus= {false} + showIndicators = {false} + interval={8000} + transitionTime={1000} + autoPlay + infiniteLoop > - <div className={`${contrast}BackColor`}> - <img src={Img1} alt="Slide 1" /> - <span className={`${contrast}TextColor`}>Buscar e Baixar Recursos</span> - <p className={`${contrast}TextColor`} style={{ margin: 0, padding: 0 }}>São mais de 20 mil recursos educacionais à sua disposição. São recursos de portais parceiros do MEC e de professores que, como você, atuam na Educação Básica!</p> + <div> + <img src={Img1} alt="Slide 1"/> + <span>Buscar e Baixar Recursos</span> + <p>São mais de 20 mil recursos educacionais à sua disposição. São recursos de portais parceiros do MEC e de professores que, como você, atuam na Educação Básica!</p> </div> - <div className={`${contrast}BackColor`}> - <img src={Img2} alt="Slide 2" /> - <span className={`${contrast}TextColor`}>Guardar Recursos em Coleções</span> - <p className={`${contrast}TextColor`} style={{ margin: 0, padding: 0 }}>Guarde e organize em coleções aqueles recursos que você considera ser interessantes para elaborar a sua aula. Aproveite e indique aos colegas pelas redes sociais ou e-mail.</p> + <div> + <img src={Img2} alt="Slide 2"/> + <span>Guardar Recursos em Coleções</span> + <p>Guarde e organize em coleções aqueles recursos que você considera ser interessantes para elaborar a sua aula. Aproveite e indique aos colegas pelas redes sociais ou e-mail.</p> </div> - <div className={`${contrast}BackColor`}> - <img src={Img3} alt="Slide 3" /> + <div> + <img src={Img3} alt="Slide 3"/> - <span className={`${contrast}TextColor`}>Compartilhar suas Experiências</span> - <p className={`${contrast}TextColor`} style={{ margin: 0, padding: 0 }}>Você pode relatar suas experiências sobre o uso de recursos no seu cotidiano escolar. Aproveite esse espaço para sugerir e conhecer novos usos para um mesmo recurso.</p> + <span>Compartilhar suas Experiências</span> + <p>Você pode relatar suas experiências sobre o uso de recursos no seu cotidiano escolar. Aproveite esse espaço para sugerir e conhecer novos usos para um mesmo recurso.</p> </div> - <div className={`${contrast}BackColor`}> - <img src={Img4} alt="Slide 4" /> + <div> + <img src={Img4} alt="Slide 4"/> - <span className={`${contrast}TextColor`}>Publicar o seu Recurso</span> - <p className={`${contrast}TextColor`} style={{ margin: 0, padding: 0 }}>Colabore e ajude a fortalecer a plataforma publicando um recurso educacional desenvolvido por você ou pelo coletivo da escola do qual faz parte. Compartilhe seu conhecimento e dê visibilidade ao seu recurso, torne-o público enriquecendo o conhecimento partilhado!</p> + <span>Publicar o seu Recurso</span> + <p>Colabore e ajude a fortalecer a plataforma publicando um recurso educacional desenvolvido por você ou pelo coletivo da escola do qual faz parte. Compartilhe seu conhecimento e dê visibilidade ao seu recurso, torne-o público enriquecendo o conhecimento partilhado!</p> </div> - <div className={`${contrast}BackColor`}> - <img src={Img5} alt="Slide 5" /> + <div> + <img src={Img5} alt="Slide 5"/> - <span className={`${contrast}TextColor`}>Encontrar Materiais de Formação</span> - <p className={`${contrast}TextColor`} style={{ margin: 0, padding: 0 }}>A plataforma disponibiliza um conjunto de materiais de formação desenvolvidos pelo Ministério da Educação com diversidade de temas e recursos educacionais.</p> + <span>Encontrar Materiais de Formação</span> + <p>A plataforma disponibiliza um conjunto de materiais de formação desenvolvidos pelo Ministério da Educação com diversidade de temas e recursos educacionais.</p> </div> diff --git a/src/Components/AboutCarouselPartner.js b/src/Components/AboutCarouselPartner.js index 7c1eef5d6b2a2073711ca4f2d7cb899323e705d4..ba4800d6963383c5c2154fb3f89c95f1abdae188 100644 --- a/src/Components/AboutCarouselPartner.js +++ b/src/Components/AboutCarouselPartner.js @@ -39,12 +39,12 @@ import { Impulsiona } from "ImportImages.js"; import { InstPeninsula } from "ImportImages.js"; import { Telefonica } from "ImportImages.js"; -function AboutCarouselPartner() { +function AboutCarouselPartner(props) { const items = [ <a href="http://portaldoprofessor.mec.gov.br/index.html" rel="noreferrer" target="_blank"> - <img src={LogoPortalDoProfessor} alt="LogoPortalDoProfessor" /> + <img src={LogoPortalDoProfessor} alt="LogoPortalDoProfessor"/> </a>, <a href="http://objetoseducacionais2.mec.gov.br/" rel="noreferrer" target="_blank"> <img src={LogoBioe} alt="LogoBioe" /> @@ -55,8 +55,8 @@ function AboutCarouselPartner() { <a href="https://tvescola.org.br/" rel="noreferrer" target="_blank"> <img src={LogoTvEscola} alt="LogoTvEscola" /> </a>, - <a href="http://www.fundacaolemann.org.br/" rel="noreferrer" target="_blank"> - <img style={{ align: "middle" }} src={FundacaoLemann} alt="FundacaoLemann" /> + <a href="http://www.fundacaolemann.org.br/" rel="noreferrer" target="_blank"> + <img style={{align: "middle"}} src={FundacaoLemann} alt="FundacaoLemann" /> </a>, <a href="http://new.safernet.org.br/" rel="noreferrer" target="_blank"> <img src={Safer} alt="Safer" /> @@ -71,7 +71,7 @@ function AboutCarouselPartner() { <img src={Educagital} alt="Educagital" /> </a>, <a href="http://www.aefbrasil.org.br" rel="noreferrer" target="_blank"> - <img style={{ filter: "grayscale(1)" }} src={EnefAef} alt="EnefAef" /> + <img style={{filter: "grayscale(1)"}} src={EnefAef} alt="EnefAef" /> </a>, <a href="https://impa.br/" rel="noreferrer" target="_blank"> <img src={Impa} alt="Impa" /> @@ -89,12 +89,12 @@ function AboutCarouselPartner() { <img src={Telefonica} alt="Telefonica" /> </a> ] - const partnerPerPage = (() => { + const partnerPerPage = (()=> { var pageWidth = window.innerWidth - if (pageWidth >= 1200) { + if (pageWidth >= 1200){ return 3 } - else { + else{ return 1 } }) @@ -106,35 +106,34 @@ function AboutCarouselPartner() { return ( <div id="Partner-Caroussel"> - <Carousel - showThumbs={false} - showStatus={false} - showIndicators={true} - interval={4500} - transitionTime={1000} - autoPlay - infiniteLoop + <Carousel showThumbs= {false} + showStatus= {false} + showIndicators = {true} + interval={4500} + transitionTime={1000} + autoPlay + infiniteLoop - > - { - rows.map((row, index) => ( - <div key={(index + 1)} style={{ display: 'inline-flex', paddingTop: 100 }}> - { - row.map((partner, index2) => ( - <div - key={index + (index2 * 10)} - style={{ marginLeft: 10, display: 'flex', maxWidth: 300 }} - > - { - partner - } - </div> - )) - } - </div> - )) - } - </Carousel> + > + { + rows.map((row, index) => ( + <div key={(index+1)} style={{display:'inline-flex', paddingTop:100}}> + { + row.map((partner, index2) => ( + <div + key={index + (index2*10)} + style={{marginLeft:10, display: 'flex', maxWidth:300}} + > + { + partner + } + </div> + )) + } + </div> + )) + } + </Carousel> </div> ); diff --git a/src/Components/Accessibility/ContrastBar.js b/src/Components/Accessibility/ContrastBar.js deleted file mode 100644 index 0596af0ff78346f729db85a615f83b96fddc09eb..0000000000000000000000000000000000000000 --- a/src/Components/Accessibility/ContrastBar.js +++ /dev/null @@ -1,209 +0,0 @@ -/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre -Departamento de Informatica - Universidade Federal do Parana - -This file is part of Plataforma Integrada MEC. - -Plataforma Integrada MEC is free software: you can redistribute it and/or modify -it under the terxs of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Plataforma Integrada MEC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -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 } from 'react'; -import './ContrastBar.css'; -import ContrastImageOn from '../../img/OnContrastIcon.png'; -import ContrastImageOff from '../../img/OffContrastIcon.png'; -import { Store } from '../../Store'; -import Grid from "@material-ui/core/Grid" -import { Button } from '@material-ui/core'; -import styled from 'styled-components'; - -/** - * Bar allowing for the toggle of the high contrast mode on the page. - */ -function ContrastBar() { - /* eslint-disable */ - - // Hook to set contrast context - const { state, dispatch } = React.useContext(Store); - - const handleScrollTo = (location) => { - if (location === "Pesquisa_scroll") - dispatch({ - type: 'HANDLE_SEARCH_BAR', - opened: !state.searchOpen - }) - document.getElementById(location).scrollIntoView({ behavior: 'smooth' }); - } - - useEffect(() => { - const testContrast = localStorage.getItem('@portalmec/contrast'); - if (testContrast) { - setContrastAction(testContrast); - } else { - setContrastAction(''); - } - }, []); - - const setContrastAction = (newContrast) => { - localStorage.setItem('@portalmec/contrast', newContrast) - return dispatch({ - type: 'SET_CONTRAST', - payload: newContrast - }) - } - - const setFontSizeAction = (newFontSize) => { - return dispatch({ - type: 'SET_FONT_SIZE', - payload: newFontSize - }) - } - - const toggleContrast = () => { - var status = (state.contrast === '' ? 'Contrast' : '') - - setContrastAction(status) - } - const incrementFontSize = () => { - document.getElementsByTagName("body")[0].style.fontSize = (parseInt(state.fontSize, 10) + 1) + "px"; - setFontSizeAction(parseInt(state.fontSize, 10) + 1); - } - const decrementFontSize = () => { - document.getElementsByTagName("body")[0].style.fontSize = (parseInt(state.fontSize, 10) - 1) + "px"; - setFontSizeAction(parseInt(state.fontSize, 10) - 1); - } - const defaultFontSize = () => { - setFontSizeAction(15); - document.getElementsByTagName("body")[0].style.fontSize = "15px"; - } - - return ( - <React.Fragment> - <StyledGrid contrast={state.contrast} xs={12}> - { - window.innerWidth > 750 ? - ( - <> - <Grid xs={8}> - <StyledButton style={{justifyContent: "flex-start"}}> - <a href="/" accessKey="1" title="Ir para a página principal alt + 1"> - <span className={`${state.contrast}text`}>Plataforma MEC de Recursos Educacionais Digitais</span> - </a> - </StyledButton> - </Grid> - <Grid xs={4} style={{display: "flex"}}> - <Grid xs={3}> - <StyledButton onClick={() => handleScrollTo("Conteudo_scroll")}> - <a className={`${state.contrast}text`} accessKey="2" title="Ir para o conteúdo alt + 2"> - Conteúdo - </a> - </StyledButton> - </Grid> - <Grid xs={3}> - <StyledButton onClick={() => handleScrollTo("Pesquisa_scroll")}> - <a className={`${state.contrast}text`} accessKey="3" title="Ir para o menu e a barra de pesquisa alt + 3"> - Menu - </a> - </StyledButton> - </Grid> - <Grid xs={3}> - <StyledButton onClick={() => handleScrollTo("Rodape_scroll")}> - <a className={`${state.contrast}text`} accessKey="4" title="Ir para o rodapé alt + 4"> - Rodapé - </a> - </StyledButton> - </Grid> - <Grid xs={3}> - <StyledButton onClick={toggleContrast}> - <a className={`${state.contrast}text`} title={state.contrast === "" ? "Ativar alto contraste" : "Desativar alto contraste"}> - <img className='Constrasticon' src={state.contrast === "" ? ContrastImageOff : ContrastImageOn} style={{ paddingRight: "15px" }} alt="Ícone de contraste" /> - </a> - </StyledButton> - </Grid> - </Grid> - </> - ) - : - ( - <> - <Grid xs={12} style={{display: "flex"}}> - <Grid xs={3}> - <StyledButton> - <a href="/" accessKey="1" title="Ir para a página principal alt + 1"> - <span className={`${state.contrast}text`}>MEC RED</span> - </a> - </StyledButton> - </Grid> - <Grid xs={3}> - <StyledButton onClick={() => handleScrollTo("Conteudo_scroll")}> - <a className={`${state.contrast}text`} accessKey="2" title="Ir para o conteúdo alt + 2"> - Conteúdo - </a> - </StyledButton> - </Grid> - <Grid xs={2}> - <StyledButton onClick={() => handleScrollTo("Pesquisa_scroll")}> - <a className={`${state.contrast}text`} accessKey="3" title="Ir para o menu e a barra de pesquisa alt + 3"> - Menu - </a> - </StyledButton> - </Grid> - <Grid xs={3}> - <StyledButton onClick={() => handleScrollTo("Rodape_scroll")}> - <a className={`${state.contrast}text`} accessKey="4" title="Ir para o rodapé alt + 4"> - Rodapé - </a> - </StyledButton> - </Grid> - <Grid xs={1}> - <StyledButton onClick={toggleContrast}> - <a className={`${state.contrast}text`} title={state.contrast === "" ? "Ativar alto contraste" : "Desativar alto contraste"}> - <img className='Constrasticon' src={state.contrast === "" ? ContrastImageOff : ContrastImageOn} style={{ paddingRight: "15px" }} alt="Ícone de contraste" /> - </a> - </StyledButton> - </Grid> - </Grid> - </> - ) - } - </StyledGrid> - </React.Fragment> - ); - -} - -const StyledGrid = styled(Grid) ` - display: flex; - padding-left: 15px; - padding-right: 15px; - background: ${props => props.contrast === "" ? "white" : "black"}; - border-bottom: ${props => props.contrast === "" ? "1px solid #666" : "1px solid white"}; -` - -const StyledButton = styled(Button)` - width: 100%; -` - -/* -<div> - <a className={`${state.contrast}text`} onClick={incrementFontSize} title="Aumentar tamanho da fonte"> - A+ - </a> - <a className={`${state.contrast}text`} onClick={decrementFontSize} title="Diminuir tamanho da fonte"> - A- - </a> - <a className={`${state.contrast}text`} onClick={defaultFontSize} title="Restaurar tamanho da fonte"> - A - </a> -</div> -*/ - -export default ContrastBar; \ No newline at end of file diff --git a/src/Components/ActivityListItem.js b/src/Components/ActivityListItem.js index fe0a4086e8522344df7ddf8c57db83fc23216729..43402a8e5176dc14edaba476f2403d6a72f0f202 100644 --- a/src/Components/ActivityListItem.js +++ b/src/Components/ActivityListItem.js @@ -117,7 +117,7 @@ export default function ActivityListItem(props) { }, []) return ( - <StyledListItem onMenuBar={props.onMenuBar} contrast={props.contrast}> + <StyledListItem onMenuBar={props.onMenuBar}> { !props.onMenuBar && <> @@ -140,11 +140,10 @@ export default function ActivityListItem(props) { } secondary={ <div> - - <span style={props.contrast === "" ? { color: "#666" } : {color: "white"}}> - + + <span> <Link to={{ - pathname: props.ownerHref, + pathname: props.ownerHref, state: '0', }} className="owner-name-a" >{props.ownerName}</Link> {activity.text} <Link to={props.recipientHref} className="recipient-name-a">{props.recipientName}</Link> {activity.text2} </span> @@ -170,24 +169,22 @@ const StyledListItem = styled(ListItem)` .time-ago-span { font-size : 12px; - font-family : 'Lato', medium; - color: ${props => props.contrast === '' ? "#787380" : "white"}; + font-family : 'Lato', medium; + color : #787380; } .owner-name-a { - color: ${props => props.contrast === '' ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; + color : #00bcd4; } .recipient-name-a { cursor : pointer; - color: ${props => props.contrast === '' ? "#337ab7" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; + color : #337ab7; } .icon { padding-right : 10px; - color: ${props => props.contrast === '' ? "#666" : "white"}; + color : #666; } .tag-object { @@ -211,18 +208,16 @@ const StyledListItem = styled(ListItem)` } .recurso-color { - background-color: ${props => props.contrast === '' ? "orange" : ""}; - border: ${props => props.contrast === '' ? "" : "1px solid #d4d4d4"}; + background-color : orange; } .colecao-color { - background-color: ${props => props.contrast === '' ? "blue" : ""}; - border: ${props => props.contrast === '' ? "" : "1px solid #d4d4d4"}; + background-color : blue; } .curadoria-color { - background-color: ${props => props.contrast === '' ? "red" : ""}; - border: ${props => props.contrast === '' ? "" : "1px solid #d4d4d4"}; + background-color : red; } + ` diff --git a/src/Components/AreasSubPagesFunction.js b/src/Components/AreasSubPagesFunction.js index 7078cb081a7a40a928da548ab6101ff1edacda6f..8670178587cacf74b98445342206d7a2a7b04f95 100644 --- a/src/Components/AreasSubPagesFunction.js +++ b/src/Components/AreasSubPagesFunction.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, { useState, useEffect, useContext } from "react"; +import React, { useState, useEffect } from "react"; import "./carousel.css"; import { Col, Row, Container, Hidden, Visible } from "react-grid-system"; import styled from 'styled-components' @@ -40,16 +40,6 @@ import { materiais } from "ImportImages.js"; import { colecoes } from "ImportImages.js"; import { ColecaoVazia } from "ImportImages.js"; import { RecursoVazio } from "ImportImages.js"; -import { Store } from '../Store' -import { makeStyles } from '@material-ui/core/styles' - -const useStyles = makeStyles(theme => ({ - contrastTextField: { - border: "1px solid white", - borderRadius: theme.shape.borderRadius, - backgroundColor: "black", - } -})) function objectsPerPage() { var pageWidth = window.innerWidth @@ -74,7 +64,7 @@ function ReqResources(props) { var aux = [] var resources_per_page = objectsPerPage() for (let i = 0; i < 12 / resources_per_page; i++) { - aux.push(data.slice(i * resources_per_page, resources_per_page * (i + 1))) + aux.push(data.slice(i * resources_per_page, resources_per_page * (i + 1))) } setRows(aux) setIsLoading(false) @@ -91,7 +81,7 @@ function ReqResources(props) { isLoading ? <Grid container justify="center" alignItems="center" style={{ margin: "2em" }} > <Grid item> - <CircularProgress size={24} style={props.contrast === "" ? { color: "#ff7f00" } : { color: "yellow" }} /> + <CircularProgress size={24} color="#ff7f00" /> </Grid> </Grid> : @@ -99,34 +89,33 @@ function ReqResources(props) { { rows.length >= 1 ? rows.map((row, index) => ( - <Row style={{ paddingBottom: "5px", margin: '0 auto', width: "80%", justifyContent: "center", minHeight: "50px" }} key={(index + 1)}> - {row.map((card) => ( - <div style={{ marginLeft: 10, display: 'flex' }} key={card.id * (index + 1)}> - <ResourceCardFunction - contrast={props.contrast} - avatar={card.publisher.avatar} - id={card.id} - thumbnail={card.thumbnail} - type={card.object_type ? card.object_type : "Outros"} - title={card.name} - published={card.state === "published" ? true : false} - likeCount={card.likes_count} - liked={card.liked} - rating={card.review_average} - author={card.publisher.name} - tags={card.tags} - href={"/recurso/" + card.id} - downloadableLink={card.default_attachment_location} - /> - </div> - ))} - </Row> + <Row style={{ paddingBottom: "5px", margin: '0 auto', width: "80%", justifyContent: "center", minHeight: "50px" }} key={(index + 1)}> + {row.map((card) => ( + <div style={{ marginLeft: 10, display: 'flex' }} key={card.id * (index + 1)}> + <ResourceCardFunction + avatar={card.publisher.avatar} + id={card.id} + thumbnail={card.thumbnail} + type={card.object_type ? card.object_type : "Outros"} + title={card.name} + published={card.state === "published" ? true : false} + likeCount={card.likes_count} + liked={card.liked} + rating={card.review_average} + author={card.publisher.name} + tags={card.tags} + href={"/recurso/" + card.id} + downloadableLink={card.default_attachment_location} + /> + </div> + ))} + </Row> )) : <Grid container justify="center" alignItems="center"> - <Grid item> - <img src={RecursoVazio} alt="Não há recursos" /> - </Grid> + <Grid item> + <img src={RecursoVazio} alt="Não há recursos" /> + </Grid> </Grid> } </Carousel> @@ -142,7 +131,7 @@ function ReqCollections(props) { var aux = [] var collections_per_page = objectsPerPage() for (let i = 0; i < 12 / collections_per_page; i++) { - aux.push(data.slice(i * collections_per_page, collections_per_page * (i + 1))) + aux.push(data.slice(i * collections_per_page, collections_per_page * (i + 1))) } setIsLoading(false) setRows(aux) @@ -158,51 +147,86 @@ function ReqCollections(props) { return ( isLoading ? <Grid container justify="center" alignItems="center" style={{ marginTop: "2em" }}> - <Grid item> - <CircularProgress size={24} style={props.contrast === "" ? { color: "#673ab7" } : { color: "yellow" }} /> - </Grid> + <Grid item> + <CircularProgress size={24} color="#673ab7" /> + </Grid> </Grid> : rows.length >= 1 ? <Carousel showThumbs={false} infiniteLoop={true} showStatus={false}> { - rows.map((row, index) => ( + rows.map((row, index) => ( <Row style={{ paddingBottom: "5px", margin: '0 auto', width: "80%", justifyContent: "center", minHeight: "50px" }} key={(index + 1)}> - {row.map((card) => ( - <div style={{ marginLeft: 10, display: 'flex' }} key={card.id * (index + 1)}> - <CollectionCardFunction - contrast={props.contrast} - name={card.name} - tags={card.tags} - rating={card.score} - id={card.id} - author={card.owner ? card.owner.name : ""} - description={card.description} - thumbnails={card.items_thumbnails} - avatar={card.owner ? card.owner.avatar : ""} - likeCount={card.likes_count} - followed={card.followed} - liked={card.liked} - collections={card.collection_items} - authorID={card.owner ? card.owner.id : ""} - /> - </div> - ))} + {row.map((card) => ( + <div style={{ marginLeft: 10, display: 'flex' }} key={card.id * (index + 1)}> + <CollectionCardFunction + name={card.name} + tags={card.tags} + rating={card.score} + id={card.id} + author={card.owner ? card.owner.name : ""} + description={card.description} + thumbnails={card.items_thumbnails} + avatar={card.owner ? card.owner.avatar : ""} + likeCount={card.likes_count} + followed={card.followed} + liked={card.liked} + collections={card.collection_items} + authorID={card.owner ? card.owner.id : ""} + /> + </div> + ))} </Row> - )) - } + ))} </Carousel> - : + : <Grid container justify="center" alignItems="center"> <Grid item> - <img src={ColecaoVazia} alt="Não há coleções" /> + <img src={ColecaoVazia} alt="Não há coleções" /> </Grid> </Grid> ) } -function TabRecurso({ contrast }) { - const classes = useStyles() +function ReqMaterials(props) { + const materials = colecoes_obj(); + + const handleExpandMaterial = (id) => { + if (id !== props.currMaterial.material.id) + props.setCurrMaterial({ + open: true, + material: { ...materials[id] } + }) + else + props.setCurrMaterial({ + open: false, + material: {} + }) + } + + return ( + <Row> + { + materials.map((material, index) => { + return ( + <Col md={3} key={index}> + <MaterialCard + name={material.name} + thumb={material.img} + score={material.score} + modules={material.topics} + handleExpand={handleExpandMaterial} + id={index} + /> + </Col> + ) + }) + } + </Row> + ) +} + +function TabRecurso() { const text = "Nesta área, você tem acesso a Recursos Educacionais Digitais, isto é, a vídeos, animações e a outros recursos destinados à educação. São Recursos de portais parceiros do MEC e de professores que, como você, atuam na Educação Básica!" const [currOrder, setCurrOrder] = useState("Mais Relevante"); const [currValue, setCurrValue] = useState("score"); @@ -217,111 +241,105 @@ function TabRecurso({ contrast }) { return ( <React.Fragment> - <div style={{ backgroundColor: contrast === "" ? "#ff7f00" : "black", position: "relative" }}> - <StyledTab container contrast={contrast}> - <Grid item md={3} xs={12}> - <img - src={recursos} - alt="aba recursos" - style={{ float: "left", marginRight: 20, marginBottom: 20, marginLeft: window.innerWidth >= 825 ? "25%" : "0px" }} - /> - </Grid> + <div style={{ backgroundColor: "#ff7f00", position: "relative" }}> + <StyledTab container> + <Grid item md={3} xs={12}> + <img + src={recursos} + alt="aba recursos" + style={{ float: "left", marginRight: 20, marginBottom: 20, marginLeft: window.innerWidth >= 825 ? "25%" : "0px" }} + /> + </Grid> + { + window.innerWidth <= 501 && + <h4> + Recursos Educacionais Digitais + </h4> + } + <Grid item md={6} xs={12}> + <p> + {text} + </p> + </Grid> + { + window.innerWidth <= 501 && + <div style={{ display: "flex", justifyContent: "center" }}> + <Link to={`/busca?page=0&results_per_page=12&order=review_average&query=*&search_class=LearningObject`} className="button-ver">VER RECURSOS</Link> + </div> + } + </StyledTab> + </div> + { + window.innerWidth > 501 && + <Container style={{ padding: "20px" }}> + <Grid + container + direction="row" + justify="space-between" + alignItems="center" + style={{ + paddingBottom: "5px", + borderBottom: "1px solid #ff7f00", + color: "#ff7f00", + }} + > + <Grid item> + <p + style={{ margin: 0, padding: 0 }} + > { - window.innerWidth <= 501 && - <h4> - Recursos Educacionais Digitais - </h4> + `Recursos ${currOrder}` } - <Grid item md={6} xs={12}> - <p> - {text} - </p> + </p> + </Grid> + + <Grid item> + <Grid container direction="row" alignItems="center" spacing={1}> + <Grid item> + <p style={{ margin: 0, padding: 0 }}> + Ordenar por: + </p> </Grid> - { - window.innerWidth <= 501 && - <div style={{ display: "flex", justifyContent: "center" }}> - <Link to={`/busca?page=0&results_per_page=12&order=review_average&query=*&search_class=LearningObject`} className="button-ver">VER RECURSOS</Link> - </div> - } - </StyledTab> - </div> - { - window.innerWidth > 501 && - <div className={`${contrast}BackColor`}> - <Container style={{ padding: "20px" }}> - <Grid - container - direction="row" - justify="space-between" - alignItems="center" - style={{ - paddingBottom: "5px", - borderBottom: contrast === "" ? "1px solid #ff7f00" : "1px solid white", - color: contrast === "" ? "#ff7f00" : "white", + <Grid item> + <TextField + select + fullWidth + value={currValue} + variant="outlined" + > + {ordenar.map((option) => ( + <MenuItem + key={option.value} + value={option.value} + name={option.value} + onClick={() => { + setCurrOrder(option.label) + setCurrValue(option.value) }} > - <Grid item> - <p - style={{ margin: 0, padding: 0 }} - > - { - `Recursos ${currOrder}` - } - </p> - </Grid> - - <Grid item> - <Grid container direction="row" alignItems="center" spacing={1}> - <Grid item> - <p style={{ margin: 0, padding: 0 }}> - Ordenar por: - </p> - </Grid> - <Grid item> - <StyledTextField - contrast={contrast} - select - fullWidth - value={currValue} - variant="outlined" - className={contrast === "Contrast" && classes.contrastTextField} - > - {ordenar.map((option) => ( - <StyledMenuItem - contrast={contrast} - key={option.value} - value={option.value} - name={option.value} - onClick={() => { - setCurrOrder(option.label) - setCurrValue(option.value) - }} - > - <span style={currValue === option.value ? { color: contrast === "" ? "#ff7f00" : "yellow", textDecoration: contrast === "" ? "none" : "underline", fontWeight: "500" } : { color: contrast === "" ? "" : "yellow", textDecoration: contrast === "" ? "none" : "underline", fontWeight: "lighter" }} > - {option.label} - </span> - </StyledMenuItem> - ))} - </StyledTextField> - </Grid> - </Grid> - </Grid> - </Grid> - <Hidden sm xs> - <ReqResources order={currValue} contrast={contrast} /> - </Hidden> - <Visible sm xs> - <ReqResources order={currValue} contrast={contrast} /> - </Visible> - </Container> - </div> - } + <span style={currValue === option.value ? { color: "#ff7f00" } : null} > + {option.label} + </span> + </MenuItem> + ))} + </TextField> + </Grid> + </Grid> + </Grid> + </Grid> + <Hidden sm xs> + <ReqResources order={currValue} /> + </Hidden> + <Visible sm xs> + <ReqResources order={currValue} /> + </Visible> + </Container> + } </React.Fragment> ) } -function TabColecoes({ contrast }) { - const classes = useStyles() +function TabColecoes() { const text = "Nesta área, você tem acesso às coleções criadas e organizadas pelos usuários da plataforma. É mais uma possibilidade de buscar recursos educacionais para sua aula!" const [currOrder, setCurrOrder] = useState("Mais Relevante"); const [currValue, setCurrValue] = useState("score"); @@ -336,223 +354,179 @@ function TabColecoes({ contrast }) { return ( <React.Fragment> - <div style={{ backgroundColor: "#673ab7", position: "relative" }}> - <StyledTab container contrast={contrast}> - <Grid item md={3} xs={12}> - <img - src={colecoes} - alt="aba recursos" - style={{ float: "left", marginRight: 20, marginBottom: 20, marginLeft: window.innerWidth >= 825 ? "25%" : "0px" }} - /> - </Grid> + <div style={{ backgroundColor: "#673ab7", position: "relative" }}> + <StyledTab container> + <Grid item md={3} xs={12}> + <img + src={colecoes} + alt="aba recursos" + style={{ float: "left", marginRight: 20, marginBottom: 20, marginLeft: window.innerWidth >= 825 ? "25%" : "0px" }} + /> + </Grid> + { + window.innerWidth <= 501 && + <h4> + Coleções dos Usuários + </h4> + } + <Grid item md={6} xs={12}> + <p> + {text} + </p> + </Grid> + { + window.innerWidth <= 501 && + <div style={{ display: "flex", justifyContent: "center" }}> + <Link to={`/busca?page=0&results_per_page=12&order=review_average&query=*&search_class=Collection`} className="button-ver">VER COLEÇÕES</Link> + </div> + } + </StyledTab> + </div> + { + window.innerWidth > 501 && + <Container style={{ padding: "20px" }}> + <Grid + container + direction="row" + justify="space-between" + alignItems="center" + style={{ + paddingBottom: "5px", + borderBottom: "1px solid #673ab7", + color: "#673ab7", + }} + > + <Grid item> + <p + style={{ margin: 0, padding: 0 }} + > { - window.innerWidth <= 501 && - <h4> - Coleções dos Usuários - </h4> + `Coleções ${currOrder}` } - <Grid item md={6} xs={12}> - <p> - { text} - </p> + </p> + </Grid> + + <Grid item> + <Grid container direction="row" alignItems="center" spacing={1}> + <Grid item> + <p style={{ margin: 0, padding: 0 }}> + Ordenar por: + </p> </Grid> - { - window.innerWidth <= 501 && - <div style={{ display: "flex", justifyContent: "center" }}> - <Link to={`/busca?page=0&results_per_page=12&order=review_average&query=*&search_class=Collection`} className="button-ver">VER COLEÇÕES</Link> - </div> - } - </StyledTab> - </div> - { - window.innerWidth > 501 && - <div className={`${contrast}BackColor`}> - <Container style={{ padding: "20px" }}> - <Grid - container - direction="row" - justify="space-between" - alignItems="center" - style={{ - paddingBottom: "5px", - borderBottom: contrast === "" ? "1px solid #673ab7" : "1px solid white", - color: contrast === "" ? "#673ab7" : "white", + <Grid item> + <TextField + select + fullWidth + value={currValue} + variant="outlined" + > + {ordenar.map((option) => ( + <MenuItem + key={option.value} + value={option.value} + name={option.value} + onClick={() => { + setCurrOrder(option.label) + setCurrValue(option.value) }} > - <Grid item> - <p - style={{ margin: 0, padding: 0 }} - > - { - `Coleções ${currOrder}` - } - </p> - </Grid> - - <Grid item> - <Grid container direction="row" alignItems="center" spacing={1}> - <Grid item> - <p style={{ margin: 0, padding: 0 }}> - Ordenar por: - </p> - </Grid> - <Grid item> - <StyledTextField - contrast={contrast} - select - fullWidth - value={currValue} - variant="outlined" - className={contrast === "Contrast" && classes.contrastTextField} - > - {ordenar.map((option) => ( - <StyledMenuItem - contrast={contrast} - key={option.value} - value={option.value} - name={option.value} - style={contrast === "" ? {} : { backgroundColor: "black" }} - onClick={() => { - setCurrOrder(option.label) - setCurrValue(option.value) - }} - > - <span style={currValue === option.value ? { color: contrast === "" ? "#673ab7" : "yellow", textDecoration: contrast === "" ? "none" : "underline", fontWeight: "500" } : { color: contrast === "" ? "" : "yellow", textDecoration: contrast === "" ? "none" : "underline", fontWeight: "lighter" }} > - {option.label} - </span> - </StyledMenuItem> - ))} - </StyledTextField> - </Grid> - </Grid> - </Grid> - </Grid> - <ReqCollections order={currValue} contrast={contrast} /> - </Container> - </div> - } + <span style={currValue === option.value ? { color: "#673ab7" } : null} > + {option.label} + </span> + </MenuItem> + ))} + </TextField> + </Grid> + </Grid> + </Grid> + </Grid> + <ReqCollections order={currValue} /> + </Container> + } </React.Fragment> ) } -function TabMateriais({ contrast }) { +function TabMateriais() { const text = "Nesta área, você acessa livremente materiais completos de formação, como cursos já oferecidos pelo MEC e seus parceiros. São conteúdos elaborados por equipes multidisciplinares e de autoria de pesquisadores e educadores renomados nas áreas." - const materials = colecoes_obj() - const [currMaterial, setCurrMaterial] = useState({ open: false, material: {} }) - const handleExpandMaterial = (id) => { - if (id !== currMaterial.material.id) - setCurrMaterial({ - open: true, - material: { ...materials[id] } - }) - else { - setCurrMaterial({ - open: false, - material: {} - }) - } - } - return ( <React.Fragment> <div style={{ backgroundColor: "#e81f4f", position: "relative" }}> - <StyledTab container contrast={contrast}> - <Grid item md={3} xs={12}> - <img - src={materiais} - alt="aba recursos" - style={{ float: "left", marginRight: 20, marginBottom: 20, marginLeft: window.innerWidth >= 825 ? "25%" : "0px" }} - /> - </Grid> - { - window.innerWidth <= 501 && - <h4> - Materiais de formação - </h4> - } - <Grid item md={6} xs={12}> - <p> - {text} - </p> - </Grid> - { - window.innerWidth <= 501 && - <div style={{ display: "flex", justifyContent: "center" }}> - <Link to={`/material-formacao`} className="button-ver">VER MATERIAIS</Link> - </div> - } + <StyledTab container> + <Grid item md={3} xs={12}> + <img + src={materiais} + alt="aba recursos" + style={{ float: "left", marginRight: 20, marginBottom: 20, marginLeft: window.innerWidth >= 825 ? "25%" : "0px" }} + /> + </Grid> + { + window.innerWidth <= 501 && + <h4> + Materiais de formação + </h4> + } + <Grid item md={6} xs={12}> + <p> + {text} + </p> + </Grid> + { + window.innerWidth <= 501 && + <div style={{ display: "flex", justifyContent: "center" }}> + <Link to={`/material-formacao`} className="button-ver">VER MATERIAIS</Link> + </div> + } </StyledTab> </div> { - window.innerWidth > 501 && - <div className={`${contrast}BackColor`}> - <Container style={{ padding: "20px" }}> - <p - style={{ - paddingBottom: "5px", - borderBottom: contrast === "" ? "1px solid #e81f4f" : "1px solid white", - color: contrast === "" ? "#e81f4f" : "white", - }} - > - Materiais mais recentes{" "} - </p> - <Carousel - style={{ padding: "20px" }} - showThumbs={false} - infiniteLoop={true} - showStatus={false} - > - <Row> - { - materials.map((material, index) => { - return ( - <Col md={3} key={index}> - <MaterialCard - contrast={contrast} - name={material.name} - thumb={material.img} - score={material.score} - modules={material.topics} - handleExpand={handleExpandMaterial} - id={index} - /> - </Col> - ) - }) - } - </Row> - </Carousel> - { - currMaterial.open ? - <ExpandedMaterial contrast={contrast} material={currMaterial.material} /> - : - null - } - </Container> - </div> - } - </React.Fragment > - ) + window.innerWidth > 501 && + <Container style={{ padding: "20px" }}> + <p + style={{ + paddingBottom: "5px", + borderBottom: "1px solid #e81f4f", + color: "#e81f4f", + }} + > + Materiais mais recentes{" "} + </p> + <Carousel + style={{ padding: "20px" }} + showThumbs={false} + infiniteLoop={true} + showStatus={false} + > + <ReqMaterials currMaterial={currMaterial} setCurrMaterial={setCurrMaterial} /> + </Carousel> + { + currMaterial.open ? + <ExpandedMaterial material={currMaterial.material} /> + : + null + } + </Container> + } + </React.Fragment > + ) } export default function AreasSubPages(props) { - const { state } = useContext(Store) - const areaRender = () => { switch (props.banner) { case "Recursos": - return <TabRecurso contrast={state.contrast} /> + return <TabRecurso /> case "Materiais": - return <TabMateriais contrast={state.contrast} /> + return <TabMateriais /> case "Colecoes": - return <TabColecoes contrast={state.contrast} /> + return <TabColecoes /> default: return null } @@ -563,9 +537,9 @@ export default function AreasSubPages(props) { { window.innerWidth <= 501 ? ( <React.Fragment> - <TabRecurso contrast={state.contrast} /> - <TabMateriais contrast={state.contrast} /> - <TabColecoes contrast={state.contrast} /> + <TabRecurso /> + <TabMateriais /> + <TabColecoes /> </React.Fragment> ) : ( areaRender() @@ -587,7 +561,6 @@ const StyledTab = styled(Grid)` color : #fff; min-height : 190px; padding : 20px 10px 20px 10px; - background: ${props => props.contrast === "" ? "" : "black"}; img { float : left; @@ -613,24 +586,9 @@ const StyledTab = styled(Grid)` padding: 5px 10px; border: solid 2px #fff; border-radius: 7px; - color: ${props => props.contrast === "" ? "#fff" : "yellow"}; + color: #fff; cursor: pointer; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + text-decoration: none; } ` - -const StyledMenuItem = styled(MenuItem)` - background-color: ${props => props.contrast === "" ? "" : "black !important"}; -` - -const StyledTextField = styled(TextField)` - .MuiOutlinedInput-root { - &.Mui-focused fieldset { - border-color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - } - fieldset { - border-color: ${props => props.contrast === "" ? "#666" : "white"}; - } - } -` \ No newline at end of file diff --git a/src/Components/ButtonAvaliarRecurso.js b/src/Components/ButtonAvaliarRecurso.js index 06d6305977e90c105dbdcf7965b04bca33cb0d48..8b307048182a36bd0cafa1063a86b45ad64105b8 100644 --- a/src/Components/ButtonAvaliarRecurso.js +++ b/src/Components/ButtonAvaliarRecurso.js @@ -6,20 +6,18 @@ import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; export default function ButtonAvaliarRecurso (props) { return ( - <StyledButton contrast={props.contrast} onClick={props.callback}> - <ExpandMoreIcon style={{color: "white"}}/> AVALIAR RECURSO + <StyledButton onClick={props.callback}> + <ExpandMoreIcon/> AVALIAR RECURSO </StyledButton> ) } -export const StyledButton = styled(Button)` +const StyledButton = styled(Button)` &:hover { - background-color: ${props => props.contrast === "" ? "#ed6f00" : "black"} !important; + background-color : #ed6f00 !important; } - background-color: ${props => props.contrast === "" ? "#ff7f00" : "black"} !important; - border: ${props => props.contrast === "" ? "none" : "1px solid white"} !important; - color : ${props => props.contrast === "" ? "white" : "yellow"} !important; - text-decoration : ${props => props.contrast === "" ? "none" : "underline"} !important; + background-color : #ff7f00 !important; + color : #fff !important; font-weight : 600 !important; box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; .MuiSvgIcon-root { diff --git a/src/Components/ButtonGuardarColecao.js b/src/Components/ButtonGuardarColecao.js index ca0729a269e8d756bfc4686eb04acded43dbce12..564c07183b23510edf5ba1170651a63fff879122 100644 --- a/src/Components/ButtonGuardarColecao.js +++ b/src/Components/ButtonGuardarColecao.js @@ -46,9 +46,9 @@ export default function ButtonGuardarColecao(props) { return ( <> - <SignUpModal contrast={props.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> - <LoginModal contrast={props.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} openSnackbar={() => { handleSuccessfulLogin(true) }} /> <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleLoginSnackbar} @@ -56,28 +56,28 @@ export default function ButtonGuardarColecao(props) { > <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> </Snackbar> - <GuardarModal contrast={props.contrast} open={saveToCol} handleClose={() => { toggleSave(false) }} + <GuardarModal open={saveToCol} handleClose={() => { toggleSave(false) }} thumb={props.thumb} title={props.title} recursoId={props.learningObjectId} /> - <StyledButton onClick={handleGuardar} className={`${props.contrast}LinkColor`} - style={props.contrast === "" ? {border: "2px solid #f07e05", borderRadius : "5px", color :"#f07e05"} : {border: "1px solid white", borderRadius : "5px", color :"#f07e05"}} - > - <CreateNewFolderIcon className={`${props.contrast}IconColor`}/><span>GUARDAR</span> + <StyledButton onClick={handleGuardar}> + <CreateNewFolderIcon /> GUARDAR </StyledButton> </> ) } const StyledButton = styled(Button)` + color : #666 !important; background-color : transparent !important; font-size : 14px important; font-weight : 500 !important; .MuiSvgIcon-root { font-size : 24px; + color : inherit; } &:hover { - color: rgb(107, 35, 142); + color: rgb(107, 35, 142) !important; } ` diff --git a/src/Components/Carousel.js b/src/Components/Carousel.js new file mode 100644 index 0000000000000000000000000000000000000000..dde54bd232c55208fcae91ef2aee236250ac7cfc --- /dev/null +++ b/src/Components/Carousel.js @@ -0,0 +1,665 @@ +/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana + +This file is part of Plataforma Integrada MEC. + +Plataforma Integrada MEC is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Plataforma Integrada MEC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +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, { Component } from 'react'; +import "react-responsive-carousel/lib/styles/carousel.min.css"; +import { Carousel } from 'react-responsive-carousel'; +import styled from 'styled-components'; +import Grid from '@material-ui/core/Grid'; + + + +/*Importação de imagens para o componente*/ +import Handshake from "../img/termos/handshake.svg" +import Pessoa from "../img/termos/Pessoa.svg" +import Email from "../img/termos/Email.svg" +import Seguranca from "../img/termos/Seguranca.svg" +import Arrow_down from "../img/termos/Arrow_down.svg"; +import Arrow_double from "../img/termos/Arrow_double.svg"; +import Like from "../img/termos/Like.svg"; +import Unlike from "../img/termos/Unlike.svg"; +import Line from "../img/termos/Line.svg"; +import Entenda from "../img/termos/Entenda.svg"; +import V from "../img/termos/V.svg"; +//Image Import +import { Aberto } from "ImportImages.js"; +import { Fechado } from "ImportImages.js"; +import { Arrow_O } from "ImportImages.js"; +import { Arrow_O_1 } from "ImportImages.js"; +import { OrthogonalLineUp } from "ImportImages.js"; +import { OrthogonalLineDown } from "ImportImages.js"; + +const Slide = styled.div` + +position: absolute; +height: 500px; +width: 1366px; + +h2{ + font-family: "Pompiere", regular; + font-size: 44px; + line-height: 120%; + color: #FFFFFF; +} + +h3{ + font-family: "Roboto", regular; + font-size: 27px; + line-height: 120%; + color: #FFFFFF; +} + +p{ + font-family: "Roboto", regular; + font-size: 20px; + line-height: 120%; + color: #FFFFFF; + text-align: left; +} + +.container{ + position: absolute; + height: auto; + width: auto; + margin: 70px 180px 90px; +} + + +.tmpl1{ + background-color: #00BCD4; + height: inherit; + width: inherit; + display: flex; + align-items: center; + + + .box-text{ + position: relative; + float: left; + padding-right: 10px; + padding-left: 10px; + + p { + margin: 0 0 10px; + } + } + + .box-image{ + position: relative; + float: right; + } +} + +.tmpl2{ + height: inherit; + width: inherit; + display: flex; + align-items: center; + background-color: #673AB7; + + .title{ + padding-bottom: 50px; + } + + .images{ + position: absolute; + display: table-row; + } + + .arrow{ + display: table-row; + position: absolute; + margin-left: 55px; + margin-top: -15px; + width: 282px; + } + + .circle{ + display: table-row; + position: absolute; + margin-top: -100px; + margin-left: 795px; + width: 191px; + } + + h2 { + margin-top: 20px; + margin-bottom: 10px; + font-weight: 500; + } + + .box-text{ + p{ + font-size: 18px; + line-height: 25px; + } + + position: relative; + + } + + +} + +.tmpl3{ + height: inherit; + width: inherit; + display: flex; + align-items: center; + background-color: #E81F4F; + + .title{ + position: relative; + padding-left: 10px; + h3{ + line-height: 40px; + } + } + + .box-text1{ + .text{ + padding-top: 20px; + } + + .content{ + display: table-row; + + p{ + display: table-cell; + font-size: 18px; + line-height: 25px; + vertical-align: middle; + } + + img{ + position: relative; + left: 0; + margin-right: 20px; + display: table-cell; + vertical-align: middle; + margin: 10px 20px 10px -10px; + } + } + + } + + .box-text2{ + top: -50px; + .content{ + p{ + padding-bottom: 20px; + } + + img{ + margin-left: -65px; + margin-top: 25px; + } + + .twoArrow{ + margin-top: -5px; + } + } + + + } + + + +} + +.tmpl4{ + height: inherit; + width: inherit; + display: flex; + align-items: center; + background-color: #FF7F00; + + h2{ + padding-bottom: 20px; + } + + p{ + font-size: 20px; + line-height: 25px; + vertical-align: middle; + } + + .box-images{ + height: inherit; + display: table-row; + padding-top: 50px; + } + + img{ + display: table-cell; + vertical-align: middle; + top: 40px; + } + + +} + +.tmpl5{ + height: inherit; + width: inherit; + display: flex; + align-items: center; + background-color: #1AB9DE; + + .title{ + display: table-row; + align-items: center; + + img{ + display: table-cell; + margin-right: 30px; + } + + h2{ + display: table-cell; + text-align: center; + vertical-align: middle; + } + } + + .box-text { + margin-top: 20px; + p{ + font-size: 17px; + font-weight: 15px; + } + } + +} + +.tmpl6{ + height: inherit; + width: inherit; + display: flex; + align-items: center; + background-color: #673AB7; + + .box-text-1{ + h3{ + margin-bottom: 20px; + font-size: 27px; + } + p{ + margin-bottom: 20px; + font-size: 18px; + margin-top: 0px; + } + + + .licences{ + padding: 35px 150px 50px 35px; + margin-top: 50pz; + background-image: url(${Entenda}); + background-repeat: no-repeat; + background-size: cover; + p::before{ + content: url(${V}); + } + p{ + padding-left: 20px; + font-family: "Kalam", regular; + font-size: 24px; + white-space: nowrap; + } + .row{ + padding-bottom: 5px; + + + } + } + } + + + .box-text-2{ + background-image: url(${OrthogonalLineUp}),url(${OrthogonalLineDown}); + background-repeat: no-repeat; + background-position: left top, right bottom; + padding-top: 30px; + padding-left: 50px; + p{ + font-size: 15px; + padding-bottom: 15px; + } + + .licenses_type{ + margin-left: -20px; + font-size: 22px; + font-weight: bold; + text-align: right; + white-space: nowrap; + } + .row { + margin-right: -15px; + margin-left: -15px; + + p { + padding-left: 15px; + } + } + } + +} + +.tmpl7{ + height: inherit; + width: inherit; + display: flex; + align-items: center; + background-color: #E81F4F; + + .title{ + h2{ + font-family: Roboto; + font-size: 44px; + } + } + + .box-text{ + margin-top: 20px; + p{ + line-height: 20px; + font-family: "Roboto"; + font-size: 18px; + } + } + + .rodape{ + margin-top: 40px; + p{ + line-height: 20px; + font-family: "Pompiere", regular; + font-size: 28px; + text-align: center; + } + span{ + text-decoration: underline; + font-family: "Pompiere", regular; + line-height: 20px; + font-size: 28px; + cursor: pointer; + } + } +} + +` + +const CarouselStyled = styled(Carousel)` + + .carousel.carousel-slider { + height: 500px !important; + } + + .carousel .slider-wrapper.axis-horizontal { + height: 500px !important; + } + .carousel .control-dots { + position: absolute !important; + padding-bottom: 20px; + } + + .carousel .control-arrow:before, .carousel.carousel-slider .control-arrow:before { + margin: 0 5px; + display: inline-block; + border-top: 8px solid transparent; + border-bottom: 8px solid transparent; + content: ' '; + } + .carousel .control-arrow { + background: transparent !important; + } + .m4d-icons { + size: 50px + } + + +` + + +class TermsCarousel extends Component { + render() { + return ( + <CarouselStyled + showThumbs= {false} + showStatus= {false} + transitionTime={1000} + + width={"1366px"} + + > + <div > + <Slide> + <div className="tmpl1"> + <div className="container"> + <Grid container spacing={0}> + <Grid item xs={6} > + <div className="box-text"> + <p>A Plataforma Integrada MEC RED é parte do Compromisso 6 do 3º Plano de Ação da Parceria para Governo Aberto (OGP-Brasil), que tem por objetivo “incorporar na política educacional o potencial da cultura digital, de modo a fomentar a autonomia para uso, reuso e adaptação de recursos educacionais digitais, valorizando a pluralidade e a diversidade da educação brasileira”.</p> + </div> + </Grid> + <Grid style={{display:"flex",justifyContent:"center"}} item xs={6}> + <div className="box-image"> + <img src={Handshake} alt="handshake"/> + </div> + </Grid> + </Grid> + </div> + </div> + </Slide> + + </div> + <div> + <Slide> + <div className="tmpl2"> + <div className="container"> + <div className="title"> + <h2>O que é a Plataforma Integrada MEC RED e como ela está organizada?</h2> + <div className="images"> + <div className="arrow"> + <img src={Arrow_O} alt="Arrow_O"/> + </div> + <div className="circle"> + <img src={Arrow_O_1} alt="Arrow_O_1"/> + </div> + </div> + </div> + <Grid container> + <Grid className="box-text" item xs={6}> + <p>Uma plataforma interativa, colaborativa e criada em software livre, que disponibiliza conteúdos do acervo do MEC e indica conteúdos de parceiros com o objetivo de formar uma rede ativa de educadores interessados em usar, criar e compartilhar recursos educacionais digitais.</p> + </Grid> + <Grid className="box-text" item xs={6}> + <p><strong>Repositório</strong> de recursos educacionais digitais que permite aos usuários cadastrados a publicação de seus materiais e <strong>Referatório</strong> que aponta links para conteúdos em sites externos.</p> + </Grid> + </Grid> + </div> + </div> + </Slide> + </div> + <div> + <Slide> + <div className="tmpl3"> + <div className="container"> + <Grid className="title" container spacing={1}> + <Grid item xs={12}> + <h3>Os recursos educacionais disponibilizados<br/> podem ser de dois tipos:</h3> + </Grid> + </Grid> + <Grid className="box-text1" container spacing={1}> + <Grid className="text" item xs={8}> + <div className="content"> + <img src={Aberto} alt="Aberto"/> + <p><strong>Abertos</strong>: recursos sem nenhuma restrição de acesso e<br/> com flexibilidade quanto ao uso ou reuso.</p> + </div> + <div className="content"> + <img src={Fechado} alt="Fechado"/> + <p><strong>Fechados</strong>: recursos com alguma restrição de acesso, uso<br/> ou reuso, como aqueles que, para acesso, há demanda de<br/> cadastro ou que têm licenças restritivas.</p> + </div> + </Grid> + <Grid className="box-text2" item xs={4}> + <div className="content"> + <img src={Arrow_down} alt="Arrow_down"/> + <p>Como repositório, a Plataforma hospeda somente Recursos Educacionais Abertos (REA). Todo conteúdo inserido por usuários deve ser aberto.</p> + </div> + <div className="content"> + <img alt="" className="twoArrow" src={Arrow_double}/> + <p>Como referatório, a Plataforma aponta links para parceiros, e<br/> esses recursos podem ser abertos ou fechados.</p> + </div> + </Grid> + </Grid> + </div> + </div> + </Slide> + </div> + <div> + <Slide> + <div class="tmpl4"> + <div class="container"> + <Grid container spacing={5}> + <Grid item xs={6}> + <h2>Como se cadastrar?</h2> + <div> + <p>Para criar uma conta, o usuário deverá clicar no botão “Cadastre-se” na página inicial da Plataforma e fazer um cadastro utilizando um endereço de e-mail e criando uma senha.</p> + </div> + </Grid> + <Grid item xs={2} style={{alignSelf:"center"}}> <img style={{width:"150px",height:"150px"}} src={Pessoa} alt="Pessoa" /> </Grid> + <Grid item xs={2} style={{alignSelf:"center"}}> <img style={{width:"150px",height:"150px"}} src={Email} alt="Email" /> </Grid> + <Grid item xs={2} style={{alignSelf:"center"}}> <img style={{width:"150px",height:"150px"}} src={Seguranca} alt="Seguranca" /> </Grid> + </Grid> + </div> + </div> + </Slide> + </div> + <div> + <Slide> + <div class="tmpl5"> + <div class="container"> + <Grid container justify="space-evenly" spacing={12}> + <Grid style={{paddingRight: "40px"}} item xs={6}> + <div class="title"> + <img src={Like} alt= "Like"/> + <h2>O que publicar?</h2> + </div> + <img src={Line} alt="Line"/> + <div class="box-text"> + <p>Conteúdos de cunho educacional e pertinentes ao assunto no qual estão inseridos, de autoria do usuário, de autoria coletiva (com consentimento dos demais autores) ou que estejam no domínio público. </p> + </div> + </Grid> + <Grid item xs={6}> + <div class= "title"> + <img src={Unlike} alt="Unlike"/> + <h2>O que não publicar?</h2> + </div> + <img src={Line} alt="Line"/> + <div class="box-text"> + <p>Materiais ofensivos, pornográficos, relacionados a atividades ilegais, que invadam a privacidade de terceiros, que violem a legislação de Direito Autoral ou os Direitos Humanos. Propagandas, conteúdos com vírus, spam ou comentários abusivos.</p> + </div> + </Grid> + </Grid> + </div> + </div> + </Slide> + </div> + <div> + <Slide> + <div className="tmpl6"> + <div className="container"> + <Grid container> + <Grid className="box-text-1" item xs={7}> + <h3>Direitos do autor e licenças de uso</h3> + <p>Ao inserir um novo material de sua autoria no Repositório, o usuário deverá escolher um dos tipos de licença aberta disponíveis na Plataforma:</p> + <div className="licences"> + <Grid className="row" container> + <Grid item xs={6}> + <p>CC-BY</p> + </Grid> + <Grid item xs={6}> + <p>CC-BY-SA</p> + </Grid> + </Grid> + <Grid className="row" container> + <Grid item xs={6}> + <p>CC-BY-NC</p> + </Grid> + <Grid item xs={6}> + <p>CC-BY-NC-SA</p> + </Grid> + </Grid> + </div> + </Grid> + <Grid className="box-text-2" item xs={5}> + <Grid className="row" container> + <Grid item xs={2}> + <p className="licenses_type">CC-BY</p> + </Grid> + <Grid item xs={10}> + <p> significa que o autor permite que distribuam, remixem, adaptem e criem a partir do seu trabalho, desde que lhe atribuam o devido crédito pela criação original</p> + </Grid> + </Grid> + <Grid className="row" container> + <Grid item xs={2}> + <p className="licenses_type">NC</p> + </Grid> + <Grid item xs={10}> + <p> indica que as criações elaboradas a partir do trabalho do autor podem ser utilizadas somente para fins não comerciais (se não houver esta especificação, o novo recurso poderá ser utilizado para fins comerciais)</p> + </Grid> + </Grid> + <Grid className="row" container> + <Grid item xs={2}> + <p className="licenses_type">SA</p> + </Grid> + <Grid item xs={10}> + <p> quer dizer que as novas criações devem ser licenciadas sob termos idênticos aos do trabalho original</p> + </Grid> + </Grid> + </Grid> + </Grid> + </div> + </div> + </Slide> + </div> + <div> + <Slide> + <div class="tmpl7"> + <div class="container"> + <Grid container> + <Grid className="title" item xs={4}> + <h2>Respeitamos<br/> a sua privacidade</h2> + </Grid> + <Grid className="box-text" item xs={8}> + <p>Além de solicitar alguns dados pessoais para o cadastro, a Plataforma coleta, de forma automática, os dados não pessoais relativos à interação dos usuários no sistema. Esses dados nunca serão fornecidos para fins comerciais, assim como nunca serão compartilhados quaisquer dados pessoais que possam identificar o usuário.</p> + <p>Os dados anônimos poderão ser utilizados para fins de melhoria da plataforma, transparência e para o uso em pesquisas.</p> + </Grid> + </Grid> + <div class="rodape col-md-12"> + <p>Dúvidas? Leia a íntegra dos <span ng-click="hide()">Termos de Uso</span> ou fale conosco por meio do <a style={{color: "#fff"}} href="contato">formulário de contato</a>.</p> + </div> + </div> + </div> + </Slide> + </div> + </CarouselStyled> + ) + } +} + +export default TermsCarousel; diff --git a/src/Components/Checkbox.js b/src/Components/Checkbox.js index 6aaa04c7632f0ee9d67b3560bf671b41cb126690..3e0be625c424542d75bd13680417450a409f410d 100644 --- a/src/Components/Checkbox.js +++ b/src/Components/Checkbox.js @@ -19,54 +19,29 @@ import React from 'react'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import Checkbox from '@material-ui/core/Checkbox'; import styled from 'styled-components' -import { yellow, blue } from "@material-ui/core/colors"; -import { withStyles } from '@material-ui/core/styles'; const StyledFormControlLabel = styled(FormControlLabel)` font-size : 12px !important; .label { font-size : 12px !important; } + .MuiCheckbox-colorSecondary.Mui-checked { + color : #00bcd4 !important; + } ` -const ContrastCheckBox = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -const NormalCheckBox = withStyles({ - root: { - color: blue[400], - '&$checked': { - color: blue[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); export default function LabeledCheckbox(props) { return ( - <StyledFormControlLabel - contrast={props.contrast} - control={ - props.contrast === "" ? - <NormalCheckBox - value={props.checked} - onChange={props.handleChange} - /> - : - <ContrastCheckBox - value={props.checked} - onChange={props.handleChange} + <StyledFormControlLabel + control={ + <Checkbox + value = {props.checked} + onChange = {props.handleChange} /> - } - label={<span style={{ fontSize: '12px' }}>{props.label}</span>} - /> + } + label={<span style={{ fontSize: '12px' }}>{props.label}</span>} + /> ); } diff --git a/src/Components/CloseModalButton.js b/src/Components/CloseModalButton.js index 186f36f06da8c452037c20df5093dd01780d984c..00e8b3c34553c1ced9ba1b6e397fd5f404ef571d 100644 --- a/src/Components/CloseModalButton.js +++ b/src/Components/CloseModalButton.js @@ -6,7 +6,7 @@ import CloseIcon from '@material-ui/icons/Close'; export default function CloseModalButton (props) { return ( <StyledCloseModalButton onClick={props.handleClose}> - <CloseIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }}/> + <CloseIcon/> </StyledCloseModalButton> ) } diff --git a/src/Components/ColCardOwnerOptions.js b/src/Components/ColCardOwnerOptions.js index 0d1f9e4b360e151e286e53067c6ea28f71dd673b..a075780622f76c453592afb7d07b84de6ccd3df3 100644 --- a/src/Components/ColCardOwnerOptions.js +++ b/src/Components/ColCardOwnerOptions.js @@ -31,71 +31,71 @@ import ModalExcluirColecao from './ModalExcluirColecao.js' import ModalEditarColecao from './ModalEditarColecao.js' export default function ColCardOwnerOptions (props) { - const [anchorEl, setAnchorEl] = React.useState(null); - - function handleClick(event) { - setAnchorEl(event.currentTarget); - } - - function handleClose() { - setAnchorEl(null); - } - - const [modalExcluirOpen, toggleModalExcluir] = useState(false) - - const [modalEditarOpen, toggleModalEditar] = useState(false) - - - return ( - <> - <ModalExcluirColecao id={props.id} - contrast={props.contrast} open={modalExcluirOpen} handleClose={() => {toggleModalExcluir(false)}} removeColl={props.removeColl} - /> - <ModalEditarColecao id={props.id} - contrast={props.contrast} open={modalEditarOpen} handleClose={() => {toggleModalEditar(false)}} - changeColName={props.changeColName} changeColPrivacy={props.changeColPrivacy} - /> - - <div style={{fontSize: "12px"}}> - <Button className={`${props.contrast}LinkColor`} aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick} style={{color : "#666"}}> - OPÇÕES <MoreVertIcon className={`${props.contrast}IconColor`}/> - </Button> - <Menu - id="simple-menu" - anchorEl={anchorEl} - keepMounted - open={Boolean(anchorEl)} - onClose={handleClose} - MenuListProps={{ - disablePadding: true - }} - > - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast}> - <Link to={"/colecao-do-usuario/" + props.id}> - <ListItemIcon className={`${props.contrast}IconColor`}><OpenIcon /></ListItemIcon>Abrir - </Link> - </StyledMenuItem> - - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={() => {toggleModalEditar(true)}}> - <ListItemIcon className={`${props.contrast}IconColor`}><CreateIcon /></ListItemIcon>Editar - </StyledMenuItem> - - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={() => {toggleModalExcluir(true)}} > - <ListItemIcon className={`${props.contrast}IconColor`}><DeleteForeverIcon /></ListItemIcon>Excluir - </StyledMenuItem> - </Menu> - </div> - </> - ) + const [anchorEl, setAnchorEl] = React.useState(null); + + function handleClick(event) { + setAnchorEl(event.currentTarget); + } + + function handleClose() { + setAnchorEl(null); + } + + const [modalExcluirOpen, toggleModalExcluir] = useState(false) + + const [modalEditarOpen, toggleModalEditar] = useState(false) + + + return ( + <> + <ModalExcluirColecao id={props.id} + open={modalExcluirOpen} handleClose={() => {toggleModalExcluir(false)}} removeColl={props.removeColl} + /> + <ModalEditarColecao id={props.id} + open={modalEditarOpen} handleClose={() => {toggleModalEditar(false)}} + changeColName={props.changeColName} changeColPrivacy={props.changeColPrivacy} + /> + + <div style={{fontSize: "12px"}}> + <Button aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick} style={{color : "#666"}}> + OPÇÕES <MoreVertIcon style={{color : "inherit"}}/> + </Button> + <Menu + id="simple-menu" + anchorEl={anchorEl} + keepMounted + open={Boolean(anchorEl)} + onClose={handleClose} + > + <StyledMenuItem> + <Link to={"/colecao-do-usuario/" + props.id}> + <ListItemIcon><OpenIcon /></ListItemIcon>Abrir + </Link> + </StyledMenuItem> + + <StyledMenuItem onClick={() => {toggleModalEditar(true)}}> + <ListItemIcon><CreateIcon /></ListItemIcon>Editar + </StyledMenuItem> + + <StyledMenuItem onClick={() => {toggleModalExcluir(true)}} > + <ListItemIcon><DeleteForeverIcon /></ListItemIcon>Excluir + </StyledMenuItem> + + + </Menu> + </div> + </> + ) } export const StyledMenuItem = styled(MenuItem)` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; + color : #666 !important; .MuiSvgIcon-root { vertical-align : middle !important; } a { - color : inherit !important; + text-decoration : none !important; + color : #666 !important; } ` diff --git a/src/Components/ColCardPublicOptions.js b/src/Components/ColCardPublicOptions.js index 63b4d864c0b2961799156849e83f94d71ec4fe5b..2b58c70f58000d4014fb53330c8901a65cbfc1b3 100644 --- a/src/Components/ColCardPublicOptions.js +++ b/src/Components/ColCardPublicOptions.js @@ -32,7 +32,7 @@ import OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser'; import AddIcon from '@material-ui/icons/Add'; import ExitToAppIcon from '@material-ui/icons/ExitToApp'; -export default function ColCardPublicOptions({ contrast, id, userFollowingCol, handleLike, handleFollow, currentUserId, handleLogin, liked }) { +export default function ColCardPublicOptions({ id, userFollowingCol, handleLike, handleFollow, currentUserId, handleLogin, liked }) { const [anchorEl, setAnchorEl] = React.useState(null); function handleClick(event) { @@ -49,7 +49,6 @@ export default function ColCardPublicOptions({ contrast, id, userFollowingCol, h return ( <> <ReportModal - contrast={contrast} open={reportModalOpen} handleClose={() => handleReportModal(false)} form="colecao" @@ -63,7 +62,7 @@ export default function ColCardPublicOptions({ contrast, id, userFollowingCol, h onClick={handleClick} style={{ color: "#666" }} > - <MoreVertIcon className={`${contrast}IconColor`} style={{ color: "inherit" }} /> + <MoreVertIcon style={{ color: "inherit" }} /> </Button> <Menu id="simple-menu" @@ -71,13 +70,10 @@ export default function ColCardPublicOptions({ contrast, id, userFollowingCol, h keepMounted open={Boolean(anchorEl)} onClose={handleClose} - MenuListProps={{ - disablePadding: true - }} > - <StyledMenuItem className={`${contrast}LinkColor ${contrast}Text`} contrast={contrast}> + <StyledMenuItem> <Link to={"/colecao-do-usuario/" + id}> - <ListItemIcon className={`${contrast}IconColor`}> + <ListItemIcon> <OpenIcon /> </ListItemIcon> Abrir @@ -85,23 +81,21 @@ export default function ColCardPublicOptions({ contrast, id, userFollowingCol, h </StyledMenuItem> <StyledMenuItem - className={`${contrast}LinkColor ${contrast}Text`} - contrast={contrast} onClick={() => window.open("/colecao-do-usuario/" + id, "_blank") } > - <ListItemIcon className={`${contrast}IconColor ${contrast}Text`}> + <ListItemIcon> <OpenInBrowserIcon /> </ListItemIcon> Abrir em nova guia </StyledMenuItem> - <StyledMenuItem className={`${contrast}LinkColor ${contrast}Text`} contrast={contrast} onClick={handleLike}> - <ListItemIcon className={`${contrast}IconColor`}> + <StyledMenuItem onClick={handleLike}> + <ListItemIcon> { liked ? - <FavoriteIcon /> : <FavoriteIcon /> + <FavoriteIcon style={{ fill: 'red' }} /> : <FavoriteIcon style={{ fill: '#666' }} /> } </ListItemIcon> { @@ -110,8 +104,8 @@ export default function ColCardPublicOptions({ contrast, id, userFollowingCol, h } </StyledMenuItem> - <StyledMenuItem className={`${contrast}LinkColor ${contrast}Text`} contrast={contrast} onClick={handleFollow}> - <ListItemIcon className={`${contrast}IconColor`}> + <StyledMenuItem onClick={handleFollow}> + <ListItemIcon> { userFollowingCol ? <ExitToAppIcon /> : <AddIcon /> @@ -124,8 +118,6 @@ export default function ColCardPublicOptions({ contrast, id, userFollowingCol, h </StyledMenuItem> <StyledMenuItem - className={`${contrast}LinkColor ${contrast}Text`} - contrast={contrast} onClick={() => { if (currentUserId) handleReportModal(true); @@ -133,7 +125,7 @@ export default function ColCardPublicOptions({ contrast, id, userFollowingCol, h handleLogin() }} > - <ListItemIcon className={`${contrast}IconColor`}> + <ListItemIcon> <ReportProblemIcon /> </ListItemIcon> Reportar @@ -145,11 +137,13 @@ export default function ColCardPublicOptions({ contrast, id, userFollowingCol, h } export const StyledMenuItem = styled(MenuItem)` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - .MuiSvgIcon-root { - vertical-align: middle !important; - } - a { - color: inherit !important; - } + color: #666 !important; + + .MuiSvgIcon-root { + vertical-align: middle !important; + } + a { + text-decoration: none !important; + color: #666 !important; + } `; diff --git a/src/Components/CollectionAuthor.js b/src/Components/CollectionAuthor.js index 3d5c42318f5db49f869d0b462d24879b64c4607d..c6c299cf08bba817e4a14e684609084840c44f4b 100644 --- a/src/Components/CollectionAuthor.js +++ b/src/Components/CollectionAuthor.js @@ -30,20 +30,19 @@ export default function CollectionAuthor(props) { justify="center" alignItems="center"> {props.imgsrc ? - <Link + <UserLink to={`/usuario-publico/${props.author_id}`} - contrast={props.contrast} > <UserAvatar src={props.imgsrc} /> - </Link> + </UserLink> : <CircularProgress color="secondary" /> } - <InfoText contrast={props.contrast}>Coleção organizada por:</InfoText> + <InfoText>Coleção organizada por:</InfoText> {props.name ? - <Link to={`/usuario-publico/${props.author_id}`} contrast={props.contrast}> - <UserName contrast={props.contrast}>{props.name}</UserName> - </Link> + <UserLink to={`/usuario-publico/${props.author_id}`} > + <UserName>{props.name}</UserName> + </UserLink> : <CircularProgress /> } @@ -59,10 +58,15 @@ const UserAvatar = styled.img` const InfoText = styled.p` margin-bottom: 0; padding-bottom: 0; - color: ${props => props.contrast === "" ? "#666 !important" : "white !important"}; + color: #666; ` const UserName = styled.h2` margin-top: 10px; - color: ${props => props.contrast === "" ? "#673ab7 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"}; + color: #673ab7; +` +const UserLink = styled(Link)` + text-decoration: none; + &:focus, &:hover, &:visited, &:link, &:active { + text-decoration: none; + } ` diff --git a/src/Components/CollectionCardFunction.js b/src/Components/CollectionCardFunction.js index 926de15f02f20605b7f3dd5ad7407974e186111d..1a3057ddf92eb5c358443007ce25c7d700ab70be 100644 --- a/src/Components/CollectionCardFunction.js +++ b/src/Components/CollectionCardFunction.js @@ -43,291 +43,283 @@ import MuiAlert from '@material-ui/lab/Alert'; import { noAvatar } from "ImportImages.js"; export default function CollectionCardFunction(props) { - const { state } = useContext(Store) - - // eslint-disable-next-line - const [userAvatar] = useState(props.avatar ? (`${apiDomain}` + props.avatar) : noAvatar) - const [userFollowingCol, toggleUserFollowingCol] = useState(props.followed) - const handleToggleUserFollowingCol = () => { toggleUserFollowingCol(!userFollowingCol) } - - const [name, setName] = useState(props.name) - const changeColName = (newName) => { setName(newName) } - - const [privacy, setPrivacy] = useState(props.privacy) - const changeColPrivacy = (newPrivacy) => { setPrivacy(newPrivacy) } - - const [likesCount, setLikesCount] = useState(props.likeCount) - const [liked, toggleLiked] = useState(props.liked) - - const [signUpOpen, setSignUp] = useState(false) - const [loginOpen, setLogin] = useState(false) - const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) - + const { state } = useContext(Store) + + // eslint-disable-next-line + const [userAvatar] = useState(props.avatar ? (`${apiDomain}` + props.avatar) : noAvatar) + const [userFollowingCol, toggleUserFollowingCol] = useState(props.followed) + const handleToggleUserFollowingCol = () => { toggleUserFollowingCol(!userFollowingCol) } + + const [name, setName] = useState(props.name) + const changeColName = (newName) => { setName(newName) } + + const [privacy, setPrivacy] = useState(props.privacy) + const changeColPrivacy = (newPrivacy) => { setPrivacy(newPrivacy) } + + const [likesCount, setLikesCount] = useState(props.likeCount) + const [liked, toggleLiked] = useState(props.liked) + + const [signUpOpen, setSignUp] = useState(false) + const [loginOpen, setLogin] = useState(false) + const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) + + + function handleSuccessLike(data) { + toggleLiked(!liked) + setLikesCount(data.count) + } + const handleLike = () => { + if (state.currentUser.id) + putRequest(`/collections/${props.id}/like`, {}, handleSuccessLike, (error) => { console.log(error) }) + else + handleLogin() + } + + const [followingHover, handleFollowingHover] = useState(false) + const toggleFollowingHover = (value) => { handleFollowingHover(value) } + + const [slideIn, setSlide] = useState(false) + const controlSlide = () => { setSlide(!slideIn) } + + function handleSuccessFollow(data) { + handleToggleUserFollowingCol() + } + const handleFollow = () => { + if (state.currentUser.id) + putRequest(`/collections/${props.id}/follow`, {}, handleSuccessFollow, (error) => { console.log(error) }) + else + handleLogin() + } + + const RenderFollowButton = () => { + return ( + <FollowButton onClick={handleFollow}> + <AddIcon /><span>SEGUIR</span> + </FollowButton> + ) + } - function handleSuccessLike(data) { - toggleLiked(!liked) - setLikesCount(data.count) - } - const handleLike = () => { - if (state.currentUser.id) - putRequest(`/collections/${props.id}/like`, {}, handleSuccessLike, (error) => { console.log(error) }) - else - handleLogin() + useEffect(() => { + if (!state.currentUser.id) { + toggleLiked(false); + toggleUserFollowingCol(false); } + }, [state.currentUser.id]) - const [followingHover, handleFollowingHover] = useState(false) - const toggleFollowingHover = (value) => { handleFollowingHover(value) } + const RenderFollowingButton = () => { + return ( + <FollowingButton onMouseOver={() => toggleFollowingHover(true)} + onMouseLeave={() => toggleFollowingHover(false)} onClick={handleFollow}> + { + followingHover ? + ( + [ + <span>DEIXAR DE SEGUIR</span> + ] + ) + : + ( + [ + <React.Fragment> + <CheckIcon /><span>SEGUINDO</span> + </React.Fragment> + ] + ) + } + </FollowingButton> + ) + } - const [slideIn, setSlide] = useState(false) - const controlSlide = () => { setSlide(!slideIn) } + const SlideAnimationContent = () => { + return ( + <SlideContentDiv> + <HeaderContainer container="row" justify="flex-start" alignItems="center"> + <AvatarDiv item xs={2}> + <img className="img" src={userAvatar} alt="user avatar" /> + </AvatarDiv> + <EnviadoPor item xs={10}> + Enviado por: + <br /> + <p>{props.author}</p> + </EnviadoPor> + </HeaderContainer> + { + props.tags ? + <TagContainer container direction="row"> + { + props.tags.map((tag) => + <Grid item key={tag.id}> + <span >{tag.name}</span> + </Grid> + ) + } + </TagContainer> : + null + } + </SlideContentDiv> + ) + } - function handleSuccessFollow(data) { - handleToggleUserFollowingCol() - } - const handleFollow = () => { - if (state.currentUser.id) - putRequest(`/collections/${props.id}/follow`, {}, handleSuccessFollow, (error) => { console.log(error) }) - else - handleLogin() - } + const handleSignUp = () => { + setSignUp(!signUpOpen) + } - const RenderFollowButton = () => { - return ( - <FollowButton className={`${props.contrast}LinkColor`} style={props.contrast === "" ? {border: "2px solid #503096", borderRadius : "5px", color :"#503096" } : {border: "1px solid white", borderRadius : "5px", color :"#503096"}} onClick={handleFollow}> - <AddIcon className={`${props.contrast}IconColor`}/><span>SEGUIR</span> - </FollowButton> - ) - } + const handleLogin = () => { + setLogin(!loginOpen) + } - useEffect(() => { - if (!state.currentUser.id) { - toggleLiked(false); - toggleUserFollowingCol(false); - } - }, [state.currentUser.id]) + function Alert(props) { + return <MuiAlert elevation={6} variant="filled" {...props} />; + } - const RenderFollowingButton = () => { - return ( - <FollowingButton className={`${props.contrast}LinkColor`} style={props.contrast === "" ? {border: "2px solid #503096", borderRadius : "5px", color :"#fff", backgroundColor : "#503096" } : {border: "1px solid white", borderRadius : "5px", color :"#503096"}}onMouseOver={() => toggleFollowingHover(true)} - onMouseLeave={() => toggleFollowingHover(false)} onClick={handleFollow}> - { - followingHover ? - ( - [ - <span>DEIXAR DE SEGUIR</span> - ] - ) - : - ( - [ - <React.Fragment> - <CheckIcon className={`${props.contrast}IconColor`}/><span>SEGUINDO</span> - </React.Fragment> - ] - ) - } - </FollowingButton> - ) + function toggleLoginSnackbar(reason) { + if (reason === 'clickaway') { + return; } - - const SlideAnimationContent = (contrast) => { - return ( - <SlideContentDiv style={contrast === '' ? {backgroundColor: "#7e57c2"} : {backgroundColor: "inherit"}}> - <HeaderContainer container="row" justify="flex-start" alignItems="center"> - <AvatarDiv item xs={2}> - <img className="img" src={userAvatar} alt="user avatar" /> - </AvatarDiv> - <EnviadoPor item xs={10}> - Enviado por: - <br /> - <p>{props.author}</p> - </EnviadoPor> - </HeaderContainer> - { - props.tags ? - <TagContainer container direction="row"> + handleSuccessfulLogin(false); + } + + return ( + <> + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} + /> + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + openSnackbar={() => { handleSuccessfulLogin(true) }} + /> + <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleLoginSnackbar} + anchorOrigin={{ vertical: 'top', horizontal: 'center' }} + > + <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> + </Snackbar> + <StyledCard> + <CardDiv> + <CardReaDiv> + <Link to={"/colecao-do-usuario/" + props.id}> + <Header onMouseEnter={controlSlide} onMouseLeave={controlSlide}> + <div className={`slideContentLinkBeforeActive${slideIn}`} style={{ width: '272.5px', height: '230px' }}> + <UserInfo style={{ width: '272.5px'}}> + {/* I(Luis) dont know why, but if i use styled components, sometimes the avatar will be deconfigured */} + <img src={userAvatar} alt="user avatar" style={{ + height: "70px", width: "70px", borderRadius: "50%", + zIndex: 1, border: "2px solid white", + boxShadow: "0 1px 3px rgba(0,0,0,.45)" + }} /> + <UserAndTitle> + <span>{props.author}</span> + <span className={"col-name"}>{name}</span> + </UserAndTitle> + </UserInfo> + <StyledGrid container direction="row" style={{ width: '272.5px' }}> { - props.tags.map((tag) => - <Grid item key={tag.id}> - <span className={`${props.contrast}BackColor ${props.contrast}Text`}>{tag.name}</span> + props.thumbnails.map((thumb) => + <Grid item xs={props.thumbnails.length <= 3 && props.thumbnails.length > 0 ? 12 / props.thumbnails.length : 6}> + <div style={{ backgroundImage: `url(${`${apiDomain}` + thumb})`, height: `${props.thumbnails.length <= 3 ? '230px' : '100%'}`, width: "100%", backgroundSize: "cover", backgroundPosition: "center" }} /> </Grid> - ) + ) } - </TagContainer> : - null - } - </SlideContentDiv> - ) - } - - const handleSignUp = () => { - setSignUp(!signUpOpen) - } - - const handleLogin = () => { - setLogin(!loginOpen) - } - - function Alert(props) { - return <MuiAlert elevation={6} variant="filled" {...props} />; - } - - function toggleLoginSnackbar(reason) { - if (reason === 'clickaway') { - return; - } - handleSuccessfulLogin(false); - } - - return ( - <> - <SignUpModal contrast={props.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} - /> - <LoginModal contrast={props.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} - openSnackbar={() => { handleSuccessfulLogin(true) }} - /> - <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleLoginSnackbar} - anchorOrigin={{ vertical: 'top', horizontal: 'center' }} - > - <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> - </Snackbar> - <StyledCard> - <CardDiv className={`${props.contrast}Border`}> - <CardReaDiv className={`${props.contrast}BackColor`}> - <Link to={"/colecao-do-usuario/" + props.id}> - <Header onMouseEnter={controlSlide} onMouseLeave={controlSlide}> - <div className={`slideContentLinkBeforeActive${slideIn}`} style={{ width: '272.5px', height: '230px' }}> - <UserInfo style={{ width: '272.5px'}}> - {/* I(Luis) dont know why, but if i use styled components, sometimes the avatar will be deconfigured */} - <img src={userAvatar} alt="user avatar" style={{ - height: "70px", width: "70px", borderRadius: "50%", - zIndex: 1, border: "2px solid white", - boxShadow: "0 1px 3px rgba(0,0,0,.45)" - }} /> - <UserAndTitle> - <span>{props.author}</span> - <span className={"col-name"}>{name}</span> - </UserAndTitle> - </UserInfo> - <StyledGrid container direction="row" style={{ width: '272.5px' }}> - { - props.thumbnails.map((thumb) => - <Grid item xs={props.thumbnails.length <= 3 && props.thumbnails.length > 0 ? 12 / props.thumbnails.length : 6}> - <div style={{ backgroundImage: `url(${`${apiDomain}` + thumb})`, height: `${props.thumbnails.length <= 3 ? '230px' : '100%'}`, width: "100%", backgroundSize: "cover", backgroundPosition: "center" }} /> - </Grid> - ) - } - </StyledGrid> - </div> - { - <div className={`slideContentLinkAfterActive${slideIn}`}> - <div className="Text" style={{ width: "100%" }}> - {SlideAnimationContent(props.contrast)} - </div> - </div> - } - </Header> - </Link> - - <Description className={`${props.contrast}BackColor`}> {/*renders rating, number of learning objects and likes count*/} - { - props.authorID !== state.currentUser.id && - <Rating - style={props.contrast === "" ? {} : {color: "white"}} - name="customized-empty" - value={props.rating} - readOnly - emptyIcon={<StarBorderIcon className={`${props.contrast}Text`} fontSize="inherit" />} - /> - } - - <Footer className={`${props.contrast}Text`}> - <Type> - <FolderIcon style={props.contrast === "" ? {} : {color: "white"}} /> - <span style={{ fontWeight: "bold" }}>{props.collections ? props.collections.length : 0} </span> - <span>{props.collections ? props.collections.length !== 1 ? "Recursos" : "Recurso" : 0}</span> - </Type> - <LikeCounter> - <span>{likesCount}</span> - <ButtonNoWidth onClick={handleLike}> - <FavoriteIcon className={`${props.contrast}LinkColor`} style={ props.contrast === "" ? {color: liked ? "red" : "#666"} : {color: liked ? "red" : "white"} } /> - </ButtonNoWidth> - </LikeCounter> - </Footer> - </Description> - - </CardReaDiv> - + </StyledGrid> + </div> { - props.authorID === state.currentUser.id ? - ( - <CardReaFooter className={`${props.contrast}BackColor`} style={{ justifyContent: "space-between" }}> {/*renders following/unfollow and follow button*/} - <Grid container> - <Grid item xs={6} style={{ display: "flex", justifyContent: "center" }}> - { - privacy === 'private' && - <LockIcon className={`${props.contrast}IconColor`} /> - } - </Grid> - <Grid item xs={6} style={{ display: "flex", justifyContent: "flex-end" }}> - <ColCardOwnerOptions - contrast={props.contrast} - id={props.id} - changeColName={changeColName} - changeColPrivacy={changeColPrivacy} - removeColl={props.removeColl} - /> - </Grid> - </Grid> - </CardReaFooter> - ) - : - ( - <CardReaFooter className={`${props.contrast}BackColor`}> {/*renders following/unfollow and follow button*/} - <Grid container> - <Grid item xs={2}></Grid> - <Grid item xs={8} style={{ display: "flex", justifyContent: "center" }}> - { - userFollowingCol ? - ( - [ - RenderFollowingButton() - ] - ) - : - ( - [ - RenderFollowButton() - ] - ) - } - </Grid> - <Grid item xs={2} style={{ display: "flex", justifyContent: "flex-end" }}> - <ColCardPublicOptions - contrast={props.contrast} - id={props.id} - userFollowingCol={userFollowingCol} - handleLike={handleLike} - handleFollow={handleFollow} - liked={liked} - handleLogin={handleLogin} - currentUserId={state.currentUser.id} - /> - </Grid> - </Grid> - </CardReaFooter> - ) + <div className={`slideContentLinkAfterActive${slideIn}`} style={{ width: '272.5px', height: '230px' }}> + <div className="text" > + {SlideAnimationContent()} + </div> + </div> } - - </CardDiv> - </StyledCard> - </> - ) + </Header> + </Link> + + <Description> {/*renders rating, number of learning objects and likes count*/} + { + props.authorID !== state.currentUser.id && + <Rating + name="customized-empty" + value={props.rating} + readOnly + style={{ color: "#666" }} + emptyIcon={<StarBorderIcon fontSize="inherit" />} + /> + } + + <Footer> + <Type> + <FolderIcon /> + <span style={{ fontWeight: "bold" }}>{props.collections ? props.collections.length : 0} </span> + <span>{props.collections ? props.collections.length !== 1 ? "Recursos" : "Recurso" : 0}</span> + </Type> + <LikeCounter> + <span>{likesCount}</span> + <ButtonNoWidth onClick={handleLike}> + <FavoriteIcon style={{ color: liked ? "red" : "#666" }} /> + </ButtonNoWidth> + </LikeCounter> + </Footer> + </Description> + + </CardReaDiv> + + { + props.authorID === state.currentUser.id ? + ( + <CardReaFooter style={{ justifyContent: "space-between" }}> {/*renders following/unfollow and follow button*/} + <Grid container> + <Grid item xs={6} style={{ display: "flex", justifyContent: "center" }}> + { + privacy === 'private' && + <LockIcon style={{ color: "#666" }} /> + } + </Grid> + <Grid item xs={6} style={{ display: "flex", justifyContent: "flex-end" }}> + <ColCardOwnerOptions + id={props.id} + changeColName={changeColName} + changeColPrivacy={changeColPrivacy} + removeColl={props.removeColl} + /> + </Grid> + </Grid> + </CardReaFooter> + ) + : + ( + <CardReaFooter> {/*renders following/unfollow and follow button*/} + { + userFollowingCol ? + ( + [ + RenderFollowingButton() + ] + ) + : + ( + [ + RenderFollowButton() + ] + ) + } + <ColCardPublicOptions + id={props.id} + userFollowingCol={userFollowingCol} + handleLike={handleLike} + handleFollow={handleFollow} + liked={liked} + handleLogin={handleLogin} + currentUserId={state.currentUser.id} + /> + </CardReaFooter> + ) + } + + </CardDiv> + </StyledCard> + </> + ) } const SlideContentDiv = styled.div` + background-color : #7e57c2; padding : 10px; width : 272.5px; height : 230px; @@ -377,6 +369,7 @@ const CardReaFooter = styled.div` display : flex; justify-content : center; align-items : center; + border-top : 1px solid #e5e5e5; .MuiSvgIcon-root { font-family: 'Material Icons'; @@ -411,6 +404,8 @@ const StyledGrid = styled(Grid)` height : 136px; width 130px; background : #f9f9f9; + border : 1px solid #f4f4f4; + border-color : #f4f4f4; } ` @@ -430,6 +425,12 @@ const Description = styled.div` padding : 15px; ` const FollowButton = styled(Button)` + border : 2px solid #503096 !important; + border-radius : 5px !important; + margin : 10px !important; + color :#503096 !important; + min-width : 150px !important; + min-height : 36px !important; text-align : center !important; vertical-align : middle !important; background : transparent !important; @@ -442,11 +443,22 @@ const FollowButton = styled(Button)` white-space : nowrap !important; font-weight: 500; + &:hover { + background-color : rgba(158,158,158,0.2) !important; + + } + ` const FollowingButton = styled(Button)` + border : 2px solid #503096 !important; + border-radius : 5px !important; + margin : 10px !important; + color :#fff !important; + min-width : 150px !important; + min-height : 36px !important; text-align : center !important; vertical-align : middle !important; - + background-color : #503096 !important; text-transform : uppercase !important; font-family : inherit !important; overflow : hidden !important; @@ -456,4 +468,10 @@ const FollowingButton = styled(Button)` white-space : nowrap !important; font-weight: 500; -` \ No newline at end of file + &:hover { + background-color : rgba(158,158,158,0.2) !important; + color : #503096 !important; + box-shadow : none !important; + } + +` diff --git a/src/Components/CollectionCommentSection.js b/src/Components/CollectionCommentSection.js index a317a429b6174183140a772b4eab292bc10d4c66..4f16d012eb2e8adf52e53e5aed76fb59e63c291d 100644 --- a/src/Components/CollectionCommentSection.js +++ b/src/Components/CollectionCommentSection.js @@ -20,6 +20,7 @@ import React, { useRef, useState, useEffect, Fragment } from 'react'; import { Grid } from '@material-ui/core'; import Card from '@material-ui/core/Card'; import Button from '@material-ui/core/Button'; +import EditIcon from '@material-ui/icons/Edit'; import styled from 'styled-components'; import CommentForm from './ResourcePageComponents/CommentForm.js'; import Comment from './Comment.js'; @@ -40,7 +41,7 @@ import { Comentarios } from "ImportImages.js"; export default function CollectionCommentSection(props) { const [post_snack_open, setPostSnackOpen] = useState(false); const [delete_snack_open, setDeleteSnackOpen] = useState(false); - const [render_state, setRenderState] = useState(0); + const [render_state, setRenderState] = useState(false); const [sign_up_open, setSignUpOpen] = useState(false); const [log_in_open, setLoginOpen] = useState(false); const [is_loading, setIsLoading] = useState(false); @@ -55,7 +56,7 @@ export default function CollectionCommentSection(props) { const [currPageReviews, setCurrPageReviews] = useState(0); const comment_ref = useRef(null); - const forceUpdate = () => { setCurrPageReviews(0); setRenderState(render_state + 1); } + const forceUpdate = () => { setRenderState(!render_state); } const handlePostSnackbar = () => { setPostSnackOpen(!post_snack_open); @@ -65,6 +66,10 @@ export default function CollectionCommentSection(props) { setDeleteSnackOpen(!delete_snack_open); } + const handleScrollToCommentForm = () => { + window.scrollTo(0, comment_ref.current.offsetTop); + } + function handleOpenSnackSignIn() { const info = { open: true, @@ -113,37 +118,47 @@ export default function CollectionCommentSection(props) { } } - const NoCommentsMessage = (contrast) => { + const NoCommentsMessage = () => { const NoCommentsContainer = styled.div` text-align: center; margin-left: 9vw; margin-right: 9vw; ` const BlueTitle = styled.h2` - color: ${props => props.contrast === "" ? "#673ab7" : "white"}; + color: #673ab7; ` const Secondary = styled.h3` font-weight: 100; - color: ${props => props.contrast === "" ? "#666" : "white"}; + ` + const ButtonText = styled.span` + font-weight: 900; ` const Image = styled.img` ` return ( <NoCommentsContainer> <Image src={Comentarios} style={{ width: "100%", maxWidth: 234 }} /> - <BlueTitle contrast={contrast}>Compartilhe sua opinião com a rede!</BlueTitle> - <Secondary contrast={contrast}>Gostou desta coleção? Comente e compartilhe com a rede sua opinião. Interagindo com a rede, você contribui para que mais coleções como esta sejam criadas.</Secondary> + <BlueTitle>Compartilhe sua opinião com a rede!</BlueTitle> + <Secondary>Gostou desta coleção? Comente e compartilhe com a rede sua opinião. Interagindo com a rede, você contribui para que mais coleções como esta sejam criadas.</Secondary> + <Button + variant="contained" + color="primary" + startIcon={<EditIcon />} + onClick={handleScrollToCommentForm} + > + <ButtonText>Relatar experiência</ButtonText> + </Button> </NoCommentsContainer> ); } - const CollectionComments = (contrast) => { + const CollectionComments = () => { return ( - <ComentariosBox contrast={contrast}> + <ComentariosBox> + <h3>{totalReviews} {totalReviews !== 1 ? 'Relatos' : 'Relato'} sobre o uso do Recurso</h3> {reviews.map(r => { return ( <div className="comentario-template" key={r.created_at}> <Comment - contrast={contrast} isCollection={false} rerenderCallback={forceUpdate} objectID={props.id} @@ -172,10 +187,7 @@ export default function CollectionCommentSection(props) { } function handleSuccessGet(data, headers) { - if (currPageReviews !== 0) - setReviews((previousState) => previousState.concat(data)); - else - setReviews(data); + setReviews((previousState) => previousState.concat(data)); if (headers.has('X-Total-Count')) setTotalReviews(headers.get('X-Total-Count')) setIsLoading(false); @@ -195,7 +207,7 @@ export default function CollectionCommentSection(props) { }, [render_state, currPageReviews]); return ( - <CommentAreaContainer contrast={props.contrast} container xs={12} direction="row" justify="center" alignItems="center"> + <CommentAreaContainer container xs={12} direction="row" justify="center" alignItems="center"> <SnackBarComponent snackbarOpen={snackInfo.open} handleClose={handleCloseSnack} @@ -204,24 +216,22 @@ export default function CollectionCommentSection(props) { color={snackInfo.color} /> <SignUpModal - contrast={props.contrast} open={sign_up_open} handleClose={() => setSignUpOpen(false)} openLogin={() => setLoginOpen(true)} /> <LoginModal - contrast={props.contrast} openSnackbar={handleOpenSnackSignIn} open={log_in_open} handleClose={() => setLoginOpen(false)} openSignUp={handleOpenSignUp} /> <Grid item xs={12} ref={comment_ref}> - <CommentAreaCard contrast={props.contrast}> + <CommentAreaCard> { props.currentUserId ? <Fragment> - <Title contrast={props.contrast}>Conte sua experiência com a coleção</Title> + <Title>Conte sua experiência com a coleção</Title> <Grid container style={{ paddingTop: "20px" }} spacing={1}> <Grid item xs={12} sm={2} style={{ paddingLeft: "15px", paddingRight: "15px" }}> <div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}> @@ -230,7 +240,6 @@ export default function CollectionCommentSection(props) { </Grid> <Grid item xs={12} sm={10}> <CommentForm - contrast={props.contrast} colecao recursoId={props.id} handleSnackbar={handlePostSnackbar} @@ -241,11 +250,11 @@ export default function CollectionCommentSection(props) { </Fragment> : <Grid item xs={12}> - <LogInToComment contrast={props.contrast}> + <LogInToComment> <span className="span-purple">Você precisa entrar para comentar</span> - <Button onClick={() => setSignUpOpen(true)} style={props.contrast === "" ? { textTransform: "uppercase", color: "#666", fontWeight: "700" } : { textTransform: "uppercase", color: "yellow", fontWeight: "700", textDecoration: "underline" }}> + <Button onClick={() => setSignUpOpen(true)} style={{ textTransform: "uppercase", color: "#666", fontWeight: "700" }}> <ExitToAppIcon />ENTRAR - </Button> + </Button> </LogInToComment> </Grid> } @@ -255,7 +264,7 @@ export default function CollectionCommentSection(props) { <CircularProgress className="loading" /> </LoadingDiv> : - reviews.length ? CollectionComments(props.contrast) : NoCommentsMessage(props.contrast) + reviews.length ? CollectionComments() : NoCommentsMessage() } </CommentAreaCard> </Grid> @@ -267,7 +276,7 @@ export default function CollectionCommentSection(props) { > <Alert onClose={handlePostSnackbar} severity="info"> Seu comentário foi publicado com sucesso! - </Alert> + </Alert> </Snackbar> <Snackbar open={delete_snack_open} @@ -293,7 +302,7 @@ const ComentariosBox = styled.div` font-family: 'Roboto Light','Roboto Regular',Roboto; font-weight: 300; font-style: normal; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color:#666; font-size: 1.857em; margin: 15px 2%; text-align : flex-start; @@ -305,17 +314,17 @@ const ComentariosBox = styled.div` border-bottom : 1px solid #f4f4f4; } - .load-more{ - width: 100%; - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - } - - .button{ - box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); - } + .load-more{ + width: 100%; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + } + + .button{ + box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); + } ` const Avatar = styled.img` @@ -348,7 +357,7 @@ const LogInToComment = styled.div` font-size : 24px; font-weight : 700; padding-bottom : 5px; - color: ${props => props.contrast === "" ? "#673ab7" : "white"}; + color : #673ab7; } img { @@ -359,15 +368,12 @@ const LogInToComment = styled.div` const CommentAreaContainer = styled(Grid)` padding: 10px; - background: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; ` const CommentAreaCard = styled(Card)` padding: 45px; - background: ${props => props.contrast === "" ? "#f4f4f4" : "black !important"}; - border: ${props => props.contrast === "" ? "" : "1px solid white !important"}; ` const Title = styled.h1` text-align: center; font-weight: 100; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; ` diff --git a/src/Components/CollectionDescription.js b/src/Components/CollectionDescription.js index a8eedcbce66be688362e3976320c1dd9118b67b7..60de747f5bb7c17d9dff5d1a9acb2f69d8c95808 100644 --- a/src/Components/CollectionDescription.js +++ b/src/Components/CollectionDescription.js @@ -43,9 +43,7 @@ export default function CollectionDescription(props) { }, [props.collection_id]); return ( - <Grid container direction="column" justify="center" alignItems="center" spacing={5} - style={props.contrast === "" ? {color: "#666"} : {color: "white"}} - > + <Grid container direction="column" justify="center" alignItems="center" spacing={5}> <Grid item justify="center" @@ -61,7 +59,6 @@ export default function CollectionDescription(props) { > <Grid item> <CollectionReview - contrast={props.contrast} stars={props.stars} liked={props.liked} likes={props.likes} @@ -95,5 +92,6 @@ export default function CollectionDescription(props) { const Title = styled.h1` font-size: 2.5em; + color: rgb(102, 102, 102); text-align: center ` \ No newline at end of file diff --git a/src/Components/CollectionDowloadButton.js b/src/Components/CollectionDowloadButton.js index 427b3464a833c94e60b0a76d55de7dc74b936767..bda45946d26e9fb373ba79d5e006d4cacb5bb495 100644 --- a/src/Components/CollectionDowloadButton.js +++ b/src/Components/CollectionDowloadButton.js @@ -96,7 +96,6 @@ const DowloadButton = (props) => { </Alert> </Snackbar> <DownloadButton - contrast={props.contrast} variant="outlined" color="primary" startIcon={<GetAppIcon fontSize="large" />} @@ -114,10 +113,6 @@ const ButtonText = styled.span` font-size: 1.2em; ` const DownloadButton = styled(Button)` - color: ${props => props.contrast === "" ? "#3f51b5 !important" : "yellow !important"}; - background-color: ${props => props.contrast === "" ? "white !important" : "black !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "yellow underline !important"}; - border: ${props => props.contrast === "" ? "1px solid #3f51b5 !important" : "1px solid white !important"}; padding-left: 10; padding-right: 10; width: 250px; diff --git a/src/Components/CollectionReview.js b/src/Components/CollectionReview.js index bd35d03140d24c87e0e67cedb565a2f83c5fcc51..0d94757b2dbd235e2b3b9ef2b8077707b8a9a357 100644 --- a/src/Components/CollectionReview.js +++ b/src/Components/CollectionReview.js @@ -107,7 +107,7 @@ export default function CollectionReview(props) { }, [props]) return ( - <Grid container direction="column" style={props.contrast === "" ? {color: "#666"} : {color: "white"}}> + <Grid container direction="column"> <SnackBarComponent snackbarOpen={snackInfo.open} handleClose={handleCloseSnack} @@ -115,34 +115,31 @@ export default function CollectionReview(props) { text={snackInfo.text} color={snackInfo.color} /> - <Grid sm={12} container direction="row" alignItems="center" - style={{justifyContent: "center"}} - > + <Grid sm={12} container direction="row" alignItems="center"> <Grid item> <Rating - style={props.contrast === "" ? {} : {color: "white"}} name="customized-empty" value={Number(stars)} readOnly onClick={props.scrollToComment} - emptyIcon={<StarBorderIcon className={`${props.contrast}Text`} fontSize="inherit" />} + style={{ color: "#666" }} + emptyIcon={<StarBorderIcon fontSize="inherit" />} /> </Grid> <Grid item justify="center" alignItems="center"> - <IconButton style={{color: "inherit"}} aria-label="like" onClick={handleLikeClick}> - {likes}<FavoriteIcon style={props.contrast === "" ? {fill: liked ? "red" : null} : {fill: "yellow"}} /> + <IconButton aria-label="like" onClick={handleLikeClick}> + {likes}<FavoriteIcon style={{ fill: liked ? "red" : null }} /> </IconButton> </Grid> </Grid> <Grid item sm={12}> <IconButton aria-label="report" - style={{ fontSize: 'medium' }} + style={{ fontSize: 'small' }} onClick={handleClickReport}> - <InfoIcon style={props.contrast === "" ? {color: "#666"} : {color: "white"}}/><span style={props.contrast === "" ? {color: "#666"} : {color: "yellow", textDecoration: "underline"}}>Reportar erro ou abuso</span> + <InfoIcon />Reportar erro ou abuso </IconButton> <ReportModal - contrast={props.contrast} open={reportOpen} handleClose={handleCloseModal} form="colecao" @@ -151,13 +148,11 @@ export default function CollectionReview(props) { /> </Grid> <SignUpModal - contrast={props.contrast} open={sign_up_open} handleClose={() => setSignUpOpen(false)} openLogin={() => setLoginOpen(true)} /> <LoginModal - contrast={props.contrast} openSnackbar={handleOpenSnackSignIn} open={log_in_open} handleClose={() => setLoginOpen(false)} diff --git a/src/Components/Comment.js b/src/Components/Comment.js index f6ca3f2c50a81c667b124612c0178d3c4a46909a..b3e1df7a9b286e598a758004a5a721adce5b58ad 100644 --- a/src/Components/Comment.js +++ b/src/Components/Comment.js @@ -27,425 +27,296 @@ import Rating from '@material-ui/lab/Rating'; import StarBorderIcon from '@material-ui/icons/StarBorder'; import EditIcon from '@material-ui/icons/Edit'; import TextField from "@material-ui/core/TextField"; -import Menu from "@material-ui/core/Menu"; -import MenuItem from "@material-ui/core/MenuItem"; -import ModalExcluir from "./ModalExcluirComentario.js"; -import { putRequest, deleteRequest } from "./HelperFunctions/getAxiosConfig"; -import { makeStyles } from "@material-ui/styles"; +import Menu from '@material-ui/core/Menu'; +import MenuItem from '@material-ui/core/MenuItem'; +import ModalExcluir from './ModalExcluirComentario.js' +import { putRequest, deleteRequest } from './HelperFunctions/getAxiosConfig' + //Image Import import { noAvatar } from "ImportImages.js"; -const useStyles = makeStyles((theme) => ({ - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "white", - width: "100%", - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "black", - width: "100%", - }, -})); - - export default function Comment(props) { - var moment = require("moment"); - const classes = useStyles(); - const { state } = useContext(Store); - const [displayedComment, setDisplayedComment] = useState(props.description); - const [editando, setEditando] = useState(false); + console.log(props) + /* + Required props: + rerenderCallback = callback function to trigger re-render on parent component + reviewRatings = required to update comment even though the user cannot update their rating score... + objectID = collection/learning object id + reviewID = self-explanatory I hope + authorID = author id; links to public user page + authorAvatar = either a string denoting the author's avatar file location or null + rating = star rating + name = title (?) + authorName = author username + description = the user comment itself + createdAt + recurso : boolean; determines whether to display orange or purple font + */ + var moment = require('moment') + + const { state } = useContext(Store) + const [displayedComment, setDisplayedComment] = useState(props.description) + const [editando, setEditando] = useState(false) const [anchorEl, setAnchorEl] = React.useState(null); - const handleClick = (event) => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); }; - const [modalOpen, toggleModal] = useState(false); + const [modalOpen, toggleModal] = useState(false) const [comment, setComment] = useState({ error: false, - value: props.description, - }); + value: props.description + }) const handleChange = (e) => { - const userInput = e.target.value; - const flag = userInput.length === 0 ? true : false; - setComment({ ...comment, error: flag, value: userInput }); - }; + const userInput = e.target.value + const flag = (userInput.length === 0 ? true : false); + setComment({ ...comment, error: flag, value: userInput }) + } function handleOnSuccessfulComment(data) { - setDisplayedComment(comment.value); - setEditando(false); - props.handlePost(); + setDisplayedComment(comment.value) + setEditando(false) + props.handlePost() } const updateComment = () => { - const finalComment = comment; + const finalComment = comment let url; if (props.isCollection) - url = `/collections/${props.objectID}/reviews/${props.reviewID}`; - else url = `/learning_objects/${props.objectID}/reviews/${props.reviewID}`; + url = `/collections/${props.objectID}/reviews/${props.reviewID}` + else + url = `/learning_objects/${props.objectID}/reviews/${props.reviewID}` if (!finalComment.error) { + let payload = { - review: { - description: finalComment.value, - review_ratings_attributes: props.reviewRatings, - }, - }; - putRequest(url, payload, handleOnSuccessfulComment, (error) => { - console.log(error); - }); + "review": { + "description": finalComment.value, + "review_ratings_attributes": props.reviewRatings + } + } + putRequest(url, payload, handleOnSuccessfulComment, (error) => { console.log(error) }) + } - }; + } function handleSuccessDeleteComment(data) { - props.rerenderCallback(); - props.handleSnackbar(3); + props.rerenderCallback() + props.handleSnackbar(3) } const deleteComment = () => { let url; if (props.isCollection) - url = `/collections/${props.objectID}/reviews/${props.reviewID}`; - else url = `/learning_objects/${props.objectID}/reviews/${props.reviewID}`; + url = `/collections/${props.objectID}/reviews/${props.reviewID}` + else + url = `/learning_objects/${props.objectID}/reviews/${props.reviewID}` - deleteRequest(url, handleSuccessDeleteComment, (error) => { - console.log(error); - }); + deleteRequest(url, handleSuccessDeleteComment, (error) => { console.log(error) }) - toggleModal(false); - }; + toggleModal(false) + } if (props.authorID) return ( <React.Fragment> <ModalExcluir - contrast={state.contrast} - open={modalOpen} - handleClose={() => { - toggleModal(false); - }} + open={modalOpen} handleClose={() => { toggleModal(false) }} handleConfirm={deleteComment} /> <Grid container style={{ paddingLeft: "20px" }}> + <Grid item xs={1}> - {props.authorID && ( - <AvatarDiv> - <Link to={"/usuario-publico/" + props.authorID}> - <img - src={ - props.authorAvatar - ? apiDomain + props.authorAvatar - : noAvatar - } - alt="author avatar" - /> - </Link> - </AvatarDiv> - )} + { + props.authorID && + <AvatarDiv> + <Link to={'/usuario-publico/' + props.authorID}> + <img src={props.authorAvatar ? apiDomain + props.authorAvatar : noAvatar} alt="author avatar" /> + </Link> + </AvatarDiv> + } </Grid> <Grid item xs={10}> - <Comentario contrast={state.contrast}> + <Comentario> <div className="star-rating-container"> <Rating name="read-only" value={props.rating} readOnly size="small" - style={ - state.contrast === "" - ? { color: "#666" } - : { color: "yellow" } - } - emptyIcon={ - <StarBorderIcon - fontSize="inherit" - style={ - state.contrast === "" - ? { color: "#a5a5a5" } - : { color: "yellow" } - } - /> - } + style={{ color: "#666" }} + emptyIcon={<StarBorderIcon fontSize="inherit" style={{ color: "#a5a5a5" }} />} /> </div> - {props.name && <strong>{props.name}</strong>} + { + props.name && + <strong>{props.name}</strong> + } <div> - {editando ? ( - <React.Fragment> - <div style={{ marginTop: "5%", padding: "2px" }}> - <StyledTextField - contrast={props.contrast} - colecao={!props.recurso} - id="input-comentario" - label={"Editar Comentário"} - margin="normal" - value={comment.value} - InputProps={ - props.contrast === "" - ? { className: classes.lightTextField } - : { className: classes.darkTextField } - } - variant="outlined" - multiline={true} - rows="5" - onChange={(e) => { - handleChange(e); - }} - style={{ width: "100%" }} - /> - </div> - <div style={{ float: "right" }}> - <StyledButton - contrast={state.contrast} - style={ - state.contrast === "" - ? props.recurso - ? { backgroundColor: "#ff7f00" } - : { backgroundColor: "#673ab7" } - : { - backgroundColor: "black", - border: "1px solid white", - textDecoration: "underline", - } - } - onClick={() => { - setEditando(false); - }} - > - Fechar - </StyledButton> - <StyledButton - contrast={state.contrast} - style={ - state.contrast === "" - ? props.recurso - ? { backgroundColor: "#ff7f00" } - : { backgroundColor: "#673ab7" } - : { - backgroundColor: "black", - border: "1px solid white", - textDecoration: "underline", + { + editando ? + ( + <React.Fragment> + <div style={{ marginTop: "5%", padding: "2px" }}> + <StyledTextField + colecao={!props.recurso} + id="input-comentario" + label={"Editar Comentário"} + margin="normal" + value={comment.value} + multiline={true} + rows="5" + onChange={(e) => { handleChange(e) }} + style={{ width: "100%" }} + /> + </div> + <div style={{ float: "right" }}> + <StyledButton + style={props.recurso ? { backgroundColor: "#ff7f00" } : { backgroundColor: "#673ab7" }} + onClick={() => { setEditando(false) }} + > + Fechar + </StyledButton> + <StyledButton + style={props.recurso ? { backgroundColor: "#ff7f00" } : { backgroundColor: "#673ab7" }} + onClick={() => updateComment()} + > + Salvar + </StyledButton> + </div> + </React.Fragment> + ) + : + ( + <React.Fragment> + <p> + { + props.authorID && + <Link + to={'/usuario-publico/' + props.authorID} + style={{ + fontWeight: "bolder", + color: props.recurso ? "#ff7f00" : "#673ab7" + }} + > + {props.authorName} + </Link> } - } - onClick={() => updateComment()} - > - Salvar - </StyledButton> - </div> - </React.Fragment> - ) : ( - <React.Fragment> - <p> - {props.authorID && ( - <Link - to={"/usuario-publico/" + props.authorID} - style={{ - fontWeight: "bolder", - color: - state.contrast === "" - ? props.recurso - ? "#ff7f00" - : "#673ab7" - : "white", - }} - > - {props.authorName} - </Link> - )} - : {displayedComment} - </p> - <span className="date"> - {moment(props.createdAt).format("DD/MM/YYYY")} - </span> - </React.Fragment> - )} + : {displayedComment} + </p> + <span className="date"> + {moment(props.createdAt).format("DD/MM/YYYY")} + </span> + </React.Fragment> + ) + } </div> + </Comentario> </Grid> - {props.authorID === state.currentUser.id && ( + { + props.authorID === state.currentUser.id && <Grid item xs={1}> <StyledDiv> - <Button onClick={handleClick}> - <EditIcon - style={state.contrast === "" ? {} : { color: "white" }} - /> - </Button> + <Button onClick={handleClick}><EditIcon /></Button> <Menu id="simple-menu" anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose} - MenuListProps={{ - disablePadding: true - }} > - <MenuItem - style={ - state.contrast === "" - ? {} - : { - backgroundColor: "black", - color: "yellow", - textDecoration: "underline", - } - } - onClick={() => { - setEditando(true); - handleClose(); - }} - > - Editar - </MenuItem> - <MenuItem - style={ - state.contrast === "" - ? {} - : { - backgroundColor: "black", - color: "yellow", - textDecoration: "underline", - } - } - onClick={() => { - toggleModal(true); - handleClose(); - }} - > - Excluir - </MenuItem> + <MenuItem onClick={() => { setEditando(true); handleClose() }}>Editar</MenuItem> + <MenuItem onClick={() => { toggleModal(true); handleClose() }}>Excluir</MenuItem> </Menu> </StyledDiv> </Grid> - )} + } </Grid> </React.Fragment> - ); + ) else return ( - <Grid - container - style={{ paddingLeft: "20px" }} - justify="center" - alignItems="center " - > + <Grid container style={{ paddingLeft: "20px" }} justify='center' alignItems='center '> + <Grid item xs={1}> - { - <AvatarDiv> - <img src={noAvatar} alt="author avatar" /> - </AvatarDiv> - } + { + <AvatarDiv> + <img src={noAvatar} alt="author avatar" /> + </AvatarDiv> + } </Grid> <Grid item xs={10}> - <Comentario contrast={state.contrast}> - <p>O usuário que fez esse comentário deletou a conta.</p> + <Comentario> + <p> + O usuário que fez esse comentário deletou a conta. + </p> </Comentario> </Grid> </Grid> - ); + ) } const StyledTextField = styled(TextField)` - .MuiInputBase-root { - margin-bottom: 5px; - } - - .MuiOutlinedInput-root { - &.Mui-focused fieldset { - border-color: ${(props) => - props.contrast === "" - ? props.colecao - ? "#673ab7" - : "rgb(255,127,0)" - : "yellow"}; - } - fieldset { - border-color: ${(props) => (props.contrast === "" ? "#666" : "white")}; - } - } - - label { - color: ${(props) => (props.contrast === "" ? "#666" : "white")}; - } - label.Mui-focused { - color: ${(props) => - props.contrast === "" - ? props.colecao - ? "#673ab7" - : "rgb(255,127,0)" - : "yellow"}; + color : ${props => props.colecao ? "rgb(103,58,183)" : "rgb(255,127,0)"}; } - label.Mui-focused.Mui-error { - color: red; + .MuiInput-underline::after { + border-bottom: ${props => props.colecao ? "2px solid rgb(103,58,183)" : "2px solid rgb(255,127,0)"}; } - width: 95%; -`; +` const StyledDiv = styled.div` - text-align: center; - .MuiButton-root { - @media screen and (max-width: 990px) { - padding-right: 35px !important; - } - } -`; + text-align : center; + .MuiButton-root { + @media screen and (max-width: 990px) { + padding-right : 35px !important; + } + } +` const StyledButton = styled(Button)` - color: ${(props) => - props.contrast === "" - ? "rgba(255,255,255,0.87) !important" - : "yellow !important"}; - box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26) !important; - margin: 6px 8px !important; - font-weight: 600 !important; - :hover { - background-color: ${(props) => - props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } -`; + color : rgba(255,255,255,0.87) !important; + box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; + margin : 6px 8px !important; + font-weight : 600 !important; +` const Comentario = styled.div` - padding-left: 55px !important; - font-size: 14px; - color: ${(props) => (props.contrast === "" ? "#ababab" : "white")}; + padding-left : 55px !important; + font-size : 14px; .star-rating-container { - width: 100px; + width : 100px; } p { - margin: 0 0 10px; - padding-left: 2px; + margin : 0 0 10px; + padding-left : 2px } a { - text-decoration: none !important; + text-decoration : none !important; } .date { - color: ${(props) => (props.contrast === "" ? "#ababab" : "white")}; - font-size: 12px; - font-weight: lighter; - padding-left: 3px; + color : #ababab; + font-size : 12px; + font-weight : lighter; + padding-left : 3px; } -`; +` const AvatarDiv = styled.div` text-align : center; @@ -463,4 +334,4 @@ const AvatarDiv = styled.div` border-radius : 100% vertical-align : middle; } -`; +` diff --git a/src/Components/ContactButtons/FollowButton.js b/src/Components/ContactButtons/FollowButton.js index 96c7794c6fd25ee6a5a333d3c0132e9456f7d1e9..245eecbccd12abba7a88c5d76643d9302328c0d9 100644 --- a/src/Components/ContactButtons/FollowButton.js +++ b/src/Components/ContactButtons/FollowButton.js @@ -16,12 +16,12 @@ 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, { useContext, useState } from 'react' -import { Store } from '../../Store' +import React, {useContext, useState} from 'react' +import {Store} from '../../Store' import PersonAddIcon from '@material-ui/icons/PersonAdd'; import styled from 'styled-components' import Button from '@material-ui/core/Button'; -import { putRequest } from '../HelperFunctions/getAxiosConfig' +import {putRequest} from '../HelperFunctions/getAxiosConfig' import LoginModal from './../LoginModal.js' import Snackbar from '@material-ui/core/Snackbar'; import SignUpModal from './../SignUpModal' @@ -31,9 +31,9 @@ function Alert(props) { return <MuiAlert elevation={6} variant="filled" {...props} />; } -export default function FollowButton(props) { +export default function FollowButton (props) { - const { state } = useContext(Store) + const {state} = useContext(Store) const [loginOpen, setLogin] = useState(false) const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) const [signUpOpen, setSignUp] = useState(false) @@ -50,18 +50,18 @@ export default function FollowButton(props) { if (reason === 'clickaway') { return; } - - handleSuccessfulLogin(false); + + handleSuccessfulLogin(false); } - function handleSuccess(data) { + function handleSuccess (data) { props.toggleFollowed() } const handleFollow = (followerID) => { if (followerID !== undefined) { const url = `/users/${followerID}/follow/` - putRequest(url, {}, handleSuccess, (error) => { console.log(error) }) + putRequest(url, {}, handleSuccess, (error) => {console.log(error)}) } } @@ -73,49 +73,38 @@ export default function FollowButton(props) { <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> </Snackbar> {/*-------------------------------MODALS---------------------------------------*/} - <LoginModal contrast={props.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} openSnackbar={() => { handleSuccessfulLogin(true) }} /> - <SignUpModal contrast={props.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> {/*----------------------------------------------------------------------------*/} { state.currentUser.id !== '' ? ( - <StyledButton className={`${props.contrast}LinkColor`} - style={props.contrast === "" ? {border: "2px solid #00bcd4", borderRadius : "5px", color :"#00bcd4", backgroundColor: "white"} : {border: "1px solid white", borderRadius : "5px", color :"#00bcd4"}} - onClick={() => handleFollow(props.followerID)}> - <PersonAddIcon - className={`${props.contrast}IconColor`} - style={{ - fontSize: "24px", - display: "inline-block", - verticalAlign: "middle", - }} /> + <StyledButton onClick={() => handleFollow(props.followerID)}> + <PersonAddIcon style={{fontSize : "24px", + display : "inline-block", + verticalAlign : "middle", + color : "#00bcd4"}}/> SEGUIR </StyledButton> ) - : - ( - <StyledButton className={`${props.contrast}LinkColor `} - style={props.contrast === "" ? {border: "2px solid #00bcd4", borderRadius : "5px", color :"#00bcd4", backgroundColor: "white"} : {border: "1px solid white", borderRadius : "5px", color :"#00bcd4"}} - onClick={() => handleLogin(true)}> - <PersonAddIcon - className={`${props.contrast}IconColor`} - style={{ - fontSize: "24px", - display: "inline-block", - verticalAlign: "middle", - - }} /> + : + ( + <StyledButton onClick={() => handleLogin(true)}> + <PersonAddIcon style={{fontSize : "24px", + display : "inline-block", + verticalAlign : "middle", + color : "#00bcd4"}}/> SEGUIR - </StyledButton> - ) + </StyledButton> + ) } </React.Fragment> ) } -export function NoIcon(props) { - const { state } = useContext(Store) +export function NoIcon (props) { + const {state} = useContext(Store) const [loginOpen, setLogin] = useState(false) const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) const [signUpOpen, setSignUp] = useState(false) @@ -132,14 +121,14 @@ export function NoIcon(props) { if (reason === 'clickaway') { return; } - - handleSuccessfulLogin(false); + + handleSuccessfulLogin(false); } const handleFollow = (followerID) => { if (followerID !== undefined) { const url = `/users/${followerID}/follow/` - putRequest(url, {}, (data) => { props.toggleFollowed() }, (error) => { console.log(error) }) + putRequest(url, {}, (data) => {props.toggleFollowed()}, (error) => {console.log(error)}) } } @@ -151,58 +140,72 @@ export function NoIcon(props) { <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> </Snackbar> {/*-------------------------------MODALS---------------------------------------*/} - <LoginModal contrast={props.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} openSnackbar={() => { handleSuccessfulLogin(true) }} /> - <SignUpModal contrast={props.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> {/*----------------------------------------------------------------------------*/} { state.currentUser.id !== '' ? ( - <NoIconButton contrast={state.contrast} onClick={() => handleFollow(props.followableID)}>seguir</NoIconButton> + <NoIconButton onClick={() => handleFollow(props.followableID)}>seguir</NoIconButton> + ) + : + ( + <NoIconButton onClick={() => handleLogin(true)}>seguir</NoIconButton> ) - : - ( - <NoIconButton contrast={state.contrast} className={`${props.contrast}LinkColor`} - style={props.contrast === "" ? {border: "2px solid #00bcd4", borderRadius : "5px", color :"#00bcd4", backgroundColor: "white"} : {border: "1px solid white", borderRadius : "5px", color :"#00bcd4"}} - onClick={() => handleLogin(true)}>seguir</NoIconButton> - ) } </React.Fragment> ) } const NoIconButton = styled(Button)` - &:hover { - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } .MuiButton-label { - color: ${props => props.contrast === "" ? "#00bcd4 !important" : "yellow !important"}; + color : #00bcd4 !important; } - background-color: ${props => props.contrast === "" ? "#fff !important" : "black !important"}; - border: ${props => props.contrast === "" ? "solid 1px rgba(0,188,212,.85) !important" : "solid 1px white !important"}; + background-color : #fff !important; + border : solid 1px rgba(0,188,212,.85) !important; font-size : 14px !important; border-radius : 3px !important; height : 36px !important; min-width : 88px !important; vertical-align : middle !important; + text-color : #00bcd4 !important; align-items : center !important; text-align : center !important; padding : 0 6px !important; margin : 6px 8px !important; - color: ${props => props.contrast === "" ? "#00bcd4 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; ` const StyledButton = styled(Button)` - font-size : 14px important; - font-weight : 500 !important; - - .MuiSvgIcon-root { - font-size : 24px; - } - - &:hover { - color: rgb(107, 35, 142); - } + background-color : #fff !important; + border : 1px solid #00bcd4 !important; + color : #00bcd4 !important; + font-size : 14px !important; + display : inline-block !important; + position : relative !important; + cursor : pointer !important; + height : 36px !important; + min-width : 88px !important; + line-height : 36px !important; + vertical-align : middle !important; + -webkit-box-align : center !important; + -webkit-align-items : center !important; + -ms-grid-row-align : center !important; + align-items : center !important; + text-align : center !important; + border-radius : 3px !important; + -webkit-user-select : none !important; + -moz-user-select : none !important; + -ms-user-select : none !important; + user-select : none !important; + padding : 0 6px !important; margin : 6px 8px !important; + white-space : nowrap !important; + text-transform : uppercase !important; + font-weight : 500 !important; + font-style : inherit !important; + font-variant : inherit !important; + font-family : inherit !important; + text-decoration : none !important; + overflow : hidden !important; ` diff --git a/src/Components/ContactButtons/FollowersCountButton.js b/src/Components/ContactButtons/FollowersCountButton.js index f40a03370a42794245592f7f76487f5c0f2f68bc..43dfbfb8ea0b7c21f92b0f778a8b3b05b0e87eea 100644 --- a/src/Components/ContactButtons/FollowersCountButton.js +++ b/src/Components/ContactButtons/FollowersCountButton.js @@ -11,7 +11,7 @@ export default function FollowersCountButton (props) { } return ( - <FollowersButton className={`${props.contrast}BackColor ${props.contrast}Border ${props.contrast}LinkColor`}> + <FollowersButton> {FollowerButtonSpan()} </FollowersButton> ) @@ -21,6 +21,7 @@ export default function FollowersCountButton (props) { const FollowersButton = styled(Button)` right : 0 !important; text-transform : none !important; + color : #666 !important; font-size : 13px !important; font-weight : 400 !important; box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; @@ -30,5 +31,7 @@ const FollowersButton = styled(Button)` min-height : 36px !important; vertical-align : middle !important; text-align : center !important; + border : 0 !important; border-radius : 3px !important; + background-color : rgb(250,250,250) !important; ` diff --git a/src/Components/ContactButtons/FollowingButton.js b/src/Components/ContactButtons/FollowingButton.js index cee2ddda0a7deed483f47eb47e85b5bfbea5525a..87ad2cba7242c0897deccc462eff2ce1c45c8c82 100644 --- a/src/Components/ContactButtons/FollowingButton.js +++ b/src/Components/ContactButtons/FollowingButton.js @@ -16,20 +16,22 @@ 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} from 'react' import styled from 'styled-components' import Button from '@material-ui/core/Button'; -import GroupIcon from '@material-ui/icons/Group'; import ModalConfirmarUnfollow from '../ModalConfirmarUnfollow.js' -import { putRequest } from '../HelperFunctions/getAxiosConfig' +import {putRequest} from '../HelperFunctions/getAxiosConfig' -export default function FollowingButton(props) { +//Image Import +import { FollowingIcon } from "ImportImages.js"; + +export default function FollowingButton (props) { const [modalOpen, toggleModal] = useState(false) const [unfollowID, setUnfollowID] = useState(-1) const [followingHover, handleFollowingHover] = useState(false) - const toggleFollowingHover = (value) => { handleFollowingHover(value) } + const toggleFollowingHover = (value) => {handleFollowingHover(value)} const handleUnfollowPartOne = (followedID) => { setUnfollowID(followedID) @@ -37,65 +39,53 @@ export default function FollowingButton(props) { } - function handleSuccess(data) { + function handleSuccess (data) { props.toggleFollowed() toggleModal(false) } const handleUnfollowPartTwo = () => { const url = `/users/${unfollowID}/follow/` - putRequest(url, {}, handleSuccess, (error) => { console.log(error) }) + putRequest(url, {}, handleSuccess, (error) => {console.log(error)}) } return ( <React.Fragment> - <ModalConfirmarUnfollow contrast={props.contrast} open={modalOpen} - handleClose={() => { toggleModal(false) }} - handleConfirm={handleUnfollowPartTwo} + <ModalConfirmarUnfollow open={modalOpen} + handleClose={() => {toggleModal(false)}} + handleConfirm = {handleUnfollowPartTwo} /> <StyledButton - contrast={props.contrast} - className={`${props.contrast}LinkColor`} onMouseOver={() => toggleFollowingHover(true)} onMouseLeave={() => toggleFollowingHover(false)} onClick={() => handleUnfollowPartOne(props.followedID)} > { - followingHover ? - ( - [ - <div className={`${props.contrast}LinkColor`}> - DEIXAR DE SEGUIR - </div> - ] - ) - : ( - [ - <div className={`${props.contrast}LinkColor`}> - <GroupIcon - className={`${props.contrast}IconColor`} - style={{ - fontSize: "24px", - display: "inline-block", - verticalAlign: "middle", - }} - /> - SEGUINDO - </div> - ] - ) - } + followingHover? + ( + [ + <span>DEIXAR DE SEGUIR</span> + ] + ) + : ( + [ + <> + <img src={FollowingIcon} alt='ícone seguindo'/><span>Seguindo</span> + </> + ] + ) + } </StyledButton> </React.Fragment> ) } -export function NoIconFollowing(props) { +export function NoIconFollowing (props) { const [modalOpen, toggleModal] = useState(false) const [unfollowID, setUnfollowID] = useState(-1) const [followingHover, handleFollowingHover] = useState(false) - const toggleFollowingHover = (value) => { handleFollowingHover(value) } + const toggleFollowingHover = (value) => {handleFollowingHover(value)} const handleUnfollowPartOne = (followedID) => { setUnfollowID(followedID) @@ -103,41 +93,40 @@ export function NoIconFollowing(props) { } - function handleSuccess(data) { + function handleSuccess (data) { props.toggleFollowed() toggleModal(false) } const handleUnfollowPartTwo = () => { const url = `/users/${unfollowID}/follow/` - putRequest(url, {}, handleSuccess, (error) => { console.log(error) }) + putRequest(url, {}, handleSuccess, (error) => {console.log(error)}) } return ( <React.Fragment> - <ModalConfirmarUnfollow contrast={props.contrast} open={modalOpen} - handleClose={() => { toggleModal(false) }} - handleConfirm={handleUnfollowPartTwo} + <ModalConfirmarUnfollow open={modalOpen} + handleClose={() => {toggleModal(false)}} + handleConfirm = {handleUnfollowPartTwo} /> <NoIconButton - contrast={props.contrast} onMouseOver={() => toggleFollowingHover(true)} onMouseLeave={() => toggleFollowingHover(false)} onClick={() => handleUnfollowPartOne(props.followedID)} > { - followingHover ? - ( - [ - <span>DEIXAR DE SEGUIR</span> - ] - ) - : ( - [ - <span>SEGUINDO</span> - ] - ) - } + followingHover? + ( + [ + <span>DEIXAR DE SEGUIR</span> + ] + ) + : ( + [ + <span>SEGUINDO</span> + ] + ) + } </NoIconButton> </React.Fragment> ) @@ -145,38 +134,64 @@ export function NoIconFollowing(props) { export const StyledButton = styled(Button)` - border : 1px solid white !important; - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"} !important; - color: white !important; - font-size : 14px important; + background-color : #00bcd4 !important; + color : #fff !important; + display : inline-block !important; + position : relative !important; + cursor : pointer !important; + min-height : 36px !important; + min-width : 88px !important; + line-height : 36px !important; + vertical-align : middle !important; + -webkit-box-align : center !important; + -webkit-align-items : center !important; + -ms-grid-row-align : center !important; + align-items : center !important; + text-align : center !important; + border-radius : 3px !important; + -webkit-user-select : none !important; + -moz-user-select : none !important; + -ms-user-select : none !important; + user-select : none !important; + border : 0 !important; + padding : 0 6px !important; + margin : 6px 8px !important; + white-space : nowrap !important; + text-transform : uppercase !important; font-weight : 500 !important; - - .MuiSvgIcon-root { - font-size : 24px; + font-size : 14px !important; + font-style : inherit !important; + font-variant : inherit !important; + font-family : inherit !important; + text-decoration : none !important; + overflow : hidden !important; + &:hover { + background-color : #fff !important; + color : #00bcd4 !important; + border : 1px solid #00bcd4 !important; + } + img { + height : 24px; + display : inline-block; + vertical-align : middle; + color : #fff !important; } - ` const NoIconButton = styled(Button)` - &:hover { - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } .MuiButton-label { - color: ${props => props.contrast === "" ? "#00bcd4 !important" : "yellow !important"}; + color : #00bcd4 !important; } - background-color: ${props => props.contrast === "" ? "#fff !important" : "black !important"}; - border: ${props => props.contrast === "" ? "solid 1px rgba(0,188,212,.85) !important" : "solid 1px white !important"}; + background-color : #fff !important; + border : solid 1px rgba(0,188,212,.85) !important; font-size : 14px !important; border-radius : 3px !important; height : 36px !important; min-width : 88px !important; vertical-align : middle !important; + text-color : #00bcd4 !important; align-items : center !important; text-align : center !important; padding : 0 6px !important; margin : 6px 8px !important; - - span{ - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; - } ` diff --git a/src/Components/ContactCard.js b/src/Components/ContactCard.js index a854ce77a6cae3ad0ce33d0393e1fe10cf5512cf..fa51ee8d8c488679f3428d05c662d0d59d0c1597 100644 --- a/src/Components/ContactCard.js +++ b/src/Components/ContactCard.js @@ -18,7 +18,6 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React, { useState } from 'react'; import Card from '@material-ui/core/Card'; -import Grid from '@material-ui/core/Grid'; import CardContent from '@material-ui/core/CardContent'; import CardMedia from '@material-ui/core/CardMedia'; import styled from 'styled-components' @@ -37,14 +36,14 @@ export default function ImgMediaCard(props) { const toggleFollowed = () => { setFollowedBoolean(!followedBoolean) } return ( <StyledCard> - <CardDiv className={`${props.contrast}BackColor ${props.contrast}Border ${props.contrast}Text`}> + <CardDiv> <CardAreaDiv> {/*Top part of contat card (background image, number of followers and avatar)*/} <Header> <StyledCardMedia image={props.cover}> <div style={{ display: "flex", backgroundColor: "inherit", float: "right" }}> <Link to={props.href} style={{textDecoration : "none"}}> - <FollowersCountButton contrast={props.contrast} followCount={props.follow_count} /> + <FollowersCountButton followCount={props.follow_count} /> </Link> <Link to={props.href}> <AvatarDiv> @@ -57,63 +56,52 @@ export default function ImgMediaCard(props) { </Header> {/*Rest of the card content. Button to be rendered depends on whether the contact is followed by the user*/} - <CardContent style={{height: "148px", padding: "0", bottom: "0"}}> + <CardContent> <UserInfo> - <Link to={props.href} className={`${props.contrast}LinkColor`}> + <Link to={props.href}> <p className="p1"> {props.name} </p> </Link> - <Link to={props.href} className={`${props.contrast}LinkColor`}> + <Link to={props.href}> <span style={{ fontSize: "14px", fontWeight: "normal" }}> <b>{props.numCollections}</b> {props.numCollections !== 1 ? "Coleções" : "Coleção"} | <b>{props.numLearningObjects}</b> {props.numLearningObjects !== 1 ? "Recursos" : "Recurso"} </span> </Link> - </UserInfo> - </CardContent> - <CardContent style={{padding: "0"}}> - <Grid container> - <Grid item xs={2}></Grid> - { - followedBoolean ? - ( - <> - <Grid item xs={8} style={{ display: "flex", justifyContent: "center" }}> + + <div style={{ display: "flex", justifyContent: "center" }}> + { + followedBoolean ? + ( + <React.Fragment> <FollowingButton - contrast={props.contrast} followedID={props.followerID ? props.followerID : props.followedID} toggleFollowed={toggleFollowed} /> - </Grid> - <Grid item xs={2} style={{ display: "flex", justifyContent: "flex-start" }}> + <Options - contrast={props.contrast} followableID={props.followerID ? props.followerID : props.followedID} followed={followedBoolean} toggleFollowed={toggleFollowed} /> - </Grid> - </> - ) - : - ( - <> - <Grid item xs={8} style={{ display: "flex", justifyContent: "center" }}> + </React.Fragment> + ) + : + ( + <React.Fragment> <FollowButton - contrast={props.contrast} followerID={props.followedID ? props.followedID : props.followerID} toggleFollowed={toggleFollowed} /> - </Grid> - <Grid item xs={2} style={{ display: "flex", justifyContent: "flex-start" }}> + <Options - contrast={props.contrast} followableID={props.followedID ? props.followedID : props.followerID} followed={followedBoolean} toggleFollowed={toggleFollowed} /> - </Grid> - </> - ) - } - </Grid> + </React.Fragment> + ) + } + + </div> + </UserInfo> </CardContent> </CardAreaDiv> </CardDiv> @@ -137,8 +125,10 @@ export const CardAreaDiv = styled.div` margin : 0 auto; ` export const CardDiv = styled.div` + background-color : #fff; text-align : start; font-family : 'Roboto', sans serif; + color : #666; ` /*----------------------------------------------------------------------------*/ @@ -147,7 +137,7 @@ export const CardDiv = styled.div` /*Override Material UI styling -----------------------------------------------*/ const StyledCardMedia = styled(CardMedia)` height : 100%; - width : 270.5px; + width : 100%; background-size : cover; background-position : center; @@ -167,7 +157,10 @@ const StyledCard = styled(Card)` const UserInfo = styled.div` text-align : center; margin-top : 50px; + color : #666; + a { + text-decoration : none !important; color : #666; } diff --git a/src/Components/ContactCardOptions.js b/src/Components/ContactCardOptions.js index f347928a858b6e6c3ab40f365cc5c6063e1250e0..2cf3555c6ac3cae3da3cb7590ae2d149653391e4 100644 --- a/src/Components/ContactCardOptions.js +++ b/src/Components/ContactCardOptions.js @@ -73,6 +73,7 @@ export default function SimpleMenu(props) { const handleFollow = (followerID) => { putRequest(`/users/${followerID}/follow`, {}, (data) => { + console.log(data); props.toggleFollowed() }, (error) => { console.log(error) }) @@ -92,22 +93,22 @@ export default function SimpleMenu(props) { <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> </Snackbar> {/*-------------------------------MODALS---------------------------------------*/} - <LoginModal contrast={props.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} openSnackbar={() => { handleSuccessfulLogin(true) }} /> - <SignUpModal contrast={props.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> {/*----------------------------------------------------------------------------*/} <> { reportModal && - <ReportModal contrast={props.contrast} open={reportModal} handleClose={() => handleModal(false)} + <ReportModal open={reportModal} handleClose={() => handleModal(false)} form="user" complainableId={props.followableID} complainableType={"User"} {...props}/> } <div style={{fontSize: "12px", display : "flex", flexDirection : "column", justifyContent : "center"}}> - <ButtonNoWidth aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick}> - <MoreVertIcon className={`${props.contrast}LinkColor ${props.contrast}Text`} /> + <ButtonNoWidth aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick} style={{color : "#666"}}> + <MoreVertIcon style={{color : "#666"}}/> </ButtonNoWidth> <Menu id="simple-menu" @@ -115,34 +116,31 @@ export default function SimpleMenu(props) { keepMounted open={Boolean(anchorEl)} onClose={handleClose} - MenuListProps={{ - disablePadding: true - }} > - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={handleClose}> + <StyledMenuItem onClick={handleClose}> <Link to={"/usuario-publico/" + props.followableID}> - <ListItemIcon className={`${props.contrast}IconColor`}><OpenIcon /></ListItemIcon>Abrir + <ListItemIcon><OpenIcon /></ListItemIcon>Abrir </Link> </StyledMenuItem> { props.followed ? ( - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={() => {handleFollow(props.followableID)}}> - <ListItemIcon className={`${props.contrast}IconColor`}><ReportIcon /></ListItemIcon>Deixar de Seguir + <StyledMenuItem onClick={() => {handleFollow(props.followableID)}}> + <ListItemIcon><ReportIcon /></ListItemIcon>Deixar de Seguir </StyledMenuItem> ) : ( state.currentUser.id !== '' ? ( - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={() => {handleFollow(props.followableID)}}> - <ListItemIcon className={`${props.contrast}IconColor`}><PersonAddIcon /></ListItemIcon>Seguir + <StyledMenuItem onClick={() => {handleFollow(props.followableID)}}> + <ListItemIcon><PersonAddIcon /></ListItemIcon>Seguir </StyledMenuItem> ) : ( - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={() => {handleLogin(props.followableID)}}> - <ListItemIcon className={`${props.contrast}IconColor`}><PersonAddIcon /></ListItemIcon>Seguir + <StyledMenuItem onClick={() => {handleLogin(props.followableID)}}> + <ListItemIcon><PersonAddIcon /></ListItemIcon>Seguir </StyledMenuItem> ) ) @@ -150,14 +148,14 @@ export default function SimpleMenu(props) { { state.currentUser.id !== '' ? ( - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={() => {handleModal(true); handleClose()}}> - <ListItemIcon className={`${props.contrast}IconColor`}><ReportIcon /></ListItemIcon>Reportar + <StyledMenuItem onClick={() => {handleModal(true); handleClose()}}> + <ListItemIcon><ReportIcon /></ListItemIcon>Reportar </StyledMenuItem> ) : ( - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={() => {handleLogin(true)}}> - <ListItemIcon className={`${props.contrast}IconColor`}><ReportIcon /></ListItemIcon>Reportar + <StyledMenuItem onClick={() => {handleLogin(true)}}> + <ListItemIcon><ReportIcon /></ListItemIcon>Reportar </StyledMenuItem> ) } @@ -173,6 +171,8 @@ const ButtonNoWidth = styled(Button)` min-width : 24px !important; max-height : 24px !important; padding : 0 !important; + background-color : #fff !important; + color : #a5a5a5 !important; border : 0 !important; .MuiButton-root { @@ -191,11 +191,12 @@ const ButtonNoWidth = styled(Button)` ` const StyledMenuItem = styled(MenuItem)` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; + color : #666 !important; .MuiSvgIcon-root { vertical-align : middle !important; } a { - color : inherit !important; + text-decoration : none !important; + color : #666 !important; } -` \ No newline at end of file +` diff --git a/src/Components/ContactForm.js b/src/Components/ContactForm.js index e44460d3f1cf0148a2d29738dbefc15e6b715195..3eb206b99c272fd8fcf179c1808f778ecbcd3152 100644 --- a/src/Components/ContactForm.js +++ b/src/Components/ContactForm.js @@ -16,189 +16,190 @@ 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 { Store } from '../Store.js' +import React, {useState, useContext} from 'react' +import {Store} from '../Store.js' import styled from 'styled-components'; import FormInput from "../Components/FormInput.js" -import { postRequest } from './HelperFunctions/getAxiosConfig' +import {postRequest} from './HelperFunctions/getAxiosConfig' import LoginModal from './LoginModal.js' import Snackbar from '@material-ui/core/Snackbar'; import SignUpModal from './SignUpModal' import MuiAlert from '@material-ui/lab/Alert'; function Alert(props) { - return <MuiAlert elevation={6} variant="filled" {...props} />; + return <MuiAlert elevation={6} variant="filled" {...props} />; } const Button = styled.button` - background-color: ${props => props.contrast === "" ? "#00acc1" : "black"}; - color: ${props => props.contrast === "" ? "#fff" : "yellow"}; - font-family: Roboto,sans-serif; - font-size: 14px; - font-weight: 500; - height: 36px; - padding-left: 16px; - padding-right: 16px; - box-shadow: 0 2px 5px 0 rgba(0,0,0,.26); - outline: none; - position: relative; - cursor: pointer; - min-height: 36px; - min-width: 88px; - line-height: 36px; - vertical-align: middle; - align-items: center; - text-align: center; - border-radius: 3px; - box-sizing: border-box; - user-select: none; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; - padding: 0 6px; - padding-right: 6px; - padding-left: 6px; - margin: 6px 8px; - - white-space: nowrap; - text-transform: uppercase; - font-weight: 500; - font-size: 14px; - font-style: inherit; - font-variant: inherit; - font-family: inherit; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - overflow: hidden; - transition: box-shadow .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1); - :hover{ - background-color: ${props => props.contrast === "" ? "rgba(0, 172, 193, 0.65)" : "rgba(255,255,0,0.24)"}; - } + + background-color: #00acc1; + color:#fff; + font-family: Roboto,sans-serif; + font-size: 14px; + font-weight: 500; + height: 36px; + border-radius: 3px; + padding-left: 16px; + padding-right: 16px; + box-shadow: 0 2px 5px 0 rgba(0,0,0,.26); + outline: none; + position: relative; + cursor: pointer; + min-height: 36px; + min-width: 88px; + line-height: 36px; + vertical-align: middle; + align-items: center; + text-align: center; + border-radius: 3px; + box-sizing: border-box; + user-select: none; + border: 0; + padding: 0 6px; + padding-right: 6px; + padding-left: 6px; + margin: 6px 8px; + + white-space: nowrap; + text-transform: uppercase; + font-weight: 500; + font-size: 14px; + font-style: inherit; + font-variant: inherit; + font-family: inherit; + text-decoration: none; + overflow: hidden; + transition: box-shadow .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1); + ` -function validateNome(nome) { - let flag = false - if (nome.length === 0) { - flag = true - } + function validateNome (nome) { + let flag = false + if(nome.length === 0) { + flag = true + } - return flag -} + return flag + } -function validateMensagem(mensagem) { - let flag = false - if (mensagem.length === 0) { - flag = true - } + function validateMensagem (mensagem) { + let flag = false + if(mensagem.length === 0) { + flag = true + } - return flag -} + return flag + } -function validateEmail(email) { + function validateEmail (email) { let flag = false if (email.split("").filter(x => x === "@").length !== 1 || email.length < 7) { - flag = true + flag = true } return flag -} + } -function Formulario(props) { - const { state } = useContext(Store) + function Formulario (props){ + const {state} = useContext(Store) const [loginOpen, setLogin] = useState(false) const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) const [signUpOpen, setSignUp] = useState(false) - const [nome, handleNome] = useState({ - dict: { - key: false, - value: "" - } - }) - const [email, handleEmail] = useState({ - dict: { - key: false, - value: "" - } - }) - const [mensagem, handleMensagem] = useState({ - dict: { - key: false, - value: "" - } + const [nome, handleNome] = useState( + { + dict : { + key:false, + value:"" + } + }) + const [email, handleEmail] = useState( + { + dict : { + key:false, + value:"" + } }) + const [mensagem, handleMensagem] = useState( + { + dict : { + key: false, + value:"" + } + }) const preencheNome = (e) => { - const aux2 = e.target.value - const flag = validateNome(aux2) - handleNome({ - ...nome, dict: { - key: flag, - value: e.target.value - } - }) + const aux2 = e.target.value + const flag = validateNome(aux2) + handleNome({...nome, dict : { + key : flag, + value : e.target.value + }}) + console.log(nome) } const preencheEmail = (e) => { - const aux = e.target.value - const flag = validateEmail(aux) - handleEmail({ - ...email, dict: { - key: flag, - value: e.target.value - } - }) + const aux = e.target.value + const flag = validateEmail(aux) + handleEmail({...email, dict : { + key : flag, + value : e.target.value + }}) + console.log(email) } const preencheMensagem = (e) => { - const msg = e.target.value - let flag = validateMensagem(msg) - handleMensagem({ - ...mensagem, dict: { - key: flag, - value: msg - } - }) + const msg = e.target.value + console.log(msg) + let flag = validateMensagem(msg) + handleMensagem({...mensagem, dict : { + key : flag, + value : msg + }}) + console.log(mensagem) } const limpaTudo = () => { - handleNome({ - dict: { - key: false, - value: "" - } - }); - - handleEmail({ - dict: { - key: false, - value: "" - } - }) - - handleMensagem({ - dict: { - key: false, - value: "" - } - }) + handleNome({ + dict : { + key: false, + value:"" + }} + ); + + handleEmail({ + dict : { + key: false, + value:"" + }} + ) + + handleMensagem({ + dict : { + key: false, + value:"" + }} + ) } const handleSignUp = () => { - setSignUp(!signUpOpen) + setSignUp(!signUpOpen) } const handleLogin = () => { - setLogin(!loginOpen) + setLogin(!loginOpen) } const toggleSnackbar = (event, reason) => { - if (reason === 'clickaway') { - return; - } + if (reason === 'clickaway') { + return; + } handleSuccessfulLogin(false); } @@ -206,90 +207,89 @@ function Formulario(props) { const onSubmit = (e) => { //on submit we should prevent the page from refreshing e.preventDefault(); //though this is arguable + console.log(!(nome.dict.key && email.dict.key && mensagem.dict.key )) // Se não houver erro em nunhum dos campos E nenhum dos campos for vazio: a página faz o contato com o backend e os campos ficam em branco no formulário - if (!(nome.dict.key || email.dict.key || mensagem.dict.key)) { + if (!(nome.dict.key || email.dict.key || mensagem.dict.key )) { let payload = { - contact: { + contact : { name: nome.dict.value, email: email.dict.value, message: mensagem.dict.value } - } - postRequest(`/contacts`, payload, (data) => { limpaTudo() }, (error) => { console.log(error) }) + } + postRequest(`/contacts`, payload, (data) => {limpaTudo()}, (error) => {console.log(error)}) } } - return ( - <React.Fragment> - <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleSnackbar} - anchorOrigin={{ vertical: 'top', horizontal: 'center' }} - > - <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> - </Snackbar> - {/*-------------------------------MODALS---------------------------------------*/} - <LoginModal contrast={props.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} - openSnackbar={() => { handleSuccessfulLogin(true) }} - /> - <SignUpModal contrast={props.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> - {/*----------------------------------------------------------------------------*/} - <div> - <form onSubmit={e => onSubmit(e)}> - <FormInput - contrast={props.contrast} - - inputType={"text"} - name={"nome"} - value={nome.dict.value} - placeholder={"Nome *"} - error={nome.dict.key} - help={nome.dict.key ? "insira seu nome para o contato " : ""} - handleChange={e => preencheNome(e)} - /> - <br /> - <FormInput - contrast={props.contrast} - inputType={"text"} - name={"email"} - value={email.dict.value} - placeholder={"E-mail *"} - error={email.dict.key} - help={email.dict.key ? "Formato de e-mail incorreto ou vazio, tente : usuario@provedor.com" : ""} - handleChange={e => preencheEmail(e)} - /> - <br /> - <br /> - <FormInput - contrast={props.contrast} - inputType={"text"} - name={"mensagem"} - value={mensagem.dict.value} - placeholder={"Mensagem *"} - multi={true} - rows="5" - rowsMax="6" - error={mensagem.dict.key} - help={mensagem.dict.key ? "Faltou escrever sua mensagem de sugestão, crítica ou dúvida." : "Escreva sua mensagem no campo acima."} - handleChange={e => preencheMensagem(e)} - /> - <br /> - <br /> - <div style={{ display: "flex", justifyContent: "center" }}> - { - state.currentUser.id !== '' ? ( - <Button contrast={props.contrast} onClick={e => onSubmit(e)} >ENVIAR MENSAGEM</Button> - ) - : - ( - <Button contrast={props.contrast} onClick={e => { e.preventDefault(); handleLogin(true); }} >ENVIAR MENSAGEM</Button> - ) - } - </div> - </form> - </div> - </React.Fragment> + return( + <React.Fragment> + <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleSnackbar} + anchorOrigin={{ vertical: 'top', horizontal: 'center' }} + > + <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> + </Snackbar> + {/*-------------------------------MODALS---------------------------------------*/} + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + openSnackbar={() => { handleSuccessfulLogin(true) }} + /> + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> + {/*----------------------------------------------------------------------------*/} + + + <form onSubmit={e => onSubmit(e)}> + <FormInput + inputType={"text"} + name={"nome"} + value={nome.dict.value} + placeholder={"Nome *"} + error = {nome.dict.key} + help = {nome.dict.key ? "insira seu nome para o contato " : ""} + handleChange={e => preencheNome(e)} + /> + <br/> + <FormInput + inputType={"text"} + name={"email"} + value={email.dict.value} + placeholder={"E-mail *"} + error = {email.dict.key} + help = {email.dict.key ? "Formato de e-mail incorreto ou vazio, tente : usuario@provedor.com" : ""} + handleChange={e => preencheEmail(e)} + /> + <br/> + <br/> + <FormInput + inputType={"text"} + name={"mensagem"} + value={mensagem.dict.value} + placeholder={"Mensagem *"} + multi = {true} + rows = "5" + rowsMax = "6" + error = {mensagem.dict.key} + help = {mensagem.dict.key ? "Faltou escrever sua mensagem de sugestão, crítica ou dúvida." : "Escreva sua mensagem no campo acima."} + handleChange={e => preencheMensagem(e)} + /> + <br/> + <br/> + <div style={{display: "flex", justifyContent: "center"}}> + { + state.currentUser.id !== '' ? ( + <Button onClick={e => onSubmit(e)} >ENVIAR MENSAGEM</Button> + ) + : + ( + <Button onClick={e => {e.preventDefault(); handleLogin(true);}} >ENVIAR MENSAGEM</Button> + ) + } + </div> + </form> + </React.Fragment> + + ); } diff --git a/src/Components/CriarColecaoForm.js b/src/Components/CriarColecaoForm.js index f5c9b4d3b76edb5e51427a2a8edd90d42df0ae72..ea8c05070f21519b8594a13c03897d69481b2556 100644 --- a/src/Components/CriarColecaoForm.js +++ b/src/Components/CriarColecaoForm.js @@ -16,28 +16,26 @@ 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, { useContext } from 'react' -import { Store } from '../Store.js' +import React, {useContext} from 'react' +import {Store} from '../Store.js' import { Button } from '@material-ui/core'; import styled from 'styled-components' import Radio from '@material-ui/core/Radio'; import RadioGroup from '@material-ui/core/RadioGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import FormControl from '@material-ui/core/FormControl'; -import {StyledTextField, useStyles} from './ReportUserForm.js' -import { postRequest } from './HelperFunctions/getAxiosConfig' +import TextField from '@material-ui/core/TextField'; +import {postRequest} from './HelperFunctions/getAxiosConfig' -export default function CriarColecaoForm(props) { - const { state } = useContext(Store) - - const classes = useStyles(); +export default function CriarColecaoForm (props) { + const {state} = useContext(Store) const [value, setValue] = React.useState(-1); /*values are set according to backend complaint id*/ const [options] = React.useState([ - { value: "pública", text: 'Pública (Sua coleção estará disponível para todos)' }, - { value: "privada", text: 'Privada (Somente você poderá visualizar esta coleção)' } + {value : "pública", text :'Pública (Sua coleção estará disponível para todos)'}, + {value : "privada", text : 'Privada (Somente você poderá visualizar esta coleção)'} ]) const handleChange = (event) => { @@ -45,8 +43,8 @@ export default function CriarColecaoForm(props) { }; const [colName, setColName] = React.useState({ - key: false, - value: "", + key : false, + value : "", }) const handleColName = (e) => { @@ -54,14 +52,13 @@ export default function CriarColecaoForm(props) { const flag = userInput.length === 0 ? true : false - setColName({ - ...colName, - key: flag, - value: userInput + setColName({...colName, + key : flag, + value : userInput }) } - function handleSuccess(data) { + function handleSuccess (data) { props.finalize(data.id) } const formSubmit = (e) => { @@ -71,52 +68,51 @@ export default function CriarColecaoForm(props) { const finalRadioValue = value === 'pública' ? 'public' : 'private' const finalColName = colName - if (!(finalColName.key)) { + if(!(finalColName.key)) { let payload = { - "collection": { - "name": finalColName.value, - "owner_id": state.currentUser.id, - "owner_type": "User", - "privacy": finalRadioValue + "collection" : { + "name" : finalColName.value, + "owner_id" : state.currentUser.id, + "owner_type" : "User", + "privacy" : finalRadioValue } } - postRequest(`/collections/`, payload, handleSuccess, (error) => { console.log(error) }) + postRequest( `/collections/`, payload, handleSuccess, (error) =>{console.log(error)}) } } return ( - <form onSubmit={(e) => { formSubmit(e) }} style={{ textAlign: "left" }}> + <form onSubmit={(e) => {formSubmit(e)}} style={{textAlign : "left"}}> <StyledTextField - id={"col-name"} + id = {"col-name"} label={"Nome da coleção"} - type={"text"} - value={colName.value} - onChange={e => handleColName(e)} - error={colName.key} - InputProps={state.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} - contrast={state.contrast} - helperText={colName.key ? <span>O nome é importante para identificar a sua coleção na plataforma.<br />Ex: Matemática Ensino Médio </span> : ""} - required={true} - style={{ width: "100%" }} + type = {"text"} + value = {colName.value} + onChange = {e => handleColName(e)} + error = {colName.key} + + helperText = {colName.key ? <span>O nome é importante para identificar a sua coleção na plataforma.<br/>Ex: Matemática Ensino Médio </span> : ""} + required = {true} + style={{width:"100%"}} /> - <span style={{ fontSize: "12px" }}>Esta coleção é:</span> + <span style={{fontSize : "12px", color : "#b3b3b3"}}>Esta coleção é:</span> - <StyledFormControl contrast={state.contrast} component="fieldset"> + <StyledFormControl component="fieldset"> <RadioGroup value={value} onChange={handleChange}> { options.map(option => - <FormControlLabel key={option.value} value={option.value} control={<Radio color="#673ab7" />} label={option.text} /> + <FormControlLabel key={option.value} value={option.value} control={<Radio color="#673ab7"/>} label={option.text} /> ) } </RadioGroup> </StyledFormControl> <ButtonsDiv> - <ButtonCancelar contrast={state.contrast} onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonEnviar contrast={state.contrast} type="submit">CRIAR COLEÇÃO</ButtonEnviar> + <ButtonCancelar onClick={props.handleClose}>CANCELAR</ButtonCancelar> + <ButtonEnviar type="submit">CRIAR COLEÇÃO</ButtonEnviar> </ButtonsDiv> </form> ); @@ -130,21 +126,23 @@ export const ButtonsDiv = styled.div` ` export const ButtonCancelar = styled(Button)` + &:hover { + background-color : rgba(158,158,158,0.2) !important; + } height : 36px !important; padding-left : 16px !important; padding-right : 16px !important; font-weight : 500 !important; border-radius : 3px !important; - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; + color :#666 !important; background-color: transparent; min-width : 88px !important; height : 36px !important; ` export const ButtonEnviar = styled(Button)` - background-color: ${props => props.contrast === "" ? "#673ab7" : "black"} !important; - color: ${props => props.contrast === "" ? "#fff" : "yellow"} !important; + background-color : #673ab7 !important; + color : #fff !important; font-size: 14px !important; font-weight: 500 !important; height: 36px !important; @@ -156,24 +154,41 @@ export const ButtonEnviar = styled(Button)` min-width : 88px !important; vertical-align : middle !important; margin : 6px 8px !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white !important"}; + text-decoration : none !important; + .MuiButton-label { padding-right : 16px; padding-left : 16px; } ` +export const StyledTextField = styled(TextField)` + margin : 18px 0 !important; + .MuiFormHelperText-root { + text-align : right; + } + + label.Mui-focused { + color : #673ab7; + } + + label.Mui-focused.Mui-error { + color : red; + } + + .MuiInput-underline::after { + border-bottom: 2px solid #673ab7; + } +` export const StyledFormControl = styled(FormControl)` display : block !important; .MuiFormControlLabel-root { - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color : #666; } .MuiIconButton-label { - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; } .PrivateRadioButtonIcon-checked { color : orange; diff --git a/src/Components/CriarColecaoModal.js b/src/Components/CriarColecaoModal.js index 82b6749bfe5f099c1671972c8b330b9d7614863e..73e7384fc040f415e947113c26b9ff56544f3d7f 100644 --- a/src/Components/CriarColecaoModal.js +++ b/src/Components/CriarColecaoModal.js @@ -25,21 +25,22 @@ import styled from 'styled-components' import CriarColecaoForm from './CriarColecaoForm.js' import CloseIcon from '@material-ui/icons/Close'; -function CloseModalButton(props) { +function CloseModalButton (props) { return ( <StyledCloseModalButton onClick={props.handleClose}> - <CloseIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }} /> + <CloseIcon/> </StyledCloseModalButton> ) } -export default function CriarColecaoModal(props) { +export default function CriarColecaoModal (props) { return ( <StyledModal aria-labelledby="transition-modal-title" aria-describedby="transition-modal-description" open={props.open} + centered="true" onClose={props.handleClose} closeAfterTransition @@ -49,14 +50,14 @@ export default function CriarColecaoModal(props) { }} > <Fade in={props.open}> - <Container contrast={props.contrast}> - <Header contrast={props.contrast}> - <span style={{ width: "32px" }} /> + <Container> + <Header> + <span style={{width:"32px"}}/> <h2>Criar Coleção</h2> - <CloseModalButton handleClose={props.handleClose} contrast={props.contrast} /> + <CloseModalButton handleClose={props.handleClose}/> </Header> - <Content style={{ paddingTop: "0" }}> - <CriarColecaoForm handleClose={props.handleClose} finalize={props.handleClose} /> + <Content style={{paddingTop : "0"}}> + <CriarColecaoForm handleClose={props.handleClose} finalize={props.handleClose}/> </Content> </Container> </Fade> @@ -81,13 +82,14 @@ const Header = styled.div` h2 { font-size : 26px; font-weight : lighter; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666 } ` const StyledCloseModalButton = styled(Button)` display : inline-block; position : relative; + float : right !important; margin-right : -8px !important; background : transparent !important; min-width: 0 !important; @@ -110,9 +112,8 @@ const StyledModal = styled(Modal)` const Container = styled.div` box-sizing : border-box; box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12); - background-color: ${props => props.contrast === "" ? "white" : "black"}; - border: ${props => props.contrast === "" ? "" : "1px solid white"}; - align-items : center; + background-color : white; + align : center; display : flex; flex-direction : column; min-width : 240px; diff --git a/src/Components/Cropper.js b/src/Components/Cropper.js index 277b5c314e0d397218c7290f97a10032298b9ffd..ccccc4c2e57ca23d7b7de6500c630cf052a0a847 100644 --- a/src/Components/Cropper.js +++ b/src/Components/Cropper.js @@ -20,92 +20,97 @@ import React, { PureComponent } from 'react'; import ReactCrop from 'react-image-crop'; import 'react-image-crop/dist/ReactCrop.css'; + export default class Cropper extends PureComponent { - state = { - src: this.props.src, - crop:this.props.crop - }; - - // If you setState the crop in here you should return false. - onImageLoaded = image => { - this.imageRef = image; - }; - - onCropComplete = crop => { - this.makeClientCrop(crop); - }; - - onCropChange = (crop, percentCrop) => { - // You could also use percentCrop: - // this.setState({ crop: percentCrop }); - this.setState({ crop }); - }; - - async makeClientCrop(crop) { - if (this.imageRef && crop.width && crop.height) { - // eslint-disable-next-line - const croppedImageUrl = await this.getCroppedImg( - this.imageRef, - crop, - 'newFile.jpeg' - ); - } - } + state = { + src: this.props.src, + crop:this.props.crop + }; - getCroppedImg(image, crop, fileName) { - const canvas = document.createElement('canvas'); - const scaleX = image.naturalWidth / image.width; - const scaleY = image.naturalHeight / image.height; - canvas.width = crop.width; - canvas.height = crop.height; - const ctx = canvas.getContext('2d'); - - ctx.drawImage( - image, - crop.x * scaleX, - crop.y * scaleY, - crop.width * scaleX, - crop.height * scaleY, - 0, - 0, - crop.width, - crop.height - ); - const reader = new FileReader(); - canvas.toBlob(blob => { - reader.readAsDataURL(blob) - reader.onloadend = () => { - // {/*this.dataURLtoFile(reader.result, 'cropped.jpg')*/} - this.props.update(reader.result) - } - }) - } + // If you setState the crop in here you should return false. + onImageLoaded = image => { + this.imageRef = image; + }; + + onCropComplete = crop => { + this.makeClientCrop(crop); + }; + + onCropChange = (crop, percentCrop) => { + // You could also use percentCrop: + // this.setState({ crop: percentCrop }); + this.setState({ crop }); + }; + + async makeClientCrop(crop) { + if (this.imageRef && crop.width && crop.height) { + // eslint-disable-next-line + const croppedImageUrl = await this.getCroppedImg( + this.imageRef, + crop, + 'newFile.jpeg' + ); + - render() { - // eslint-disable-next-line - const { crop, croppedImageUrl, src } = this.state; - - return ( - <> - {src && ( - <ReactCrop - src={src} - crop={crop} - circularCrop={this.props.circularCrop} - onImageLoaded={this.onImageLoaded} - onComplete={this.onCropComplete} - onChange={this.onCropChange} - style={{maxHeight : "100%", maxWidth : "100%"}} - imageStyle={{maxHeight : "100%", maxWidth : "100%"}} - /> - )} - {/*croppedImageUrl && ( - <img alt="Crop" style={{ maxWidth: '100%', maxHeight : "100%"}} src={croppedImageUrl} /> - )*/} - </> - ); } + } + + + + getCroppedImg(image, crop, fileName) { + const canvas = document.createElement('canvas'); + const scaleX = image.naturalWidth / image.width; + const scaleY = image.naturalHeight / image.height; + canvas.width = crop.width; + canvas.height = crop.height; + const ctx = canvas.getContext('2d'); + + ctx.drawImage( + image, + crop.x * scaleX, + crop.y * scaleY, + crop.width * scaleX, + crop.height * scaleY, + 0, + 0, + crop.width, + crop.height + ); + const reader = new FileReader(); + canvas.toBlob(blob => { + reader.readAsDataURL(blob) + reader.onloadend = () => { + // {/*this.dataURLtoFile(reader.result, 'cropped.jpg')*/} + this.props.update(reader.result) + } + }) + + } + + render() { + // eslint-disable-next-line + const { crop, croppedImageUrl, src } = this.state; + + return ( + <> + {src && ( + <ReactCrop + src={src} + crop={crop} + circularCrop={this.props.circularCrop} + onImageLoaded={this.onImageLoaded} + onComplete={this.onCropComplete} + onChange={this.onCropChange} + style={{maxHeight : "300px", maxWidth : "100%"}} + /> + )} + {/*croppedImageUrl && ( + <img alt="Crop" style={{ maxWidth: '100%', maxHeight : "100%"}} src={croppedImageUrl} /> + )*/} + </> + ); + } } diff --git a/src/Components/Dropdown.js b/src/Components/Dropdown.js index ea1a161b44693fb58f1ac6e9e46062ad81224b41..cc064489e05b8550c0b787fc7b15a13fa156a758 100644 --- a/src/Components/Dropdown.js +++ b/src/Components/Dropdown.js @@ -28,72 +28,71 @@ import { Store } from '../Store'; import { HashLink as Link } from 'react-router-hash-link'; const useStyles = makeStyles((theme) => ({ - typography: { - padding: theme.spacing(2), - }, + typography: { + padding: theme.spacing(2), + }, })); export default function PositionedPopper(props) { - const [anchorEl, setAnchorEl] = React.useState(null); - const [open, setOpen] = React.useState(false); - //const [placement, setPlacement] = React.useState(); - const classes = useStyles(); - const { state, dispatch } = React.useContext(Store) - const innerDropdown = React.useRef(null) + const [anchorEl, setAnchorEl] = React.useState(null); + const [open, setOpen] = React.useState(false); + const [placement, setPlacement] = React.useState(); + const classes = useStyles(); + const { state, dispatch } = React.useContext(Store) + const innerDropdown = React.useRef(null) - const handleClick = (newPlacement) => (event) => { - if (state.searchOpen) - dispatch({ - type: 'HANDLE_SEARCH_BAR', - opened: false - }) - setAnchorEl(event.currentTarget); - setOpen(!open); - //setPlacement(newPlacement); - }; + const handleClick = (newPlacement) => (event) => { + if (state.searchOpen) + dispatch({ + type: 'HANDLE_SEARCH_BAR', + opened: false + }) + setAnchorEl(event.currentTarget); + setOpen((prev) => placement !== newPlacement || !prev); + setPlacement(newPlacement); + }; - const handleItemClicked = () => { - setOpen(false) - } + const handleItemClicked = () => { + setOpen(false) + } - useEffect(() => { - const handleClickOutside = (event) => { - innerDropdown.current && !innerDropdown.current.contains(event.target) && setOpen(false) - } + useEffect(() => { + const handleClickOutside = (event) => { + innerDropdown.current && !innerDropdown.current.contains(event.target) && setOpen(false) + } - document.addEventListener('mousedown', handleClickOutside) + document.addEventListener('mousedown', handleClickOutside) - return () => document.removeEventListener('mousedown', handleClickOutside) + return () => document.removeEventListener('mousedown', handleClickOutside) - }, []) + }, []) - return ( - <div className={classes.root}> - <Popper open={open} anchorEl={anchorEl} placement="bottom" transition ref={innerDropdown}> - {({ TransitionProps }) => ( - <Fade {...TransitionProps} timeout={350}> - <Paper> - <MenuList className={`${state.contrast}BackColor`}> - { - props.items.map((item) => - <Link onClick={handleItemClicked} className={`${state.contrast}LinkColor`} style={{ textDecoration: "none", color: "black" }} key={`${item.name}_${new Date().toString()}`} to={item.href} ><MenuItem>{item.name}</MenuItem></Link> - ) - } - </MenuList> - </Paper> - </Fade> - )} - </Popper> - <Button - className={`${state.contrast}LinkColor`} - style={{ textTransform: "none" }} - aria-controls="menu-list-grow" - aria-haspopup="true" - onClick={handleClick('bottom')} - > - {props.name} - <ExpandMoreIcon className={`${state.contrast}IconColor`}/> - </Button> - </div> - ); + return ( + <div className={classes.root}> + <Popper open={open} anchorEl={anchorEl} placement="bottom" transition ref={innerDropdown}> + {({ TransitionProps }) => ( + <Fade {...TransitionProps} timeout={350}> + <Paper> + <MenuList> + { + props.items.map((item) => + <Link onClick={handleItemClicked} style={{ textDecoration: "none", color: "black" }} key={`${item.name}_${new Date().toString()}`} to={item.href} ><MenuItem>{item.name}</MenuItem></Link> + ) + } + </MenuList> + </Paper> + </Fade> + )} + </Popper> + <Button + style={{ textTransform: "none", fontSize: "14px" }} + aria-controls="menu-list-grow" + aria-haspopup="true" + onClick={handleClick('bottom')} + > + {props.name} + <ExpandMoreIcon /> + </Button> + </div> + ); } \ No newline at end of file diff --git a/src/Components/EcFooter.js b/src/Components/EcFooter.js index f0abfb6ed154f360c801fe3e61a5679bb29fe4e6..2b23f622c8514df9d387e9818d03128fc0c3f180 100644 --- a/src/Components/EcFooter.js +++ b/src/Components/EcFooter.js @@ -25,10 +25,8 @@ import { HashLink as Link } from 'react-router-hash-link'; import { eduConectada } from "ImportImages.js"; const BlueFooter = styled.div` - border-top: ${props => props.contrast === '' ? "none" : "1px solid white"}; - border-bottom: ${props => props.contrast === '' ? "none" : "1px solid white"}; - background-color: ${props => props.contrast === '' ? "#00bcd4" : "black"}; - color: white; + background-color : #00bcd4; + color : white; display : block; padding-top : 2em; @media screen and (min-width : 502px) { @@ -44,33 +42,33 @@ const listStyle = { lineHeight: "1.6", } const WhiteLink = styled(Link)` - text-decoration: ${props => props.contrast === '' ? "none" : "underline"};; - color: ${props => props.contrast === '' ? "white" : "yellow"}; + text-decoration: none; + color: white; ` class EcFooter extends Component { render() { return ( - <BlueFooter contrast={this.props.contrast}> + <BlueFooter> <Container> <Row> <Col md={4} sm={6} xs={6} style={window.innerWidth < 502 && { textAlign: "center" }}> <h4>Sobre</h4> <ul style={listStyle}> - <li> <WhiteLink contrast={this.props.contrast} to="/sobre">Sobre a Plataforma</WhiteLink> </li> - <li> <WhiteLink contrast={this.props.contrast} to="/sobre#portaisparceiros">Portais Parceiros</WhiteLink> </li> - <li> <WhiteLink contrast={this.props.contrast} to="/termos">Termos de Uso</WhiteLink> </li> - <li> <WhiteLink contrast={this.props.contrast} to="/contato">Contato</WhiteLink> </li> + <li> <WhiteLink to="/sobre">Sobre a Plataforma</WhiteLink> </li> + <li> <WhiteLink to="/sobre#portaisparceiros">Portais Parceiros</WhiteLink> </li> + <li> <WhiteLink to="/termos">Termos de Uso</WhiteLink> </li> + <li> <WhiteLink to="/contato">Contato</WhiteLink> </li> </ul> </Col> <Col md={4} sm={6} xs={6} style={window.innerWidth < 502 && { textAlign: "center" }}> <h4>Ajuda</h4> <ul style={listStyle}> - <li> <WhiteLink contrast={this.props.contrast} to="/ajuda">Central de Ajuda</WhiteLink> </li> - <li> <WhiteLink contrast={this.props.contrast} to="/publicando-recurso">Publicando Recursos</WhiteLink> </li> - <li> <WhiteLink contrast={this.props.contrast} to="/encontrando-recurso">Encontrando Recursos</WhiteLink> </li> - <li> <WhiteLink contrast={this.props.contrast} to="/participando-da-rede">Participando da Rede</WhiteLink> </li> - <li> <WhiteLink contrast={this.props.contrast} to="/gerenciando-conta">Gerenciando a Conta</WhiteLink> </li> + <li> <WhiteLink to="/ajuda">Central de Ajuda</WhiteLink> </li> + <li> <WhiteLink to="/publicando-recurso">Publicando Recursos</WhiteLink> </li> + <li> <WhiteLink to="/encontrando-recurso">Encontrando Recursos</WhiteLink> </li> + <li> <WhiteLink to="/participando-da-rede">Participando da Rede</WhiteLink> </li> + <li> <WhiteLink to="/gerenciando-conta">Gerenciando a Conta</WhiteLink> </li> </ul> </Col> <Col md={4} sm={12} xs={12} style={window.innerWidth < 502 && { textAlign: "center" }}> diff --git a/src/Components/EditarColecaoForm.js b/src/Components/EditarColecaoForm.js index 67b1e4d90587164a5093dde377181aa3b76fc764..f0ea1fdc47f91ce1c68b2a70d2684ad0443707ee 100644 --- a/src/Components/EditarColecaoForm.js +++ b/src/Components/EditarColecaoForm.js @@ -24,14 +24,12 @@ import Radio from '@material-ui/core/Radio'; import RadioGroup from '@material-ui/core/RadioGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import FormControl from '@material-ui/core/FormControl'; -import {StyledTextField, useStyles} from './ReportUserForm.js' +import TextField from '@material-ui/core/TextField'; import {getRequest, putRequest} from './HelperFunctions/getAxiosConfig' export default function EditarColecaoForm (props) { const {state} = useContext(Store) - const classes = useStyles(); - function handleSuccessfulGet (data) { setColName({key : false, value : data.name}) setValue( data.privacy === 'public' ? 'pública' : 'privada') @@ -101,37 +99,33 @@ export default function EditarColecaoForm (props) { <form onSubmit={(e) => {formSubmit(e)}} style={{textAlign : "left"}}> <StyledTextField - contrast={props.contrast} id = {"col-name"} label={"Nome"} type = {"text"} value = {colName.value} onChange = {e => handleColName(e)} error = {colName.key} - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} required = {true} style={{width:"100%"}} /> <StyledTextField - contrast={props.contrast} id = {"col-description"} label={"Descrição"} type = {"text"} value = {colDescription} multiline - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} rows={5} onChange = {e => setColDescription(e)} style={{width:"100%"}} /> - <span style={{fontSize : "12px"}}>Esta coleção é:</span> - <StyledFormControl contrast={props.contrast} component="fieldset"> + <span style={{fontSize : "12px", color : "#b3b3b3"}}>Esta coleção é:</span> + <StyledFormControl component="fieldset"> <RadioGroup value={value} onChange={handleChange}> { options.map(option => - <FormControlLabel key={option.value} value={option.value} control={<Radio/>} label={option.text} /> + <FormControlLabel key={option.value} value={option.value} control={<Radio color="#673ab7"/>} label={option.text} /> ) } </RadioGroup> @@ -139,8 +133,8 @@ export default function EditarColecaoForm (props) { <ButtonsDiv> - <ButtonCancelar contrast={props.contrast} onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonEnviar contrast={props.contrast} type="submit">SALVAR</ButtonEnviar> + <ButtonCancelar onClick={props.handleClose}>CANCELAR</ButtonCancelar> + <ButtonEnviar type="submit">SALVAR</ButtonEnviar> </ButtonsDiv> </form> ); @@ -154,23 +148,23 @@ export const ButtonsDiv = styled.div` ` export const ButtonCancelar = styled(Button)` - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; + &:hover { + background-color : rgba(158,158,158,0.2) !important; + } height : 36px !important; padding-left : 16px !important; padding-right : 16px !important; font-weight : 500 !important; border-radius : 3px !important; + color :#666 !important; background-color: transparent; min-width : 88px !important; height : 36px !important; ` export const ButtonEnviar = styled(Button)` - color: ${props => props.contrast === "" ? "white" : "yellow"} !important; - background-color: ${props => props.contrast === "" ? "#673ab7" : "black"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - border: ${props => props.contrast === "" ? "none" : "1px solid white"} !important; + background-color : #673ab7 !important; + color : #fff !important; font-size: 14px !important; font-weight: 500 !important; height: 36px !important; @@ -182,23 +176,42 @@ export const ButtonEnviar = styled(Button)` min-width : 88px !important; vertical-align : middle !important; margin : 6px 8px !important; + text-decoration : none !important; .MuiButton-label { padding-right : 16px; padding-left : 16px; } ` +export const StyledTextField = styled(TextField)` + margin : 18px 0 !important; + + .MuiFormHelperText-root { + text-align : right; + } + + label.Mui-focused { + color : #673ab7; + } + + label.Mui-focused.Mui-error { + color : red; + } + + .MuiInput-underline::after { + border-bottom: 2px solid #673ab7; + } +` export const StyledFormControl = styled(FormControl)` + display : block !important; + .MuiFormControlLabel-root { - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color : #666; } .MuiIconButton-label { - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; } - display : block !important; - .PrivateRadioButtonIcon-checked { color : orange; } diff --git a/src/Components/ExpandedMaterials.js b/src/Components/ExpandedMaterials.js index 767f0a0fccbf7889e09625d25e6575175b0a9a3e..603ec4ed4f8053d3c72d8ed36527fec9cb221bc9 100644 --- a/src/Components/ExpandedMaterials.js +++ b/src/Components/ExpandedMaterials.js @@ -24,7 +24,7 @@ const ExpandedMaterial = (props) => { const classes = useStyles(); return ( - <Paper className={`${props.contrast}Border`} elevation={3} style={props.contrast === "" ? { backgroundColor: "#444444", padding: "20px" } : { backgroundColor: "black", padding: "20px" }}> + <Paper elevation={3} style={{ backgroundColor: "#444444", padding: "20px" }}> <Grid container direction="row" spacing={2}> <Grid item direction="column" xs={12} md={4}> <Grid item> @@ -40,7 +40,7 @@ const ExpandedMaterial = (props) => { { material.tags.map((tag, index) => { return ( - <Chip className={`${props.contrast}Text ${props.contrast}BackColor`} label={tag.name} key={index} style={props.contrast === "" ? { padding: "0.5px" } : {border: "1px solid white"}} /> + <Chip color="default" label={tag.name} key={index} style={{ padding: "0.5px" }} /> ) }) } @@ -55,7 +55,7 @@ const ExpandedMaterial = (props) => { </DevelopedByDiv> <SizedHeightBox3 /> <StyledLink to={`/colecao?colecao=${material.id}`}> - <Button className={`${props.contrast}LinkColor ContrastText`} variant="contained" style={props.contrast === "" ? { background: "#e8224f" } : { background: "black" }}> + <Button variant="contained" color="secondary"> Ver todos </Button> </StyledLink> @@ -73,21 +73,18 @@ const ExpandedMaterial = (props) => { <Grid container direction="row" justify="center" alignItems="center" spacing={3}> <Grid item md={4}> <TopicCard - contrast={props.contrast} topic={material.topics[0]} colecao_id={material.id} /> </Grid> <Grid item md={4}> <TopicCard - contrast={props.contrast} topic={material.topics[1]} colecao_id={material.id} /> </Grid> <Grid item md={4}> <TopicCard - contrast={props.contrast} topic={material.topics[2]} colecao_id={material.id} /> diff --git a/src/Components/ExpansionPanels.js b/src/Components/ExpansionPanels.js index 4582b138e81ed850528c468c181d77c267d1a3a1..017816eb2c4160545b7b9597c206a28eec9b3b1d 100644 --- a/src/Components/ExpansionPanels.js +++ b/src/Components/ExpansionPanels.js @@ -37,8 +37,10 @@ const ExpansionPanelTeste = styled(ExpansionPanel)` ` const ExpansionPanelSummaryColorido = styled(ExpansionPanelSummary)` - background-color: ${props => props.contrast === "" ? "#e5e5e5 !important" : "black !important"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white !important"}; + + + background-color:#e5e5e5 !important; + .MuiExpansionPanel-root { background-color: #00BCD4 !important; } @@ -46,46 +48,46 @@ const ExpansionPanelSummaryColorido = styled(ExpansionPanelSummary)` ` const ExpansionPanelDetailsColorido = styled(ExpansionPanelDetails)` - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; + + background-color: #fff; font-size: 15px; - p{ - color: ${props => props.contrast === "" ? "" : "white"}; - } ` const TypographyColorido = styled(Typography)` - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666 !important; font-size: 16px !important; font-weight: 400 !important; ` const AColorido = styled.a` - color: ${props => props.contrast === "" ? "#00BCD4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color: #00BCD4; + text-decoration:none; + ` -export default function SimpleExpansionPanel({ contrast }) { +export default function SimpleExpansionPanel() { + + return ( <div > <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon/>} aria-controls="panel1a-content" id="panel1a-header" > - <TypographyColorido contrast={contrast} >1. Características da <strong>Plataforma Integrada de RED do MEC</strong></TypographyColorido> + <TypographyColorido >1. Características da <strong>Plataforma Integrada de RED do MEC</strong></TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast} > + <ExpansionPanelDetailsColorido > <Grid container spacing={3}> <Grid item xs={12} md={7}> <div> <p>A <strong>Plataforma Integrada de RED do MEC</strong> é um é sítio (website) em formato de plataforma - interativa colaborativa para propiciar a formação de uma rede de pessoas interessadas em usar, criar e compartilhar recursos e materiais educacionais. Seu objetivo é reunir e disponibilizar conteúdos do acervo do MEC, antes distribuídos em diferentes portais (Portal do Professor, Banco Internacional de Objetos Educacionais, Domínio Público e TV Escola), conteúdo de organizações parceiras, bem como fomentar espaços de participação, criação e compartilhamento de conhecimento entre usuários para temas relacionados à educação básica brasileira. A <strong>Plataforma Integrada de RED do MEC</strong> foi criada em software livre, cujas informações para desenvolvedores estão disponíveis em <AColorido contrast={contrast} href="https://gitlab.c3sl.ufpr.br/portalmec" target="_blank">gitlab.c3sl.ufpr.br/portalmec</AColorido>.</p> + interativa colaborativa para propiciar a formação de uma rede de pessoas interessadas em usar, criar e compartilhar recursos e materiais educacionais. Seu objetivo é reunir e disponibilizar conteúdos do acervo do MEC, antes distribuídos em diferentes portais (Portal do Professor, Banco Internacional de Objetos Educacionais, Domínio Público e TV Escola), conteúdo de organizações parceiras, bem como fomentar espaços de participação, criação e compartilhamento de conhecimento entre usuários para temas relacionados à educação básica brasileira. A <strong>Plataforma Integrada de RED do MEC</strong> foi criada em software livre, cujas informações para desenvolvedores estão disponíveis em <AColorido href="https://gitlab.c3sl.ufpr.br/portalmec" target="_blank">gitlab.c3sl.ufpr.br/portalmec</AColorido>.</p> <p>A <strong>Plataforma Integrada de RED do MEC</strong> funciona ao mesmo tempo como repositório e referatório:</p> <ul> <li> @@ -97,12 +99,12 @@ export default function SimpleExpansionPanel({ contrast }) { </ul> <p>No que se refere ao Repositório, a <strong>Plataforma Integrada de RED do MEC</strong> disponibiliza recursos educacionais digitais e materiais de formação de seu acervo e também permite que usuários (pessoas físicas) depositem (publiquem, façam upload) seus recursos e materiais para serem armazenados, desde que façam seu cadastro, disponibilizem as informações necessárias no momento da publicação e respeitem as regras estabelecidas neste Termo.</p> <p>Os usuários terão acesso a uma variedade de recursos on-line. Para além, mediante cadastro, terão a sua disposição um maior número de funcionalidades, incluindo ferramentas de comunicação e interação, mecanismos de consulta, poderão fazer upload e download de recursos educacionais digitais. Poderão utilizar serviços relacionados à criação, à consulta e ao acompanhamento de coleções de recursos educacionais digitais de outros usuários, dentre outras funcionalidades. Professores cadastrados e identificados poderão ainda fazer upload de RED.</p> - <p>No que se refere ao Referatório, a <strong>Plataforma Integrada de RED do MEC</strong> indica e organiza links externos para recursos e materiais de terceiros. Os recursos serão disponibilizados mediante a adesão aos critérios específicos levantados pelo MEC. Para mais informações, utilize a página de <AColorido contrast={contrast} href="contato">Contato</AColorido> da plataforma.</p> + <p>No que se refere ao Referatório, a <strong>Plataforma Integrada de RED do MEC</strong> indica e organiza links externos para recursos e materiais de terceiros. Os recursos serão disponibilizados mediante a adesão aos critérios específicos levantados pelo MEC. Para mais informações, utilize a página de <AColorido href="contato">Contato</AColorido> da plataforma.</p> </div> </Grid> - <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={1}></Grid> <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> <p>BASICAMENTE,</p> <p>A Plataforma MEC RED reúne e disponibiliza conteúdos do acervo do MEC que antes estavam distribuídos em diferentes portais.</p> <p>Esses conteúdos podem estar armazenados na própria Plataforma, ou podem estar em sites externos, sendo indicados pela Plataforma e acessados por meio dela. </p> @@ -114,223 +116,217 @@ export default function SimpleExpansionPanel({ contrast }) { </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel2a-content" id="panel2a-header" > - <TypographyColorido contrast={contrast}>2. Cadastro e segurança</TypographyColorido> + <TypographyColorido >2. Cadastro e segurança</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div> - <p>A realização de cadastro pode ser exigida como condição para a utilização de determinados ambientes, recursos ou ferramentas. O cadastramento de um usuário só será finalizado ao serem preenchidos todos os campos indicados como obrigatórios. Para o registro de sua conta, o usuário deverá indicar uma senha e uma identificação, tornando-se responsável por mantê-las em sigilo, assumindo a total responsabilidade pelas atividades que se realizam por meio dela. O usuário compromete-se igualmente em sair ("deslogar") de sua conta ao final de cada sessão.</p> - <p>Além das informações básicas, aos professores que quiserem ter a sua identidade verificada - o que o permitirá depositar recursos na plataforma (fazer upload) - será necessário identificar a escola da rede em que atua. A mesma informação será verificada a partir dos dados do Censo Escolar.</p> - <p>A <strong>Plataforma Integrada de RED do MEC</strong> não se responsabiliza pelas informações inseridas por seus usuários. Os usuários garantem e respondem, em qualquer caso, pela veracidade, exatidão e autenticidade dos dados pessoais cadastrados. A <strong>Plataforma Integrada de RED do MEC</strong> se reserva o direito de conferir a identificação de seus usuários, bem como de solicitar dados adicionais e documentos que julgue pertinentes, a fim de verificar os dados pessoais informados caso julgue necessário.</p> - <p>Para acessar sua conta, o usuário deverá identificar-se por meio de e-mail e senha. O usuário compromete-se a não informar a terceiros sua senha, responsabilizando-se integral e exclusivamente pelo uso que dela seja feito e pelas operações efetuadas em sua conta.</p> - <p>O usuário compromete-se a notificar a <strong>Plataforma Integrada de RED do MEC</strong>, por meio da funcionalidade “Contato”, sobre qualquer uso não autorizado de sua conta, assim como sobre o seu acesso por terceiros não autorizados.</p> - <p>Contas de usuários com informações consideradas inadequadas pela <strong>Plataforma Integrada de RED do MEC</strong>, conforme as cláusulas destes Termos de Uso, poderão ser desativadas, removidas ou ter seu conteúdo bloqueado por decisão do Ministério da Educação. O usuário será notificado através do seu e-mail de cadastro.</p> - <p>A criação de conta ou a disponibilização de conteúdo na <strong>Plataforma Integrada de RED do MEC</strong> não geram nenhum direito de suporte técnico ou de indenização por dificuldades técnicas ou falhas nos sistemas. O cancelamento, a suspensão, a perda de dados armazenados, a indisponibilidade ou outra situação adversa que afete o acesso, os dados ou o conteúdo do usuário não ensejarão qualquer tipo de reparação, compensação ou outra obrigação.</p> - <p>A <strong>Plataforma Integrada de RED do MEC</strong> não se responsabiliza por qualquer dano, prejuízo ou perda no equipamento do usuário causado por falhas no sistema, no servidor ou na internet decorrentes de condutas de terceiros, de vírus por acesso, da utilização ou navegação na internet ou da transferência de dados.</p> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE,</p> - <p>Para utilizar determinados recursos e ferramentas, o usuário precisa efetuar o cadastro no sistema, informando um e-mail válido e cadastrando uma senha.</p> - <p>O usuário é o único responsável pelas informações que fornece. E a Plataforma MEC RED se reserva o direito de conferir a veracidade desses dados, caso julgue necessário.</p> - <p>Se houver qualquer tipo de acesso e uso não autorizado em sua conta, o usuário compromete-se a notificar a Plataforma por meio da funcionalidade “Reportar”.</p> - <p>A criação de conta não gera direito à suporte técnico ou indenização por dificuldades técnicas ou falhas no sistema.</p> - </div> - </Grid> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div> + <p>A realização de cadastro pode ser exigida como condição para a utilização de determinados ambientes, recursos ou ferramentas. O cadastramento de um usuário só será finalizado ao serem preenchidos todos os campos indicados como obrigatórios. Para o registro de sua conta, o usuário deverá indicar uma senha e uma identificação, tornando-se responsável por mantê-las em sigilo, assumindo a total responsabilidade pelas atividades que se realizam por meio dela. O usuário compromete-se igualmente em sair ("deslogar") de sua conta ao final de cada sessão.</p> + <p>Além das informações básicas, aos professores que quiserem ter a sua identidade verificada - o que o permitirá depositar recursos na plataforma (fazer upload) - será necessário identificar a escola da rede em que atua. A mesma informação será verificada a partir dos dados do Censo Escolar.</p> + <p>A <strong>Plataforma Integrada de RED do MEC</strong> não se responsabiliza pelas informações inseridas por seus usuários. Os usuários garantem e respondem, em qualquer caso, pela veracidade, exatidão e autenticidade dos dados pessoais cadastrados. A <strong>Plataforma Integrada de RED do MEC</strong> se reserva o direito de conferir a identificação de seus usuários, bem como de solicitar dados adicionais e documentos que julgue pertinentes, a fim de verificar os dados pessoais informados caso julgue necessário.</p> + <p>Para acessar sua conta, o usuário deverá identificar-se por meio de e-mail e senha. O usuário compromete-se a não informar a terceiros sua senha, responsabilizando-se integral e exclusivamente pelo uso que dela seja feito e pelas operações efetuadas em sua conta.</p> + <p>O usuário compromete-se a notificar a <strong>Plataforma Integrada de RED do MEC</strong>, por meio da funcionalidade “Contato”, sobre qualquer uso não autorizado de sua conta, assim como sobre o seu acesso por terceiros não autorizados.</p> + <p>Contas de usuários com informações consideradas inadequadas pela <strong>Plataforma Integrada de RED do MEC</strong>, conforme as cláusulas destes Termos de Uso, poderão ser desativadas, removidas ou ter seu conteúdo bloqueado por decisão do Ministério da Educação. O usuário será notificado através do seu e-mail de cadastro.</p> + <p>A criação de conta ou a disponibilização de conteúdo na <strong>Plataforma Integrada de RED do MEC</strong> não geram nenhum direito de suporte técnico ou de indenização por dificuldades técnicas ou falhas nos sistemas. O cancelamento, a suspensão, a perda de dados armazenados, a indisponibilidade ou outra situação adversa que afete o acesso, os dados ou o conteúdo do usuário não ensejarão qualquer tipo de reparação, compensação ou outra obrigação.</p> + <p>A <strong>Plataforma Integrada de RED do MEC</strong> não se responsabiliza por qualquer dano, prejuízo ou perda no equipamento do usuário causado por falhas no sistema, no servidor ou na internet decorrentes de condutas de terceiros, de vírus por acesso, da utilização ou navegação na internet ou da transferência de dados.</p> + </div> </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE,</p> + <p>Para utilizar determinados recursos e ferramentas, o usuário precisa efetuar o cadastro no sistema, informando um e-mail válido e cadastrando uma senha.</p> + <p>O usuário é o único responsável pelas informações que fornece. E a Plataforma MEC RED se reserva o direito de conferir a veracidade desses dados, caso julgue necessário.</p> + <p>Se houver qualquer tipo de acesso e uso não autorizado em sua conta, o usuário compromete-se a notificar a Plataforma por meio da funcionalidade “Reportar”.</p> + <p>A criação de conta não gera direito à suporte técnico ou indenização por dificuldades técnicas ou falhas no sistema.</p> + </div> + </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel3a-content" id="panel3a-header" > - <TypographyColorido contrast={contrast}>3. Publicações de usuários</TypographyColorido> + <TypographyColorido >3. Publicações de usuários</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div> - <p>O conteúdo disponibilizado pelo usuário é de inteira responsabilidade do usuário, não sendo a <strong>Plataforma Integrada de RED do MEC</strong> responsável por quaisquer fatos decorrentes de sua utilização.</p> - <p>Os recursos publicados devem ter cunho educacional, mantendo-se dentro do assunto em que estão inseridos, em conformidade com estes Termos de Uso.</p> - <p>Todas as informações publicadas na <strong>Plataforma Integrada de RED do MEC</strong>, como os metadados (descritivos dos recursos), comentários e discussões inseridas são consideradas públicas, visíveis por qualquer pessoa, sem nenhum tipo de confidencialidade. Não serão aceitos materiais que contenham vocabulário ofensivo ou desrespeitoso a terceiros, incluindo ofensas, calúnias, injúrias e difamações. Também não serão permitidos materiais que invadam a privacidade de terceiros, que sejam ameaçadoras, preconceituosas ou racistas.</p> - <p>Caso o usuário entenda que alguma postagem, material, notícia, comentário ou outro conteúdo disponibilizado na <strong>Plataforma Integrada de RED do MEC</strong> violem algum direito seu, a legislação aplicável ou as cláusulas deste Termos de Uso, deverá notificar a <strong>Plataforma Integrada de RED do MEC</strong> por meio da funcionalidade “Reportar” ou, quando não houver, através do formulário de Contato.</p> - <p>O spam (mensagens não solicitadas) ou o abuso em comentários poderão ser ativamente prevenidos através do bloqueio de palavras e expressões predeterminadas, ou excluídos posteriormente, sendo cabível a remoção da conta do usuário, no caso de tentativas de violação sistemática e repetitiva destes Termos de Uso, incluindo a reintrodução de material que já tenha sido previamente bloqueado ou excluído.</p> - <p>Conteúdos com informações consideradas inadequadas pela <strong>Plataforma Integrada de RED do MEC</strong>, conforme as cláusulas destes Termos de Uso, poderão ser removidos por decisão do Ministério da Educação e o usuário será notificado através do seu e-mail de cadastro.</p> - <h6 style={{ fontSize: "18px", marginBlock: "10px" }} >3.1 É permitido ao usuário:</h6> - <ul> - <li> - <p>Depositar (publicar) recurso ou material de sua autoria ou de autoria coletiva, com anuência dos demais autores, que esteja em domínio público, ou para o qual há anuência dos autores originais, desde que os dados sejam corretamente preenchidos nos campos descritivos (metadados) indicados para preenchimento das informações sobre os recursos;</p> - </li> - <li> - <p>Nos comentários, contatos e comunicações, é fundamental ser cortês e tratar os demais usuários com respeito;</p> - </li> - <li> - <p>O usuário poderá sugerir links para outros sites, desde que tenham relação direta com o assunto abordado.</p> - </li> - </ul> - <h6 style={{ fontSize: "18px", marginBlock: "10px" }}>3.2 É vedado ao usuário:</h6> - <ul> - <li> - <p>Transmitir, exibir, enviar, ou de qualquer outra forma, disponibilizar conteúdo que contenha material pornográfico e/ou atividades ilegais relativas a menores de 18 anos (consoante o <AColorido contrast={contrast} href="http://www.planalto.gov.br/ccivil_03/leis/L8069.htm" target="_blank">Estatuto da Criança e do Adolescente</AColorido>), que invada a privacidade de terceiros, que tenha cunho comercial, viole os <AColorido contrast={contrast} href="https://www.ohchr.org/EN/UDHR/Pages/Language.aspx?LangID=por" target="_blank">Direitos Humanos</AColorido> ou seja ilegal, ofensivo, ameaçador, que incite a violência, seja vulgar, preconceituoso ou racista (como descrito nos artigos 138-140 do Código Penal Brasileiro), ou de qualquer forma seja contrário às cláusulas destes Termos de Uso;</p> - </li> - <li> - <p>Assumir a identidade de outra pessoa, física ou jurídica; forjar cabeçalhos, ou de qualquer outra forma manipular identificadores, a fim de disfarçar a origem de qualquer material contido na plataforma, com sentido de desmoralizar, desprestigiar ou se fazer passar pela <strong>Plataforma Integrada de RED do MEC</strong>;</p> - </li> - <li> - <p>Disponibilizar conteúdo em desconformidade com a <AColorido contrast={contrast} href="http://www.planalto.gov.br/ccivil_03/leis/L9610.htm" target="_blank">legislação de Direito Autoral</AColorido>, incluindo conteúdo que viole marca registrada, patente, segredo de negócio, direito autoral ou qualquer outro direito de terceiro; disponibilizar conteúdo com qualquer tipo de propaganda, material promocional, spam (mensagens não solicitadas), correntes ou esquemas de pirâmide;</p> - </li> - <li> - <p>Disponibilizar conteúdo que contenha vírus ou qualquer outro código, arquivo ou programa de computador, com o propósito de interromper, destruir ou limitar a funcionalidade de qualquer software, hardware ou equipamento de telecomunicações;</p> - </li> - <li> - <p>Interferir ou interromper os serviços, as redes ou os servidores conectados à plataforma de modo a dificultar a utilização e o aproveitamento dos serviços por outros usuários, bem como obter ou tentar obter acesso não autorizado à plataforma;</p> - </li> - <li> - <p>Pedir votos, mencionar número de candidato ou expressar qualquer outra manifestação que se caracterize como propaganda política ou que viole as normas eleitorais.</p> - </li> - </ul> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE,</p> - <p>O conteúdo disponibilizado pelo usuário é de sua inteira responsabilidade. Os recursos publicados tevem ter cunho educacional, em conformidade com estes Termos.</p> - <p>Todas informações publicadas na Plataforma MEC RED são cosideradas públicas, visíveis por qualquer pessoa.</p> - <p>Não serão aceitos materiais com vocabulário ofensivo ou que invadam a privacidade de terceiros.</p> - <p>Caso o usuário entenda que algum conteúdo disponibilizado viole um direito ou as cláusulas deste Termo de Uso, deverá notificar a Plataforma por meio da funcionalidade “Reportar”.</p> - <p>O usuário poderá ter a sua conta removida em casos de violações sistemáticas destes Termos de Uso.</p> - </div> - </Grid> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div> + <p>O conteúdo disponibilizado pelo usuário é de inteira responsabilidade do usuário, não sendo a <strong>Plataforma Integrada de RED do MEC</strong> responsável por quaisquer fatos decorrentes de sua utilização.</p> + <p>Os recursos publicados devem ter cunho educacional, mantendo-se dentro do assunto em que estão inseridos, em conformidade com estes Termos de Uso.</p> + <p>Todas as informações publicadas na <strong>Plataforma Integrada de RED do MEC</strong>, como os metadados (descritivos dos recursos), comentários e discussões inseridas são consideradas públicas, visíveis por qualquer pessoa, sem nenhum tipo de confidencialidade. Não serão aceitos materiais que contenham vocabulário ofensivo ou desrespeitoso a terceiros, incluindo ofensas, calúnias, injúrias e difamações. Também não serão permitidos materiais que invadam a privacidade de terceiros, que sejam ameaçadoras, preconceituosas ou racistas.</p> + <p>Caso o usuário entenda que alguma postagem, material, notícia, comentário ou outro conteúdo disponibilizado na <strong>Plataforma Integrada de RED do MEC</strong> violem algum direito seu, a legislação aplicável ou as cláusulas deste Termos de Uso, deverá notificar a <strong>Plataforma Integrada de RED do MEC</strong> por meio da funcionalidade “Reportar” ou, quando não houver, através do formulário de Contato.</p> + <p>O spam (mensagens não solicitadas) ou o abuso em comentários poderão ser ativamente prevenidos através do bloqueio de palavras e expressões predeterminadas, ou excluídos posteriormente, sendo cabível a remoção da conta do usuário, no caso de tentativas de violação sistemática e repetitiva destes Termos de Uso, incluindo a reintrodução de material que já tenha sido previamente bloqueado ou excluído.</p> + <p>Conteúdos com informações consideradas inadequadas pela <strong>Plataforma Integrada de RED do MEC</strong>, conforme as cláusulas destes Termos de Uso, poderão ser removidos por decisão do Ministério da Educação e o usuário será notificado através do seu e-mail de cadastro.</p> + <h6 style={{fontSize:"18px",marginBlock:"10px"}} >3.1 É permitido ao usuário:</h6> + <ul> + <li> + <p>Depositar (publicar) recurso ou material de sua autoria ou de autoria coletiva, com anuência dos demais autores, que esteja em domínio público, ou para o qual há anuência dos autores originais, desde que os dados sejam corretamente preenchidos nos campos descritivos (metadados) indicados para preenchimento das informações sobre os recursos;</p> + </li> + <li> + <p>Nos comentários, contatos e comunicações, é fundamental ser cortês e tratar os demais usuários com respeito;</p> + </li> + <li> + <p>O usuário poderá sugerir links para outros sites, desde que tenham relação direta com o assunto abordado.</p> + </li> + </ul> + <h6 style={{fontSize:"18px",marginBlock: "10px"}}>3.2 É vedado ao usuário:</h6> + <ul> + <li> + <p>Transmitir, exibir, enviar, ou de qualquer outra forma, disponibilizar conteúdo que contenha material pornográfico e/ou atividades ilegais relativas a menores de 18 anos (consoante o <AColorido href="http://www.planalto.gov.br/ccivil_03/leis/L8069.htm" target="_blank">Estatuto da Criança e do Adolescente</AColorido>), que invada a privacidade de terceiros, que tenha cunho comercial, viole os <AColorido href="https://www.ohchr.org/EN/UDHR/Pages/Language.aspx?LangID=por" target="_blank">Direitos Humanos</AColorido> ou seja ilegal, ofensivo, ameaçador, que incite a violência, seja vulgar, preconceituoso ou racista (como descrito nos artigos 138-140 do Código Penal Brasileiro), ou de qualquer forma seja contrário às cláusulas destes Termos de Uso;</p> + </li> + <li> + <p>Assumir a identidade de outra pessoa, física ou jurídica; forjar cabeçalhos, ou de qualquer outra forma manipular identificadores, a fim de disfarçar a origem de qualquer material contido na plataforma, com sentido de desmoralizar, desprestigiar ou se fazer passar pela <strong>Plataforma Integrada de RED do MEC</strong>;</p> + </li> + <li> + <p>Disponibilizar conteúdo em desconformidade com a <AColorido href="http://www.planalto.gov.br/ccivil_03/leis/L9610.htm" target="_blank">legislação de Direito Autoral</AColorido>, incluindo conteúdo que viole marca registrada, patente, segredo de negócio, direito autoral ou qualquer outro direito de terceiro; disponibilizar conteúdo com qualquer tipo de propaganda, material promocional, spam (mensagens não solicitadas), correntes ou esquemas de pirâmide;</p> + </li> + <li> + <p>Disponibilizar conteúdo que contenha vírus ou qualquer outro código, arquivo ou programa de computador, com o propósito de interromper, destruir ou limitar a funcionalidade de qualquer software, hardware ou equipamento de telecomunicações;</p> + </li> + <li> + <p>Interferir ou interromper os serviços, as redes ou os servidores conectados à plataforma de modo a dificultar a utilização e o aproveitamento dos serviços por outros usuários, bem como obter ou tentar obter acesso não autorizado à plataforma;</p> + </li> + <li> + <p>Pedir votos, mencionar número de candidato ou expressar qualquer outra manifestação que se caracterize como propaganda política ou que viole as normas eleitorais.</p> + </li> + </ul> + </div> + </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE,</p> + <p>O conteúdo disponibilizado pelo usuário é de sua inteira responsabilidade. Os recursos publicados tevem ter cunho educacional, em conformidade com estes Termos.</p> + <p>Todas informações publicadas na Plataforma MEC RED são cosideradas públicas, visíveis por qualquer pessoa.</p> + <p>Não serão aceitos materiais com vocabulário ofensivo ou que invadam a privacidade de terceiros.</p> + <p>Caso o usuário entenda que algum conteúdo disponibilizado viole um direito ou as cláusulas deste Termo de Uso, deverá notificar a Plataforma por meio da funcionalidade “Reportar”.</p> + <p>O usuário poderá ter a sua conta removida em casos de violações sistemáticas destes Termos de Uso.</p> + </div> </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel4a-content" id="panel4a-header" > - <TypographyColorido contrast={contrast}>4. Licença de uso do conteúdo</TypographyColorido> + <TypographyColorido >4. Licença de uso do conteúdo</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div> - <p>A <strong>Plataforma Integrada de RED do MEC</strong>, entendida como obra intelectual em seu conjunto, é de titularidade do Ministério da Educação. Sua disponibilização ocorrerá de acordo com os termos da <AColorido contrast={contrast} href="https://creativecommons.org/licenses/by-sa/4.0/deed.pt_BR" target="_blank">Licença Pública Creative Commons do tipo CC BY-SA</AColorido>, exceto nos casos em que for indicado de outra forma.</p> - <p>A licença CC BY SA é uma licença aberta e permite que seja feita cópia, redistribuição, adaptação e criação de obras derivadas, inclusive uso comercial, desde que o autor seja referenciado e que a licença da obra derivada seja também CC BY SA, garantindo o constante caráter aberto das produções.</p> - <p>Aplica-se aos códigos de software desenvolvidos pela <strong>Plataforma Integrada de RED do MEC</strong> a <AColorido contrast={contrast} href="https://www.gnu.org/licenses/gpl.html" target="_blank">Licença Pública Geral Affero GNU GPL</AColorido> (veja a tradução livre <AColorido contrast={contrast} href="https://creativecommons.org/licenses/GPL/2.0/legalcode.pt" target="_blank">aqui</AColorido>), que visa garantir a liberdade de compartilhar e de modificar softwares livres.</p> - <p>O usuário que utilizar a <strong>Plataforma Integrada de RED do MEC</strong> como repositório, ou seja, para armazenamento de conteúdo, garante que detém todos os direitos e autorizações para a publicação do conteúdo e deverá escolher uma das licenças Creative Commons elencadas no formulário no momento de cadastro do material. As licenças Creative Commons relacionadas abaixo serão aceitas na <strong>Plataforma Integrada de RED do MEC</strong>, pois garantem o devido crédito pela criação original do usuário e permitem as seguintes ações de uso:</p> - <ul> - <li> - <p><strong>CC-BY</strong>: esta licença permite que outros distribuam, remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito pela criação original.</p> - </li> - <li> - <p><strong>CC-BY-SA</strong>: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito e que licenciem as novas criações sob termos idênticos.</p> - </li> - <li> - <p><strong>CC-BY-NC</strong>: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais e, embora os novos trabalhos tenham de lhe atribuir o devido crédito e não possam ser usados para fins comerciais, os usuários não têm de licenciar esses trabalhos derivados sob os mesmos termos.</p> - </li> - <li> - <p><strong>CC-BY-NC-SA</strong>: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais, desde que atribuam o devido crédito e que licenciem as novas criações sob termos idênticos.</p> - </li> - </ul> - <p>Cabe ao Usuário verificar a compatibilidade da licença do material obtido na <strong>Plataforma Integrada de RED do MEC</strong> para utilizar em outras produções. Para consultar a compatibilidade das licenças Creative Commons, há uma ferramenta disponível no site <AColorido contrast={contrast} href="http://aberta.org.br/compatibilidade/" target="_blank">Iniciativa Educação Aberta</AColorido>.</p> - <p>O usuário da <strong>Plataforma Integrada de RED do MEC</strong> responde por todo o conteúdo publicado por meio de seu perfil, inclusive no que diz respeito à violação dos direitos autorais relacionados a tais postagens. Ao inserir um conteúdo de sua autoria para armazenamento, o usuário concorda e autoriza o licenciamento ao escolher uma das licenças abertas descritas no formulário de publicação, de forma a permitir não só o seu reconhecimento pleno de autoria, como também a possibilidade de replicação, reedição e reformulação de suas postagens por terceiros, com o objetivo de possibilitar o compartilhamento e a reutilização de conteúdo educacional.</p> - <p>A <strong>Plataforma Integrada de RED do MEC</strong> poderá disponibilizar endereços eletrônicos de outros sítios externos, por meio de links, o que não significa que estes sejam de sua propriedade ou por ele operados. A presença de links para outros sites não implica relação de sociedade ou de supervisão da <strong>Plataforma Integrada de RED do MEC</strong> com esses sites e seus conteúdos. Os campos descritivos de cada recurso conterão informações específicas sobre as licenças dos mesmos. Cabe ao usuário verificar a licença de cada recurso.</p> - <p>É vedado o uso não autorizado da obra ou seu uso em desconformidade com a legislação autoral e com os termos da licença mencionada.</p> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE.</p> - <p>A Plataforma MEC RED, por ser entendida como obra intelectual, possui uma licença aberta de uso que permite a reutilização e o compartilhamento do conteúdo, inclusive para uso comercial, desde que o autor seja referenciado. Além disso, no caso de obras derivadas, a licença deverá ser a mesma da obra original.</p> - <p>Os códigos de software desenvolvidos para a Plataforma, possuem uma licença pública, de software livre, que garante a liberdade de compartilhamento e modificação dos mesmos.</p> - <p>Os conteúdos publicados e armazenados na Plataforma pelos usuários, serão sempre abertos, sendo permitidas ações de edição e compartilhamento desde que o autor seja referenciado. Cabe ao usuário decidir se o recurso poderá ser utilizado somente para fins não comerciais e se os trabalhos derivados deverão ter os termos idênticos ao original, selecionando uma das opções de licença disponíveis no momento de upload do recurso.</p> - </div> - </Grid> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div> + <p>A <strong>Plataforma Integrada de RED do MEC</strong>, entendida como obra intelectual em seu conjunto, é de titularidade do Ministério da Educação. Sua disponibilização ocorrerá de acordo com os termos da <AColorido href="https://creativecommons.org/licenses/by-sa/4.0/deed.pt_BR" target="_blank">Licença Pública Creative Commons do tipo CC BY-SA</AColorido>, exceto nos casos em que for indicado de outra forma.</p> + <p>A licença CC BY SA é uma licença aberta e permite que seja feita cópia, redistribuição, adaptação e criação de obras derivadas, inclusive uso comercial, desde que o autor seja referenciado e que a licença da obra derivada seja também CC BY SA, garantindo o constante caráter aberto das produções.</p> + <p>Aplica-se aos códigos de software desenvolvidos pela <strong>Plataforma Integrada de RED do MEC</strong> a <AColorido href="https://www.gnu.org/licenses/gpl.html" target="_blank">Licença Pública Geral Affero GNU GPL</AColorido> (veja a tradução livre <AColorido href="https://creativecommons.org/licenses/GPL/2.0/legalcode.pt" target="_blank">aqui</AColorido>), que visa garantir a liberdade de compartilhar e de modificar softwares livres.</p> + <p>O usuário que utilizar a <strong>Plataforma Integrada de RED do MEC</strong> como repositório, ou seja, para armazenamento de conteúdo, garante que detém todos os direitos e autorizações para a publicação do conteúdo e deverá escolher uma das licenças Creative Commons elencadas no formulário no momento de cadastro do material. As licenças Creative Commons relacionadas abaixo serão aceitas na <strong>Plataforma Integrada de RED do MEC</strong>, pois garantem o devido crédito pela criação original do usuário e permitem as seguintes ações de uso:</p> + <ul> + <li> + <p><strong>CC-BY</strong>: esta licença permite que outros distribuam, remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito pela criação original.</p> + </li> + <li> + <p><strong>CC-BY-SA</strong>: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito e que licenciem as novas criações sob termos idênticos.</p> + </li> + <li> + <p><strong>CC-BY-NC</strong>: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais e, embora os novos trabalhos tenham de lhe atribuir o devido crédito e não possam ser usados para fins comerciais, os usuários não têm de licenciar esses trabalhos derivados sob os mesmos termos.</p> + </li> + <li> + <p><strong>CC-BY-NC-SA</strong>: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais, desde que atribuam o devido crédito e que licenciem as novas criações sob termos idênticos.</p> + </li> + </ul> + <p>Cabe ao Usuário verificar a compatibilidade da licença do material obtido na <strong>Plataforma Integrada de RED do MEC</strong> para utilizar em outras produções. Para consultar a compatibilidade das licenças Creative Commons, há uma ferramenta disponível no site <AColorido href="http://aberta.org.br/compatibilidade/" target="_blank">Iniciativa Educação Aberta</AColorido>.</p> + <p>O usuário da <strong>Plataforma Integrada de RED do MEC</strong> responde por todo o conteúdo publicado por meio de seu perfil, inclusive no que diz respeito à violação dos direitos autorais relacionados a tais postagens. Ao inserir um conteúdo de sua autoria para armazenamento, o usuário concorda e autoriza o licenciamento ao escolher uma das licenças abertas descritas no formulário de publicação, de forma a permitir não só o seu reconhecimento pleno de autoria, como também a possibilidade de replicação, reedição e reformulação de suas postagens por terceiros, com o objetivo de possibilitar o compartilhamento e a reutilização de conteúdo educacional.</p> + <p>A <strong>Plataforma Integrada de RED do MEC</strong> poderá disponibilizar endereços eletrônicos de outros sítios externos, por meio de links, o que não significa que estes sejam de sua propriedade ou por ele operados. A presença de links para outros sites não implica relação de sociedade ou de supervisão da <strong>Plataforma Integrada de RED do MEC</strong> com esses sites e seus conteúdos. Os campos descritivos de cada recurso conterão informações específicas sobre as licenças dos mesmos. Cabe ao usuário verificar a licença de cada recurso.</p> + <p>É vedado o uso não autorizado da obra ou seu uso em desconformidade com a legislação autoral e com os termos da licença mencionada.</p> + </div> </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE.</p> + <p>A Plataforma MEC RED, por ser entendida como obra intelectual, possui uma licença aberta de uso que permite a reutilização e o compartilhamento do conteúdo, inclusive para uso comercial, desde que o autor seja referenciado. Além disso, no caso de obras derivadas, a licença deverá ser a mesma da obra original.</p> + <p>Os códigos de software desenvolvidos para a Plataforma, possuem uma licença pública, de software livre, que garante a liberdade de compartilhamento e modificação dos mesmos.</p> + <p>Os conteúdos publicados e armazenados na Plataforma pelos usuários, serão sempre abertos, sendo permitidas ações de edição e compartilhamento desde que o autor seja referenciado. Cabe ao usuário decidir se o recurso poderá ser utilizado somente para fins não comerciais e se os trabalhos derivados deverão ter os termos idênticos ao original, selecionando uma das opções de licença disponíveis no momento de upload do recurso.</p> + </div> + </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel5a-content" id="panel5a-header" > - <TypographyColorido contrast={contrast}>5. Práticas de uso e armazenamento</TypographyColorido> - </ExpansionPanelSummaryColorido > - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div> - <p>A depender da capacidade de espaço no servidor, a <strong>Plataforma Integrada de RED do MEC</strong> poderá retirar conteúdos armazenados na plataforma, observados os critérios de antiguidade e do tamanho dos arquivos disponibilizados, mediante notificação e justificativa ao usuário.</p> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE,</p> - <p>O usuário será notificado caso algum conteúdo tenha que ser retirado da Plataforma por falta de espaço no servidor.</p> - </div> - </Grid> + <TypographyColorido >5. Práticas de uso e armazenamento</TypographyColorido> + </ExpansionPanelSummaryColorido> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div> + <p>A depender da capacidade de espaço no servidor, a <strong>Plataforma Integrada de RED do MEC</strong> poderá retirar conteúdos armazenados na plataforma, observados os critérios de antiguidade e do tamanho dos arquivos disponibilizados, mediante notificação e justificativa ao usuário.</p> + </div> </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE,</p> + <p>O usuário será notificado caso algum conteúdo tenha que ser retirado da Plataforma por falta de espaço no servidor.</p> + </div> + </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel6a-content" id="panel6a-header" > - <TypographyColorido contrast={contrast}>6. Privacidade da informação</TypographyColorido> + <TypographyColorido >6. Privacidade da informação</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div > - <p>A <strong>Plataforma Integrada de RED do MEC</strong> tomará todas as medidas possíveis para manter a confidencialidade e a segurança de suas informações. No entanto, a <strong>Plataforma Integrada de RED do MEC</strong> não responderá por prejuízos que possam ser derivados da violação dessas medidas por parte de terceiros que subvertam os sistemas de segurança para acessar as informações de Usuários.</p> - <p>A <strong>Plataforma Integrada de RED do MEC</strong> solicitará alguns dados pessoais para seu cadastro. Além disso, dados sobre a interação dos usuários e seu comportamento na plataforma são coletados de maneira automática. Esses dados nunca serão vendidos, alugados, trocados ou fornecidos para fins comerciais. No entanto, o MEC poderá colaborar com instituições públicas parceiras, como universidades, para análise desses dados bem como de qualquer conteúdo da plataforma para para fins de pesquisa, divulgação e melhoria dos serviços. Dados pessoais que possam identificá-lo nunca serão compartilhados.</p> - <p>Dados que não identificam o usuário serão armazenados indefinidamente para fins de pesquisa.</p> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE,</p> - <p>Para manter a confidencialidade e a segurança dos dados, a Plataforma MEC RED tomará todas as medidas possíveis.</p> - <p>Os dados sobre interação e comportamento dos usuários nunca serão comercializados, mas poderão ser analisados para fins de pesquisa, divulgação e melhorias, sem a identificação dos usuários.</p> - </div> - </Grid> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div > + <p>A <strong>Plataforma Integrada de RED do MEC</strong> tomará todas as medidas possíveis para manter a confidencialidade e a segurança de suas informações. No entanto, a <strong>Plataforma Integrada de RED do MEC</strong> não responderá por prejuízos que possam ser derivados da violação dessas medidas por parte de terceiros que subvertam os sistemas de segurança para acessar as informações de Usuários.</p> + <p>A <strong>Plataforma Integrada de RED do MEC</strong> solicitará alguns dados pessoais para seu cadastro. Além disso, dados sobre a interação dos usuários e seu comportamento na plataforma são coletados de maneira automática. Esses dados nunca serão vendidos, alugados, trocados ou fornecidos para fins comerciais. No entanto, o MEC poderá colaborar com instituições públicas parceiras, como universidades, para análise desses dados bem como de qualquer conteúdo da plataforma para para fins de pesquisa, divulgação e melhoria dos serviços. Dados pessoais que possam identificá-lo nunca serão compartilhados.</p> + <p>Dados que não identificam o usuário serão armazenados indefinidamente para fins de pesquisa.</p> + </div> + </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE,</p> + <p>Para manter a confidencialidade e a segurança dos dados, a Plataforma MEC RED tomará todas as medidas possíveis.</p> + <p>Os dados sobre interação e comportamento dos usuários nunca serão comercializados, mas poderão ser analisados para fins de pesquisa, divulgação e melhorias, sem a identificação dos usuários.</p> + </div> </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel7a-content" id="panel7a-header" > - <TypographyColorido contrast={contrast}>7. Violação no sistema ou na base de dados</TypographyColorido> + <TypographyColorido >7. Violação no sistema ou na base de dados</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> + <ExpansionPanelDetailsColorido> <Grid container spacing={3}> <Grid item xs={12} md={7}> <div > @@ -339,7 +335,7 @@ export default function SimpleExpansionPanel({ contrast }) { </Grid> <Grid item xs={12} md={1}></Grid> <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> <p>BASICAMENTE,</p> <p>Serão aplicadas as sanções previstas ou as ações legais ao responsável por intromissão, ou tentativa de intromissão, na Plataforma MEC RED.</p> </div> @@ -349,178 +345,172 @@ export default function SimpleExpansionPanel({ contrast }) { </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel8a-content" id="panel8a-header" > - <TypographyColorido contrast={contrast}>8. Sanções</TypographyColorido> + <TypographyColorido >8. Sanções</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div > - <p>Sem prejuízo de outras medidas, a <strong>Plataforma Integrada de RED do MEC</strong> poderá advertir, bloquear, desativar ou remover, temporária ou definitivamente, a conta e conteúdos disponibilizados por um usuário, em qualquer momento, e iniciar as ações legais cabíveis caso:</p> - <ul> - <li> - <p>o usuário não cumprir qualquer dispositivo destes Termos de Uso;</p> - </li> - <li> - <p>o usuário praticar atos fraudulentos ou dolosos;</p> - </li> - <li> - <p>o MEC entender que as postagens, o conteúdo disponibilizado ou qualquer atitude do usuário tenham causado algum dano a terceiros ou à própria Plataforma, ou tenham a potencialidade de assim o fazer.</p> - </li> - </ul> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE,</p> - <p>No caso do usuário não cumprir qualquer item destes Termos, praticar atos fraudulentos ou dolosos ou causar dano a alguém ou à Plataforma MEC RED, sua conta poderá ser bloqueada, desativada ou removida, em caráter temporário ou definitivo.</p> - </div> - </Grid> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div > + <p>Sem prejuízo de outras medidas, a <strong>Plataforma Integrada de RED do MEC</strong> poderá advertir, bloquear, desativar ou remover, temporária ou definitivamente, a conta e conteúdos disponibilizados por um usuário, em qualquer momento, e iniciar as ações legais cabíveis caso:</p> + <ul> + <li> + <p>o usuário não cumprir qualquer dispositivo destes Termos de Uso;</p> + </li> + <li> + <p>o usuário praticar atos fraudulentos ou dolosos;</p> + </li> + <li> + <p>o MEC entender que as postagens, o conteúdo disponibilizado ou qualquer atitude do usuário tenham causado algum dano a terceiros ou à própria Plataforma, ou tenham a potencialidade de assim o fazer.</p> + </li> + </ul> + </div> + </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE,</p> + <p>No caso do usuário não cumprir qualquer item destes Termos, praticar atos fraudulentos ou dolosos ou causar dano a alguém ou à Plataforma MEC RED, sua conta poderá ser bloqueada, desativada ou removida, em caráter temporário ou definitivo.</p> + </div> </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel9a-content" id="panel9a-header" > - <TypographyColorido contrast={contrast}>9. Limitações de responsabilidade</TypographyColorido> + <TypographyColorido >9. Limitações de responsabilidade</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div > - <p>Em nenhuma situação a <strong>Plataforma Integrada de RED do MEC</strong> e o Ministério da Educação serão responsáveis por quaisquer danos, prejuízos ou outro efeito, direto ou indireto, relacionados ao uso, por parte de seus usuários, leitores ou de qualquer outra pessoa, deste sítio, de seu conteúdo ou de qualquer outro website mencionado.</p> - <p>O usuário reconhece que será integralmente responsável pelos materiais enviados à <strong>Plataforma Integrada de RED do MEC</strong> e se compromete a responder por quaisquer reivindicações, demandas, penalidades e todos os danos, perdas e despesas, causados à <strong>Plataforma Integrada de RED do MEC</strong>.</p> - <p>Todo autor de conteúdo exibido na <strong>Plataforma Integrada de RED do MEC</strong> retém os seus direitos e responsabilidades autorais, nos termos da Lei n. 9.610/1998, sem prejuízo dos termos de licenciamento de livre uso, conforme exposto nestes Termos de Uso, no item “Licença de uso do conteúdo”.</p> - <p>Se o usuário verificar que qualquer comentário ou participação na <strong>Plataforma Integrada de RED do MEC</strong> infringem um direito de sua titularidade ou de um terceiro, deverá entrar em contato imediatamente na forma indicada neste mesmo documento, no item “Como reportar violações”.</p> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE,</p> - <p>A Plataforma MEC RED e o Ministério da Educação não serão responsáveis por danos, prejuízos ou outro efeito relacionados ao uso da Plataforma por parte de qualquer pessoa.</p> - <p>O usuário é integralmente responsável pelos materiais enviados e por qualquer conteúdo publicado, se comprometendo a responder por eles, quando necessário.</p> - </div> - </Grid> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div > + <p>Em nenhuma situação a <strong>Plataforma Integrada de RED do MEC</strong> e o Ministério da Educação serão responsáveis por quaisquer danos, prejuízos ou outro efeito, direto ou indireto, relacionados ao uso, por parte de seus usuários, leitores ou de qualquer outra pessoa, deste sítio, de seu conteúdo ou de qualquer outro website mencionado.</p> + <p>O usuário reconhece que será integralmente responsável pelos materiais enviados à <strong>Plataforma Integrada de RED do MEC</strong> e se compromete a responder por quaisquer reivindicações, demandas, penalidades e todos os danos, perdas e despesas, causados à <strong>Plataforma Integrada de RED do MEC</strong>.</p> + <p>Todo autor de conteúdo exibido na <strong>Plataforma Integrada de RED do MEC</strong> retém os seus direitos e responsabilidades autorais, nos termos da Lei n. 9.610/1998, sem prejuízo dos termos de licenciamento de livre uso, conforme exposto nestes Termos de Uso, no item “Licença de uso do conteúdo”.</p> + <p>Se o usuário verificar que qualquer comentário ou participação na <strong>Plataforma Integrada de RED do MEC</strong> infringem um direito de sua titularidade ou de um terceiro, deverá entrar em contato imediatamente na forma indicada neste mesmo documento, no item “Como reportar violações”.</p> + </div> </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE,</p> + <p>A Plataforma MEC RED e o Ministério da Educação não serão responsáveis por danos, prejuízos ou outro efeito relacionados ao uso da Plataforma por parte de qualquer pessoa.</p> + <p>O usuário é integralmente responsável pelos materiais enviados e por qualquer conteúdo publicado, se comprometendo a responder por eles, quando necessário.</p> + </div> + </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel10a-content" id="panel10a-header" > - <TypographyColorido contrast={contrast}>10.Inexistência de vínculo</TypographyColorido> + <TypographyColorido >10.Inexistência de vínculo</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div > - <p>A adesão a estes Termos de Uso pelo usuário não gera nenhum contrato, mandato, franquia ou vínculo de tipo trabalhista, societário, de parceria ou associativo entre a <strong>Plataforma Integrada de RED do MEC</strong> e o usuário.</p> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE,</p> - <p>Não há nenhum tipo de vínculo (trabalhista, parceria, etc) entre a Plataforma e o usuário.</p> - </div> - </Grid> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div > + <p>A adesão a estes Termos de Uso pelo usuário não gera nenhum contrato, mandato, franquia ou vínculo de tipo trabalhista, societário, de parceria ou associativo entre a <strong>Plataforma Integrada de RED do MEC</strong> e o usuário.</p> + </div> </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE,</p> + <p>Não há nenhum tipo de vínculo (trabalhista, parceria, etc) entre a Plataforma e o usuário.</p> + </div> + </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel11a-content" id="panel11a-header" > - <TypographyColorido contrast={contrast}>11. Como reportar violações</TypographyColorido> + <TypographyColorido >11. Como reportar violações</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div > - <p>Nem todo o conteúdo disponibilizado pelo usuário nas áreas de comentário e debates é lido pela administração da <strong>Plataforma Integrada de RED do MEC</strong>.</p> - <p>Se algum artigo, notícia, comentário ou outro conteúdo da <strong>Plataforma Integrada de RED do MEC</strong> violar qualquer direito do usuário, de terceiros ou a legislação aplicável, o usuário poderá usar a funcionalidade "Reportar" nas páginas que houver essa opção ou, quando não houver, entrar em contato com a administração da <strong>Plataforma Integrada de RED do MEC</strong> pelo formulário de “Contato”, mencionando de forma específica e detalhada a violação.</p> - <p>De posse das informações, a <strong>Plataforma Integrada de RED do MEC</strong> poderá analisar e resolver a questão tão breve quanto possível. Caso a informação esteja incompleta, ou com detalhamento insuficiente, a <strong>Plataforma Integrada de RED do MEC</strong> poderá entrar em contato para solicitar a complementação, possivelmente atrasando a providência desejada.</p> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE,</p> - <p>O usuário poderá reportar,utilizando a funcionalidade “Reportar” ou pelo formulário de “Contato”, qualquer tipo de conteúdo publicado na Plataforma MEC RED que viole os direitos dos usuários, de terceiros ou a legislação aplicável.</p> - </div> - </Grid> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div > + <p>Nem todo o conteúdo disponibilizado pelo usuário nas áreas de comentário e debates é lido pela administração da <strong>Plataforma Integrada de RED do MEC</strong>.</p> + <p>Se algum artigo, notícia, comentário ou outro conteúdo da <strong>Plataforma Integrada de RED do MEC</strong> violar qualquer direito do usuário, de terceiros ou a legislação aplicável, o usuário poderá usar a funcionalidade "Reportar" nas páginas que houver essa opção ou, quando não houver, entrar em contato com a administração da <strong>Plataforma Integrada de RED do MEC</strong> pelo formulário de “Contato”, mencionando de forma específica e detalhada a violação.</p> + <p>De posse das informações, a <strong>Plataforma Integrada de RED do MEC</strong> poderá analisar e resolver a questão tão breve quanto possível. Caso a informação esteja incompleta, ou com detalhamento insuficiente, a <strong>Plataforma Integrada de RED do MEC</strong> poderá entrar em contato para solicitar a complementação, possivelmente atrasando a providência desejada.</p> + </div> </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE,</p> + <p>O usuário poderá reportar,utilizando a funcionalidade “Reportar” ou pelo formulário de “Contato”, qualquer tipo de conteúdo publicado na Plataforma MEC RED que viole os direitos dos usuários, de terceiros ou a legislação aplicável.</p> + </div> + </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel12a-content" id="panel12a-header" > - <TypographyColorido contrast={contrast}>12. Modificações nos Termos de Uso</TypographyColorido> + <TypographyColorido >12. Modificações nos Termos de Uso</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div > - <p>A <strong>Plataforma Integrada de RED do MEC</strong> poderá alterar, a qualquer tempo, estes Termos de Uso, mediante declaração pública no site, visando seu aprimoramento e melhoria dos serviços prestados. Os novos Termos de Uso entrarão em vigor a partir de sua publicação na plataforma. Usuários cadastrados receberão notificação dessa alteração no e-mail de cadastro e haverá divulgação/chamada na página principal do Sistema. No prazo de 72 (setenta e duas) horas, contadas a partir da publicação das modificações, o usuário poderá comunicar-se com a <strong>Plataforma Integrada de RED do MEC</strong>, caso não concorde com os novos Termos de Uso. Nesse caso, a conta do usuário será desativada. Não havendo manifestações no prazo estipulado, entender-se-á que o Usuário aceitou tacitamente os novos Termos de Uso.</p> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE,</p> - <p>Com o objetivo de melhorar os serviços prestados, estes Termos podem ser alterados, a qualquer tempo. Caso ocorra, os usuários serão notificados e terão um período para se manifestar em relação às alterações.</p> - </div> - </Grid> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div > + <p>A <strong>Plataforma Integrada de RED do MEC</strong> poderá alterar, a qualquer tempo, estes Termos de Uso, mediante declaração pública no site, visando seu aprimoramento e melhoria dos serviços prestados. Os novos Termos de Uso entrarão em vigor a partir de sua publicação na plataforma. Usuários cadastrados receberão notificação dessa alteração no e-mail de cadastro e haverá divulgação/chamada na página principal do Sistema. No prazo de 72 (setenta e duas) horas, contadas a partir da publicação das modificações, o usuário poderá comunicar-se com a <strong>Plataforma Integrada de RED do MEC</strong>, caso não concorde com os novos Termos de Uso. Nesse caso, a conta do usuário será desativada. Não havendo manifestações no prazo estipulado, entender-se-á que o Usuário aceitou tacitamente os novos Termos de Uso.</p> + </div> + </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE,</p> + <p>Com o objetivo de melhorar os serviços prestados, estes Termos podem ser alterados, a qualquer tempo. Caso ocorra, os usuários serão notificados e terão um período para se manifestar em relação às alterações.</p> + </div> </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> <ExpansionPanelTeste> <ExpansionPanelSummaryColorido - contrast={contrast} - expandIcon={<ExpandMoreIcon style={contrast === "" ? {} : { color: "white" }} />} + expandIcon={<ExpandMoreIcon />} aria-controls="panel13a-content" id="panel13a-header" > - <TypographyColorido contrast={contrast}>13. Foro</TypographyColorido> + <TypographyColorido >13. Foro</TypographyColorido> </ExpansionPanelSummaryColorido> - <ExpansionPanelDetailsColorido contrast={contrast}> - <Grid container spacing={3}> - <Grid item xs={12} md={7}> - <div > - <p>Para dirimir dúvidas ou litígios referentes à interpretação e ao cumprimento destes Termos de Uso, as partes se submeterão ao Foro da Justiça Federal, Seção Judiciária do Distrito Federal.</p> - </div> - </Grid> - <Grid item xs={12} md={1}></Grid> - <Grid item xs={12} md={4}> - <div style={{ color: "#00BCD4", fontSize: "18px" }}> - <p>BASICAMENTE,</p> - <p>Em caso de dúvidas ou litígios, é preciso recorrer ao Foro da Justiça Federal.</p> - </div> - </Grid> + <ExpansionPanelDetailsColorido> + <Grid container spacing={3}> + <Grid item xs={12} md={7}> + <div > + <p>Para dirimir dúvidas ou litígios referentes à interpretação e ao cumprimento destes Termos de Uso, as partes se submeterão ao Foro da Justiça Federal, Seção Judiciária do Distrito Federal.</p> + </div> + </Grid> + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={4}> + <div style={{color:"#00BCD4",fontSize:"18px"}}> + <p>BASICAMENTE,</p> + <p>Em caso de dúvidas ou litígios, é preciso recorrer ao Foro da Justiça Federal.</p> + </div> </Grid> + </Grid> </ExpansionPanelDetailsColorido> </ExpansionPanelTeste> - </div > + </div> ); } diff --git a/src/Components/Firulas.js b/src/Components/Firulas.js index 72dd44f196698f089f0039f3fac6eae7ceb37bff..6a368a11cf553166280ec8d85dd9ede03562e781 100644 --- a/src/Components/Firulas.js +++ b/src/Components/Firulas.js @@ -1,84 +1,38 @@ -import React, { useState, useContext } from 'react'; -import { Store } from '../Store' +import React, {useState} from 'react' import styled from 'styled-components' import Rating from '@material-ui/lab/Rating'; import StarBorderIcon from '@material-ui/icons/StarBorder'; -import { LikeCounter, ButtonNoWidth } from '../Components/ResourceCardFunction.js' +import {LikeCounter, ButtonNoWidth} from '../Components/ResourceCardFunction.js' import FavoriteIcon from '@material-ui/icons/Favorite'; -import { putRequest } from './HelperFunctions/getAxiosConfig' -import SignUpModal from './SignUpModal' -import LoginModal from './LoginModal.js' -import Snackbar from '@material-ui/core/Snackbar'; -import MuiAlert from '@material-ui/lab/Alert'; +import {putRequest} from './HelperFunctions/getAxiosConfig' -export default function Firulas(props) { - const { state } = useContext(Store); - const [liked, toggleLiked] = useState(props.liked) - const [likesCount, setLikesCount] = useState(props.likesCount) +export default function Firulas (props) { + const [liked, setLiked] = useState(props.liked) - const [signUpOpen, setSignUp] = useState(false) - const [loginOpen, setLogin] = useState(false) - const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) - - function Alert(props) { - return <MuiAlert elevation={6} variant="filled" {...props} />; - } - - function handleSuccessLike(data) { - toggleLiked(!liked) - setLikesCount(data.count) + function handleSuccess (data) { + setLiked(!liked) } - const handleLike = () => { - if (!state.currentUser.id) { - handleLogin() - } - else { - const url = `/learning_objects/${props.recursoId}/like/` - - putRequest(url, {}, handleSuccessLike, (error) => { console.log(error) }) - } - } - - const handleLogin = () => { - setLogin(!loginOpen) - } - - const handleSignUp = () => { - setSignUp(!signUpOpen) - } - - function toggleLoginSnackbar(reason) { - if (reason === 'clickaway') { - return; - } - handleSuccessfulLogin(false); + putRequest(`/learning_objects/${props.recursoId}/like/`, {}, handleSuccess, (error) => {console.log(error)}) } return ( - <ConteinerFirulas style={props.contrast === "" ? {} : {color: "white"}}> - <SignUpModal contrast={props.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} - /> - <LoginModal contrast={props.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} - openSnackbar={() => { handleSuccessfulLogin(true) }} - /> - <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleLoginSnackbar} - anchorOrigin={{ vertical: 'top', horizontal: 'center' }} - > - <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> - </Snackbar> + <ConteinerFirulas> <Rating - className={`${props.contrast}IconColor`} - name="customized-empty" - value={props.rating} - readOnly - emptyIcon={<StarBorderIcon className={`${props.contrast}IconColor`} fontSize="inherit"/>} + name="customized-empty" + value={props.rating*10} + precision={0.5} + readOnly + style={{color:"#666", marginRight : "20px"}} + emptyIcon={<StarBorderIcon fontSize="inherit" />} /> - <LikeCounter> - <span>{likesCount}</span> + <LikeCounter style={{marginLeft : "-3px", display : "flex", alignItems : "center"}}> + <span>{props.likesCount}</span> + <ButtonNoWidth onClick={handleLike}> - <FavoriteIcon className={`${props.contrast}LinkColor`} style={ props.contrast === "" ? {color: liked ? "red" : "#666"} : {color: liked ? "red" : "white"} } /> + <FavoriteIcon style={{color : liked ? "red" : "#666" }}/> </ButtonNoWidth> + </LikeCounter> </ConteinerFirulas> ) diff --git a/src/Components/FollowCollectionButton.js b/src/Components/FollowCollectionButton.js index dd85205b87de4f0a58bdd833c877aa95fba5ebda..e89f8901c0e586124c99df453dc70ac627027f63 100644 --- a/src/Components/FollowCollectionButton.js +++ b/src/Components/FollowCollectionButton.js @@ -188,8 +188,8 @@ export default function FollowCollectionButton(props) { color={snackInfo.color} /> <FollowButton - contrast={props.contrast} variant={variant} + color="primary" startIcon={icon} size="small" onMouseEnter={handleMouseEnter} @@ -199,13 +199,11 @@ export default function FollowCollectionButton(props) { <ButtonText>{button_text}</ButtonText> </FollowButton> <SignUpModal - contrast={props.contrast} open={sign_up_open} handleClose={() => setSignUpOpen(false)} openLogin={handleOpenLogin} /> <LoginModal - contrast={props.contrast} openSnackbar={handleOpenSnackSignIn} open={open_login} handleClose={() => setOpenLogin(false)} @@ -221,10 +219,6 @@ const ButtonText = styled.span` font-size: 1.2em; ` const FollowButton = styled(Button)` - color: ${props => props.contrast === "" ? "white !important" : "yellow !important"}; - background-color: ${props => props.contrast === "" ? "#3f51b5 !important" : "black !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "yellow underline !important"}; - border: ${props => props.contrast === "" ? "none !important" : "1px solid white !important"}; padding-left: 10; padding-right: 10; width: 250px; diff --git a/src/Components/FormInput.js b/src/Components/FormInput.js index 55c3e503745f0549fc6212590a10229800504565..813877ed5261daf1e1723771ab71b77b07d0696d 100644 --- a/src/Components/FormInput.js +++ b/src/Components/FormInput.js @@ -25,91 +25,60 @@ const StyledTextField = styled(TextField)` max-width: 100%; font-size : 15px; font-weight : lighter; - color : white; + color : inherit; width : 100% !important; - width : 100% !important; - - .MuiOutlinedInput-root { - /* &.Mui-focused.Mui-error fieldset{ - border-color: ${props => props.contrast === "" ? "red" : "#e75480"}; - } - - &.Mui-error fieldset{ - border-color: ${props => props.contrast === "" ? "red" : "#e75480"}; - } */ - - &.Mui-focused fieldset { - border-color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - } - fieldset { - border-color: ${props => props.contrast === "" ? "#666" : "white"}; - } - } - - label{ - color: ${props => props.contrast === "" ? "#666" : "white"}; - } + full-width : 100% !important; label.Mui-focused { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; + color : #00bcd4; } label.Mui-focused.Mui-error { - color: red; + color : red; } - /* label.Mui-error { - color: ${props => props.contrast === "" ? "red" : "#e75480"}; - } */ + .MuiInput-underline::after { + border-bottom: 2px solid #00bcd4; + } ` const useStyles = makeStyles(theme => ({ - container: { - display: "flex", - flexWrap: "wrap", - padding: "2px" - }, - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "white", - width: "100%" - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "black", - width: "100%" - } + container: { + display: "flex", + flexWrap: "wrap", + padding: "2px" + }, + textField: { + maxWidth: "100%", + fontSize: "15px", + fontWeight: "lighter", + color: "inherit", + width: "100%" + } })); export default function FormInput(props) { - const classes = useStyles(); + const classes = useStyles(); + + return ( - return ( <StyledTextField - contrast={props.contrast} - label={props.placeholder} - margin="normal" - id={props.id} - name={props.name} - type={props.inputType} - value={props.value} - onChange={props.handleChange} - onKeyDown={props.onKeyDown} - variant="outlined" - rows={props.rows} - error={props.error} - rowsMax={props.rowsMax} - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} - required={props.required} - // helperText={<span style={props.contrast === "" ? { color: "red" } : { color: "#e75480" }}>{props.help}</span>} - helperText={props.help} - style={{ width: "100%" }} - mask={props.mask} - multiline={props.multi} + label={props.placeholder} + margin="normal" + id = {props.name} + name = {props.name} + type = {props.inputType} + value = {props.value} + onChange = {props.handleChange} + rows = {props.rows} + error = {props.error} + rowsMax = {props.rowsMax} + InputProps={{className: classes.input}} + required = {props.required} + helperText ={props.help} + style={{width:"100%"}} + mask={props.mask} + multiline={props.multi} /> - ); + ); } diff --git a/src/Components/FormationMaterialDescription.js b/src/Components/FormationMaterialDescription.js index f348771430afc319e0252cf9eb1935e7e379f93e..dc984d1f8286f8f8e7237e8344c33a92ac1c0d5a 100644 --- a/src/Components/FormationMaterialDescription.js +++ b/src/Components/FormationMaterialDescription.js @@ -25,32 +25,31 @@ export default function FormationMaterialDescription(props) { const topico_obj = props.topico_obj; return ( - <WrappingCard contrast={props.contrast}> + <WrappingCard> <Grid container - style={props.contrast === "" ? {} : {backgroundColor: "black"}} direction="row" justify="flex-start" alignItems="center" > <Grid item xs={12} md={8}> - <TextContainer contrast={props.contrast}> - <Title contrast={props.contrast}> + <TextContainer> + <Title> {colecao ? "Sobre o Material" : "Resumo do " + props.colecao_obj.topic_name.slice(0, -1) } </Title> - <Description contrast={props.contrast}> + <Description> {colecao ? colecao_obj.description : topico_obj.description } </Description> {colecao ? - <SubTitle contrast={props.contrast}>Histórico do Curso</SubTitle> - : <Strong contrast={props.contrast}>Autoria (autores):</Strong> + <SubTitle>Histórico do Curso</SubTitle> + : <Strong>Autoria (autores):</Strong> } - <Description contrast={props.contrast}> + <Description> {colecao ? colecao_obj.historic : topico_obj.author @@ -59,17 +58,17 @@ export default function FormationMaterialDescription(props) { </TextContainer> </Grid> <Grid item xs={12} md={3}> - <IconList contrast={props.contrast}> - <IconItem contrast={props.contrast}> + <IconList> + <IconItem> <LibraryBooksIcon /> - <Strong contrast={props.contrast}>Tipo de recurso: </Strong> + <Strong>Tipo de recurso: </Strong> Material de Formação <br /> </IconItem> - <IconItem contrast={props.contrast}> + <IconItem> <MoveToInboxIcon /> - <Strong contrast={props.contrast}>Ano de publicação: </Strong> + <Strong>Ano de publicação: </Strong> {colecao ? colecao_obj.created_at.split('-')[0] : topico_obj.created_at.split('-')[0] @@ -86,24 +85,24 @@ export default function FormationMaterialDescription(props) { topico_obj.language[i].name : '') return ( - <IconItem contrast={props.contrast}> + <IconItem> <TranslateIcon /> - <Strong contrast={props.contrast}>Idioma: </Strong> + <Strong>Idioma: </Strong> {content} <br /> </IconItem> ); })} - <IconItem contrast={props.contrast}> - <Strong contrast={props.contrast}>{colecao ? "Criado" : "Enviado"} por:</Strong> + <IconItem> + <Strong>{colecao ? "Criado" : "Enviado"} por:</Strong> <br /> <StyledAnchor href={colecao_obj.developedurl}> { colecao_obj.id === 3 ? <LongUserIcon src={IcNute} /> : <div> <UserIcon src={IcPeninsula} /> - <Red contrast={props.contrast}> + <Red> {colecao_obj.developed} </Red> </div> @@ -119,14 +118,12 @@ export default function FormationMaterialDescription(props) { const Title = styled.h1` font-weight: 100; - color: ${props => props.contrast === "" ? "#666" : "white"}; - + color: rgb(102, 102, 102); ` const SubTitle = styled.h3` font-weight: 900; padding-top: 10px; - color: ${props => props.contrast === "" ? "#666" : "white"}; - + color: rgb(102, 102, 102); ` const UserIcon = styled.img` width: 50px; @@ -139,10 +136,9 @@ const LongUserIcon = styled.img` margin: 10px; ` const Description = styled.p` - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; ` const TextContainer = styled.div` - background: ${props => props.contrast === "" ? "white" : "black"}; margin: 15px; height: 100%; @media screen and (max-width: 768px) { @@ -163,14 +159,12 @@ const TextContainer = styled.div` padding : 0 15px 0 0 } ` -export const WrappingCard = styled(Card)` - background: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; + +const WrappingCard = styled(Card)` border-radius: 0; margin-right : auto; margin-left : auto; margin-bottom: 30px; - margin-top: 30px; @media screen and (max-width: 768px) { width : 100% !important; @@ -182,21 +176,18 @@ export const WrappingCard = styled(Card)` width : 970px !important; } ` - const IconList = styled.div` margin: 15px; - background: ${props => props.contrast === "" ? "white" : "black"}; ` const IconItem = styled.span` width: 100%; display: inline-block; margin-bottom: 15px; font-size : 14px; - color: ${props => props.contrast === "" ? "#666" : "white"}; .MuiSvgIcon-root { vertical-align : middle - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; } img { @@ -206,11 +197,10 @@ const IconItem = styled.span` ` const Strong = styled.span` font-weight: bold; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; ` const Red = styled.span` - color: ${props => props.contrast === "" ? "#e81f4f" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color: #e81f4f; ` const StyledAnchor = styled.a` text-decoration: none !important; diff --git a/src/Components/FormationMaterialHeader.js b/src/Components/FormationMaterialHeader.js index b231cd0f7c91835d37d2b614b5b839127cbd9d6a..0c49772337828e81ec2ccfb9b045d3cb4f7ef2b9 100644 --- a/src/Components/FormationMaterialHeader.js +++ b/src/Components/FormationMaterialHeader.js @@ -38,13 +38,13 @@ export default function FormationMaterialHeader(props) { } const getThumb = () => { - return colecao ? + return colecao ? require(`../../public/${colecao_obj.img}`) : require(`../../public/${topico_obj.img}`) } return ( - <WrappingCard contrast={props.contrast}> + <WrappingCard> <Grid container direction="row" justify="flex-start" @@ -57,42 +57,38 @@ export default function FormationMaterialHeader(props) { direction="column" justify="flex-start" alignItems="stretch" - style={props.contrast === "" ? { padding: "8px 10px" } : { backgroundColor: "black" }} + style={{ padding: "8px 10px" }} > <Grid item> - <Title contrast={props.contrast}>{get_title()}</Title> + <Title>{get_title()}</Title> </Grid> <Grid item> - <SubTitle contrast={props.contrast}> + <SubTitle> {colecao ? get_subtitle() - : <StyledLink contrast={props.contrast} to={'/colecao?id=' + colecao_obj.id}>{get_subtitle()}</StyledLink>} + : <StyledLink to={'/colecao?id=' + colecao_obj.id}>{get_subtitle()}</StyledLink>} </SubTitle> </Grid> <Grid item> <ChipsDiv className={classes.root}> {colecao_obj.tags.map((t, index) => { - return (<Chip color="default" label={t.name} key={index} style={props.contrast === "" ? { padding: "0.5px" } : { border: "1px solid white", padding: "0.5px", backgroundColor: "black", color: "white" }} />); + return (<Chip color="default" label={t.name} key={index} style={{ padding: "0.5px" }} />); })} </ChipsDiv> </Grid> <Grid item> {colecao ? - <StyledDiv contrast={props.contrast}> - <Button - className="button" - variant="contained" - color="secondary" - style={{ marginLeft: '15px' }} - onClick={props.handleClick} - > - {props.colecao ? "Ver todos os módulos" : "Iniciar leitura"} - </Button> - </StyledDiv> + <Button + variant="contained" + color="secondary" + style={{ marginLeft: '15px' }} + onClick={props.handleClick} + > + {props.colecao ? "Ver todos os módulos" : "Iniciar leitura"} + </Button> : - <StyledLink contrast={props.contrast} to={'/iframe-colecao?colecao=' + colecao_obj.id + '&topico=' + topico_obj.id}> + <StyledLink to={'/iframe-colecao?colecao=' + colecao_obj.id + '&topico=' + topico_obj.id}> <Button - className="button" variant="contained" color="secondary" style={{ marginLeft: '15px', marginTop: '10px' }} @@ -123,18 +119,15 @@ const Img = styled.img` const Title = styled.h2` font-weight: 100; margin: 15px; - color: ${props => props.contrast === "" ? "rgb(102, 102, 102)" : "white"}; - + color: rgb(102, 102, 102); ` const SubTitle = styled.h4` font-weight: 50; margin: 15px;; margin-top: 0; - color: ${props => props.contrast === "" ? "rgb(102, 102, 102)" : "white"}; + color: rgb(102, 102, 102); ` export const WrappingCard = styled(Card)` - background: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; border-radius: 0; margin-right : auto; margin-left : auto; @@ -153,29 +146,6 @@ export const WrappingCard = styled(Card)` ` const StyledLink = styled(Link)` - color: ${props => props.contrast === "" ? "#e81f4f !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; - - .button{ - background-color: ${props => props.contrast === "" ? "" : "black "}; - color: ${props => props.contrast === "" ? "white" : "yellow"}; - border: ${props => props.contrast === "" ? "0" : "1px solid white"}; - :hover{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; - } - } -` - -const StyledDiv = styled.div` - color: ${props => props.contrast === "" ? "#e81f4f !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; - - .button{ - background-color: ${props => props.contrast === "" ? "" : "black "}; - color: ${props => props.contrast === "" ? "white" : "yellow"}; - border: ${props => props.contrast === "" ? "0" : "1px solid white"}; - :hover{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; - } - } + text-decoration: none !important; + color: #e81f4f !important; ` diff --git a/src/Components/Funcionalities.js b/src/Components/Funcionalities.js index eeaa81c9f065b6f8ff4ad417f87e28310ae269bd..5a1750b99f1915ed3ca133bfa51038daa6e164f9 100644 --- a/src/Components/Funcionalities.js +++ b/src/Components/Funcionalities.js @@ -16,8 +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, { useContext } from 'react'; -import { Row, Col, Container } from 'react-grid-system'; +import React, {Component} from 'react'; +import {Row, Col, Container} from 'react-grid-system'; //Image Import import { acessar } from "ImportImages.js"; @@ -26,103 +26,100 @@ import { compartilhar } from "ImportImages.js"; import { relatar } from "ImportImages.js"; import { seguir } from "ImportImages.js"; import { guardar } from "ImportImages.js"; -import { Store } from '../Store'; -const imgRow = { +const imgRow={ textAlign: "center", padding: "1%", fontFamily: "Roboto, sans-serif" }; -const title = { +const title={ display: "block", fontSize: "1.1em", fontWeight: "Bold", fontFamily: "Roboto, sans-serif", - textAlign: "center" + textAlign: "center" }; -const caption = { +const caption={ fontSize: "1.07em", fontWeight: "lighter", }; - -export default function Funcionalities() { - const { state } = useContext(Store) - - return ( - <div className={`${state.contrast}BackColor`}> - <Container style={{ textAlign: "center", paddingTop: "40px", paddingBottom: "40px", color: state.contrast === "" ? "#666" : "white" }}> - <h2 style={{ margin: 0, paddingBottom: 40 }}>Aqui na Plataforma você pode:</h2> +class Funcionalities extends Component{ + render(){ + return( + <Container style={{textAlign: "center", paddingBottom : "20px", color : "#666"}}> + <h2>Aqui na Plataforma você pode:</h2> <Row style={imgRow}> <Col sm={4} md={4}> - <img src={compartilhar} height="150px" alt="compartilhar recursos" /> + <img src={compartilhar} height="150px" alt="compartilhar recursos"/> <span> <span style={title}> Compartilhar </span> <span style={caption}> - com os colegas + com os colegas </span> </span> </Col> <Col sm={4} md={4}> - <img src={relatar} height="150px" alt="relatar experiências" /> + <img src={relatar} height="150px" alt="relatar experiências"/> <span> <span style={title}> Relatar experiências, </span> <span> - curtir e avaliar + curtir e avaliar </span> </span> </Col> <Col sm={4} md={4}> - <img src={guardar} height="150px" alt="guardar recursos" /> + <img src={guardar} height="150px" alt="guardar recursos"/> <span> <span style={title}> Guardar recursos </span> <span> - em coleções + em coleções </span> </span> </Col> <Col sm={4} md={4}> - <img src={seguir} height="150px" alt="seguir usuários" /> + <img src={seguir} height="150px" alt="seguir usuários"/> <span> <span style={title}> Seguir usuários </span> <span> - e suas coleções + e suas coleções </span> </span> </Col> <Col sm={4} md={4}> - <img src={baixar} height="150px" alt="baixar recursos" /> + <img src={baixar} height="150px" alt="baixar recursos"/> <span> <span style={title}> Baixar </span> <span> - recursos + recursos </span> </span> </Col> <Col sm={4} md={4}> - <img src={acessar} height="150px" alt="acessar materiais" /> + <img src={acessar} height="150px" alt="acessar materiais"/> <span> <span style={title}> Acessar materiais </span> <span> - de formação + de formação </span> </span> </Col> </Row> </Container> - </div> - ) + ) + } } +export default Funcionalities; diff --git a/src/Components/GreyButton.js b/src/Components/GreyButton.js index 10123e027e0712e9edc40476789a1fae87f7bd40..a2d687d5e50382fb1a39ec7bcf6bd5d3d314b47d 100644 --- a/src/Components/GreyButton.js +++ b/src/Components/GreyButton.js @@ -22,18 +22,21 @@ import styled from 'styled-components' export default function GreyButton (props) { return ( - <StyledButton onClick={props.callback} contrast={props.contrast}> + <StyledButton onClick={props.callback}> {props.text} </StyledButton> ) } const StyledButton = styled(Button)` + &:hover { + background-color : rgba(158,158,158,0.2) !important; + } max-height : 36px !important; background-color : transparent !important; - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration : ${props => props.contrast === "" ? "none" : "underline yellow"} !important; + color : #666 !important; + text-decoration : none !important; outline : none !important; text-align : center !important; diff --git a/src/Components/GuardarModal.js b/src/Components/GuardarModal.js index f08774eedc3638ad04a4d1b9ae87c6095a6a241a..075f74d6c4292d589c77ef4cdf10bc368d2937d9 100644 --- a/src/Components/GuardarModal.js +++ b/src/Components/GuardarModal.js @@ -35,7 +35,7 @@ import { getRequest, postRequest } from './HelperFunctions/getAxiosConfig' function CloseModalButton(props) { return ( <StyledCloseModalButton onClick={props.handleClose}> - <CloseIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }}/> + <CloseIcon /> </StyledCloseModalButton> ) } @@ -132,23 +132,23 @@ export default function GuardarModal(props) { onRendered={() => { getCols() }} > <Fade in={props.open}> - <Container className={`${props.contrast}BackColor ${props.contrast}Text ${props.contrast}Border`}> + <Container> <Header> <span style={{ width: "32px" }} /> <h2>Guardar recurso</h2> - <CloseModalButton contrast={props.contrast} handleClose={props.handleClose} /> + <CloseModalButton handleClose={props.handleClose} /> </Header> <Content style={{ paddingTop: "0" }}> <ResourceInfo> <img src={props.thumb ? apiDomain + props.thumb : require('../img/logo_small.svg')} alt="thumbnail recurso" /> - <div> + <div className="text"> <h3>{props.title}</h3> </div> </ResourceInfo> { loading ? ( - <LoadingSpinner contrast={props.contrast} text="Carregando coleções" /> + <LoadingSpinner text="Carregando coleções" /> ) : ( @@ -157,7 +157,6 @@ export default function GuardarModal(props) { creatingCol ? ( <CriarColecaoForm - contrast={props.contrast} handleClose={() => setCreating(false)} finalize={postToCol} /> @@ -170,15 +169,7 @@ export default function GuardarModal(props) { <div classname="no-cols"> <h2>Você não possui coleções ainda.</h2> </div> - <div style={{ display: "flex", justifyContent: "center" }}> - <CriarColButton className={`${props.contrast}LinkColor ${props.contrast}Border ContrastText`} - style={{backgroundColor: props.contrast === "" ? "#673ab7" : "black"}} - onClick={() => { setCreating(true) }} - > - CRIAR COLEÇÃO - </CriarColButton> - </div> - </> + </> ) : ( @@ -197,25 +188,12 @@ export default function GuardarModal(props) { } <h5>{collection.name}</h5> </div> - <GuardarBotao className={`${props.contrast}LinkColor ${props.contrast}Border ContrastText`} - style={{backgroundColor: props.contrast === "" ? "#673ab7" : "black"}} - onClick={() => { postToCol(collection.id) }} - > - GUARDAR - </GuardarBotao> + <GuardarBotao onClick={() => { postToCol(collection.id) }}>GUARDAR</GuardarBotao> </div> ) } </div> </ChooseCol> - <div style={{ display: "flex", justifyContent: "center" }}> - <CriarColButton className={`${props.contrast}LinkColor ${props.contrast}Border ContrastText`} - style={{backgroundColor: props.contrast === "" ? "#673ab7" : "black"}} - onClick={() => { setCreating(true) }} - > - CRIAR COLEÇÃO - </CriarColButton> - </div> </> ) @@ -225,6 +203,9 @@ export default function GuardarModal(props) { ) } + <div style={{ display: "flex", justifyContent: "center" }}> + <CriarColButton onClick={() => { setCreating(true) }}>CRIAR COLEÇÃO</CriarColButton> + </div> </Content> </Container> </Fade> @@ -234,7 +215,12 @@ export default function GuardarModal(props) { } const GuardarBotao = styled(Button)` + &:hover { + background-color : #503096 !important; + } max-height : 36px !important; + background-color : #673ab7 !important; + color : #fff !important; box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; padding-left : 32px !important; padding-right : 32px !important; @@ -293,8 +279,10 @@ const ChooseCol = styled.div` const CriarColButton = styled(Button)` width : 200px !important; margin-top : 16px !important; + background-color : #673ab7 !important; margin-left : auto !important; margin-right : auto !important; + color : #fff !important; font-weight : 600 !important; box-shadow : !important; padding-left : 0 2px 5px 0 rgba(0,0,0,.26) 16px !important; @@ -304,6 +292,7 @@ const CriarColButton = styled(Button)` const ChooseColContainer = styled.div` display : flex; flex-direction : column; + color : #666; .no-cols { align-self : center; @@ -316,18 +305,19 @@ const ChooseColContainer = styled.div` const ResourceInfo = styled.div` margin-top : 0; + background-color : #f4f4f4; overflow : hidden; border-radius : 5px; display : flex; flex-direction : column; align-items : center; align-content : center; - max-width : 100%; + max-wdith : 100%; justify-content : space-between; .text { max-height : 100%; - max-width : 100%; + max-width : 66.66%; display : flex; flex-direction : column; text-align : center; @@ -375,6 +365,7 @@ const Header = styled.div` h2 { font-size : 26px; font-weight : lighter; + color : #666 } ` @@ -404,6 +395,7 @@ const StyledModal = styled(Modal)` const Container = styled.div` box-sizing : border-box; box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12); + background-color : white; align : center; display : flex; flex-direction : column; @@ -420,5 +412,6 @@ const Container = styled.div` @media screen and (max-width : 699px) { width : 100%; + height : 100%; } ` diff --git a/src/Components/Header.js b/src/Components/Header.js index fb512f3c13fc314a98eb864fc7e8d67e26694952..54e02feaa381434678d74c13bb418de8fa126924 100644 --- a/src/Components/Header.js +++ b/src/Components/Header.js @@ -33,131 +33,123 @@ import { getRequest, validateGoogleLoginToken } from './HelperFunctions/getAxios // boxShadow :none; //` function Alert(props) { - return <MuiAlert elevation={6} variant="filled" {...props} />; + return <MuiAlert elevation={6} variant="filled" {...props} />; } export default function Header(props) { - const { state, dispatch } = useContext(Store) - const [signUpOpen, setSignUp] = useState(false) - const [loginOpen, setLogin] = useState(false) - const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) - const [modalColaborar, setModalColaborar] = useState(false) - - function handleSuccessValidateToken(data) { - dispatch({ - type: "USER_LOGGED_IN", - userLoggedIn: !state.userIsLoggedIn, - login: data.data - }) + const { state, dispatch } = useContext(Store) + const [signUpOpen, setSignUp] = useState(false) + const [loginOpen, setLogin] = useState(false) + const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) + const [modalColaborar, setModalColaborar] = useState(false) + + function handleSuccessValidateToken(data) { + dispatch({ + type: "USER_LOGGED_IN", + userLoggedIn: !state.userIsLoggedIn, + login: data.data } + ) + } - useEffect(() => { - if (localStorage.getItem('@portalmec/auth_headers')) { - const url = `/auth/validate_token/` - getRequest(url, handleSuccessValidateToken, (error) => { console.log(error) }) - } - const newContrast = localStorage.getItem("@portalmec/contrast"); - - return dispatch({ - type: 'SET_CONTRAST', - payload: newContrast - }) - }, []) - - let loc = useLocation() - let history = useHistory() - useEffect(() => { - const url = `/auth/validate_token/` - - let query = new URLSearchParams(loc.search) - - if (query.get("auth_token")) { - let config = { - headers: { - "access-token": query.get("auth_token"), - "client": query.get("client_id"), - "uid": query.get("uid"), - "expiry": query.get("expiry"), - "token-type": 'Bearer' - } - } - validateGoogleLoginToken(url, config, handleSuccessValidateToken, (error) => { console.log(error) }) - history.push("/") - } - }, [loc]) - - useEffect(() => { - if (state.currentUser.askTeacherQuestion === true) { - dispatch({ - type: "TOGGLE_MODAL_COLABORAR_PLATAFORMA", - modalColaborarPlataformaOpen: true - }); - } - }, [state.currentUser.askTeacherQuestion]) - - const toggleSnackbar = (event, reason) => { - if (reason === 'clickaway') { - return; - } - - handleSuccessfulLogin(false); + useEffect(() => { + if (localStorage.getItem('@portalmec/auth_headers')) { + const url = `/auth/validate_token/` + getRequest(url, handleSuccessValidateToken, (error) => { console.log(error) }) } - - const handleSignUp = () => { - setSignUp(!signUpOpen) + }, []) + + let loc = useLocation() + let history = useHistory() + useEffect(() => { + const url = `/auth/validate_token/` + + let query = new URLSearchParams(loc.search) + + if (query.get("auth_token")) { + let config = { + headers: { + "access-token": query.get("auth_token"), + "client": query.get("client_id"), + "uid": query.get("uid"), + "expiry": query.get("expiry"), + "token-type": 'Bearer' + } + } + validateGoogleLoginToken(url, config, handleSuccessValidateToken, (error) => { console.log(error) }) + history.push("/") } - - const handleLogin = () => { - setLogin(!loginOpen) + }, [loc]) + + useEffect(() => { + if (state.currentUser.askTeacherQuestion === true) { + dispatch({ + type: "TOGGLE_MODAL_COLABORAR_PLATAFORMA", + modalColaborarPlataformaOpen: true + }); } + }, [state.currentUser.askTeacherQuestion]) - const handleClickSearch = (open) => { - dispatch({ - type: "HANDLE_SEARCH_BAR", - opened: !state.searchOpen - }) + const toggleSnackbar = (event, reason) => { + if (reason === 'clickaway') { + return; } - let windowWidth = window.innerWidth - - return ( - <React.Fragment> - <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleSnackbar} - anchorOrigin={{ vertical: 'top', horizontal: 'center' }} - > - <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> - </Snackbar> - { - windowWidth > 990 ? - ( - <React.Fragment> - <div id="Pesquisa_scroll"></div> - <MenuBar openSearchBar={handleClickSearch} openSignUp={handleSignUp} openLogin={handleLogin} /> - { - state.searchOpen && - <SearchBar /> - } - </React.Fragment> - - ) - : - ( - <React.Fragment> - <div id="Pesquisa_scroll"></div> - <MenuBarMobile contrast={state.contrast} openSearchBar={handleClickSearch} openSignUp={handleSignUp} openLogin={handleLogin} /> - { - state.searchOpen && - <SearchBar /> - } - </React.Fragment> - ) - } - <SignUpModal contrast={state.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> - <LoginModal contrast={state.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} - openSnackbar={() => { handleSuccessfulLogin(true) }} - /> - <ColaborarModal contrast={state.contrast} open={modalColaborar} handleClose={() => { setModalColaborar(!modalColaborar) }} /> - </React.Fragment> - ) + handleSuccessfulLogin(false); + } + + const handleSignUp = () => { + setSignUp(!signUpOpen) + } + + const handleLogin = () => { + setLogin(!loginOpen) + } + + const handleClickSearch = (open) => { + dispatch({ + type: "HANDLE_SEARCH_BAR", + opened: !state.searchOpen + }) + } + + let windowWidth = window.innerWidth + + return ( + <React.Fragment> + <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleSnackbar} + anchorOrigin={{ vertical: 'top', horizontal: 'center' }} + > + <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> + </Snackbar> + { + windowWidth > 990 ? + ( + <React.Fragment> + <MenuBar openSearchBar={handleClickSearch} openSignUp={handleSignUp} openLogin={handleLogin} /> + { + state.searchOpen && + <SearchBar /> + } + </React.Fragment> + + ) + : + ( + <React.Fragment> + <MenuBarMobile openSearchBar={handleClickSearch} openSignUp={handleSignUp} openLogin={handleLogin} /> + { + state.searchOpen && + <SearchBar /> + } + </React.Fragment> + ) + } + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + openSnackbar={() => { handleSuccessfulLogin(true) }} /> + <ColaborarModal open={modalColaborar} handleClose={() => { setModalColaborar(!modalColaborar) }} /> + </React.Fragment> + ) } diff --git a/src/Components/HelpCenter/Cards/CardEncontrando.js b/src/Components/HelpCenter/Cards/CardEncontrando.js index efc9225132b3ad4adee8d9a3bf11abf341396464..fd8aa92928451d05560f0e5824c860d12401d98e 100644 --- a/src/Components/HelpCenter/Cards/CardEncontrando.js +++ b/src/Components/HelpCenter/Cards/CardEncontrando.js @@ -24,9 +24,9 @@ import { Link } from "react-router-dom"; //Image Import import { EncontrandoRecurso } from "ImportImages.js"; -export default function CardEncontrando({ contrast }) { +export default function CardEncontrando(props) { return ( - <CardAjuda contrast={contrast}> + <CardAjuda> <div className="card"> <img src={EncontrandoRecurso} alt="" /> <h3>Encontrando Recursos</h3> @@ -75,86 +75,83 @@ export default function CardEncontrando({ contrast }) { const CardAjuda = styled.div` -height: 360px; -margin-bottom: 20px; -width: 100%; - -.card { - height: 280px; - padding: 40px 15px; - text-align: center; - font-size: 14px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.24),0 1px 2px rgba(254,254,254,.48)"}; - margin-top:30px - h3 { - font-size: 23px; - font-weight: 400; - color: ${props => props.contrast === "" ? "#666" : "white"}; - margin-top: 20px; - margin-bottom: 10px; - line-height: 1.1; - } - - hr { - margin-top: 20px; - margin-bottom: 20px; - border: 0; - border-top: 1px solid #eee; - color: #a5a5a5; - } + height: 360px; + margin-bottom: 20px; + width: 100% - a { - font-size: 15px; - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: lighter; + .card { + height: 280px; + padding: 40px 15px; text-align: center; - :hover { - color: ${props => props.contrast === "" ? "#000" : "yellow"}; - font-weight: 500; + font-size: 14px; + background-color:#fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + margin-top:30px + h3 { + font-size: 23px; + font-weight: 400; + color: #666; + margin-top: 20px; + margin-bottom: 10px; + line-height: 1.1; } - } + hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eee; + color: #a5a5a5; + } - img { - height: 62px ; - width: 62px ; - } + a { + font-size: 15px; + color: #666; + text-decoration: none; + text-align: center; + :hover { + color: #000; + } -} + } + + img { + height: 62px ; + width: 62px ; + } -.card-rodape { - box-sizing: border-box; - - a { - border-radius: 0; - width: 100%; - font-size: 13px; - font-weight: 700; - color: ${props => props.contrast === "" ? "#fff" : "yellow"}; - transition: .2s ease; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - height: 40px; - line-height: 40px; - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"}; - touch-action: manipulation; - cursor: pointer; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - display: inline-block; - margin-bottom: 0; - text-align: center; - white-space: nowrap; - vertical-align: middle; - touch-action: manipulation; - cursor: pointer; - user-select: none; - box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); } - &:hover{ - a{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; + + .card-rodape { + box-sizing: border-box; + + a { + border-radius: 0; + width: 100%; + font-size: 13px; + font-weight: 700; + color: #fff; + transition: .2s ease; + border: none; + height: 40px; + line-height: 40px; + background-color: #00bcd4; + touch-action: manipulation; + cursor: pointer; + text-decoration: none; + display: inline-block; + margin-bottom: 0; + text-align: center; + white-space: nowrap; + vertical-align: middle; + touch-action: manipulation; + cursor: pointer; + user-select: none; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + } } + } + `; diff --git a/src/Components/HelpCenter/Cards/CardGerenciando.js b/src/Components/HelpCenter/Cards/CardGerenciando.js index 10487e95fe4d4c6ceae4a354e651ed89071bc4bc..3f4da6b0dba1b484aeeae15e935cf57828c10f12 100644 --- a/src/Components/HelpCenter/Cards/CardGerenciando.js +++ b/src/Components/HelpCenter/Cards/CardGerenciando.js @@ -24,9 +24,9 @@ import { Link } from "react-router-dom"; //Image Import import { GerenciandoConta } from "ImportImages.js"; -export default function CardGerenciando({ contrast }) { +export default function CardGerenciando(props) { return ( - <CardAjuda contrast={contrast}> + <CardAjuda> <div className="card"> <img src={GerenciandoConta} alt="" /> <h3>Gerenciando Conta</h3> @@ -93,87 +93,84 @@ export default function CardGerenciando({ contrast }) { const CardAjuda = styled.div` -height: 360px; -margin-bottom: 20px; -width: 100%; - -.card { - height: 280px; - padding: 40px 15px; - text-align: center; - font-size: 14px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.24),0 1px 2px rgba(254,254,254,.48)"}; - margin-top:30px - h3 { - font-size: 23px; - font-weight: 400; - color: ${props => props.contrast === "" ? "#666" : "white"}; - margin-top: 20px; - margin-bottom: 10px; - line-height: 1.1; - } - - hr { - margin-top: 20px; - margin-bottom: 20px; - border: 0; - border-top: 1px solid #eee; - color: #a5a5a5; - } + height: 360px; + margin-bottom: 20px; + width: 100% - a { - font-size: 15px; - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: lighter; + .card { + height: 280px; + padding: 40px 15px; text-align: center; - :hover { - color: ${props => props.contrast === "" ? "#000" : "yellow"}; - font-weight: 500; + font-size: 14px; + background-color:#fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + margin-top:30px + + h3 { + font-size: 23px; + font-weight: 400; + color: #666; + margin-top: 20px; + margin-bottom: 10px; + line-height: 1.1; } - } + hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eee; + color: #a5a5a5; + } - img { - height: 62px ; - width: 62px ; - } + a { + font-size: 15px; + color: #666; + text-decoration: none; + text-align: center; + :hover { + color: #000; + } -} + } + + img { + height: 62px ; + width: 62px ; + } -.card-rodape { - box-sizing: border-box; - - a { - border-radius: 0; - width: 100%; - font-size: 13px; - font-weight: 700; - color: ${props => props.contrast === "" ? "#fff" : "yellow"}; - transition: .2s ease; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - height: 40px; - line-height: 40px; - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"}; - touch-action: manipulation; - cursor: pointer; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - display: inline-block; - margin-bottom: 0; - text-align: center; - white-space: nowrap; - vertical-align: middle; - touch-action: manipulation; - cursor: pointer; - user-select: none; - box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); } - &:hover{ - a{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; + + .card-rodape { + box-sizing: border-box; + + a { + border-radius: 0; + width: 100%; + font-size: 13px; + font-weight: 700; + color: #fff; + transition: .2s ease; + border: none; + height: 40px; + line-height: 40px; + background-color: #00bcd4; + touch-action: manipulation; + cursor: pointer; + text-decoration: none; + display: inline-block; + margin-bottom: 0; + text-align: center; + white-space: nowrap; + vertical-align: middle; + touch-action: manipulation; + cursor: pointer; + user-select: none; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + } } + } `; diff --git a/src/Components/HelpCenter/Cards/CardParticipando.js b/src/Components/HelpCenter/Cards/CardParticipando.js index ab2fc83c9ba29f8ebfdbb13e20a448ac3a51c10d..31f0ad95a5b97bc70c9931d5a35f4990da8e87ee 100644 --- a/src/Components/HelpCenter/Cards/CardParticipando.js +++ b/src/Components/HelpCenter/Cards/CardParticipando.js @@ -24,9 +24,9 @@ import { Link } from "react-router-dom"; //Image Import import { ParticipandoRede } from "ImportImages.js"; -export default function CardParticipando({ contrast }) { +export default function CardParticipando(props) { return ( - <CardAjuda contrast={contrast}> + <CardAjuda> <div className="card"> <img src={ParticipandoRede} alt="" /> <h3>Participando da Rede</h3> @@ -66,87 +66,86 @@ export default function CardParticipando({ contrast }) { const CardAjuda = styled.div` -height: 360px; -margin-bottom: 20px; -width: 100%; - -.card { - height: 280px; - padding: 40px 15px; - text-align: center; - font-size: 14px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.24),0 1px 2px rgba(254,254,254,.48)"}; - margin-top:30px - h3 { - font-size: 23px; - font-weight: 400; - color: ${props => props.contrast === "" ? "#666" : "white"}; - margin-top: 20px; - margin-bottom: 10px; - line-height: 1.1; - } - - hr { - margin-top: 20px; - margin-bottom: 20px; - border: 0; - border-top: 1px solid #eee; - color: #a5a5a5; - } + height: 360px; + margin-bottom: 20px; + width: 100% + - a { - font-size: 15px; - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: lighter; + .card { + height: 280px; + padding: 40px 15px; text-align: center; - :hover { - color: ${props => props.contrast === "" ? "#000" : "yellow"}; - font-weight: 500; + font-size: 14px; + background-color:#fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + margin-top:30px + + + h3 { + font-size: 23px; + font-weight: 400; + color: #666; + margin-top: 20px; + margin-bottom: 10px; + line-height: 1.1; } - } + hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eee; + color: #a5a5a5; + } - img { - height: 62px ; - width: 62px ; - } + a { + font-size: 15px; + color: #666; + text-decoration: none; + text-align: center; + :hover { + color: #000; + } -} + } + + img { + height: 62px ; + width: 62px ; + } -.card-rodape { - box-sizing: border-box; - - a { - border-radius: 0; - width: 100%; - font-size: 13px; - font-weight: 700; - color: ${props => props.contrast === "" ? "#fff" : "yellow"}; - transition: .2s ease; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - height: 40px; - line-height: 40px; - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"}; - touch-action: manipulation; - cursor: pointer; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - display: inline-block; - margin-bottom: 0; - text-align: center; - white-space: nowrap; - vertical-align: middle; - touch-action: manipulation; - cursor: pointer; - user-select: none; - box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); } - &:hover{ - a{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; + + .card-rodape { + box-sizing: border-box; + + a { + border-radius: 0; + width: 100%; + font-size: 13px; + font-weight: 700; + color: #fff; + transition: .2s ease; + border: none; + height: 40px; + line-height: 40px; + background-color: #00bcd4; + touch-action: manipulation; + cursor: pointer; + text-decoration: none; + display: inline-block; + margin-bottom: 0; + text-align: center; + white-space: nowrap; + vertical-align: middle; + touch-action: manipulation; + cursor: pointer; + user-select: none; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + } } + } `; diff --git a/src/Components/HelpCenter/Cards/CardPublicando.js b/src/Components/HelpCenter/Cards/CardPublicando.js index 303cf2db9cd0efec19da9b498576fd9900c5e240..0c6f489df27ab92bc3cdb617bf90dd4e93a1bd1e 100644 --- a/src/Components/HelpCenter/Cards/CardPublicando.js +++ b/src/Components/HelpCenter/Cards/CardPublicando.js @@ -23,9 +23,9 @@ import { Link } from "react-router-dom"; //Image Import import { PublicandoRecursos } from "ImportImages.js"; -export default function CardPublicando({ contrast }) { +export default function CardPublicando(props) { return ( - <CardAjuda contrast={contrast}> + <CardAjuda> <div className="card"> <img src={PublicandoRecursos} alt="" /> <h3>Publicando Recursos</h3> @@ -76,20 +76,20 @@ const CardAjuda = styled.div` height: 360px; margin-bottom: 20px; -width: 100%; +width: 100% .card { height: 280px; padding: 40px 15px; text-align: center; font-size: 14px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.24),0 1px 2px rgba(254,254,254,.48)"}; + background-color:#fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); margin-top:30px h3 { font-size: 23px; font-weight: 400; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; margin-top: 20px; margin-bottom: 10px; line-height: 1.1; @@ -105,13 +105,11 @@ width: 100%; a { font-size: 15px; - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: lighter; + color: #666; + text-decoration: none; text-align: center; :hover { - color: ${props => props.contrast === "" ? "#000" : "yellow"}; - font-weight: 500; + color: #000; } } @@ -131,15 +129,15 @@ width: 100%; width: 100%; font-size: 13px; font-weight: 700; - color: ${props => props.contrast === "" ? "#fff" : "yellow"}; + color: #fff; transition: .2s ease; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; + border: none; height: 40px; line-height: 40px; - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"}; + background-color: #00bcd4; touch-action: manipulation; cursor: pointer; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + text-decoration: none; display: inline-block; margin-bottom: 0; text-align: center; @@ -149,12 +147,10 @@ width: 100%; cursor: pointer; user-select: none; box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + } - &:hover{ - a{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; - } - } +} + } `; diff --git a/src/Components/HelpCenter/TabsManageAc/Forget.js b/src/Components/HelpCenter/TabsManageAc/Forget.js index ad0a69ad35b0aca8a138daf29786ed7e9ea90836..21d598d30610c0463e84e88cad9ce332cd2be6cf 100644 --- a/src/Components/HelpCenter/TabsManageAc/Forget.js +++ b/src/Components/HelpCenter/TabsManageAc/Forget.js @@ -24,68 +24,76 @@ import { LoginImg } from "ImportImages.js"; import { RecuperarSenhaImg } from "ImportImages.js"; export default function Forget(props) { - return( - <Card contrast={props.contrast}> - <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> - <div style={{marginBottom: "9px"}}> - <span>{props.title}</span> - </div> - <p>Para redefinir a senha da sua conta, siga essas instruções:</p> - <ol> - <li> - Acesse a <a href="/" target="_blank">Página Inicial</a> e clique em - “Entrar” no canto superior direito da página. - </li> - <li>Clique em “Esqueceu a senha? Clique Aqui!”.</li> - <img className="primeira" src={LoginImg} alt="primeira imagem"/> - <li>Preencha com o seu endereço de e-mail e clique em “Buscar”.</li> - <img className="segunda" src={RecuperarSenhaImg} alt="segunda imagem"/> - <li>Você receberá um e-mail no endereço informado, contendo as instruções para redefinir sua senha.</li> - </ol> - </Card> - ); + return( + <Card> + <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> + <div style={{marginBottom: "9px"}}> + <span>{props.title}</span> + </div> + <p>Para redefinir a senha da sua conta, siga essas instruções:</p> + + <ol> + <li> + Acesse a <a href="/" target="_blank">Página Inicial</a> e clique em + “Entrar” no canto superior direito da página. + </li> + <li>Clique em “Esqueceu a senha? Clique Aqui!”.</li> + <img className="primeira" src={LoginImg} alt="primeira imagem"/> + <li>Preencha com o seu endereço de e-mail e clique em “Buscar”.</li> + <img className="segunda" src={RecuperarSenhaImg} alt="segunda imagem"/> + <li>Você receberá um e-mail no endereço informado, contendo as instruções para redefinir sua senha.</li> + </ol> + + </Card> + ); } const Card = styled.div` - margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; - padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; - span { - font-size: 14px; - font-weight: bold; - } + margin-bottom: 5px; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + padding: 30px; + color: #666; + span { + font-size: 14px; + font-weight: bold; + } - a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - :hover { - text-decoration: underline; - } + a { + color: #00bcd4; + text-decoration: none; + :hover { + text-decoration: underline; } + } - ol { - margin-top: 0; - margin-bottom: 10px; - line-height: 1.42857143; - .primeira { - height: 300px; - margin-right: 40px; - vertical-align: middle; - } - .segunda { - height: 150px; - margin-right: 40px; - vertical-align: middle; - } + ol { + margin-top: 0; + margin-bottom: 10px; + line-height: 1.42857143; + .primeira { + + height: 300px; + margin-right: 40px; + vertical-align: middle; } - - li { - font-size: 14px; + .segunda { + height: 150px; + margin-right: 40px; + vertical-align: middle; + } + } + li { + font-size: 14px; + } + + + p { + margin: 0 0 10px; + font-size: 15px; + } + + - p { - margin: 0 0 10px; - font-size: 15px; - } ` \ No newline at end of file diff --git a/src/Components/HelpCenter/TabsManageAc/HowToAccess.js b/src/Components/HelpCenter/TabsManageAc/HowToAccess.js index 8abce58dc466ebda9660ffc9556885c191c24cb8..aa06035616a818f7c2f82a0395ab93caaab5ea85 100644 --- a/src/Components/HelpCenter/TabsManageAc/HowToAccess.js +++ b/src/Components/HelpCenter/TabsManageAc/HowToAccess.js @@ -24,7 +24,7 @@ import styled from 'styled-components'; export default function HowtoAccess(props) { return( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> <div style={{marginBottom: "9px"}}> <span>{props.title}</span> @@ -48,16 +48,17 @@ export default function HowtoAccess(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; } a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; + color: #00bcd4; + text-decoration: none; :hover { text-decoration: underline; } diff --git a/src/Components/HelpCenter/TabsManageAc/HowToChange.js b/src/Components/HelpCenter/TabsManageAc/HowToChange.js index acaf53e542823d246cb2ba79ec50a1bf7001a850..1b119e9909b898331d788c1098d0abe58d0d7fb1 100644 --- a/src/Components/HelpCenter/TabsManageAc/HowToChange.js +++ b/src/Components/HelpCenter/TabsManageAc/HowToChange.js @@ -24,7 +24,7 @@ import styled from 'styled-components'; export default function HowToDo(props) { return( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> <div style={{marginBottom: "9px"}}> <span>{props.title}</span> @@ -49,16 +49,17 @@ export default function HowToDo(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; } a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; + color: #00bcd4; + text-decoration: none; :hover { text-decoration: underline; } diff --git a/src/Components/HelpCenter/TabsManageAc/HowToDo.js b/src/Components/HelpCenter/TabsManageAc/HowToDo.js index 23fbc07e44d64ae8f8d5dd09ea43a318f0172694..f2df2d292e40e39c2367a1939c956a8313cecc21 100644 --- a/src/Components/HelpCenter/TabsManageAc/HowToDo.js +++ b/src/Components/HelpCenter/TabsManageAc/HowToDo.js @@ -16,49 +16,50 @@ 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 from 'react'; import styled from 'styled-components'; export default function HowTodo(props) { - return ( - <Card contrast={props.contrast}> - <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet" /> - <div style={{ marginBottom: "9px" }}> + return( + <Card> + <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> + <div style={{marginBottom: "9px"}}> <span>{props.title}</span> </div> <p> Para fazer o cadastro é rapidinho: </p> <ol> <li>Acesse a <a href="/" target="_blank">Página Inicial</a> da Plataforma.</li> - + <li>Clique em “Cadastre-se” no canto superior direito da página.</li> - + <li> Preencha os campos solicitados.</li> - + <li>Clique em “Cadastrar”.</li> </ol> - + <p>Pronto! Você será conectado automaticamente.</p> <p>Nas próximas vezes que acessar a Plataforma, clique em “Entrar” e faça o login com seus dados de cadastro.</p> - + </Card> ); } const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; } a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; + color: #00bcd4; + text-decoration: none; :hover { text-decoration: underline; } diff --git a/src/Components/HelpCenter/TabsManageAc/Why.js b/src/Components/HelpCenter/TabsManageAc/Why.js index 327481ad8f54b054e9fffac672cb74117cb9d9f4..09c243b07d805edb7d9d1efe93b56b92492eb479 100644 --- a/src/Components/HelpCenter/TabsManageAc/Why.js +++ b/src/Components/HelpCenter/TabsManageAc/Why.js @@ -25,7 +25,7 @@ import styled from 'styled-components'; export default function Why(props) { return( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> <div style={{marginBottom: "9px"}}> <span>{props.title}</span> @@ -48,10 +48,10 @@ export default function Why(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; diff --git a/src/Components/HelpCenter/TabsNetPart/How.js b/src/Components/HelpCenter/TabsNetPart/How.js index b110d153f702556b3ed47bfeb27e14b24c63c713..221667e30390c391aa1dab7f9c3264eddcadfe9c 100644 --- a/src/Components/HelpCenter/TabsNetPart/How.js +++ b/src/Components/HelpCenter/TabsNetPart/How.js @@ -25,7 +25,7 @@ import styled from 'styled-components'; export default function How(props) { return( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> <div style={{marginBottom: "9px"}}> <span>{props.title}</span> @@ -51,10 +51,10 @@ export default function How(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; diff --git a/src/Components/HelpCenter/TabsNetPart/What.js b/src/Components/HelpCenter/TabsNetPart/What.js index d68e07f9f98660a87fe96571738d546cb0e7d083..8171c7e4253436ddb50edb6a2c337981e51d4393 100644 --- a/src/Components/HelpCenter/TabsNetPart/What.js +++ b/src/Components/HelpCenter/TabsNetPart/What.js @@ -25,7 +25,7 @@ import styled from 'styled-components'; export default function What(props) { return( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> <div style={{marginBottom: "9px"}}> <span>{props.title}</span> @@ -52,10 +52,10 @@ export default function What(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; diff --git a/src/Components/HelpCenter/TabsPlataformaMEC/How.js b/src/Components/HelpCenter/TabsPlataformaMEC/How.js index dfb466be66a71ddbdb1a56d4cef8584ec574d606..9834d9398962afcdd63315b747f1bb2f5880c2b7 100644 --- a/src/Components/HelpCenter/TabsPlataformaMEC/How.js +++ b/src/Components/HelpCenter/TabsPlataformaMEC/How.js @@ -21,7 +21,7 @@ import styled from "styled-components"; export default function How(props) { return ( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet" @@ -29,11 +29,11 @@ export default function How(props) { <div style={{ marginBottom: "9px" }}> <span>{props.title}</span> </div> - <div> + <div style={{ width: "640px", height: "360px" }}> <iframe title="Video Página Ajuda" - width="100%" - height={window.innerHeight} + width="640" + height="360" src="https://www.youtube.com/embed/CRW5h2pHugM" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" @@ -45,29 +45,36 @@ export default function How(props) { } const Card = styled.div` - background: ${props => props.contrast === "" ? "#fff" : "black"}; + margin-bottom: 5px; + background-color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); - padding: 2em 1.5em; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - font-weight: lighter; - + padding: 30px; + color: #666; span { font-size: 14px; font-weight: bold; } a { - font-weight: lighter; - font-family: 'Roboto', 'sans-serif'; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - :hover{ - cursor: pointer; - font-weight: 500; + color: #00bcd4; + text-decoration: none; + :hover { + text-decoration: underline; } } + ul { + padding-left: 0 !important; + margin-top: 0; + margin-bottom: 10px; + line-height: 1.42857143; + } + + li { + list-style-type: none; + font-size: 14px; + } + p { margin: 0 0 10px; font-size: 15px; diff --git a/src/Components/HelpCenter/TabsPlataformaMEC/Software.js b/src/Components/HelpCenter/TabsPlataformaMEC/Software.js index 4bd517979d9845a910c49e7923fc4cb0b454862f..9da4c8bddb9a5659b3755d965572926698d3aea7 100644 --- a/src/Components/HelpCenter/TabsPlataformaMEC/Software.js +++ b/src/Components/HelpCenter/TabsPlataformaMEC/Software.js @@ -87,7 +87,7 @@ const softwares = [ export default function Software(props) { return ( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet" @@ -134,18 +134,24 @@ export default function Software(props) { } const Card = styled.div` - background: ${props => props.contrast === "" ? "#fff" : "black"}; + margin-bottom: 5px; + background-color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); - padding: 2em 1.5em; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - font-weight: lighter; - + padding: 30px; + color: #666; span { font-size: 14px; font-weight: bold; } + a { + color: #00bcd4; + text-decoration: none; + :hover { + text-decoration: underline; + } + } + ul { padding-left: 0 !important; margin-top: 0; @@ -158,17 +164,6 @@ const Card = styled.div` font-size: 14px; } - a { - font-weight: lighter; - font-family: 'Roboto', 'sans-serif'; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - :hover{ - cursor: pointer; - font-weight: 500; - } - } - p { margin: 0 0 10px; font-size: 15px; diff --git a/src/Components/HelpCenter/TabsPlataformaMEC/Types.js b/src/Components/HelpCenter/TabsPlataformaMEC/Types.js index 0858c1f9a229ace404a106f6a955d05330093255..1d30662b8f79b6741a0708cd906fb57c38d3547e 100644 --- a/src/Components/HelpCenter/TabsPlataformaMEC/Types.js +++ b/src/Components/HelpCenter/TabsPlataformaMEC/Types.js @@ -30,7 +30,7 @@ const tipos = [ export default function Types(props) { return ( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet" @@ -57,13 +57,11 @@ export default function Types(props) { } const Card = styled.div` - background: ${props => props.contrast === "" ? "#fff" : "black"}; + margin-bottom: 5px; + background-color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); - padding: 2em 1.5em; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - font-weight: lighter; - + padding: 30px; + color: #666; span { font-size: 14px; font-weight: bold; @@ -81,19 +79,8 @@ const Card = styled.div` font-size: 14px; } - a { - font-weight: lighter; - font-family: 'Roboto', 'sans-serif'; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - :hover{ - cursor: pointer; - font-weight: 500; - } - } - p { margin: 0 0 10px; font-size: 15px; } -`; \ No newline at end of file +`; diff --git a/src/Components/HelpCenter/TabsPlataformaMEC/Understand.js b/src/Components/HelpCenter/TabsPlataformaMEC/Understand.js index d267d1825d2318601eab632b6b822828174fd621..4696bce01ce19794d4adf4f827f263e65f2bc488 100644 --- a/src/Components/HelpCenter/TabsPlataformaMEC/Understand.js +++ b/src/Components/HelpCenter/TabsPlataformaMEC/Understand.js @@ -21,7 +21,7 @@ import styled from "styled-components"; export default function Understand(props) { return ( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet" @@ -59,32 +59,18 @@ export default function Understand(props) { } const Card = styled.div` - background: ${props => props.contrast === "" ? "#fff" : "black"}; + margin-bottom: 5px; + background-color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); - padding: 2em 1.5em; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - font-weight: lighter; - + padding: 30px; + color: #666; span { font-size: 14px; font-weight: bold; } - a { - font-weight: lighter; - font-family: 'Roboto', 'sans-serif'; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - :hover{ - cursor: pointer; - font-weight: 500; - } - } - p { margin: 0 0 10px; font-size: 15px; } `; - diff --git a/src/Components/HelpCenter/TabsPlataformaMEC/What.js b/src/Components/HelpCenter/TabsPlataformaMEC/What.js index 074156625f153fcb8afd37226ef2ad3f4349e3b3..8bab746bc3418efd516b158125a50a366cabfa0d 100644 --- a/src/Components/HelpCenter/TabsPlataformaMEC/What.js +++ b/src/Components/HelpCenter/TabsPlataformaMEC/What.js @@ -21,7 +21,7 @@ import styled from "styled-components"; export default function What(props) { return ( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet" @@ -92,26 +92,21 @@ export default function What(props) { } const Card = styled.div` - background: ${props => props.contrast === "" ? "#fff" : "black"}; + margin-bottom: 5px; + background-color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); - padding: 2em 1.5em; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - font-weight: lighter; - + padding: 30px; + color: #666; span { font-size: 14px; font-weight: bold; } a { - font-weight: lighter; - font-family: 'Roboto', 'sans-serif'; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - :hover{ - cursor: pointer; - font-weight: 500; + color: #00bcd4; + text-decoration: none; + :hover { + text-decoration: underline; } } diff --git a/src/Components/HelpCenter/TabsPlataformaMEC/Which.js b/src/Components/HelpCenter/TabsPlataformaMEC/Which.js index a03cc587dd0523e9ec74f3bec480664f30f235c8..b1fe77ed63697519fb011663dbcce423708ef1c7 100644 --- a/src/Components/HelpCenter/TabsPlataformaMEC/Which.js +++ b/src/Components/HelpCenter/TabsPlataformaMEC/Which.js @@ -28,7 +28,7 @@ const parcas = [ export default function Which(props) { return ( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet" @@ -50,13 +50,11 @@ export default function Which(props) { } const Card = styled.div` - background: ${props => props.contrast === "" ? "#fff" : "black"}; + margin-bottom: 5px; + background-color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); - padding: 2em 1.5em; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - font-weight: lighter; - + padding: 30px; + color: #666; span { font-size: 14px; font-weight: bold; @@ -74,17 +72,6 @@ const Card = styled.div` font-size: 14px; } - a { - font-weight: lighter; - font-family: 'Roboto', 'sans-serif'; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - :hover{ - cursor: pointer; - font-weight: 500; - } - } - p { margin: 0 0 10px; font-size: 15px; diff --git a/src/Components/HelpCenter/TabsResourseFind/HowToDo.js b/src/Components/HelpCenter/TabsResourseFind/HowToDo.js index abdfa089000d2604022350e5f7f25cb5db0f1314..204ca709ed9eefa440feea703239043ff35997aa 100644 --- a/src/Components/HelpCenter/TabsResourseFind/HowToDo.js +++ b/src/Components/HelpCenter/TabsResourseFind/HowToDo.js @@ -24,7 +24,7 @@ import { Busca } from "ImportImages.js"; export default function HowToDo(props) { return( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> <div style={{marginBottom: "9px"}}> <span>{props.title}</span> @@ -52,21 +52,26 @@ export default function HowToDo(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; } + + img { + height: auto; + width: 100%; + } a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; + color: #00bcd4; + text-decoration: none; :hover { text-decoration: underline; } } - ol { margin-top: 0; margin-bottom: 10px; @@ -82,4 +87,6 @@ const Card = styled.div` font-size: 15px; } + + ` \ No newline at end of file diff --git a/src/Components/HelpCenter/TabsResourseFind/HowToFilter.js b/src/Components/HelpCenter/TabsResourseFind/HowToFilter.js index 5cbf2a4c8bd368c0a30dc59d0aa16d882f4426a5..7ea8e558d04204d6d3ea97ad4ba15bab7295df9e 100644 --- a/src/Components/HelpCenter/TabsResourseFind/HowToFilter.js +++ b/src/Components/HelpCenter/TabsResourseFind/HowToFilter.js @@ -24,7 +24,7 @@ import { Filtros } from "ImportImages.js"; export default function HowToFilter(props) { return( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> <div style={{marginBottom: "9px"}}> <span>{props.title}</span> @@ -45,10 +45,10 @@ export default function HowToFilter(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; diff --git a/src/Components/HelpCenter/TabsResourseFind/HowToRank.js b/src/Components/HelpCenter/TabsResourseFind/HowToRank.js index 47f8cfcedf179169ba4b9609dab92e7f93b42626..cb2a04b6a64b73d1721edaf51aed65214c6c2801 100644 --- a/src/Components/HelpCenter/TabsResourseFind/HowToRank.js +++ b/src/Components/HelpCenter/TabsResourseFind/HowToRank.js @@ -25,7 +25,7 @@ import styled from 'styled-components'; export default function HowToRank(props) { return( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> <div style={{marginBottom: "9px"}}> <span>{props.title}</span> @@ -46,10 +46,10 @@ export default function HowToRank(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; diff --git a/src/Components/HelpCenter/TabsResoursePub/How.js b/src/Components/HelpCenter/TabsResoursePub/How.js index 86a03146dddc945345cfea624f63f6ce596c411e..a84cd304098a103d6906a6ea2e5ed2f8481ae989 100644 --- a/src/Components/HelpCenter/TabsResoursePub/How.js +++ b/src/Components/HelpCenter/TabsResoursePub/How.js @@ -24,7 +24,7 @@ import styled from 'styled-components'; export default function How(props) { return( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> <div style={{marginBottom: "9px"}}> <span>{props.title}</span> @@ -62,16 +62,17 @@ export default function How(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; } a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; + color: #00bcd4; + text-decoration: none; :hover { text-decoration: underline; } diff --git a/src/Components/HelpCenter/TabsResoursePub/Which.js b/src/Components/HelpCenter/TabsResoursePub/Which.js index e3a194201626781a2d5582e677a8c0d513a2c5d1..49a5e1f1e525cfdb04afe4fc6263bf9e57433185 100644 --- a/src/Components/HelpCenter/TabsResoursePub/Which.js +++ b/src/Components/HelpCenter/TabsResoursePub/Which.js @@ -24,7 +24,7 @@ import styled from 'styled-components'; export default function Which(props) { return( - <Card contrast={props.contrast}> + <Card> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> <div style={{marginBottom: "9px"}}> <span>{props.title}</span> @@ -55,10 +55,10 @@ export default function Which(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; diff --git a/src/Components/HelpCenter/TabsResoursePub/Why.js b/src/Components/HelpCenter/TabsResoursePub/Why.js index 349875cc4b874305c44093d7ec96adbffeba7102..ca1a16b9ece1538ed7640c181c5873d7f1e54668 100644 --- a/src/Components/HelpCenter/TabsResoursePub/Why.js +++ b/src/Components/HelpCenter/TabsResoursePub/Why.js @@ -23,31 +23,31 @@ import styled from 'styled-components'; export default function Why(props) { - return ( - <Card contrast={props.contrast}> - <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet" /> - <div style={{ marginBottom: "9px" }}> + return( + <Card> + <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet"/> + <div style={{marginBottom: "9px"}}> <span>{props.title}</span> </div> <p> - Ao enviar um recurso você estará ajudando a fortalecer a distribuição - de recursos educacionais digitais para o ensino básico brasileiro e - contribuindo na valorização da pluralidade e da diversidade da educação + Ao enviar um recurso você estará ajudando a fortalecer a distribuição + de recursos educacionais digitais para o ensino básico brasileiro e + contribuindo na valorização da pluralidade e da diversidade da educação brasileira. </p> - + <p> - A Plataforma MEC é um meio seguro e um site de referência para a - publicação e disseminação de Recursos Educacionais Digitais. Aproveite - esse espaço para compartilhar com professores de todo o Brasil recursos - criados por você ou aquele recurso de outro autor que você usou em aula + A Plataforma MEC é um meio seguro e um site de referência para a + publicação e disseminação de Recursos Educacionais Digitais. Aproveite + esse espaço para compartilhar com professores de todo o Brasil recursos + criados por você ou aquele recurso de outro autor que você usou em aula e seus alunos gostaram! </p> <p> - A partir do momento que seu recurso estiver publicado na Plataforma, os - usuários poderão interagir com seu recurso e você receberá as - notificações dos comentários, avaliações e curtidas. Cada uma dessas - interações contam para que seu recurso ganhe uma posição de destaque + A partir do momento que seu recurso estiver publicado na Plataforma, os + usuários poderão interagir com seu recurso e você receberá as + notificações dos comentários, avaliações e curtidas. Cada uma dessas + interações contam para que seu recurso ganhe uma posição de destaque na Plataforma. </p> <p>Participe dessa rede de colaboração de fomento da qualidade da educação básica!</p> @@ -57,10 +57,10 @@ export default function Why(props) { const Card = styled.div` margin-bottom: 5px; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 14px; font-weight: bold; diff --git a/src/Components/HelperFunctions/getAxiosConfig.js b/src/Components/HelperFunctions/getAxiosConfig.js index b987089a9b605807ee2a536735d453cc46495447..8ced7d5be70b3d08d7b2cb3f7864f801b8c2d484 100644 --- a/src/Components/HelperFunctions/getAxiosConfig.js +++ b/src/Components/HelperFunctions/getAxiosConfig.js @@ -284,6 +284,7 @@ export const validateGoogleLoginToken = (url, config, onSuccess, onError) => { }) }) .then(data => { + console.log(data) onSuccess(data) }) .catch(error => { diff --git a/src/Components/HomeScreenSearchBar.js b/src/Components/HomeScreenSearchBar.js index ab276143f5a73e7e6adcbc9b8bd3a0b2064d839e..634b625e1c487e585f97ed95965fe5b53d87a175 100644 --- a/src/Components/HomeScreenSearchBar.js +++ b/src/Components/HomeScreenSearchBar.js @@ -24,28 +24,10 @@ import Menu from '@material-ui/core/Menu'; import { Store } from '../Store'; import { List, ListItem, ListItemIcon, ListItemText, MenuItem, Button, TextField } from '@material-ui/core' import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown'; -import { makeStyles } from '@material-ui/core/styles'; import SearchIcon from '@material-ui/icons/Search'; +/*import {Link} from 'react-router-dom'*/ -export const useStyles = makeStyles(theme => ({ - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - color: "white", - width: "100%" - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - color: "black", - width: "100%" - } -})); - -export default function HomeScreenSearchBar() { - - const classes = useStyles(); - +export default function HomeScreenSearchBar(props) { const [query, setQuery] = useState("") const [searchClass, setSearchClass] = useState('LearningObject') @@ -85,9 +67,9 @@ export default function HomeScreenSearchBar() { } const options = [ - { text: "Recursos", value: "LearningObject", color: state.contrast === "" ? "#ff7f00" : "yellow", backColor: state.contrast === "" ? "#ff7f00" : "black"}, - { text: "Coleções", value: "Collection", color: state.contrast === "" ? "#673ab7" : "yellow", backColor: state.contrast === "" ? "#673ab7" : "black"}, - { text: "Usuários", value: "User", color: state.contrast === "" ? "#00bcd4" : "yellow", backColor: state.contrast === "" ? "#00bcd4" : "black"}, + { text: "Recursos", value: "LearningObject", color: "#ff7f00" }, + { text: "Coleções", value: "Collection", color: "#673ab7" }, + { text: "Usuários", value: "User", color: "#00bcd4" }, ] const [anchorEl, setAnchorEl] = React.useState(null); const [selectedIndex, setSelectedIndex] = React.useState(0); @@ -97,6 +79,7 @@ export default function HomeScreenSearchBar() { }; const handleMenuItemClick = (event, index, value) => { + console.log(value) setSelectedIndex(index); setSearchClass(value) setAnchorEl(null); @@ -106,26 +89,26 @@ export default function HomeScreenSearchBar() { setAnchorEl(null); }; - return ( + const WIDTH = window.innerWidth; - <StyledGrid container contrast={state.contrast}> + return ( + + <StyledGrid container> {goSearch && <Redirect to={`/busca?page=0&results_per_page=12&order=review_average&query=${state.search.query}&search_class=${state.search.class}`} />} - <Grid item md={7} xs={12} className={state.contrast === "" ? "first white" : "first black"}> + <Grid item md={7} xs={12} className="first white"> <StyledTextField - contrast={state.contrast} id="standard-search" placeholder="O que está buscando?" type="search" margin="normal" value={query} - InputProps={state.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} onChange={handleChange} onKeyPress={handleKeyDown} fullwidth /> </Grid> <Grid item md={3} xs={12} className="second white"> - <List component="nav" aria-label="Recurso" className={`${state.contrast}BackColor`} > + <List component="nav" aria-label="Recurso"> <ListItem button aria-haspopup="true" @@ -138,7 +121,7 @@ export default function HomeScreenSearchBar() { primary={options[selectedIndex].text} /> <ListItemIcon> - <ArrowDropDownIcon className={`${state.contrast}IconColor`} /> + <ArrowDropDownIcon /> </ListItemIcon> </ListItem> </List> @@ -148,28 +131,27 @@ export default function HomeScreenSearchBar() { keepMounted open={Boolean(anchorEl)} onClose={handleClose} - MenuListProps={{ - disablePadding: true - }} > - <div className={`${state.contrast}BackColor`}> - {options.map((option, index) => ( - <MenuItem - key={option.value} - selected={index === selectedIndex} - onClick={(event) => handleMenuItemClick(event, index, option.value)} - style={{ color: option.color, textDecoration: state.contrast === "" ? "none" : "underline" }} - > - {option.text} - </MenuItem> - ))} - </div> + {options.map((option, index) => ( + <MenuItem + key={option.value} + selected={index === selectedIndex} + onClick={(event) => handleMenuItemClick(event, index, option.value)} + style={{ color: option.color }} + > + {option.text} + </MenuItem> + ))} </Menu> </Grid> <Grid item md={2} xs={12}> <div style={{ height: "100%" }}> - <Button title="Pesquisar" onClick={handleKeyDown} className="custom-button" style={{ backgroundColor: options[selectedIndex].backColor, color: "#fff" }}> - <SearchIcon fontSize="large" style={state.contrast === "" ? {color: "white"} : {color: "yellow"}}/> + <Button onClick={handleKeyDown} className="custom-button" style={{ backgroundColor: options[selectedIndex].color, color: "#fff" }}> + { + WIDTH < 503 && + <span>Buscar</span> + } + <SearchIcon fontSize="large" /> </Button> </div> </Grid> @@ -178,65 +160,35 @@ export default function HomeScreenSearchBar() { } const StyledTextField = styled(TextField)` - background-color: ${props => props.contrast === "" ? "white" : "black"}; max-width: 100%; font-size : 15px; font-weight : lighter; + color : inherit; width : 90% !important; margin-right : 10px !important; margin-left : 10px !important; - - .MuiOutlinedInput-root { - &.Mui-focused fieldset { - border-color: ${props => props.contrast === "" ? "#ff7f00" : "yellow"}; - } - fieldset { - border-color: ${props => props.contrast === "" ? "#666" : "white"}; - } - } - - label{ - color: ${props => props.contrast === "" ? "#666" : "white"}; - } - - label.Mui-focused { - color: ${props => props.contrast === "" ? "#ff7f00" : "yellow"}; - } - - .MuiFormHelperText-root { - text-align : left; - color: ${props => props.contrast === "" ? "#666" : "white"}; - } - .MuiInput-underline::after { - border-bottom: 2px solid ${props => props.contrast === "" ? "#ff7f00" : "yellow"}; + border-bottom : none !important; } - ` const StyledGrid = styled(Grid)` - margin-top : 20px; + padding-top : 20px; - .first { - border: ${props => props.contrast === "" ? "" : "1px solid white"}; + .MuiGrid-item { @media screen and (max-width : 502px) { - border-top-left-radius : 5px; - border-top-right-radius : 5px; - } - @media screen and (min-width : 502px) { - border-top-left-radius : 5px; - border-bottom-left-radius : 5px; + border-radius : 5px; + margin-bottom : 10px !important; } } - .second { + .first { @media screen and (max-width : 502px) { - border-left: ${props => props.contrast === "" ? "" : "1px solid white"}; - border-right: ${props => props.contrast === "" ? "" : "1px solid white"}; + margin-top : 10px; } @media screen and (min-width : 502px) { - border-top: ${props => props.contrast === "" ? "" : "1px solid white"}; - border-bottom: ${props => props.contrast === "" ? "" : "1px solid white"}; + border-top-left-radius : 5px; + border-bottom-left-radius : 5px; } } @@ -244,10 +196,12 @@ const StyledGrid = styled(Grid)` background-color : #fff; } - .black { - background-color : black; - } + .MuiList-root { + @media screen and (min-width : 502px) { + border-left: 1px solid #ccc !important; + } + } .MuiPaper-root { width : 100% !important; } @@ -256,7 +210,6 @@ const StyledGrid = styled(Grid)` } .custom-button { - border: ${props => props.contrast === "" ? "" : "1px solid white"}; height: 100% !important; width: 100% !important; margin: 0 !important; @@ -264,10 +217,8 @@ const StyledGrid = styled(Grid)` align-items : center !important; @media screen and (max-width : 502px) { - border-top-left-radius : 0 !important; - border-top-right-radius : 0 !important; - border-bottom-left-radius : 5px !important; - border-bottom-right-radius : 5px !important; + padding-top : 10px; + border-radius : 5px; } @media screen and (min-width : 502px) { diff --git a/src/Components/IframeOverlay/DrawerContent.js b/src/Components/IframeOverlay/DrawerContent.js index 8936cfd80e82c8442ed9f8f54ab2367307b9ea1b..72c1d659fd030cb72a7bb7a5ad38f2ef026ba341 100644 --- a/src/Components/IframeOverlay/DrawerContent.js +++ b/src/Components/IframeOverlay/DrawerContent.js @@ -26,6 +26,10 @@ export default function DrawerContent(props) { search(props.tag); }, [props.tag]); + useEffect(() => { + console.log(resources); + }, [resources]); + return( <Wrapper container direction="row" diff --git a/src/Components/LoadingSpinner.js b/src/Components/LoadingSpinner.js index e25599746e6ffcf88f3f7746a13724d303e7df4b..68c447c4c3be4aee028bf6b4997ceefa956fd197 100644 --- a/src/Components/LoadingSpinner.js +++ b/src/Components/LoadingSpinner.js @@ -1,11 +1,11 @@ import React from 'react'; 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> + const LoadingSpinner = (props) => ( + <div style={{display:"flex", flexDirection:"column", alignItems:"center", justifyContent:"center"}}> + <img alt="" src={LoadingGif} /> + <span style={{textTransform:"uppercase"}}>{props.text}</span> </div> -); + ); -export default LoadingSpinner; + export default LoadingSpinner; diff --git a/src/Components/LoginContainerFunction.js b/src/Components/LoginContainerFunction.js index 086cca3daad364c4cceabc691dffb78a6dc8c114..0e79abf17cab7bbac7e4ca221e4baa119b0ea6e1 100644 --- a/src/Components/LoginContainerFunction.js +++ b/src/Components/LoginContainerFunction.js @@ -15,39 +15,40 @@ 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} from "react"; import GoogleLogin from 'react-google-login' import { Button } from '@material-ui/core'; //import FacebookLogin from 'react-facebook-login'; import CloseIcon from '@material-ui/icons/Close'; import styled from 'styled-components' -import { device } from './device.js' +import {device} from './device.js' import LabeledCheckbox from './Checkbox.js' import FormInput from "./FormInput.js" import GoogleLogo from "../img/logo_google.svg" import ValidateUserInput from './HelperFunctions/FormValidationFunction.js' -import { Link } from 'react-router-dom' -import { apiUrl } from '../env.js' +import {Link} from 'react-router-dom' +import {apiUrl} from '../env.js' -async function handleGoogleAttempt() { - let request_url = ( +async function handleGoogleAttempt () { + console.log("handleGoogleAttempt") + let request_url = ( `${apiUrl}/omniauth/google_oauth2?auth_origin_url=` + window.location.href + '&omniauth_window_type=sameWindow&resource_class=User' ) window.location.replace(request_url) } -export default function LoginContainer(props) { +export default function LoginContainer (props) { const [formEmail, setEmail] = useState( { - key: false, - value: localStorage.getItem("@portalmec/uid") || "", + key : false, + value : localStorage.getItem("@portalmec/uid") || "", } ) const [formSenha, setSenha] = useState( { - key: false, - value: localStorage.getItem("@portalmec/senha") || "" + key : false, + value : localStorage.getItem("@portalmec/senha") ||"" } ) @@ -63,39 +64,37 @@ export default function LoginContainer(props) { const userInput = e.target.value const flag = ValidateUserInput(type, userInput) - if (type === 'email') { - setEmail({ - ...formEmail, - key: flag, - value: userInput + if(type === 'email') { + setEmail({...formEmail, + key : flag, + value : userInput }) + // {/*console.log(formEmail)*/} } - else if (type === 'password') { - setSenha({ - ...formSenha, - key: flag, - value: userInput + else if(type === 'password') { + setSenha({...formSenha, + key : flag, + value : userInput }) + // {/*console.log(formSenha)*/} } } const limpaCamposForm = () => { - setEmail({ - ...formEmail, - key: false, - value: '' + setEmail({...formEmail, + key : false, + value : '' }); - setSenha({ - ...formSenha, - key: false, - value: '' + setSenha({...formSenha, + key : false, + value : '' }) } const onSubmit = (e) => { e.preventDefault() - const login = { email: formEmail.value, senha: formSenha.value, checkboxChecked: checkboxControl } + const login = {email : formEmail.value, senha : formSenha.value, checkboxChecked : checkboxControl} if (!(formEmail.key || formSenha.key)) { props.handleLoginInfo(login) @@ -106,76 +105,70 @@ export default function LoginContainer(props) { return ( <div> - <ContainerStyled contrast={props.contrast}> + <ContainerStyled > <DialogHeaderStyled> - <span style={{ width: "32px" }} /> - <H2Styled contrast={props.contrast}> - Entrar + <span style={{width:"32px"}}/> + <H2Styled> Entrar </H2Styled> - <StyledCloseModalButton - onClick={props.handleClose} - contrast={props.contrast} - > - <CloseIcon className="icon" /> + <StyledCloseModalButton onClick={props.handleClose}> + <CloseIcon/> </StyledCloseModalButton> </DialogHeaderStyled> <DialogContentDiv> <SocialConnectDiv> - <GoogleLoginButton contrast={props.contrast} onClick={handleGoogleAttempt}> - <img src={GoogleLogo} alt="google-logo" className="google-logo" /> - <span>Usando o Google</span> - </GoogleLoginButton> + <GoogleLoginButton onClick={handleGoogleAttempt}> + <img src={GoogleLogo} alt="google-logo" className="google-logo"/> + <span>Usando o Google</span> + </GoogleLoginButton> </SocialConnectDiv> <H3Div> - <H3Styled contrast={props.contrast}> - <RightSideStrikedH3 contrast={props.contrast} /> - <span style={{ verticalAlign: "middle" }}>ou</span> - <LeftSideStrikedH3 contrast={props.contrast} /> + <H3Styled> + <RightSideStrikedH3/> + <span style={{verticalAlign:"middle"}}>ou</span> + <LeftSideStrikedH3/> </H3Styled> </H3Div> <form onSubmit={e => onSubmit(e)}> <FormInput - contrast={props.contrast} inputType={"text"} name={"email"} value={formEmail.value} placeholder={"E-mail"} handleChange={e => handleChange(e, 'email')} required={true} - error={formEmail.key} - help={formEmail.key ? (formEmail.value.length === 0 ? "Faltou preencher seu e-mail." : "Insira um endereço de e-mail válido") : ""} + error = {formEmail.key} + help = {formEmail.key ? ( formEmail.value.length === 0 ? "Faltou preencher seu e-mail." : <span>Insira um endereço de e-mail válido.<br/>Por exemplo: seunome@gmail.com, seunome@hotmail.com</span>) : ""} /> - <br /> + <br/> <FormInput - contrast={props.contrast} inputType={"password"} name={"senha"} value={formSenha.value} placeholder={"Senha"} handleChange={e => handleChange(e, 'password')} required={true} - error={formSenha.key} - help={formSenha.key ? (formSenha.value.length === 0 ? "Faltou digitar sua senha." : "A senha precisa ter no mínimo 8 caracteres.") : ""} + error = {formSenha.key} + help = {formSenha.key ? (formSenha.value.length === 0 ? "Faltou digitar sua senha." : "A senha precisa ter no mínimo 8 caracteres.") : ""} /> - <br /> + <br/> - <RememberRecover contrast={props.contrast}> - <LabeledCheckbox contrast={props.contrast} label={<StyledLabel contrast={props.contrast}><StyledSpan>Lembrar-me</StyledSpan></StyledLabel>} handleChange={() => setCheckbox(!checkboxControl)} /> - <UserForgotTheirPasswordSpan contrast={props.contrast}>Esqueceu a senha? <Link to={"/recuperar-senha"} style={props.contrast === "" ? { textAlign: "right", color: "#4cd0e1" } : { textAlign: "right", color: "yellow", textDecoration: "underline" }} onClick={props.handleClose}>Clique aqui!</Link></UserForgotTheirPasswordSpan> + <RememberRecover> + <LabeledCheckbox label={<StyledLabel><StyledSpan>Lembrar-me</StyledSpan></StyledLabel>} handleChange={() => setCheckbox(!checkboxControl)}/> + <UserForgotTheirPasswordSpan>Esqueceu a senha? <Link to={"/recuperar-senha"} style={{textAlign: "right", color:"#4cd0e1"}} onClick={props.handleClose}>Clique aqui!</Link></UserForgotTheirPasswordSpan> </RememberRecover> <ConfirmContainerStyled> - <StyledLoginButton contrast={props.contrast} type="submit" variant="contained"> - <span style={props.contrast === "" ? { borderRadius: "3px", boxSizing: "border-box", fontFamily: "Roboto, sans serif", fontWeight: "500", color: "#fff" } : { borderRadius: "3px", boxSizing: "border-box", fontFamily: "Roboto, sans serif", fontWeight: "500", color: "yellow" }}>ENTRAR</span> + <StyledLoginButton type="submit" variant="contained"> + <span style={{borderRadius:"3px", boxSizing:"border-box", fontFamily:"Roboto, sans serif", fontWeight:"500", color:"#fff"}}>ENTRAR</span> </StyledLoginButton> </ConfirmContainerStyled> </form> - <DialogFooterStyled contrast={props.contrast}> - <span style={props.contrast === "" ? { textAlign: "center", fontSize: "14px", color: "rgb(102, 102, 102)" } : { textAlign: "center", fontSize: "14px", color: "white" }}>Ainda não tem cadastro? <StyledAnchor contrast={props.contrast} href="" onClick={e => switchModal(e)}>CADASTRE-SE</StyledAnchor></span> + <DialogFooterStyled> + <span style={{textAlign:"center", fontSize: "14px", color:"rgb(102, 102, 102)"}}>Ainda não tem cadastro? <StyledAnchor href="" onClick={e => switchModal(e)}>CADASTRE-SE</StyledAnchor></span> </DialogFooterStyled> </DialogContentDiv> </ContainerStyled> @@ -184,14 +177,13 @@ export default function LoginContainer(props) { } -const ContainerStyled = styled.div` + const ContainerStyled = styled.div` box-sizing : border-box; - background-color: ${props => props.contrast === "" ? "white" : "black"}; + background-color : white; max-width : none; display : flex; flex-direction : column; min-width : 440px; - border: 1px solid ${props => props.contrast === "" ? "#666" : "white"}; align : center; padding : 10px; @@ -205,28 +197,28 @@ const ContainerStyled = styled.div` min-width : unset !important; } -` + ` -export const DialogHeaderStyled = styled.div` + export const DialogHeaderStyled = styled.div` text-align : center; display : flex; flex-direction : row; justify-content : space-between; padding : 10px 26px 0 26px; height : 64px; -` -const H2Styled = styled.h2` + ` + const H2Styled = styled.h2` align-self : center; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; font-size : 26px; font-weight : 100; font-family: 'Roboto', sans serif, 'Helvetica Neue', Helvetica, Arial, sans-serif !important; justify-content: space-between; text-align: center; letter-spacing: .005em; -` + ` -export const StyledCloseModalButton = styled(Button)` + export const StyledCloseModalButton = styled(Button)` display : inline-block; position : relative; float : right !important; @@ -234,87 +226,85 @@ export const StyledCloseModalButton = styled(Button)` background : transparent !important; min-width: 0 !important; width : 40px; - - .icon{ - color: ${props => props.contrast === "" ? "#666" : "white"}; - } -` -export const DialogContentDiv = styled.div` + ` + export const DialogContentDiv = styled.div` padding : 20px 30px; overflow : visible !important; -` + ` -export const SocialConnectDiv = styled.div` - margin: auto; - -` -export const StyledGoogleLoginButton = styled(GoogleLogin)` + export const SocialConnectDiv = styled.div` + margin-top : 0; + display : flex; + flex-direction : row; + ` + export const StyledGoogleLoginButton = styled(GoogleLogin)` background-color : #fff !important; color : #666 !important; border : 1px solid rgb(66, 133, 244); box-shadow: 0 0 0 1px #4285f4 !important; -` + :hover { + background-color: #f4f4f4 !important; + } + ` -const DialogFooterStyled = styled.div` + const DialogFooterStyled = styled.div` box-sizing : border-box; font-family : 'Roboto', sans serif; margin : 20px -20px; padding-top : 20px; - border-top: ${props => props.contrast === "" ? "1px #e5e5e5 solid" : "1px white solid"}; + border-top : 1px #e5e5e5 solid; justify-content : center; text-align : center; line-height : 1.42857143 -` + ` export const RightSideStrikedH3 = styled.div` display : inline-block; - border-bottom: ${props => props.contrast === "" ? "1px dotted #666" : "1px dotted white"}; + border-bottom: 1px dotted #666; vertical-align : middle; font-weight : 500; margin-right : 5px; width : 44%; -` + ` -export const LeftSideStrikedH3 = styled.div` + export const LeftSideStrikedH3 = styled.div` display : inline-block; - border-bottom: ${props => props.contrast === "" ? "1px dotted #666" : "1px dotted white"}; + border-bottom: 1px dotted #666; vertical-align : middle; font-weight : 500; margin-left : 5px; width : 44%; -` + ` -export const H3Div = styled.div` + export const H3Div = styled.div` margin-top : 0; margin-bottom : 10px; -` + ` -const H3Styled = styled.h3` + const H3Styled = styled.h3` overflow : hidden; text-align : center; font-size : 14px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; margin : 10px 0; -` + ` -const StyledAnchor = styled.a` - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; -` -const ConfirmContainerStyled = styled.div` + const StyledAnchor = styled.a` + color : #00bcd4; + text-decoration : none; + ` + const ConfirmContainerStyled = styled.div` display : flex; margin-top : 10px; align-items : center; justify-content : center; -` -const StyledLoginButton = styled(Button)` - background-color: ${props => props.contrast === "" ? "#00bcd4 !important" : "black !important"}; + ` + const StyledLoginButton = styled(Button)` + background-color : #00bcd4 !important; box-shadow : none !important; outline: none !important; - border: ${props => props.contrast === "" ? 0 : "1px solid white !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; - color: ${props => props.contrast === "" ? "" : "yellow !important"}; + border : 0 !important; overflow : hidden !important; width : 35% !important; display : inline-block !important; @@ -324,48 +314,52 @@ const StyledLoginButton = styled(Button)` align-items : center !important; border-radius: 3px !important; align-self : 50% !important; -` + :hover { + background-color : #00acc1 !important; + } + ` -const RememberRecover = styled.div` + const RememberRecover = styled.div` display : flex; justify-content : space-between; font-size: 12px; font-weight : 400; -` + ` -const StyledLabel = styled.div` + const StyledLabel = styled.div` box-sizing : border-box; position : relative; vertical-align : middle !important; - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; -` - -const UserForgotTheirPasswordSpan = styled.span` - margin-top : 1em; - font-size : 12px; - font-weight : 400; - text-align : right; - color: ${props => props.contrast === "" ? "#666" : "white"}; -` - -const StyledSpan = styled.span` - font-size : 12px; - font-weight : 400; - padding-top : 2px; -` + color : #666; + ` + + const UserForgotTheirPasswordSpan = styled.span` + margin-top : 1em; + font-size : 12px; + font-weight : 400; + text-align : right; + color : #666; + ` + + const StyledSpan = styled.span` + font-size : 12px; + font-weight : 400; + padding-top : 2px; + ` export const GoogleLoginButton = styled(Button)` - background-color: ${props => props.contrast === "" ? "#fff !important" : "black !important"}; - box-shadow: ${props => props.contrast === "" ? "0 0 0 1px #4285f4 !important" : "0 0 0 1px white !important"}; - color: ${props => props.contrast === "" ? "#666 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; - + background-color : #fff; + box-shadow : 0 0 0 1px #4285f4 !important; + color : #666 !important; font-weight : bolder !important; font-size : 12px !important; text-transform: none !important; width: 40%; + ${'' /* .MuiButton-root { + min-width : 88px; + } */} + .google-logo { max-height : 18px ; padding-right : 5px; diff --git a/src/Components/LoginModal.js b/src/Components/LoginModal.js index eeb51a8c4f7bfc6d1968800f7872a965bfd8dc17..9ebce1910883371a5c81adb9f36c7166247adea5 100644 --- a/src/Components/LoginModal.js +++ b/src/Components/LoginModal.js @@ -16,16 +16,16 @@ 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, { useContext, useState } from 'react'; +import React, {useContext, useState} from 'react'; import Modal from '@material-ui/core/Modal'; import Backdrop from '@material-ui/core/Backdrop'; import Zoom from '@material-ui/core/Fade'; import styled from 'styled-components' import LoginContainer from './LoginContainerFunction.js' -import { Store } from '../Store.js' +import {Store} from '../Store.js' import Snackbar from '@material-ui/core/Snackbar'; import MuiAlert from '@material-ui/lab/Alert'; -import { authentication } from './HelperFunctions/getAxiosConfig' +import {authentication} from './HelperFunctions/getAxiosConfig' const StyledLogin = styled(Modal)` margin : 0 !important; @@ -39,11 +39,11 @@ const StyledLogin = styled(Modal)` ` export function Alert(props) { - return <MuiAlert elevation={6} variant="filled" {...props} />; + return <MuiAlert elevation={6} variant="filled" {...props} />; } -export default function LoginModal(props) { - const { state, dispatch } = useContext(Store) +export default function LoginModal (props){ + const {state, dispatch} = useContext(Store) const [snackbarOpened, handleSnackbar] = useState(false) @@ -55,24 +55,24 @@ export default function LoginModal(props) { handleSnackbar(false); } - function handleSuccess(data) { - dispatch({ + function handleSuccess (data) { + dispatch ({ type: "USER_LOGGED_IN", userLoggedIn: !state.userIsLoggedIn, login: data.data - } + } ) props.handleClose(); props.openSnackbar(); } - function handleError(error) { + function handleError (error) { handleSnackbar(true) } const handleLoginInfo = (login) => { const url = `/auth/sign_in` const payload = { - email: login.email, - password: login.senha + email : login.email, + password : login.senha } authentication(url, payload, handleSuccess, handleError) @@ -81,32 +81,30 @@ export default function LoginModal(props) { return ( <> - <Snackbar open={snackbarOpened} autoHideDuration={1000} onClose={handleCloseSnackbar} - anchorOrigin={{ vertical: 'top', horizontal: 'right' }} - > - <Alert severity="error">Ocorreu um erro ao se conectar!</Alert> - </Snackbar> - <StyledLogin - aria-labelledby="transition-modal-title" - aria-describedby="transition-modal-description" - open={props.open} - centered="true" - onClose={props.handleClose} - closeAfterTransition - BackdropComponent={Backdrop} - BackdropProps={{ - timeout: 500, - }} - > - <Zoom in={props.open} style={{ transitionDelay: "0.2ms" }}> - <LoginContainer - contrast={state.contrast} - handleClose={props.handleClose} - openSignUp={props.openSignUp} - handleLoginInfo={handleLoginInfo} - /> - </Zoom> - </StyledLogin> + <Snackbar open={snackbarOpened} autoHideDuration={1000} onClose={handleCloseSnackbar} + anchorOrigin = {{ vertical:'top', horizontal:'right' }} + > + <Alert severity="error">Ocorreu um erro ao se conectar!</Alert> + </Snackbar> + <StyledLogin + aria-labelledby="transition-modal-title" + aria-describedby="transition-modal-description" + open={props.open} + centered="true" + onClose={props.handleClose} + closeAfterTransition + BackdropComponent={Backdrop} + BackdropProps={{ + timeout: 500, + }} + > + <Zoom in={props.open} style={{ transitionDelay :"0.2ms"}}> + <LoginContainer handleClose={props.handleClose} + openSignUp={props.openSignUp} + handleLoginInfo={handleLoginInfo} + /> + </Zoom> + </StyledLogin> </> ) diff --git a/src/Components/MaterialCard.js b/src/Components/MaterialCard.js index 9806251bce3413175439482978c53a60b85ffc9f..8f18cd3c03c35954a3a5d7b9f491a4c81dcd97b0 100644 --- a/src/Components/MaterialCard.js +++ b/src/Components/MaterialCard.js @@ -41,54 +41,53 @@ export default function MaterialCard(props) { const width = window.innerWidth; return ( - <Card className={`${props.contrast}BackColor ${props.contrast}Border ${props.contrast}Text`}> + <Card> <img src={thumb} alt="thumbnail do recurso" /> - <div> - <CardContent style={{ height: "60px", textAlign: "left", paddingBottom: "0px", width: "100%" }}> - <Title> - {props.name} - </Title> - </CardContent> - <CardActions> - <Grid container direction="column" justify="flex-start" alignItems="flex-start" style={{ marginLeft: "5px" }}> - <Grid item> - <Rating - style={ props.contrast === "" ? { color: "#666" } : { color: "white" }} - name="customized-empty" - value={props.score} - precision={0.5} - emptyIcon={<StarBorderIcon fontSize="inherit" />} - readOnly - /> - </Grid> - <Grid container direction="row" alignItems="center"> - <Library style={ props.contrast === "" ? { color: "#e81f4f" } : { color: "white" }} /> - <SizedBox /> - <Typography variant="body2" component="p" style={{ overflow: "hidden", fontSize: "0.8em" }}> - {props.modules.length} módulos - </Typography> - </Grid> + <CardContent style={{ height: "60px", textAlign: "left", paddingBottom: "0px", width: "100%" }}> + <Title> + {props.name} + </Title> + </CardContent> + <CardActions> + <Grid container direction="column" justify="flex-start" alignItems="flex-start" style={{ marginLeft: "5px" }}> + <Grid item> + <Rating + name="customized-empty" + value={props.score} + precision={0.5} + style={{ color: "#666" }} + emptyIcon={<StarBorderIcon fontSize="inherit" />} + readOnly + /> </Grid> - </CardActions> - </div> - <CardActions className={`${props.contrast}LinkColor`} style={{ borderTop: "1px solid #e5e5e5", justifyContent: "center" }}> + <Grid container direction="row" alignItems="center"> + <Library style={{ color: "#e81f4f" }} /> + <SizedBox /> + <Typography variant="body2" color="textSecondary" component="p" style={{ overflow: "hidden", fontSize: "0.8em" }}> + {props.modules.length} módulos + </Typography> + </Grid> + </Grid> + </CardActions> + <CardActions style={{ borderTop: "1px solid #e5e5e5", justifyContent: "center" }}> { width <= 767 ? - <Link className={`${props.contrast}LinkColor`} to={`/colecao?colecao=${props.id}`}> + <Link style={{textDecoration : "none"}} to={`/colecao?colecao=${props.id}`}> <Button - style={ props.contrast === "" ? { color: "#e81f4f" } : { color: "yellow" }} + color="secondary" endIcon={<ExpandMoreRoundedIcon />} > + Ver módulos </Button> </Link> : <Button - className={`${props.contrast}LinkColor`} - style={ props.contrast === "" ? { color: "#e81f4f" } : { color: "yellow" }} + color="secondary" endIcon={<ExpandMoreRoundedIcon />} onClick={HandleButtonPressed} > + Ver módulos </Button> } @@ -102,6 +101,7 @@ const SizedBox = styled.div` ` const Title = styled(Typography)` font-weight: 500; + color: rgb(102, 102, 102); font-size: 0.9em; margin-left: 10px; margin-right: 10px; diff --git a/src/Components/MenuBar.js b/src/Components/MenuBar.js index 3cf316ad6907f1e1d972702da96c7fbd1ece5dfd..c79d52b6f2cefa5ccf8b2e9ab5b65c5db26a5883 100644 --- a/src/Components/MenuBar.js +++ b/src/Components/MenuBar.js @@ -44,24 +44,18 @@ export const ButtonStyled = styled(Button)` text-transform: capitalize !important; margin : 0 8px !important; font-weight : normal !important; - color: ${props => props.contrast === "" ? "black !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; ` const ButtonPublicarRecurso = styled(Button)` font-family : 'Roboto', sans serif; box-shadow : none !important; - border: ${props => props.contrast === '' ? "1px transparent solid" : "1px white solid !important"}; - background-color: ${(props) => props.contrast === "" ? "#ff7f00 !important" : "black !important"}; - color: white !important; + border : 1px transparent solid; + background-color : #ff7f00 !important; align-content : center; font-weight : 500 !important; text-transform: capitalize !important; font-stretch : expanded; max-width: 200 !important; - :hover { - background-color: ${(props) => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } .MuiSvgIcon-root { vertical-align : middle !important; margin-right : 5px !important; @@ -69,7 +63,7 @@ const ButtonPublicarRecurso = styled(Button)` ` const IconSearchStyled = styled(IconSearch)` - color: ${props => props.contrast === "" ? "#16b8dd !important" : "white !important"}; + color: #16b8dd; ` const ImageStyled = styled.img` height: 50px; @@ -94,122 +88,124 @@ const Left = styled.span` export const ButtonPubRecursoStyled = styled(Button)` font-weight : 500 !important; + border : 1.5px #666 solid !important; + color: #666; box-shadow: none; margin : 0 8px !important; font-weight : normal !important; - :hover { - background-color: ${(props) => - props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } ` export default function MenuBar(props) { - const { state } = useContext(Store) - - const buildMyAreaTabs = () => { - const minhaArea = [ - { name: "Perfil e Atividades", href: "/perfil", value: '0' }, - { name: "Recursos Publicados", href: "/perfil", value: '1' }, - { name: "Favoritos", href: "/perfil", value: '2' }, - { name: "Coleções", href: "/perfil", value: '3' }, - { name: "Rede", href: "/perfil", value: '4' }, - { name: "Configurações", href: "/editarperfil", value: '5' }, - ] - - if (state.currentUser.roles) { - let canUserAdmin = false; - let index = 0; - const userRoles = [...state.currentUser.roles] - - while (!canUserAdmin && index < userRoles.length) { - if (userRoles[index].id === 3 || userRoles[index].id === 7) - canUserAdmin = true - index++ - } - - if (canUserAdmin) - minhaArea.push({ - name: "Administrador", - href: "/admin/home", - value: '6', - }) - - const canUserCurator = (elem) => elem.id === 4 - if (userRoles.some(canUserCurator)) - minhaArea.push({ - name: "Curadoria", - href: "/perfil", - value: '5', - }) - } - - return minhaArea; - } + const { state } = useContext(Store) - const menuSobre = [ - { name: "Sobre a Plataforma", href: "/sobre" }, - { name: "Portais Parceiros", href: "/sobre#portaisparceiros" }, - { name: "Termos de Uso", href: "/termos" }, - { name: "Contato", href: "/contato" } + const buildMyAreaTabs = () => { + const minhaArea = [ + { name: "Perfil e Atividades", href: "/perfil", value: '0' }, + { name: "Recursos Publicados", href: "/perfil", value: '1' }, + { name: "Favoritos", href: "/perfil", value: '2' }, + { name: "Coleções", href: "/perfil", value: '3' }, + { name: "Rede", href: "/perfil", value: '4' }, + { name: "Configurações", href: "/editarperfil", value: '5' }, ] - const menuAjuda = [ - { name: "Central de Ajuda", href: "/ajuda" }, - { name: "Publicando Recursos", href: "/publicando-recurso" }, - { name: "Encontrando Recursos", href: "/encontrando-recurso" }, - { name: "Participando da Rede", href: "/participando-da-rede" }, - { name: "Gerenciando a Conta", href: "/gerenciando-conta" } - ] + if (state.currentUser.roles) { + let canUserAdmin = false; + let index = 0; + const userRoles = [...state.currentUser.roles] + + while (!canUserAdmin && index < userRoles.length) { + if (userRoles[index].id === 3 || userRoles[index].id === 7) + canUserAdmin = true + index++ + } + + if (canUserAdmin) + minhaArea.push({ + name: "Administrador", + href: "/admin/home", + value: '6', + }) + + const canUserCurator = (elem) => elem.id === 4 + if (userRoles.some(canUserCurator)) + minhaArea.push({ + name: "Curadoria", + href: "/perfil", + value: '5', + }) + } + + return minhaArea; + } + + const menuSobre = [ + { name: "Sobre a Plataforma", href: "/sobre" }, + { name: "Portais Parceiros", href: "/sobre#portaisparceiros" }, + { name: "Termos de Uso", href: "/termos" }, + { name: "Contato", href: "/contato" } + ] + + const menuAjuda = [ + { name: "Central de Ajuda", href: "/ajuda" }, + { name: "Publicando Recursos", href: "/publicando-recurso" }, + { name: "Encontrando Recursos", href: "/encontrando-recurso" }, + { name: "Participando da Rede", href: "/participando-da-rede" }, + { name: "Gerenciando a Conta", href: "/gerenciando-conta" } + ] + + const minhaArea = buildMyAreaTabs() + + return ( + <ContainerStyled fluid={true} > + <Left> + <Link to="/"> <ImageStyled src={logo} alt="Plataforma Integrada" /> </Link> + <Dropdown name="Sobre" items={menuSobre} /> + <Dropdown name="Ajuda" items={menuAjuda} /> + <a href="http://educacaoconectada.mec.gov.br/" rel="noopener noreferrer" target="_blank" > + <ButtonStyled >Educação Conectada</ButtonStyled> + </a> + {/*<Link to="/loja"> + <ButtonStyled>Lojinha</ButtonStyled> + </Link>*/} + <ButtonStyled onClick={props.openSearchBar} ><IconSearchStyled />Buscar</ButtonStyled> + + </Left> + <Right> + { + state.userIsLoggedIn + ? ( + <> + <div style={{ boxSizing: "border-box" }}> + <Link to="/termos-publicar-recurso"> + <ButtonPublicarRecurso> + <CloudUploadIcon style={{ color: "white", marginLeft: "0" }} /> + <span style={{ color: "#fff", textAlign: "center", alignSelf: "center", fontWeight: "500" }} > + PUBLICAR RECURSO + </span> + </ButtonPublicarRecurso> + </Link> + </div> + + <div> + <Notifications /> + </div> + + <MenuList items={minhaArea} /> + + </> + ) + : ( + <React.Fragment> + <ButtonPubRecursoStyled onClick={props.openLogin}>PUBLICAR RECURSO?</ButtonPubRecursoStyled> + <ButtonStyled onClick={props.openLogin}><ExitToAppIcon style={{ color: "#00bcd4" }} />Entrar</ButtonStyled> + <ButtonStyled onClick={props.openSignUp}>Cadastre-<span style={{textTransform: 'lowercase'}}>se</span></ButtonStyled> + </React.Fragment> + ) + } - const minhaArea = buildMyAreaTabs() - - return ( - <ContainerStyled fluid={true} className={`${state.contrast}BackColor`}> - <Left> - <Link to="/"> <ImageStyled src={logo} alt="Plataforma Integrada" /> </Link> - <Dropdown name="Sobre" items={menuSobre} /> - <Dropdown name="Ajuda" items={menuAjuda} /> - <a href="http://educacaoconectada.mec.gov.br/" rel="noopener noreferrer" target="_blank" > - <ButtonStyled contrast={state.contrast} >Educação Conectada</ButtonStyled> - </a> - {/*<Link to="/loja"> - <ButtonStyled>Lojinha</ButtonStyled> - </Link>*/} - <ButtonStyled contrast={state.contrast} onClick={props.openSearchBar} ><IconSearchStyled contrast={state.contrast}/>Buscar</ButtonStyled> - - </Left> - <Right> - { - state.userIsLoggedIn - ? ( - <> - <div style={{ boxSizing: "border-box" }}> - <Link to="/termos-publicar-recurso"> - <ButtonPublicarRecurso contrast={state.contrast} className={`${state.contrast}LinkColor`}> - <CloudUploadIcon className={`${state.contrast}IconColor`} style={{ marginLeft: "0" }} /> - <span className={`${state.contrast}LinkColor`} style={{textAlign: "center", alignSelf: "center", fontWeight: "500" }} > - PUBLICAR RECURSO - </span> - </ButtonPublicarRecurso> - </Link> - </div> - <div> - <Notifications /> - </div> - <MenuList items={minhaArea} /> - </> - ) - : ( - <React.Fragment> - <ButtonPubRecursoStyled contrast={state.contrast} className={`${state.contrast}LinkColor ${state.contrast}Border`} onClick={props.openLogin}>PUBLICAR RECURSO?</ButtonPubRecursoStyled> - <ButtonStyled contrast={state.contrast} className={`${state.contrast}LinkColor`} onClick={props.openLogin}><ExitToAppIcon className={`${state.contrast}IconColor`} style={{ color: "#00bcd4" }} />Entrar</ButtonStyled> - <ButtonStyled contrast={state.contrast} className={`${state.contrast}LinkColor`} onClick={props.openSignUp}>Cadastre-<span style={{ textTransform: 'lowercase' }}>se</span></ButtonStyled> - </React.Fragment> - ) - } - </Right> - </ContainerStyled> - ); + </Right> + </ContainerStyled> + ); } diff --git a/src/Components/MenuBarMobile.js b/src/Components/MenuBarMobile.js index e6e21aaacbd31f85176e7b5adb66116971d53006..0e263606db82b52e09b2d108727784bf0aadab05 100644 --- a/src/Components/MenuBarMobile.js +++ b/src/Components/MenuBarMobile.js @@ -27,6 +27,7 @@ import IconSearch from '@material-ui/icons/Search' export default function MenuBarMobile(props) { + const [drawerOpen, setDrawerStatus] = React.useState(false); @@ -39,15 +40,12 @@ export default function MenuBarMobile(props) { return ( <> - <MobileDrawerMenu - contrast={props.contrast} - anchor={'left'} - open={drawerOpen} + <MobileDrawerMenu anchor={'left'} open={drawerOpen} onClose={toggleDrawer(false)} openSignUp={props.openSignUp} openLogin={props.openLogin} /> - <OuterDiv contrast={props.contrast}> - <Button title="Menu" style={props.contrast === "" ? { color: "#00bcd4" } : { color: "white " }} onClick={toggleDrawer(true)}> + <OuterDiv> + <Button style={{ color: "#00bcd4" }} onClick={toggleDrawer(true)}> <MenuIcon className="icon" /> </Button> <DrawerButtonDiv> @@ -55,8 +53,8 @@ export default function MenuBarMobile(props) { <img src={logo} alt="logo" style={{ border: "0", verticalAlign: "middle" }} /> </Link> </DrawerButtonDiv> - <Button title="Pesquisar" style={{ position: "absolute", right: 0 }} onClick={props.openSearchBar}> - <IconSearchStyled style={props.contrast === "" ? { color: "#00bcd4" } : { color: "white " }} /> + <Button style={{ color: "#00bcd4", position: "absolute", right: 0}} onClick={props.openSearchBar}> + <IconSearchStyled/> </Button> </OuterDiv> </> @@ -66,12 +64,11 @@ export default function MenuBarMobile(props) { const OuterDiv = styled.div` height : 48px; width : 100%; - background: ${props => props.contrast === "" ? "" : "black"}; + ${'' /* position : relative; */} display : flex; direction : row; align-items : center; - img { height : 38px; overflow : hidden; diff --git a/src/Components/MenuList.js b/src/Components/MenuList.js index ee79f724927ec39c4b3561845b3526b0e8673564..b5b920c81a2e75ea9a2ae25b6c0f088eed7a1e9c 100644 --- a/src/Components/MenuList.js +++ b/src/Components/MenuList.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, { useContext } from 'react'; +import React, {useContext} from 'react'; import Button from '@material-ui/core/Button'; import Menu from '@material-ui/core/Menu'; import MenuItem from '@material-ui/core/MenuItem'; @@ -25,91 +25,90 @@ import { Link } from 'react-router-dom' import ExitToAppIcon from '@material-ui/icons/ExitToApp'; import { Store } from '../Store'; import styled from 'styled-components' -import { apiDomain } from '../env.js' -import { deleteRequest } from './HelperFunctions/getAxiosConfig' +import {apiDomain} from '../env.js' +import {deleteRequest} from './HelperFunctions/getAxiosConfig' //Image Import import { Profile } from "ImportImages.js"; + const OverrideButton = styled(Button)` text-transform : none !important; ` export default function MenuList(props) { - const [anchorEl, setAnchorEl] = React.useState(null); - const { state, dispatch } = useContext(Store) - - const handleClick = event => { - setAnchorEl(event.currentTarget); - }; - - const handleClose = () => { - setAnchorEl(null); - }; - - function handleSuccessSignOut(data) { - dispatch({ - type: 'USER_LOGGED_OUT', - userLoggedOut: !state.userIsLoggedIn, - }) - } - const handleLogout = () => { - const url = `/auth/sign_out` - deleteRequest(url, handleSuccessSignOut, (error) => { console.log(error) }) - } - - return ( - <div > - <OverrideButton - aria-controls="customized-menu" - aria-haspopup="true" - onClick={handleClick} - > - <div style={{ borderRadius: "50%", border: "2px solid #fff", background: "#fff", overflow: "hidden", maxWidth: "50px", maxHeight: "50px" }}> - { - state.currentUser.avatar === '' || state.currentUser.avatar === null || state.currentUser.avatar === undefined ? - ( - <img src={Profile} alt={'user avatar'} style={{ width: "100%", height: "100%", verticalAlign: "middle", marginLeft: "0" }} /> - ) : - ( - <img src={apiDomain + state.currentUser.avatar} alt={'user avatar'} style={{ width: "100%", height: "100%", verticalAlign: "middle", marginLeft: "0" }} /> - ) - } - </div> - <span className={`${state.contrast}LinkColor`} style={{ fontFamily: "inherit", fontWeight: "400", color: "#666" }}>Minha Área </span> <KeyboardArrowDownIcon className={`${state.contrast}IconColor`}/> - </OverrideButton> - <Menu - anchorEl={anchorEl} - open={Boolean(anchorEl)} - onClose={handleClose} - elevation={0} - getContentAnchorEl={null} - anchorOrigin={{ - vertical: 'bottom', - horizontal: 'center', - }} - transformOrigin={{ - vertical: 'top', - horizontal: 'center', - }} - MenuListProps={{ - disablePadding: true - }} - > - <div className={`${state.contrast}BackColor`}> - { - props.items.map((item) => - <Link to={{ - pathname: item.href, - state: item.value - }} style={{ textDecoration: "none" }} key={item.value}><MenuItem className={`${state.contrast}LinkColor`} style={{ fontSize: "14px", padding: "5px 20px", color: "#666" }} key={item.value}>{item.name}</MenuItem></Link> - ) - } - <StyledButtonSair contrast={state.contrast} className={`${state.contrast}BackColor`} onClick={handleLogout}> <StyledMenuItem className={`${state.contrast}LinkColor`} disableGutters={true}>Sair<StyledExitToAppIcon className={`${state.contrast}IconColor`}/></StyledMenuItem></StyledButtonSair> - </div> - </Menu> + const [anchorEl, setAnchorEl] = React.useState(null); + const { state, dispatch } = useContext(Store) + + const handleClick = event => { + setAnchorEl(event.currentTarget); + }; + + const handleClose = () => { + setAnchorEl(null); + }; + + function handleSuccessSignOut (data) { + dispatch( { + type: 'USER_LOGGED_OUT', + userLoggedOut: !state.userIsLoggedIn, + }) + } + const handleLogout = () => { + const url = `/auth/sign_out` + deleteRequest(url, handleSuccessSignOut, (error) => {console.log(error)}) + } + + return ( + <div > + + <OverrideButton + aria-controls="customized-menu" + aria-haspopup="true" + onMouseOver={handleClick} + > + <div style={{borderRadius: "50%", border: "2px solid #fff", background: "#fff", overflow: "hidden", maxWidth : "50px", maxHeight : "50px"}}> + { + state.currentUser.avatar === '' || state.currentUser.avatar === null || state.currentUser.avatar === undefined ? + ( + + <img src={Profile} alt={'user avatar'} style={{width:"100%", height:"100%", verticalAlign : "middle", marginLeft : "0"}}/> + ): + ( + <img src={apiDomain + state.currentUser.avatar} alt={'user avatar'} style={{width:"100%", height:"100%", verticalAlign : "middle", marginLeft : "0"}}/> + ) + } </div> - ); + <span style={{fontFamily:"inherit", fontWeight:"400", color:"#666"}}>Minha Área </span> <KeyboardArrowDownIcon/> + </OverrideButton> + + <Menu + anchorEl={anchorEl} + open={Boolean(anchorEl)} + onClose={handleClose} + elevation={0} + getContentAnchorEl={null} + anchorOrigin={{ + vertical: 'bottom', + horizontal: 'center', + }} + transformOrigin={{ + vertical: 'top', + horizontal: 'center', + }}> + + { + props.items.map((item)=> + <Link to={{ + pathname : item.href, + state : item.value + }} style={{textDecoration:"none"}} key={item.value}><MenuItem style= {{fontSize:"14px", padding:"5px 20px", color:"#666"}} key={item.value}>{item.name}</MenuItem></Link> + ) + } + <StyledButtonSair onClick={handleLogout}> <StyledMenuItem disableGutters={true}>Sair<StyledExitToAppIcon/></StyledMenuItem></StyledButtonSair> + </Menu> + </div> + ); } const StyledButtonSair = styled(Button)` @@ -122,14 +121,12 @@ const StyledButtonSair = styled(Button)` display : flex !important; justify-content: space-between !important; font-size : 14px !important; + color : #a5a5a5 !important; padding : 5px 20px !important; } - color : #666; - - overflow-y: hidden; ` -const StyledExitToAppIcon = styled(ExitToAppIcon)` +const StyledExitToAppIcon = styled(ExitToAppIcon) ` fontSize : 24px; color : rgb(162,165,165); align : right; @@ -141,6 +138,6 @@ const StyledMenuItem = styled(MenuItem)` justify-content: space-between !important; width : 100% !important; font-size : 14px !important; - color : #666; + color : #a5a5a5 !important; padding : 5px 20px !important; ` diff --git a/src/Components/MobileDrawerMenu.js b/src/Components/MobileDrawerMenu.js index 66db915e93ab7cb829389e601ef3dc6d435bd8d3..317b46b2deee315e534051f2c60b2129a5372d84 100644 --- a/src/Components/MobileDrawerMenu.js +++ b/src/Components/MobileDrawerMenu.js @@ -47,6 +47,7 @@ export default function MobileDrawerMenu(props) { { name: "Favoritos", href: "/perfil", value: '2' }, { name: "Coleções", href: "/perfil", value: '3' }, { name: "Rede", href: "/perfil", value: '4' }, + { name: "Configurações", href: "/editarperfil", value: '5' }, ] if (state.currentUser.roles) { @@ -59,7 +60,7 @@ export default function MobileDrawerMenu(props) { canUserAdmin = true index++ } - + if (canUserAdmin) minhaArea.push({ name: "Administrador", @@ -118,7 +119,7 @@ export default function MobileDrawerMenu(props) { } return ( - <StyledDrawer contrast={state.contrast} anchor={props.anchor} open={props.open} onClose={props.onClose}> + <StyledDrawer anchor={props.anchor} open={props.open} onClose={props.onClose}> <MenuBody> {/*Renders menuSobre array options*/} { @@ -136,18 +137,20 @@ export default function MobileDrawerMenu(props) { { /*If user is logged in, render user actions menu; else render log in/sign in buttons*/ state.userIsLoggedIn ? - ( + ( <> <div style={{ display: "flex", justifyContent: "left", marginBottom: "10px" }}> <Link to="/termos-publicar-recurso"> - <ButtonPublicarRecurso contrast={props.contrast}> + <ButtonPublicarRecurso> <CloudUploadIcon style={{ color: "white", marginRight: "10px" }} /> - PUBLICAR RECURSO + <span style={{ color: "white", textAlign: "center", alignSelf: "center", fontWeight: "500" }} > + PUBLICAR RECURSO + </span> </ButtonPublicarRecurso> </Link> </div> - <div style={{ borderTop: "1px solid #e5e5e5", display: "flex", flexDirection: "column", marginTop: "10px", paddingTop: "10px", paddingBottom: "10px" }}> - <MyArea contrast={props.contrast}> + <div style={{ borderTop: "1px solid #e5e5e5", display: "flex", flexDirection: "column", marginTop: "10px", paddingTop: "10px", color: "#666", paddingBottom: "10px" }}> + <MyArea> <div className="user-avatar"> <img alt="user-avatar" src={getUserAvatar()} @@ -176,22 +179,22 @@ export default function MobileDrawerMenu(props) { ( <React.Fragment> <div style={{ display: "flex", justifyContent: "center", marginTop: "10px" }}> - <ButtonPublicarRecurso contrast={props.contrast} onClick={props.openLogin}> + <ButtonPublicarRecurso onClick={props.openLogin}> PUBLICAR RECURSO? </ButtonPublicarRecurso> </div> <div style={{ display: "flex", flexDirection: "row", margin: "10px 0", justifyContent: "center" }}> <div style={{ borderRight: "1px solid #e5e5e5" }}> - <ButtonStyled onClick={props.openLogin} contrast={props.contrast}> - <ExitToAppIcon style={props.contrast === "" ? { color: "#00bcd4" } : { color: "white" }} />Entrar - </ButtonStyled> + <ButtonStyled onClick={props.openLogin}> + <ExitToAppIcon style={{ color: "#00bcd4" }} />Entrar + </ButtonStyled> </div> <div> - <ButtonStyled contrast={props.contrast} onClick={props.openSignUp}> - Cadastre-<span style={{ textTransform: 'lowercase' }}>se</span> - </ButtonStyled> + <ButtonStyled onClick={props.openSignUp}> + Cadastre-<span style={{textTransform: 'lowercase'}}>se</span> + </ButtonStyled> </div> </div> </React.Fragment> @@ -222,7 +225,7 @@ const MyArea = styled.div` .text { font-size : 16px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; align-self : center; } @@ -245,21 +248,18 @@ const MyArea = styled.div` const ButtonPublicarRecurso = styled(Button)` font-weight : 500 !important; - background-color: ${props => props.contrast === "" ? "#ff7f00 !important" : "black !important"}; - color: ${props => props.contrast === "" ? "white !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; - border: ${props => props.contrast === "" ? "" : "1px solid white !important"}; + border : 1.5px #666 solid !important; + background-color : #ff7f00 !important; + color: #666; box-shadow: none; margin : 0 8px !important; padding : 6px 25px !important; - :hover{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } + ` const StyledDrawer = styled(Drawer)` .MuiPaper-root { - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; + width : 65% !important; } .menu-buttons { @@ -268,13 +268,13 @@ const StyledDrawer = styled(Drawer)` font-weight : 500; cursor : pointer; outline : 0; - color: ${props => props.contrast === "" ? "#666 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; + color : #666 !important; + text-decoration : none !important; background-color : transparent; font-family : 'Roboto', sans serif; .MuiSvgIcon-root { - color: ${props => props.contrast === "" ? "#a5a5a5 !important" : "white !important"}; + color : #a5a5a5 !important; margin-right : 20px; vertical-align : middle !important; font-weight : normal !important; @@ -292,7 +292,7 @@ const StyledDrawer = styled(Drawer)` .selected { color : #fff !important; - background-color: ${props => props.contrast === "" ? "#00bcd4" : "rgba(255,255,0,0.24)"}; + background-color : #00bcd4; .MuiSvgIcon-root { color : #fff !important; } @@ -303,5 +303,5 @@ const MenuBody = styled.div` margin-top : 20px; display : flex; flex-direction : column; - + color : #666; ` diff --git a/src/Components/Modal.js b/src/Components/Modal.js new file mode 100644 index 0000000000000000000000000000000000000000..dd2de1bc9e16debc20d88233ae5f907200dd79c2 --- /dev/null +++ b/src/Components/Modal.js @@ -0,0 +1,100 @@ +/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana + +This file is part of Plataforma Integrada MEC. + +Plataforma Integrada MEC is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Plataforma Integrada MEC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +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 { makeStyles } from '@material-ui/styles'; +import Modal from '@material-ui/core/Modal'; + +import TermsCarousel from './Carousel'; + +import Backdrop from '@material-ui/core/Backdrop'; +import Fade from '@material-ui/core/Fade'; +import VisibilityOutlinedIcon from '@material-ui/icons/VisibilityOutlined'; + + + +/*Importação de imagens para o componente*/ + + + + +const useStyles = makeStyles(theme => ({ + modal: { + display: "flex", + alignItems: "center", + justifyContent: "center" + }, + paper: { + border: '2px solid #000', + boxShadow: " 0px 3px 5px -1px rgba(0,0,0,0.2),0px 5px 8px 0px rgba(0,0,0,0.14),0px 1px 14px 0px rgba(0,0,0,0.12)" + }, + carousel: { + width: "750px", + height:"370px", + + } +})); + + + + + +export default function TransitionsModal() { + const classes = useStyles(); + const [open, setOpen] = React.useState(false); + + const handleOpen = () => { + setOpen(true); + }; + + const handleClose = () => { + setOpen(false); + }; + + return ( + + + <div style={{display:"flex", justifyContent: "center"}}> + <link href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap" rel="stylesheet"/> + + <button style = {{background: "none",border: "none", color:"#fff",verticalAlign:"center"}} type="button" onClick={handleOpen}> + <VisibilityOutlinedIcon style={{verticalAlign:"middle"}}/> <spam style={{verticalAlign: "middle",fontWeight: "600",fontSize:"14px"}}>VEJA A VERSÃO RESUMIDA</spam> + </button> + <Modal + aria-labelledby="transition-modal-title" + aria-describedby="transition-modal-description" + className={classes.modal} + open={open} + onClose={handleClose} + closeAfterTransition + BackdropComponent={Backdrop} + BackdropProps={{ + timeout: 500, + }} + > + <Fade in={open}> + + <div> + <TermsCarousel/> + </div> + + </Fade> + </Modal> + </div> + ); +} diff --git a/src/Components/ModalAbout.js b/src/Components/ModalAbout.js index 377ab6cdc8976c60279d768a70b627eb47a40fb4..84998e7cbe28194b29663cc6fc47a78ba8cfeec3 100644 --- a/src/Components/ModalAbout.js +++ b/src/Components/ModalAbout.js @@ -16,185 +16,188 @@ 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 { makeStyles } from "@material-ui/styles"; -import Modal from "@material-ui/core/Modal"; +import React from 'react'; +import { makeStyles } from '@material-ui/styles'; +import Modal from '@material-ui/core/Modal'; import Formulario from "./ContactForm"; -import Backdrop from "@material-ui/core/Backdrop"; -import Fade from "@material-ui/core/Fade"; +import Backdrop from '@material-ui/core/Backdrop'; +import Fade from '@material-ui/core/Fade'; + +import styled from 'styled-components' -import styled from "styled-components"; /*Importação de imagens para o componente*/ -const useStyles = makeStyles((theme) => ({ - modal: { - display: "flex", - alignItems: "center", - justifyContent: "center", - }, - paper: { - border: "2px solid #000", - boxShadow: - " 0px 3px 5px -1px rgba(0,0,0,0.2),0px 5px 8px 0px rgba(0,0,0,0.14),0px 1px 14px 0px rgba(0,0,0,0.12)", - }, - carousel: { - width: "750px", - height: "370px", - }, + + + +const useStyles = makeStyles(theme => ({ + modal: { + display: "flex", + alignItems: "center", + justifyContent: "center" + }, + paper: { + border: '2px solid #000', + boxShadow: " 0px 3px 5px -1px rgba(0,0,0,0.2),0px 5px 8px 0px rgba(0,0,0,0.14),0px 1px 14px 0px rgba(0,0,0,0.12)" + }, + carousel: { + width: "750px", + height:"370px", + + } })); const Button = styled.button` - background-color: ${(props) => - props.contrast === "" ? "#00bcd4" : "black !important"}; - color: ${(props) => (props.contrast === "" ? "#fff" : "yellow !important")}; - font-family: Roboto, sans-serif; + +background-color: #00bcd4; +color: #fff; +font-family: Roboto,sans-serif; +font-size: 14px; +font-weight: 700; +height: 36px; +border-radius: 3px; +padding-left: 16px; +padding-right: 16px; +box-shadow: 0 2px 5px 0 rgba(0,0,0,.26); +display: inline-block; +position: relative; +cursor: pointer; +min-height: 36px; +min-width: 88px; +line-height: 36px; +vertical-align: middle; +-webkit-box-align: center; +outline: none; +text-align: center; +border: 0; +padding: 0 16px !important; +hite-space: nowrap; +text-decoration: none; + +` + +const Formulário = styled.div ` + background-color: #fff; + padding: 40px; + + border-radius: 4px; + + + color: #666 !important; + + h2 { + font-size: 26px; + font-weight: lighter; + margin-top: 20px; + margin-bottom: 10px; + } + + form .inputBlock { + margin-block: 22px; + + } + + form .inputBlock label { + font-size: 14px; + font-weight: bold; + display: block; + + } + + form .inputBlock input { + width: 100%; + height: 32px; font-size: 14px; - font-weight: 700; - height: 36px; - border-radius: 3px; - padding-left: 16px; - padding-right: 16px; - box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); - display: inline-block; - position: relative; + border: 0; + border-bottom: 1px solid #eee; + + } + + form .inputBlock.Message input { + height: 131px; + } + + form buttom[type=submit] { + width: 100%; + border: 0; + margin-top: 30px; + background: #7d40e7 + border-radius: 2px; + padding: 15px 20px; + font-size: 16px; + font-weight: bold; + color: #fff; cursor: pointer; - min-height: 36px; - min-width: 88px; - line-height: 36px; - vertical-align: middle; - -webkit-box-align: center; - outline: none; + transition: background 0.5s; + + } + + form buttom[type=submit]:hover { + background: #6931ac + } + + + h2 { + font-size: 24px; + font-weight: lighter; + margin-bottom: 50px; + margin-top: 20px; text-align: center; - border: ${(props) => - props.contrast === "" ? "0" : "1px solid white !important"}; - padding: 0 16px !important; - text-decoration: ${(props) => - props.contrast === "" ? "none" : "underline !important"}; - :hover { - background-color: ${(props) => - props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } -`; - -const Formulário = styled.div` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - padding: 40px; - - border-radius: 4px; - - - color: ${props => props.contrast === "" ? "#666" : "white"} !important; - - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; - - h2 { - font-size: 26px; - font-weight: lighter; - margin-top: 20px; - margin-bottom: 10px; - } - - form .inputBlock { - margin-block: 22px; - - } - - form .inputBlock label { - font-size: 14px; - font-weight: bold; - display: block; - - } - - form .inputBlock input { - width: 100%; - height: 32px; - font-size: 14px; - border: 0; - border-bottom: 1px solid #eee; - - } - - form .inputBlock.Message input { - height: 131px; - } - - form buttom[type=submit] { - width: 100%; - border: 0; - margin-top: 30px; - background: #7d40e7 - border-radius: 2px; - padding: 15px 20px; - font-size: 16px; - font-weight: bold; - color: #fff; - cursor: pointer; - transition: background 0.5s; - - } - - form buttom[type=submit]:hover { - background: #6931ac - } - - - h2 { - font-size: 24px; - font-weight: lighter; - margin-bottom: 50px; - margin-top: 20px; - text-align: center; - - } -`; - -export default function TransitionsModal({ contrast }) { - - const classes = useStyles(); - const [open, setOpen] = React.useState(false); - - const handleOpen = () => { - setOpen(true); - }; - - const handleClose = () => { - setOpen(false); - }; - - return ( - <div style={{ display: "flex", justifyContent: "center" }}> - <link - href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap" - rel="stylesheet" - /> - <Button type="button" onClick={handleOpen} contrast={contrast}> - SUGERIR OUTRO SITE - </Button> - <Modal - aria-labelledby="transition-modal-title" - aria-describedby="transition-modal-description" - className={classes.modal} - open={open} - onClose={handleClose} - closeAfterTransition - BackdropComponent={Backdrop} - BackdropProps={{ - timeout: 500, - }} - > - <Fade in={open}> - <div> - <Formulário contrast={contrast}> - <h2>Sugerir site de Recursos Educacionais Digitais</h2> - <Formulario contrast={contrast}/> - </Formulário> - </div> - </Fade> - </Modal> - </div> - ); + + } +` + + + + +export default function TransitionsModal() { + const classes = useStyles(); + const [open, setOpen] = React.useState(false); + + const handleOpen = () => { + setOpen(true); + }; + + const handleClose = () => { + setOpen(false); + }; + + return ( + + + <div style={{display:"flex", justifyContent: "center"}}> + <link href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap" rel="stylesheet"/> + + <Button type="button" onClick={handleOpen}> + SUGERIR OUTRO SITE + </Button> + <Modal + aria-labelledby="transition-modal-title" + aria-describedby="transition-modal-description" + className={classes.modal} + open={open} + onClose={handleClose} + closeAfterTransition + BackdropComponent={Backdrop} + BackdropProps={{ + timeout: 500, + }} + > + <Fade in={open}> + + <div> + <Formulário> + <h2>Sugerir site de Recursos Educacionais Digitais</h2> + <Formulario/> + </Formulário> + + </div> + + </Fade> + </Modal> + </div> + ); } diff --git a/src/Components/ModalAlterarAvatar/ComponentAlterarAvatar.js b/src/Components/ModalAlterarAvatar/ComponentAlterarAvatar.js index 9af51a6cf4554215031d823189c1885b2f55c40f..a3e6a895d2138935549d4adc8e4ab689410d1f71 100644 --- a/src/Components/ModalAlterarAvatar/ComponentAlterarAvatar.js +++ b/src/Components/ModalAlterarAvatar/ComponentAlterarAvatar.js @@ -37,13 +37,13 @@ function ChooseImage (props) { <img src={props.avatar} alt="user avatar" style={{height:"inherit", width:"inherit", objectFit:"cover"}} /> - <input accept="image/*" id="avatar-file" - type="file" - onChange={(e) => props.handleFile(e.target.files)} - style={{display : "none"}} + <input accept="image/*" id="avatar-file" + type="file" + onChange={(e) => props.handleFile(e.target.files)} + style={{display : "none"}} /> <label for="avatar-file" style={{width:"inherit"}}> - <ChangeAvatarDiv contrast={props.contrast}> + <ChangeAvatarDiv > <span>Alterar</span> </ChangeAvatarDiv> </label> @@ -55,9 +55,12 @@ function ChooseImage (props) { <img alt="" src={props.tempImg}/> } <ButtonsDiv> - <ButtonCancelar contrast={props.contrast} onClick={props.handleClose}> + <ButtonCancelar onClick={props.handleClose}> <span>Cancelar</span> </ButtonCancelar> + <ButtonConfirmar> + <span>Salvar Alterações</span> + </ButtonConfirmar> </ButtonsDiv> </div> ) @@ -70,6 +73,7 @@ export default function ComponentAlterarAvatar (props) { const handleFile = (selectorFiles) => { const objectURL = URL.createObjectURL(selectorFiles[0]) + console.log(objectURL) setTempImg(objectURL) setUploading(true) } @@ -106,12 +110,12 @@ export default function ComponentAlterarAvatar (props) { } return ( - <ModalDiv contrast={props.contrast}> + <ModalDiv> <HeaderDiv> <span style={{width:"32px"}}/> <StyledH2>{uploadingImage ? 'Alterar foto do perfil' : 'Editar Foto'}</StyledH2> <StyledCloseModalButton onClick={props.handleClose}> - <CloseIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }}/> + <CloseIcon style={{color : "#666"}}/> </StyledCloseModalButton> </HeaderDiv> <DialogDiv> @@ -120,7 +124,7 @@ export default function ComponentAlterarAvatar (props) { ( [ <> - <EditarDiv contrast={props.contrast}> + <EditarDiv> <TextoEditarDiv> Clique nos ícones e arraste para selecionar a parte que você quer da foto </TextoEditarDiv> @@ -129,8 +133,11 @@ export default function ComponentAlterarAvatar (props) { </div> </EditarDiv> <FooterButtonsDiv> - <ButtonCancelar contrast={props.contrast} onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonConfirmar contrast={props.contrast} onClick={() => {completeSelection()}}>SELECIONAR FOTO</ButtonConfirmar> + <ButtonCancelar>ESCOLHER OUTRA</ButtonCancelar> + <div> + <ButtonCancelar onClick={props.handleClose}>CANCELAR</ButtonCancelar> + <ButtonConfirmar onClick={() => {completeSelection()}}>SELECIONAR FOTO</ButtonConfirmar> + </div> </FooterButtonsDiv> </> ] @@ -140,12 +147,11 @@ export default function ComponentAlterarAvatar (props) { [ <> <ChooseImage - contrast={props.contrast} avatar={props.userAvatar === '' || props.userAvatar == null ? Profile : `${apiDomain}` + props.userAvatar} handleFile={handleFile} handleClose={props.handleClose} tempImg={tempImgURL} - /> + /> </> ] ) @@ -161,9 +167,9 @@ const FooterButtonsDiv = styled.div` display : flex; flex-direction : row; align-content : center; - justify-content : flex-end; + justify-content : space-between; Button { - margin-left: 15px; + margin-top : 20px; } ` @@ -175,15 +181,13 @@ const TextoEditarDiv = styled.div` ` const EditarDiv = styled.div` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; position : relative; background-color : #f4f4f4; padding : 20px 30px 40px; ` const ChangeAvatarDiv = styled.div` - color: ${props => props.contrast === "" ? "rgba(255,255,255,.7)" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} !important; + color : rgba(255,255,255,.7); background-color:rgba(0,0,0,.5); position: absolute; bottom: 0; @@ -200,92 +204,91 @@ const ChangeAvatarDiv = styled.div` ` const ModalDiv = styled.div` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; + background-color : #fff; border-radius : 4px; + min-width : 560px; + color : #666; display: flex; flex-direction : column; @media screen and (max-width: 959px) { + height : 100%; width : 100%; } ` const ButtonConfirmar = styled(Button)` - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"} !important; - color: ${props => props.contrast === "" ? "#fff" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white !important"}; + background-color : #00bcd4 !important; + color : #fff !important; border-radius : 3px !important; ` const ButtonCancelar = styled(Button)` - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - background-color: transparent; + &:hover { + background-color : rgba(158,158,158,0.2) !important; + } + background-color : #fff !important; + color : #666 !important; + text-decoration : none !important; outline : none !important; text-align : center !important; ` const ButtonsDiv = styled.div` - Button { - margin-left: 15px; - } - display : flex; - justify-content:flex-end; +display : flex; +justify-content:flex-end; ` const AvatarCircleDiv = styled.div` - margin-bottom : 0; - border-radius : 50%; - height : 150px; - width : 150px; - position : relative; - overflow: hidden; +margin-bottom : 0; +border-radius : 50%; +height : 150px; +width : 150px; +position : relative; +overflow: hidden; ` const DivFlowHolder =styled.div` - align-self : auto; +align-self : auto; ` const DivAlterarFoto = styled.div` - display : flex; - margin-bottom : 30px; - flex-direction : row; - align-items : center; - justify-content :center; +display : flex; +margin-bottom : 30px; +flex-direction : row; +align-items : center; +justify-content :center; ` const DialogDiv = styled.div` - padding : 20px 30px; - overflow : visible !important; +padding : 20px 30px; +overflow : visible !important; ` const HeaderDiv = styled.div` - display : flex; - flex-direction : row; - align-items : center; - align-content : center; - justify-content : space-between; - max-width : 100%; +display : flex; +flex-direction : row; +align-items : center; +align-content : center; +justify-content : space-between; +max-width : 100%; ` const StyledH2 = styled.h2` - font-size : 26px; - font-weight : normal; - margin-top : 20px; - margin-bottom : 10px; - font-family: inherit; - line-height: 1.1; - color: inherit; +font-size : 26px; +font-weight : normal; +margin-top : 20px; +margin-bottom : 10px; +font-family: inherit; +line-height: 1.1; +color: inherit; ` const StyledCloseModalButton = styled(Button)` - display : inline-block; - position : relative; - float : right !important; - background : transparent !important; - min-width: 0 !important; - width : 40px; - border-radius : 50%; - padding : 8px; - height : 40px; - margin : 0 6px; +display : inline-block; +position : relative; +float : right !important; +background : transparent !important; +min-width: 0 !important; +width : 40px; +border-radius : 50%; +padding : 8px; +height : 40px; +margin : 0 6px; ` diff --git a/src/Components/ModalAlterarAvatar/ModalAlterarAvatar.js b/src/Components/ModalAlterarAvatar/ModalAlterarAvatar.js index 59fb07c7fc3a00845bfba7430ee4f8b17cc84cb4..735832040ab11c6b79e7f969bb554e42a514ebfe 100644 --- a/src/Components/ModalAlterarAvatar/ModalAlterarAvatar.js +++ b/src/Components/ModalAlterarAvatar/ModalAlterarAvatar.js @@ -31,8 +31,10 @@ const StyledModal = styled(Modal)` padding : 10px !important; ` -export default function ModalAlterarAvatar (props){ +export default function ModarAlterarAvatar (props){ + return ( + <StyledModal aria-labelledby="transition-modal-title" aria-describedby="transition-modal-description" @@ -49,12 +51,12 @@ export default function ModalAlterarAvatar (props){ <Fade in={props.open} style={{ transitionDelay :"0.4ms"}}> <ComponentAlterarAvatar - contrast={props.contrast} userAvatar={props.userAvatar} handleClose={props.handleClose} id={props.id} /> </Fade> </StyledModal> + ) } diff --git a/src/Components/ModalAlterarCover/ComponentAlterarCover.js b/src/Components/ModalAlterarCover/ComponentAlterarCover.js index 72ad98865737424bdb93a10a6326ecb925899648..a4059ecfa2e5c180382a354f92728e19217198ee 100644 --- a/src/Components/ModalAlterarCover/ComponentAlterarCover.js +++ b/src/Components/ModalAlterarCover/ComponentAlterarCover.js @@ -34,7 +34,7 @@ export default function ComponentAlterarCover (props) { const [crop] = useState({ unit: "%" , width : 100, - aspect: 16 / 3.2 + aspect: 16 / 9 }); function handleSuccess (data) { @@ -58,47 +58,49 @@ export default function ComponentAlterarCover (props) { } return ( - <ModalDiv contrast={props.contrast}> + <ModalDiv> <HeaderDiv> <span style={{width:"32px"}}/> <StyledH2>Editar Capa do Perfil</StyledH2> <StyledCloseModalButton onClick={props.handleClose}> - <CloseIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }}/> + <CloseIcon style={{color : "#666"}}/> </StyledCloseModalButton> </HeaderDiv> <DialogDiv> - <EditarDiv contrast={props.contrast}> + <EditarDiv> <TextoEditarDiv> Clique nos ícones e arraste para selecionar a parte que você quer da foto </TextoEditarDiv> - <div style={{maxWidth : "100%", maxHeight : "100%"}}> + <div style={{maxWidth : "500px", maxHeight : "300px"}}> <Cropper src={tempImgURL} crop={crop} update={updateCover}/> </div> </EditarDiv> <FooterButtonsDiv> + <ButtonCancelar>ESCOLHER OUTRA</ButtonCancelar> <div> - <ButtonCancelar contrast={props.contrast} onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonConfirmar contrast={props.contrast} onClick={() => {completeSelection()}}>SELECIONAR FOTO</ButtonConfirmar> + <ButtonCancelar onClick={props.handleClose}>CANCELAR</ButtonCancelar> + <ButtonConfirmar onClick={() => {completeSelection()}}>SELECIONAR FOTO</ButtonConfirmar> </div> </FooterButtonsDiv> </DialogDiv> - </ModalDiv> - ) + </ModalDiv> + ) } const ButtonCancelar = styled(Button)` - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - background-color: transparent; + &:hover { + background-color : rgba(158,158,158,0.2) !important; + } + background-color : #fff !important; + color : #666 !important; + text-decoration : none !important; outline : none !important; text-align : center !important; ` const ButtonConfirmar = styled(Button)` - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"} !important; - color: ${props => props.contrast === "" ? "#fff" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white !important"}; + background-color : #00bcd4 !important; + color : #fff !important; border-radius : 3px !important; ` @@ -107,12 +109,13 @@ const FooterButtonsDiv = styled.div` display : flex; flex-direction : row; align-content : center; - justify-content : flex-end; + justify-content : space-between; Button { margin-top : 20px; } ` + const TextoEditarDiv = styled.div` margin-bottom : 15px; align-self : center; @@ -121,55 +124,55 @@ const TextoEditarDiv = styled.div` ` const EditarDiv = styled.div` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; position : relative; background-color : #f4f4f4; + padding : 20px 30px 40px; ` const ModalDiv = styled.div` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; - border-radius : 4px; - width : 560px; - display: flex; - flex-direction : column; - @media screen and (max-width: 959px) { - width : 100%; - } +background-color : #fff; +border-radius : 4px; +min-width : 560px; +color : #666; +display: flex; +flex-direction : column; +@media screen and (max-width: 959px) { + height : 100%; + width : 100%; +} ` const DialogDiv = styled.div` - padding : 20px 30px; - overflow : visible !important; +padding : 20px 30px; +overflow : visible !important; ` const HeaderDiv = styled.div` - display : flex; - flex-direction : row; - align-items : center; - align-content : center; - justify-content : space-between; - max-width : 100%; +display : flex; +flex-direction : row; +align-items : center; +align-content : center; +justify-content : space-between; +max-width : 100%; ` const StyledH2 = styled.h2` - font-size : 26px; - font-weight : normal; - margin-top : 20px; - margin-bottom : 10px; - font-family: inherit; - line-height: 1.1; - color: inherit; +font-size : 26px; +font-weight : normal; +margin-top : 20px; +margin-bottom : 10px; +font-family: inherit; +line-height: 1.1; +color: inherit; ` const StyledCloseModalButton = styled(Button)` - display : inline-block; - position : relative; - float : right !important; - background : transparent !important; - min-width: 0 !important; - width : 40px; - border-radius : 50%; - padding : 8px; - height : 40px; - margin : 0 6px; +display : inline-block; +position : relative; +float : right !important; +background : transparent !important; +min-width: 0 !important; +width : 40px; +border-radius : 50%; +padding : 8px; +height : 40px; +margin : 0 6px; ` diff --git a/src/Components/ModalAlterarCover/ModalAlterarCover.js b/src/Components/ModalAlterarCover/ModalAlterarCover.js index d572530fee428603623dd0e85d18c2d2895a82e9..7e971f5806c6cee5239b1b480cc166c5b31b05a3 100644 --- a/src/Components/ModalAlterarCover/ModalAlterarCover.js +++ b/src/Components/ModalAlterarCover/ModalAlterarCover.js @@ -32,11 +32,14 @@ const StyledModal = styled(Modal)` ` export default function ModarAlterarCover (props){ + return ( + <StyledModal aria-labelledby="transition-modal-title" aria-describedby="transition-modal-description" open={props.open} + centered="true" onClose={props.handleClose} closeAfterTransition @@ -44,15 +47,16 @@ export default function ModarAlterarCover (props){ BackdropProps={{ timeout: 500, }} - > + > <Fade in={props.open} style={{ transitionDelay :"0.4ms"}}> + <ComponentAlterarCover - contrast={props.contrast} cover={props.cover} handleClose={props.handleClose} id={props.id} /> </Fade> </StyledModal> + ) } diff --git a/src/Components/ModalAvaliarRecurso.js b/src/Components/ModalAvaliarRecurso.js index 4376cee70643c1f48b5ee74b34c86065ca0c5a2f..7795876d0203a82bac0c05ddbb531773b505c39e 100644 --- a/src/Components/ModalAvaliarRecurso.js +++ b/src/Components/ModalAvaliarRecurso.js @@ -29,10 +29,10 @@ import FormControl from '@material-ui/core/FormControl'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import CloseModalButton from './CloseModalButton' import Snackbar from '@material-ui/core/Snackbar'; +import TextField from '@material-ui/core/TextField'; import { withStyles } from '@material-ui/core/styles'; import { getRequest } from './HelperFunctions/getAxiosConfig' import LoadingSpinner from '../Components/LoadingSpinner' -import {StyledTextField, useStyles} from './ReportUserForm.js' const StyledRadio = withStyles({ root: { @@ -46,8 +46,6 @@ const StyledRadio = withStyles({ export default function ModalAvaliarRecurso(props) { - const classes = useStyles(); - const [options, setOptions] = useState([]) const [avaliacao, setAvaliacao] = useState([null, null, null, null]) @@ -138,12 +136,12 @@ export default function ModalAvaliarRecurso(props) { > <Fade in={props.open}> - <Container contrast={props.contrast}> - <Header contrast={props.contrast}> + <Container> + <Header> <h2>Você está avaliando o recurso - <span style={{ fontWeight: "bolder" }}> {props.title}</span> + <span style={{ fontWeight: "bolder" }}> {props.title}</span> </h2> - <CloseModalButton contrast={props.contrast} handleClose={props.handleClose} /> + <CloseModalButton handleClose={props.handleClose} /> </Header> <Content> @@ -164,8 +162,8 @@ export default function ModalAvaliarRecurso(props) { </Grid> <Grid item xs={2}> <RadioGroup row onChange={(e) => { handleRadios(e, option.id) }}> - <FormControlLabel className={`${props.contrast}LinkColor`} value={"Sim"} control={<StyledRadio style={props.contrast === "" ? {} : {color: "white"}}/>} label="Não" /> - <FormControlLabel className={`${props.contrast}LinkColor`} value={"Não"} control={<StyledRadio style={props.contrast === "" ? {} : {color: "white"}}/>} label="Sim" /> + <FormControlLabel value={"Sim"} control={<StyledRadio />} label="Não" /> + <FormControlLabel value={"Não"} control={<StyledRadio />} label="Sim" /> </RadioGroup> </Grid> </Grid> @@ -177,12 +175,10 @@ export default function ModalAvaliarRecurso(props) { <Grid item xs={12}> <FormControl style={{ width: "100%", height: "100px" }}> <StyledTextField - contrast={props.contrast} id={"title-form"} label={"Justificativa (opcional)"} type={"text"} value={justificativa} - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} onChange={e => { handleChangeJustificativa(e) }} multiline fullWidth @@ -192,8 +188,8 @@ export default function ModalAvaliarRecurso(props) { <Grid item xs={12}> <ButtonsDiv> - <ButtonEnviarAvaliar contrast={props.contrast} disabled={buttonDisabled} onClick={() => { handleAvaliar() }}>ENVIAR AVALIAÇÂO</ButtonEnviarAvaliar> - <GreyButton contrast={props.contrast} onClick={() => { handleCancel() }}>CANCELAR</GreyButton> + <ButtonEnviarAvaliar disabled={buttonDisabled} onClick={() => { handleAvaliar() }}>ENVIAR AVALIAÇÂO</ButtonEnviarAvaliar> + <GreyButton onClick={() => { handleCancel() }}>CANCELAR</GreyButton> </ButtonsDiv> </Grid> </Grid> @@ -210,9 +206,10 @@ export default function ModalAvaliarRecurso(props) { } const Content = styled.div` - padding : 0 30px 20px 30px; + padding : 10px 75px 0 75px; overflow : visible; max-width : 100%; + color : #666; font-size : 16px; .main-content-text { @@ -230,10 +227,10 @@ const Content = styled.div` const Header = styled.div` display : flex; flex-direction : row; - padding : 20px 20px 20px 20px; + padding : 20px 75px 0 75px; align-items : center; justify-content : space-between; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; + color : #666; @media screen and (min-width : 990px) { height : 64px; @@ -265,23 +262,47 @@ const StyledModal = styled(Modal)` const Container = styled.div` box-sizing : border-box; box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12); - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; - color: ${props => props.contrast === "" ? "#666" : "white"}; + background-color : #fff; align : center; display : flex; flex-direction : column; min-width : 240px; - max-height : 90%; + max-height : none; position : relative; border-radius : 4px; max-width : 100%; - overflow-y : scroll; + + @media screen and (max-width : 699px) { + overflow : scroll; + width : 100%; + height : 100%; + } p { margin : 0 0 10px; } ` +const StyledTextField = styled(TextField)` + font-size : 14px; + width : 100% !important; + full-width : 100% !important; + + .MuiFormControl-root { + margin : 18px 0 !important; + } + + label.Mui-focused { + color : #ff7f00; + } + + label.Mui-focused.Mui-error { + color : red; + } + + .MuiInput-underline::after { + border-bottom: 2px solid #ff7f00; + } +` const ButtonsDiv = styled.div` display : flex; @@ -299,13 +320,13 @@ const ButtonsDiv = styled.div` ` const GreyButton = styled(Button)` &:hover { - background-color : ${props => props.contrast === "" ? "rgba(158,158,158,0.2)" : ""} !important; + background-color : rgba(158,158,158,0.2) !important; } max-height : 36px !important; background-color : transparent !important; - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration : ${props => props.contrast === "" ? "none" : "underline"} !important; + color : #666 !important; + text-decoration : none !important; outline : none !important; text-align : center !important; font-weight : 600 !important; @@ -314,12 +335,10 @@ const GreyButton = styled(Button)` ` const ButtonEnviarAvaliar = styled(Button)` - color : ${props => props.contrast === "" ? `${props.disabled ? `rgba(0,0,0,0.38)` : `rgba(255,255,255,0.87)`}` : `${props.disabled ? `white` : `yellow`}`} !important; + color : ${(props) => props.disabled ? "rgba(0,0,0,0.38)" : "rgba(255,255,255,0.87) !important"}; box-shadow : ${(props) => props.disabled ? "none !important" : "0 2px 5px 0 rgba(0,0,0,.26) !important"}; font-weight : 600 !important; - background-color : ${props => props.contrast === "" ? `${props.disabled ? "#e9e9e9 !important" : "#ff7f00 !important"}` : "black !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; + background-color : ${(props) => props.disabled ? "#e9e9e9 !important" : "#ff7f00 !important"}; margin-left : 8px !important; margin-right : 8px !important; diff --git a/src/Components/ModalConfirmarCuradoria.js b/src/Components/ModalConfirmarCuradoria.js index 8acc01ad17ead5a6a6c2cc0234fc1cca4e8f98ae..046106be576a7eea000031277db1c74a2f74df55 100644 --- a/src/Components/ModalConfirmarCuradoria.js +++ b/src/Components/ModalConfirmarCuradoria.js @@ -76,7 +76,7 @@ export default function ModalConfirmarCuradoriaOpen(props) { }} > <Fade in={props.open}> - <Container contrast={props.contrast} recusado={!props.aceito}> + <Container recusado={!props.aceito}> <Header> <span style={{ width: "32px" }} /> <h2>Recurso a ser {props.aceito ? 'aprovado' : 'recusado'}</h2> @@ -104,8 +104,17 @@ export default function ModalConfirmarCuradoriaOpen(props) { ) } <ButtonsDiv> - <ButtonEnviarAvaliar contrast={props.contrast} onClick={() => { handleConfirmation() }}>SIM, CONFIRMAR</ButtonEnviarAvaliar> - <GreyButton contrast={props.contrast} onClick={handleCancel}>NÃO, ALTERAR AVALIAÇÃO</GreyButton> + { + props.aceito ? + ( + <ButtonEnviarAvaliar onClick={() => { handleConfirmation() }}>SIM, CONFIRMAR</ButtonEnviarAvaliar> + ) + : + ( + <ButtonEnviarAvaliar onClick={() => { handleConfirmation() }}>SIM, CONFIRMAR</ButtonEnviarAvaliar> + ) + } + <GreyButton onClick={handleCancel}>NÃO, ALTERAR AVALIAÇÃO</GreyButton> </ButtonsDiv> </Content> </Container> @@ -119,7 +128,7 @@ const Content = styled.div` padding : 30px; overflow : visible; max-width : 100%; - color : inherit; + color : #666; font-size : 16px; text-align : start; .reason-offensive { @@ -137,7 +146,7 @@ const Header = styled.div` align-items : center; max-height : none; justify-content : space-between; - color : inherit; + color : #666; h2 { font-size : 30px; @@ -163,8 +172,7 @@ const StyledModal = styled(Modal)` const Container = styled.div` box-sizing : border-box; box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12); - background-color : ${props => props.contrast === "" ? "white" : "black"} !important; - color : ${props => props.contrast === "" ? "#666" : "white"} !important; + background-color : #fff; align : center; display : flex; flex-direction : column; @@ -172,7 +180,6 @@ const Container = styled.div` position : relative; border-radius : 4px; max-width : 100%; - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; max-height : ${props => props.recusado ? 'none' : '370px'}; @media screen and (max-width : 699px) { @@ -202,13 +209,13 @@ const ButtonsDiv = styled.div` ` const GreyButton = styled(Button)` &:hover { - background-color : ${props => props.contrast === "" ? "rgba(158,158,158,0.2)" : ""} !important; + background-color : rgba(158,158,158,0.2) !important; } max-height : 36px !important; background-color : transparent !important; - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration : ${props => props.contrast === "" ? "none" : "underline"} !important; + color : #666 !important; + text-decoration : none !important; outline : none !important; text-align : center !important; font-weight : 600 !important; @@ -222,11 +229,10 @@ const GreyButton = styled(Button)` ` const ButtonEnviarAvaliar = styled(Button)` - color : ${props => props.contrast === "" ? `rgba(255,255,255,0.87)` : `yellow`} !important; + color : rgba(255,255,255,0.87) !important; + box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; font-weight : 600 !important; - background-color : ${props => props.contrast === "" ? "#ff7f00" : "black"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; + background-color : #ff7f00 !important; margin-left : 8px !important; margin-right : 8px !important; diff --git a/src/Components/ModalConfirmarUnfollow.js b/src/Components/ModalConfirmarUnfollow.js index a7951b704509582dc6c989af30c7879e7780286c..7d349e085ec89cac173286a5406a810cc08d04dd 100644 --- a/src/Components/ModalConfirmarUnfollow.js +++ b/src/Components/ModalConfirmarUnfollow.js @@ -31,14 +31,12 @@ const HeaderDiv = styled.div` margin-top : 20px; margin-bottpm : 10px font-weight : normal; + color : #666 } ` const ContentContainer = styled.div` -color: ${props => props.contrast === "" ? "#666" : "white"} !important; -background-color: ${props => props.contrast === "" ? "white" : "black"} !important; -border: ${props => props.contrast === "" ? "1px solid black" : "1px solid white"} !important; - box-sizing : border-box; + background-color : white; max-width : none; align : center; display : flex; @@ -48,6 +46,7 @@ border: ${props => props.contrast === "" ? "1px solid black" : "1px solid white" position : relative; padding : 10px; border-radius : 4px; + color : #666; @media screen and (max-width : 899px) { width : 100%; @@ -55,21 +54,19 @@ border: ${props => props.contrast === "" ? "1px solid black" : "1px solid white" } ` const ButtonCancelar = styled(Button)` -color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; -text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - &:hover { background-color : rgba(158,158,158,0.2) !important; } + background-color : #fff !important; + color : #666 !important; + text-decoration : none !important; outline : none !important; text-align : center !important; ` const ButtonConfirmar = styled(Button)` - color: ${props => props.contrast === "" ? "white" : "yellow"} !important; - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - border: ${props => props.contrast === "" ? "none" : "1px solid white"} !important; + background-color : #00bcd4 !important; + color : #fff !important; border-radius : 3px !important; ` @@ -94,21 +91,21 @@ export default function ModalConfirmarUnfollow (props) { }} > <Fade in={props.open}> - <ContentContainer contrast={props.contrast}> + <ContentContainer> <HeaderDiv> <span style={{width:"32px"}}/> <h3> {text.header} </h3> - <CloseModalButton contrast={props.contrast} handleClose={props.handleClose}/> + <CloseModalButton handleClose={props.handleClose}/> </HeaderDiv> <div style={{display : "flex", flexDirection : "column", padding : "20px 30px"}}> <div style={{marginTop : "0", textAlign : "center", marginBottom : "20px"}}> - <span style={{fontSize : "14px"}}>{text.explanation}</span> + <span style={{fontSize : "14px", color : "#666"}}>{text.explanation}</span> </div> <div style={{display : "flex", flexDirection : "row", justifyContent: "space-evenly"}}> - <ButtonCancelar contrast={props.contrast} onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonConfirmar contrast={props.contrast} onClick={props.handleConfirm}>DEIXAR DE SEGUIR </ButtonConfirmar> + <ButtonCancelar onClick={props.handleClose}>CANCELAR</ButtonCancelar> + <ButtonConfirmar onClick={props.handleConfirm}>DEIXAR DE SEGUIR </ButtonConfirmar> </div> </div> </ContentContainer> diff --git a/src/Components/ModalEditarColecao.js b/src/Components/ModalEditarColecao.js index 52c7d5c417e6d13d37102bcd153e58b6717ed56a..bd8511f2d867bd1bd45198e086c11dd788ad0f99 100644 --- a/src/Components/ModalEditarColecao.js +++ b/src/Components/ModalEditarColecao.js @@ -36,6 +36,7 @@ export default function ModalEditarColecao (props) { aria-labelledby="transition-modal-title" aria-describedby="transition-modal-description" open={props.open} + centered="true" onClose={props.handleClose} closeAfterTransition @@ -45,14 +46,14 @@ export default function ModalEditarColecao (props) { }} > <Fade in={props.open}> - <Container contrast={props.contrast}> + <Container> <Header> <span style={{width:"32px"}}/> <h2>Editar Coleção</h2> <CloseModalButton handleClose={props.handleClose} id={props.id}/> </Header> <Content style={{paddingTop : "0"}}> - <EditarColecaoForm contrast={props.contrast} id={props.id} handleClose={props.handleClose} finalize={finalize}/> + <EditarColecaoForm id={props.id} handleClose={props.handleClose} finalize={finalize}/> </Content> </Container> </Fade> @@ -77,6 +78,7 @@ const Header = styled.div` h2 { font-size : 26px; font-weight : lighter; + color : #666 } ` @@ -96,9 +98,7 @@ const StyledModal = styled(Modal)` const Container = styled.div` box-sizing : border-box; box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12); - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; - border: 1px solid ${props => props.contrast === "" ? "#666" : "white"} !important; + background-color : white; align : center; display : flex; flex-direction : column; @@ -114,5 +114,6 @@ const Container = styled.div` @media screen and (max-width : 699px) { width : 100%; + height : 100%; } ` diff --git a/src/Components/ModalExcluirColecao.js b/src/Components/ModalExcluirColecao.js index cb55a931f2784e8662820ff494ca932c5fb8bed4..f23b819d88584a3ee2fab19dd94bf3935c90b782 100644 --- a/src/Components/ModalExcluirColecao.js +++ b/src/Components/ModalExcluirColecao.js @@ -21,8 +21,8 @@ import Modal from '@material-ui/core/Modal'; import Backdrop from '@material-ui/core/Backdrop'; import Fade from '@material-ui/core/Fade'; import styled from 'styled-components' -import { ButtonCancelar, ButtonEnviar } from './EditarColecaoForm'; -import CloseModalButton from './CloseModalButton' +import GreyButton from './GreyButton.js' +import PurpleButton from './PurpleButton.js' import SnackbarComponent from './SnackbarComponent' import {deleteRequest} from './HelperFunctions/getAxiosConfig' @@ -57,17 +57,22 @@ export default function ModalExcluirColecao (props) { <Fade in={props.open}> <> <SnackbarComponent snackbarOpen={snackbarOpen} severity={"info"} handleClose={() => {toggleSnackbar(false)}} text={"Coleção excluída com sucesso"}/> - <Container contrast={props.contrast}> + <Container> <Header> <h2>Tem certeza que deseja excluir esta Coleção?</h2> - <CloseModalButton contrast={props.contrast} handleClose={props.handleClose} id={props.id}/> </Header> <Content> <p>A exclusão de uma coleção é permanente. Não é possível desfazer.</p> <ButtonsDiv> - <ButtonCancelar contrast={props.contrast} onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonEnviar contrast={props.contrast} onClick={handleDelete}>EXCLUIR</ButtonEnviar> + <GreyButton + callback={props.handleClose} + text={"CANCELAR"} + /> + <PurpleButton + callback={handleDelete} + text={"EXCLUIR"} + /> </ButtonsDiv> </Content> </Container> @@ -107,6 +112,7 @@ const Header = styled.div` h2 { font-size : 26px; font-weight : lighter; + color : #666 } ` @@ -125,10 +131,7 @@ const StyledModal = styled(Modal)` const Container = styled.div` box-sizing : border-box; - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; - border: 1px solid ${props => props.contrast === "" ? "#666" : "white"} !important; - + background-color : white; max-width : none; align : center; display : flex; @@ -138,6 +141,7 @@ const Container = styled.div` position : relative; padding : 10px; border-radius : 4px; + color : #666; @media screen and (max-width : 899px) { width : 100%; diff --git a/src/Components/ModalExcluirComentario.js b/src/Components/ModalExcluirComentario.js index 2217e2eb316ebb15a013af65644395ccfd0b072a..1345ee369a1471558274f42c3d6574c92122dfdb 100644 --- a/src/Components/ModalExcluirComentario.js +++ b/src/Components/ModalExcluirComentario.js @@ -4,7 +4,6 @@ import Fade from '@material-ui/core/Fade'; import styled from 'styled-components' import { Button } from '@material-ui/core'; import Backdrop from '@material-ui/core/Backdrop'; -import CloseIcon from '@material-ui/icons/Close'; const StyledModal = styled(Modal)` margin : 0 !important; @@ -30,9 +29,7 @@ const HeaderDiv = styled.div` ` const ContentContainer = styled.div` box-sizing : border-box; - background-color: ${props => props.contrast === "" ? "white" : "black"}; - border: ${props => props.contrast === "" ? "" : "1px solid white"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; + background-color : white; max-width : none; min-wdith : 240px; align : center; @@ -41,8 +38,9 @@ const ContentContainer = styled.div` box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12)!important; ` const ButtonCancelar = styled(Button)` - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} !important; + background-color : rgba(158,158,158,0.2) !important; + color : #666 !important; + text-decoration : none !important; outline : none !important; text-align : center !important; margin : 0 8px !important; @@ -50,32 +48,13 @@ const ButtonCancelar = styled(Button)` ` const ButtonConfirmar = styled(Button)` - background-color: ${props => props.contrast === "" ? "#ff7f00" : "black"} !important; - color: ${props => props.contrast === "" ? "#fff" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white !important"}; + background-color : #ff7f00 !important; + color : #fff !important; border-radius : 3px !important; margin : 0 8px !important; font-weight : 600 !important; ` -const StyledCloseModalButton = styled(Button)` - display : inline-block; - position : relative; - margin-right : -8px !important; - background : transparent !important; - min-width: 0 !important; - width : 40px; -` - -function CloseModalButton(props) { - return ( - <StyledCloseModalButton onClick={props.handleClose}> - <CloseIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }} /> - </StyledCloseModalButton> - ) -} - export default function ModalExcluir (props) { const text = { header : "Tem certeza que deseja excluir este comentário?", @@ -84,33 +63,32 @@ export default function ModalExcluir (props) { return ( <StyledModal - aria-labelledby="transition-modal-title" - aria-describedby="transition-modal-description" - open={props.open} + aria-labelledby="transition-modal-title" + aria-describedby="transition-modal-description" + open={props.open} - centered="true" - onClose={props.handleClose} - closeAfterTransition - BackdropComponent={Backdrop} - BackdropProps={{ - timeout: 500, - }} + centered="true" + onClose={props.handleClose} + closeAfterTransition + BackdropComponent={Backdrop} + BackdropProps={{ + timeout: 500, + }} > <Fade in={props.open}> - <ContentContainer contrast={props.contrast}> + <ContentContainer> <HeaderDiv> <h3 style={{fontSize : "24px", margin : "20px 15px 10px", fontWeight : "normal"}}> {text.header} </h3> - <CloseModalButton handleClose={props.handleClose} contrast={props.contrast} /> </HeaderDiv> <div style={{display : "flex", flexDirection : "column", padding : "20px 30px"}}> <div style={{marginTop : "0", textAlign : "center", marginBottom : "20px"}}> - <span style={{fontSize : "14px"}}>{text.explanation}</span> + <span style={{fontSize : "14px", color : "#666"}}>{text.explanation}</span> </div> <div style={{display : "flex", flexDirection : "row", justifyContent: "center"}}> - <ButtonCancelar contrast={props.contrast} onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonConfirmar contrast={props.contrast} onClick={props.handleConfirm}> EXCLUIR </ButtonConfirmar> + <ButtonCancelar onClick={props.handleClose}>CANCELAR</ButtonCancelar> + <ButtonConfirmar onClick={props.handleConfirm}> EXCLUIR </ButtonConfirmar> </div> </div> </ContentContainer> diff --git a/src/Components/ModalLearningObjectPublished.js b/src/Components/ModalLearningObjectPublished.js index 8421e0d885b9edd5baf7fc29138c43c15b5bc482..566460be99d3b1880e179745f8777fb7a9f94a56 100644 --- a/src/Components/ModalLearningObjectPublished.js +++ b/src/Components/ModalLearningObjectPublished.js @@ -28,9 +28,6 @@ import Twitter from '../img/twitter.svg' import LinkIcon from '../img/link_icon.svg' import CloseModalButton from './CloseModalButton.js' -//Image Import -import { Publicar } from "ImportImages.js"; - export default function ModalLearningObjectPublished (props) { // const refContainer = useRef(props.link); @@ -53,11 +50,11 @@ export default function ModalLearningObjectPublished (props) { }} > <Fade in={props.open}> - <Container contrast={props.contrast}> + <Container> <Header> <span style={{width:"32px"}}/> <h2>O seu recurso foi para a curadoria!</h2> - <CloseModalButton contrast={props.contrast} handleClose={props.handleClose}/> + <CloseModalButton handleClose={props.handleClose}/> </Header> <Content > @@ -72,7 +69,7 @@ export default function ModalLearningObjectPublished (props) { </Grid> </Grid> </Content> - <ShareContainer contrast={props.contrast}> + <ShareContainer> <p>Gostaria de convidar o seus amigos para conhecer o recurso?</p> <p>Compartilhe nas redes sociais:</p> <div className="logos-shared"> @@ -80,7 +77,7 @@ export default function ModalLearningObjectPublished (props) { href={"https://www.facebook.com/sharer/sharer.php?u=https://plataformaintegrada.mec.gov.br/recurso/" + props.draftID} rel="noreferrer" target="_blank"> - <ShareButton contrast={props.contrast}> + <ShareButton> <img src={Facebook} alt="facebook-logo"/> </ShareButton> </a> @@ -89,12 +86,12 @@ export default function ModalLearningObjectPublished (props) { href={"https://www.twitter.com/intent/tweet?url=https://plataformaintegrada.mec.gov.br/recurso/" + props.draftID} rel="noreferrer" target="_blank"> - <ShareButton contrast={props.contrast}> + <ShareButton> <img src={Twitter} alt="twitter-logo"/> </ShareButton> </a> - <ShareButton contrast={props.contrast}> + <ShareButton > <img src={LinkIcon} alt="link-icon"/> </ShareButton> </div> @@ -126,18 +123,18 @@ const ShareButton = styled(Button)` p { margin : 0 0 10px; } - - border: ${props => props.contrast === "" ? "" : "1px solid yellow"} !important; ` const ShareContainer = styled.div` padding-top : 20px; + background-color : #f1f1f1; width : 100%; height : 215px; font-size : 18px; line-height : 30px; text-align : center; max-width : 600px; + color : #666; border-radius : 4px; .logos-shared { @@ -148,18 +145,16 @@ const ShareContainer = styled.div` flex-direction : row; justify-content : center; } - - background-color: ${props => props.contrast === "" ? "#f1f1f1" : "black"}; - border-top: ${props => props.contrast === "" ? "" : "1px solid white"}; ` const Content = styled.div` padding : 20px 30px; overflow : visible; max-width : 600px; + color : #666; .backgroundImg { - background-image : url(${Publicar}); + background-image : url(https://plataformaintegrada.mec.gov.br/img/Publicar.png); width : 145px; height : 125px; background-repeat : no-repeat; @@ -185,6 +180,7 @@ const Header = styled.div` h2 { font-size : 26px; font-weight : lighter; + color : #666 } ` @@ -204,6 +200,7 @@ const StyledModal = styled(Modal)` const Container = styled.div` box-sizing : border-box; box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12); + background-color : #fff; align : center; display : flex; flex-direction : column; @@ -224,8 +221,4 @@ const Container = styled.div` p { margin : 0 0 10px; } - - color: ${props => props.contrast === "" ? "#666" : "white"}; - background-color: ${props => props.contrast === "" ? "white" : "black"}; - border: ${props => props.contrast === "" ? "" : "1px solid white"}; ` diff --git a/src/Components/Notifications.js b/src/Components/Notifications.js index 3765b7795b00f7009c1a4a42f56bdf24cfbb7d86..d6973d15a49070fae58e2d226005b9b3162937eb 100644 --- a/src/Components/Notifications.js +++ b/src/Components/Notifications.js @@ -15,7 +15,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, { useState, useEffect, useContext } from 'react'; +import React, { useState, useEffect } from 'react'; import NotificationsIcon from '@material-ui/icons/Notifications'; import { Button } from '@material-ui/core'; import Badge from '@material-ui/core/Badge'; @@ -28,7 +28,6 @@ import { withStyles } from '@material-ui/core/styles'; import { Link } from 'react-router-dom' import { getRecipientHref } from './Activities/getRecipientHref.js' import SnackBar from '../Components/SnackbarComponent' -import { Store } from '../Store'; const StyledBadge = styled(Badge)` .MuiBadge-dot-45{ @@ -59,24 +58,23 @@ const StyledMenu = withStyles({ border: '1px solid #d3d4d5', }, })((props) => ( - <Menu - elevation={0} - getContentAnchorEl={null} - anchorOrigin={{ - horizontal: 'center', - vertical: "bottom", - }} - transformOrigin={{ - vertical: 'top', - horizontal: 'center', - }} - {...props} - /> + <Menu + elevation={0} + getContentAnchorEl={null} + anchorOrigin={{ + horizontal: 'center', + vertical: "bottom", + }} + transformOrigin={{ + vertical: 'top', + horizontal: 'center', + }} + {...props} + /> )); export default function Notification(props) { const [anchorEl, setAnchorEl] = React.useState(null); - const { state } = useContext(Store); const [notifications, setNotifications] = useState([]); const [snack, setSnack] = useState({ open: false, @@ -117,6 +115,7 @@ export default function Notification(props) { function handleClick(event) { + console.log('event.currentTarget: ', event.currentTarget) setAnchorEl(event.currentTarget); } @@ -186,19 +185,10 @@ export default function Notification(props) { color={snack.color} text={snack.text} /> - <StyledNotificationButton title="Notificações" onClick={handleClick}> - { - notifications.some((notification) => (notification.recipient !== null) && (notification.viewed === false) && (notification.recipient_type !== "NilClass")) ? - ( - <StyledBadge badgeContent={1} color="secondary" variant="dot" overlap="circle" className="badge"> - <StyledNotificationsIcon className={` ${state.contrast}LinkColor`} /> - </StyledBadge> - ) - : - ( - <StyledNotificationsIcon className={` ${state.contrast}LinkColor`} /> - ) - } + <StyledNotificationButton onClick={handleClick}> + <StyledBadge badgeContent={1} color="secondary" variant="dot" overlap="circle" className="badge"> + <StyledNotificationsIcon /> + </StyledBadge> </StyledNotificationButton> <StyledMenu id="simple-menu" @@ -206,23 +196,17 @@ export default function Notification(props) { keepMounted open={Boolean(anchorEl)} onClose={handleClose} - contrast={state.contrast} - MenuListProps={{ - disablePadding: true - }} > - <ContainerDiv contrast={state.contrast}> + <ContainerDiv> <div className="cabecalho"> - <span style={{ fontSize: "15px" }}>NOTIFICAÇÕES</span> + <span style={{ fontSize: "15px" }}>NOTIFICAÇÕES •</span> <span className="cabecalho-marcar" onClick={handleClickNotification}>Marcar todas como lidas</span> </div> { notifications.map((notification) => (notification.recipient !== null) && (notification.viewed === false) && - (notification.recipient_type !== "NilClass") && <ActivityListItem - contrast={state.contrast} onMenuBar={true} avatar={notification.owner.avatar ? apiDomain + notification.owner.avatar : null} activity={notification.activity} @@ -238,7 +222,7 @@ export default function Notification(props) { } <div style={{ padding: "0 15px", borderTop: "1px solid #dadada" }}> <Link to="/perfil"> - <NoPadButton contrast={state.contrast}> + <NoPadButton> MOSTRAR TODAS </NoPadButton> </Link> @@ -250,32 +234,33 @@ export default function Notification(props) { } -const NoPadButton = styled.div` +const NoPadButton = styled(Button)` padding : 6px 0 !important; - color: ${props => props.contrast === '' ? "#71409E" : "yellow"} !important; - text-decoration: ${props => props.contrast === '' ? "none" : "yellow underline"} !important; ` const ContainerDiv = styled.div` + margin-top : 10px; right : 5%; width : 360px; max-height : 400px; + box-shadow : 8px 8px 8px 8px rgba(0,0,0,.1); - overflow-y : auto; + overflow-y : scroll; padding : 5px 5px 5px 5px; min-width : 160px; - background-color: ${props => props.contrast === '' ? "white" : "black"}; + background-color : #f1f1f1; .cabecalho { border-bottom : 1px solid #dadada; padding : 10px 15px; - color: ${props => props.contrast === '' ? "#666" : "yellow"}; .cabecalho-marcar { - font-size: 15px; + font-family: Lato,bold; + font-size: 12px; + -webkit-text-decoration-line: underline; + text-decoration-line: underline; float: right; - cursor: pointer; - color: ${props => props.contrast === '' ? "#71409E" : "yellow"} !important; + cursor: pointer;s } } ` diff --git a/src/Components/PageProfessorComponents/ModalConfirmarProfessor.js b/src/Components/PageProfessorComponents/ModalConfirmarProfessor.js index 87d1a05b6d86664fc9debc8ce9950ab22621bc79..f8bceee1e9452edcd3562d71f954d923a21d7d91 100644 --- a/src/Components/PageProfessorComponents/ModalConfirmarProfessor.js +++ b/src/Components/PageProfessorComponents/ModalConfirmarProfessor.js @@ -17,12 +17,12 @@ 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 { Button } from '@material-ui/core'; import Modal from '@material-ui/core/Modal'; import Backdrop from '@material-ui/core/Backdrop'; import Fade from '@material-ui/core/Fade'; import styled from 'styled-components' -import CloseModalButton from '../CloseModalButton'; -import { ButtonCancelar, ButtonEnviar } from '../ReportUserForm'; +import CloseIcon from '@material-ui/icons/Close'; const StyledModal = styled(Modal)` display : flex; @@ -50,11 +50,13 @@ export default function ModalConfirmarProfessor (props){ > <Fade in={props.open} style={{ transitionDelay :"0.4ms"}}> <> - <ConfirmarProfessorComponent contrast={props.contrast}> + <ConfirmarProfessorComponent> <HeaderDiv> <span style={{width:"32px"}}/> <h2>Confirme os Dados</h2> - <CloseModalButton contrast={props.contrast} handleClose={props.handleClose}/> + <Button style={{marginRight:"-8px", color:"000"}} onClick={props.handleClose}> + <CloseIcon style={{color:"#666", cursor:"pointer", verticalAlign:"middle"}}/> + </Button> </HeaderDiv> <DialogContentDiv> @@ -64,8 +66,8 @@ export default function ModalConfirmarProfessor (props){ <p><strong>Telefone da Escola:</strong> {props.info.school_phone}</p> <p><strong>Seu CPF:</strong> {props.info.teacher_cpf}</p> <ButtonsDiv> - <ButtonEnviar contrast={props.contrast} onClick={props.confirmar}>CONFIRMAR</ButtonEnviar> - <ButtonCancelar contrast={props.contrast} onClick={props.cancelar}>CANCELAR</ButtonCancelar> + <ConfirmButton onClick ={props.confirmar}>CONFIRMAR</ConfirmButton> + <CancelButton onClick = {props.cancelar}>CANCELAR</CancelButton> </ButtonsDiv> </ContainerCentralized> </DialogContentDiv> @@ -76,7 +78,7 @@ export default function ModalConfirmarProfessor (props){ ) } -/* + const CancelButton = styled(Button)` width : 140px !important; color :#666 !important; @@ -107,7 +109,7 @@ const ConfirmButton = styled(Button)` margin : 6px 8px !important; display : inline-block !important; ` -*/ + const ButtonsDiv = styled.div` margin-top : 10px; display : flex; @@ -146,7 +148,6 @@ const HeaderDiv = styled.div` const ConfirmarProfessorComponent = styled.div` min-width : 600px; border-radius : 4px; - background-color: ${props => props.contrast === "" ? "white" : "black"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - border: ${props => props.contrast === "" ? "" : "1px solid white"}; + background-color : #fff; + color : #666; ` diff --git a/src/Components/PageProfessorComponents/PartOne.js b/src/Components/PageProfessorComponents/PartOne.js index e46c4f871547a5a8d8d3b694af8ceb43bc44480d..ad8fcf9a72464421bb2a467cd1c4b32aa9244db0 100644 --- a/src/Components/PageProfessorComponents/PartOne.js +++ b/src/Components/PageProfessorComponents/PartOne.js @@ -1,35 +1,18 @@ -import React, { useState, useEffect } from 'react' +import React, {useState, useEffect} from 'react' import styled from 'styled-components' import Stepper from '../Stepper.js' import FormControl from '@material-ui/core/FormControl'; import MenuItem from '@material-ui/core/MenuItem'; -import { Button } from '@material-ui/core' -import { RightSideStrikedH3, LeftSideStrikedH3 } from '../LoginContainerFunction.js' -import { ButtonCancelar } from './PartTwo.js' +import Select from '@material-ui/core/Select'; +import InputLabel from '@material-ui/core/InputLabel'; +import {Button} from '@material-ui/core' +import {RightSideStrikedH3, LeftSideStrikedH3} from '../LoginContainerFunction.js' +import Divider from '@material-ui/core/Divider'; +import {ButtonCancelar} from './PartTwo.js' import axios from 'axios' import FormInput from '../FormInput.js' -import TextField from '@material-ui/core/TextField'; -import { makeStyles } from "@material-ui/styles"; - -const useStyles = makeStyles(theme => ({ - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "white", - width: "100%" - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "black", - width: "100%" - } -})); - -export function sortDict(dict) { +export function sortDict (dict) { const newDict = dict.sort((a, b) => (a.name) > (b.name) ? 1 : -1) return newDict @@ -44,14 +27,13 @@ const extractUFInfo = (ufs, name) => { abbreviation = obj.abbreviation } } - return { id: id, abbreviation: abbreviation } + return {id : id, abbreviation : abbreviation} } -export default function PartOne(props) { - const classes = useStyles(); +export default function PartOne (props) { //stores initial get response (list of states, sorted alphabetically) const [ufList, setStates] = useState([]) - const handleSetStates = (states) => { setStates(states) } + const handleSetStates = (states) => {setStates(states)} //stores list of cities sorted alphabetically const [municipioList, setMunicipioList] = useState([]) @@ -60,34 +42,33 @@ export default function PartOne(props) { //stores a single user selected state const [uf, setUF] = useState( { - algumFoiEscolhido: false, - name: '', - abbreviation: '' + algumFoiEscolhido : false, + name : '', + abbreviation : '' } ) //stores a single user selected city const [municipio, setMunicipio] = useState( { - algumFoiEscolhido: false, - name: '' + algumFoiEscolhido : false, + name : '' } ) const [codigoINEP, setCodigoINEP] = useState( { - codigoInvalido: false, - value: '' + codigoInvalido : false, + value : '' } ) const handleCodigoINEP = (event) => { const code = event.target.value - setCodigoINEP({ - ...codigoINEP, - codigoInvalido: false, - value: code + setCodigoINEP({...codigoINEP, + codigoInvalido : false, + value : code }) } @@ -95,13 +76,12 @@ export default function PartOne(props) { const code = codigoINEP.value axios.get(('https://www.simcaq.c3sl.ufpr.br/api/v1/portal_mec_inep?filter=school_cod:' + code) - ).then((response) => { + ).then( (response) => { handleSubmit() }, (error) => { - setCodigoINEP({ - ...codigoINEP, - codigoInvalido: true, - value: '' + setCodigoINEP({...codigoINEP, + codigoInvalido : true, + value : '' }) } ) @@ -112,149 +92,128 @@ export default function PartOne(props) { } //on render component, call simcaq api and update ufList - useEffect(() => { + useEffect ( () => { axios.get(('https://simcaq.c3sl.ufpr.br/api/v1/state') - ).then((response) => { + ).then( (response) => { + console.log(sortDict(response.data.result)) handleSetStates(sortDict(response.data.result)) }, - (error) => console.log('erro acessando api do simcaq (estados)')) + (error) => console.log('erro acessando api do simcaq (estados)')) }, []) const handleChooseUF = (event) => { const ufName = event.target.value - const { id, abbreviation } = extractUFInfo(ufList, ufName) + const {id, abbreviation} = extractUFInfo(ufList, ufName) + console.log(id, abbreviation) - setUF({ - ...uf, - algumFoiEscolhido: true, - name: ufName, - abbreviation: abbreviation - } + setUF({...uf, + algumFoiEscolhido : true, + name : ufName, + abbreviation : abbreviation + } ) axios.get(('https://simcaq.c3sl.ufpr.br/api/v1/city?filter=state:' + id) - ).then((response) => { + ).then( (response) => { handleSetMunicipioList(sortDict(response.data.result)) - }, (error) => console.log('erro acessando api do simcaq (cidades)') + }, (error) => console.log('erro acessando api do simcaq (cidades)') ) } const handleChooseCity = (event) => { const cityName = event.target.value - setMunicipio({ - ...municipio, - algumFoiEscolhido: true, - name: cityName - } + console.log(cityName) + setMunicipio({...municipio, + algumFoiEscolhido : true, + name : cityName + } ) } return ( <> - {/*/////////////////////////////PRIMEIRA PARTE/////////////////////////////*/} - <Content> - <h4>Vamos localizar o seu cadastro:</h4> - <Stepper contrast={props.contrast} activeStep={props.activeStep}/> - <form style={{ textAlign: "start" }}> - <p>Localize pelo menos uma escola em que você tenha atuado até maio de 2017:</p> - <FormControl required style={{ width: "100%", marginTop: '1em' }}> - <h5> Procure sua UF </h5> - <StyledTextField - helperText={<span style={props.contrast === "" ? {} : { color: "white" }}>Clique aqui para selecionar sua UF</span>} - contrast={props.contrast} - select - fullWidth - value={uf.name} - onChange={handleChooseUF} - variant="outlined" - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} - > - { - ufList.map((ufs) => - <MenuItem style={props.contrast === "" ? {} : { backgroundColor: "black", color: "yellow", textDecoration: "underline" }} key={ufs.name} value={ufs.name}>{ufs.name}</MenuItem> - ) - } - </StyledTextField> - </FormControl> - <FormControl required style={{ width: "100%", marginTop: '1em' }}> - <h5> Busque o seu município </h5> - <StyledTextField - helperText={<span style={props.contrast === "" ? {} : { color: "white" }}>Clique aqui para selecionar seu município</span>} - contrast={props.contrast} - select - fullWidth - value={municipio.name} - onChange={handleChooseCity} - variant="outlined" - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} - > - { - municipioList.map((cidades) => - <MenuItem style={props.contrast === "" ? {} : { backgroundColor: "black", color: "yellow", textDecoration: "underline" }} key={cidades.name} value={cidades.name}>{cidades.name}</MenuItem> - ) - } - </StyledTextField> - </FormControl> - <div style={{ display: "flex", justifyContent: "center", paddingTop: "10px", paddingBottom: "10px" }}> - <ButtonConfirmar - contrast={props.contrast} - onClick={((uf.algumFoiEscolhido && municipio.algumFoiEscolhido) ? handleSubmit : '')} - > - BUSCAR</ButtonConfirmar> - </div> - </form> + {/*/////////////////////////////PRIMEIRA PARTE/////////////////////////////*/} + <Content> + <h4>Vamos localizar o seu cadastro:</h4> + <Stepper items={props.stepper}/> + <form style={{textAlign:"start"}}> + <p>Localize pelo menos uma escola em que você tenha atuado até maio de 2017:</p> + <FormControl required style={{width:"100%"}}> + <InputLabel>Procure sua UF</InputLabel> + <Select + labelId="demo-simple-select-label" + id="demo-simple-select" + value={uf.name} + onChange={handleChooseUF} + > + { + ufList.map( (ufs)=> + <MenuItem key={ufs.name} value={ufs.name}>{ufs.name}</MenuItem> + ) + } + </Select> + </FormControl> + <FormControl required style={{width:"100%"}}> + <InputLabel>Busque o seu município</InputLabel> + <Select + labelId="demo-simple-select-label" + id="demo-simple-select" + value={municipio.name} + onChange={handleChooseCity} + > + { + municipioList.map( (cidades)=> + <MenuItem key={cidades.name} value={cidades.name}>{cidades.name}</MenuItem> + ) + } + </Select> + </FormControl> + <div style={{display:"flex", justifyContent:"center",paddingTop:"10px", paddingBottom:"10px"}}> + <ButtonConfirmar + onClick={ ( (uf.algumFoiEscolhido && municipio.algumFoiEscolhido) ? handleSubmit : '')} + > + BUSCAR</ButtonConfirmar> + </div> + </form> </Content> - <div style={{ display: "flex", justifyContent: "center", alignItems: "center" }}> - <LeftSideStrikedH3 contrast={props.contrast} /><StrikeSpan>ou</StrikeSpan><RightSideStrikedH3 contrast={props.contrast} /> + <div style={{display:"flex", justifyContent:"center", alignItems:"center"}}> + <LeftSideStrikedH3/><StrikeSpan>ou</StrikeSpan><RightSideStrikedH3/> </div> {/*/////////////////////////////SEGUNDA PARTE/////////////////////////////*/} <Content> <form> <p>Localize pelo código INEP da escola:</p> - <FormControl required style={{ width: "100%" }}> - <FormInput - contrast={props.contrast} - inputType={'text'} - name={'Código INEP'} - value={codigoINEP.value} - handleChange={handleCodigoINEP} - placeholder={'Código INEP'} - required={true} - error={codigoINEP.codigoInvalido} - help={codigoINEP.codigoInvalido ? <span style={{ color: 'red' }}>código INEP inválido</span> : ''} - > - </FormInput> + <FormControl required style={{width:"100%"}}> + <FormInput + inputType={'text'} + name={'Código INEP'} + value={codigoINEP.value} + handleChange = {handleCodigoINEP} + placeholder={'Código INEP'} + required={true} + error={codigoINEP.codigoInvalido} + help={codigoINEP.codigoInvalido ? <span style={{color:'red'}}>código INEP inválido</span> : ''} + > + </FormInput> </FormControl> - <div style={{ display: "flex", justifyContent: "center", paddingTop: "10px", paddingBottom: "10px" }}> + <div style={{display:"flex", justifyContent:"center",paddingTop:"10px", paddingBottom:"10px"}}> <ButtonConfirmar - contrast={props.contrast} - onClick={validateINEP} + onClick={validateINEP} > - BUSCAR</ButtonConfirmar> + BUSCAR</ButtonConfirmar> </div> </form> </Content> - <hr style={props.contrast === "" ? { color: "#666" } : { color: "white" }} /> + <Divider/> <ButtonsArea> - <ButtonCancelar contrast={props.contrast} onClick={props.handleCancelar}>CANCELAR VERIFICAÇÃO</ButtonCancelar> + <ButtonCancelar onClick={props.handleCancelar}>CANCELAR VERIFICAÇÃO</ButtonCancelar> </ButtonsArea> </> ) } -const StyledTextField = styled(TextField)` - .MuiOutlinedInput-root { - &.Mui-focused fieldset { - border-color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - } - fieldset { - border-color: ${props => props.contrast === "" ? "#666" : "white"}; - } - } -` - export const ButtonsArea = styled.div` display : flex; justify-content : center; @@ -298,19 +257,34 @@ export const Content = styled.div` } ` export const ButtonConfirmar = styled(Button)` - :hover{ - background: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } - background: ${props => props.contrast === "" ? "#00bcd4 !important" : "black !important"}; - border: ${props => props.contrast === "" ? "0 !important" : "1px solid white !important"}; - color: ${props => props.contrast === "" ? "#fff !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; + background-color : #00bcd4 !important; + color : #fff !important; font-family : 'Roboto',sans-serif !important; + font-size : 14px !important; + font-weight : bolder !important; + padding-left : 16px !important; + padding-right : 16px !important; outline : none !important; margin : 6px 8px !important; white-space : nowrap !important; text-transform : uppercase !important; font-weight : bold !important; + font-size : 14px !important; + font-style : inherit !important; + font-variant : inherit !important; + font-family : inherit !important; + text-decoration : none !important; + overflow : hidden !important; + display : inline-block !important; + position : relative !important; cursor : pointer !important; + min-height : 36px !important; + min-width : 88px !important; + line-height : 36px !important; + vertical-align : middle !important; + align-items : center !important; text-align : center !important; + border-radius : 3px !important; + box-sizing : border-box !important; + border : 0 !important; ` diff --git a/src/Components/PageProfessorComponents/PartThree.js b/src/Components/PageProfessorComponents/PartThree.js index a65b424b9b304c7d0a208dc01b2010030c082e2d..4dc30604264bb51d3b51704b5be14fcd9c2d25dc 100644 --- a/src/Components/PageProfessorComponents/PartThree.js +++ b/src/Components/PageProfessorComponents/PartThree.js @@ -1,38 +1,36 @@ -import React, { useState } from 'react' -import { Content } from './PartOne.js' -import { ButtonCancelar, ButtonGrey } from './PartTwo.js' +import React, {useState} from 'react' +import {Content} from './PartOne.js' +import {ButtonCancelar, ButtonGrey} from './PartTwo.js' import FormControl from '@material-ui/core/FormControl'; import Stepper from '../Stepper.js' import FormInput from '../FormInput.js' import styled from 'styled-components' -import { Button } from '@material-ui/core' +import {Button} from '@material-ui/core' -export default function PartThree(props) { +export default function PartThree (props) { const [phoneNumber, setPhoneNumber] = useState( { - flagInvalid: false, - number: '' + flagInvalid : false, + number : '' } ) const handleChangePhoneNumber = (event) => { - const input = event.target.value; - setPhoneNumber({ - ...phoneNumber, - flagInvalid: (input.length < 10 ? true : false), - number: (input.length > 10 ? phoneNumber.number : input), + const input = event.target.value.replace(/\D/,'') + setPhoneNumber({...phoneNumber, + flagInvalid : (input.length < 10 ? true : false), + number : (input.length > 10 ? phoneNumber.number : input), }) } - const [cpf, setCpf] = useState({ - flagInvalid: false, - number: '' + const [cpf, setCpf] = useState( { + flagInvalid : false, + number : '' }) const handleChangeCpf = (event) => { - const input = event.target.value; - setCpf({ - ...cpf, - flagInvalid: (input.length < 11 ? true : false), - number: (input.length > 11 ? cpf.number : input), + const input = event.target.value.replace(/\D/,'') + setCpf({...cpf, + flagInvalid : (input.length < 11 ? true : false), + number : (input.length > 11 ? cpf.number : input), }) } @@ -45,69 +43,65 @@ export default function PartThree(props) { return ( <> - <Content> - <h4>Vamos localizar o seu cadastro:</h4> - <Stepper contrast={props.contrast} activeStep={props.activeStep}/> - <form style={{ textAlign: "start" }}> - <FormControl required style={{ width: "100%" }}> - <p>Inserir o telefone da escola:</p> - <FormInput - contrast={props.contrast} - variant='outlined' - inputType={'text'} - pattern="[0-9]" - name={'DDD e Número'} - placeholder={'Exemplo: 4112345678'} - value={phoneNumber.number} - handleChange={handleChangePhoneNumber} - error={phoneNumber.flagInvalid} - > - </FormInput> - </FormControl> - <FormControl required style={{ width: "100%" }}> - <p>Inserir o seu CPF</p> - <FormInput - contrast={props.contrast} - variant='outlined' - inputType={'text'} - name={'11 dígitos'} - placeholder={'11 dígitos'} - value={cpf.number} - handleChange={handleChangeCpf} - mask={'999.999.999-99'} - error={cpf.flagInvalid} - > - </FormInput> - </FormControl> - <div style={{ display: "flex", justifyContent: "space-evenly", paddingTop: "10px", paddingBottom: "10px" }}> - <div style={{ display: "flex", justifyContent: "center" }}> - <ButtonConfirmar contrast={props.contrast} onClick={((cpf.flagInvalid || phoneNumber.flagInvalid) ? () => { console.log('cpf.flagInvalid: ', cpf.flagInvalid, 'phoneNumber.flagInvalid: ', phoneNumber.flagInvalid) } : handleSubmit)}>BUSCAR</ButtonConfirmar> - </div> - <div style={{ display: "flex", justifyContent: "center" }}> - <ButtonGrey contrast={props.contrast} onClick={() => props.goBack(false, true, false)}>VOLTAR</ButtonGrey> - <ButtonCancelar contrast={props.contrast} onClick={props.handleCancelar}>CANCELAR</ButtonCancelar> - </div> + {console.log(props)} + <Content> + <h4>Vamos localizar o seu cadastro:</h4> + <Stepper items={props.stepper}/> + <form style={{textAlign:"start"}}> + <FormControl required style={{width:"100%"}}> + <p>Inserir o telefone da escola:</p> + <FormInput + inputType={'text'} + pattern="[0-9]" + name={'DDD e Número'} + placeholder={'Exemplo: 4112345678'} + value={phoneNumber.number} + handleChange={handleChangePhoneNumber} + error={phoneNumber.flagInvalid} + > + </FormInput> + </FormControl> + <FormControl required style={{width:"100%"}}> + <p>Inserir o seu CPF</p> + <FormInput + inputType={'text'} + name={'11 dígitos'} + placeholder={'11 dígitos'} + value={cpf.number} + handleChange={handleChangeCpf} + mask={'999.999.999-99'} + error={cpf.flagInvalid} + > + </FormInput> + </FormControl> + <div style={{display:"flex", justifyContent:"space-evenly",paddingTop:"10px", paddingBottom:"10px"}}> + <div style={{display:"flex", justifyContent:"center"}}> + <ButtonConfirmar onClick={( (cpf.flagInvalid || phoneNumber.flagInvalid) ? () => {console.log('cpf.flagInvalid: ', cpf.flagInvalid, 'phoneNumber.flagInvalid: ', phoneNumber.flagInvalid)} : handleSubmit)}>BUSCAR</ButtonConfirmar> </div> - </form> + <div style={{display:"flex", justifyContent:"center"}}> + <ButtonGrey onClick={() => props.goBack(false, true, false)}>VOLTAR</ButtonGrey> + <ButtonCancelar onClick={props.handleCancelar}>CANCELAR</ButtonCancelar> + </div> + </div> + </form> </Content> </> ) } const ButtonConfirmar = styled(Button)` - :hover{ - background: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } - background: ${props => props.contrast === "" ? "#00bcd4 !important" : "black !important"}; - border: ${props => props.contrast === "" ? "0 !important" : "1px solid white !important"}; - color: ${props => props.contrast === "" ? "#fff !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; + background-color : #00bcd4 !important; + color : #fff !important; + box-shadow : none !important; font-family : 'Roboto',sans-serif !important; - outline : none !important; - margin : 6px 8px !important; - white-space : nowrap !important; - text-transform : uppercase !important; + font-size : 14px !important; font-weight : bold !important; - cursor : pointer !important; + height : 36px !important; + border-radius : 3px !important; + padding-left : 16px !important; + padding-right : 16px !important; + vertical-align : middle !important; text-align : center !important; + align-items : center !important; + ` diff --git a/src/Components/PageProfessorComponents/PartTwo.js b/src/Components/PageProfessorComponents/PartTwo.js index a2b325cff4718c34bf9d7db4190d463b7fa47d88..a4e68d4a6de2ad449ab9cfd9e999b321cd546379 100644 --- a/src/Components/PageProfessorComponents/PartTwo.js +++ b/src/Components/PageProfessorComponents/PartTwo.js @@ -1,40 +1,37 @@ -import React, { useState, useEffect } from 'react' -import { Content, ButtonsArea } from './PartOne.js' +import React, {useState, useEffect} from 'react' +import {Content, ButtonsArea} from './PartOne.js' +import Divider from '@material-ui/core/Divider'; import Stepper from '../Stepper.js' import CustomizedTables from '../Table.js' import styled from 'styled-components' -import { Button } from '@material-ui/core' +import {Button} from '@material-ui/core' import axios from 'axios' -import { simcaqAPIurl } from '../../env' -import { sortDict } from './PartOne.js' +import {simcaqAPIurl} from '../../env' +import {sortDict} from './PartOne.js' -export default function PartTwo(props) { +export default function PartTwo (props) { const [schoolList, setSchoolList] = useState([]) - const [state, setState] = useState(''); - const [city, setCity] = useState(''); - useEffect(() => { + useEffect ( () => { const code = (props.info.inep_code || '') const uf = (props.info.school_uf.abbreviation || '') const municipio = (props.info.school_city || '') - - setState(uf); - setCity(municipio); + //console.log(code, uf, municipio) + //if user searched by inep code if (code !== '') { axios.get((`${simcaqAPIurl}/portal_mec_inep?filter=school_cod:` + code) - ).then((response) => { - setSchoolList(sortDict(response.data.result)) - }, (error) => console.log('erro ao dar get na escola por inep code') - ) - } + ).then ((response) => { + setSchoolList(sortDict(response.data.result)) + }, (error) => console.log('erro ao dar get na escola por inep code') + )} else if (uf !== '' && municipio !== '') { axios.get((`${simcaqAPIurl}/school?search=state_name:"` + uf + '",city_name:"' + municipio + '"&filter=year:2017') - ).then((response) => { - setSchoolList(sortDict(response.data.result)) - }, (error) => console.log('erro ao dar get na escola por uf e municipio', code, uf, municipio) - ) - } + ).then((response)=> { + //console.log(response.data.result) + setSchoolList(sortDict(response.data.result)) + }, (error) => console.log('erro ao dar get na escola por uf e municipio', code, uf, municipio) + )} }, []) const onClickTable = (city_name, id, name, state_name) => { @@ -43,54 +40,58 @@ export default function PartTwo(props) { return ( <> + {console.log(props)} <Content> <h4>Vamos localizar o seu cadastro:</h4> - <Stepper contrast={props.contrast} activeStep={props.activeStep}/> + <Stepper items={props.stepper}/> </Content> <Content> <InputContainer> - <p>Selecione a sua escola da UF: {state} e do município: {city}:</p> + <p>Selecione a sua escola:</p> - <CustomizedTables - contrast={props.contrast} - columns={['Codigo INEP', 'Escola', 'UF', 'Cidade']} - rows={schoolList} onClickTable={onClickTable} - /> + <CustomizedTables + columns={['Codigo INEP', 'Escola', 'UF', 'Cidade']} + rows={schoolList} onClickTable={onClickTable} + /> </InputContainer> </Content> - <hr style={props.contrast === "" ? { color: '#666' } : { color: "white" }} /> + <Divider/> <ButtonsArea> - <ButtonGrey contrast={props.contrast} onClick={() => props.goBack(true, false, false)}>VOLTAR</ButtonGrey> - <ButtonCancelar contrast={props.contrast} onClick={props.handleCancelar}>CANCELAR VERIFICAÇÃO</ButtonCancelar> + <ButtonGrey onClick={() => props.goBack(true, false, false)}>VOLTAR</ButtonGrey> + <ButtonCancelar onClick={props.handleCancelar}>CANCELAR VERIFICAÇÃO</ButtonCancelar> </ButtonsArea> </> ) } export const ButtonCancelar = styled(Button)` - :hover{ - background: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } - background: ${props => props.contrast === "" ? "" : "black !important"}; - border: ${props => props.contrast === "" ? "0 !important" : "1px solid white !important"}; - color: ${props => props.contrast === "" ? "#666 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; + color: #666 !important; font-family: 'Roboto',sans-serif !important; + font-size: 14px !important; font-weight: bold !important; + height: 36px !important; border-radius: 3px !important; + padding-left: 16px !important; + padding-right: 16px !important; ` export const ButtonGrey = styled(Button)` - :hover{ - background: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } - background: ${props => props.contrast === "" ? "#fff !important" : "black !important"}; - border: ${props => props.contrast === "" ? "1.5px #666 solid !important" : "1px solid white !important"}; - color: ${props => props.contrast === "" ? "#666 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; + background-color : #fff !important; + border : 1.5px #666 solid !important; + color : #666 !important; + box-shadow : none !important; font-family : 'Roboto',sans-serif !important; + font-size : 14px !important; + font-weight : bold !important; + height : 36px !important; + border-radius : 3px !important; + padding-left : 16px !important; + padding-right : 16px !important; + vertical-align : middle !important; text-align : center !important; + align-items : center !important; + ` const InputContainer = styled.div` diff --git a/src/Components/PageProfessorComponents/SuccessfulRequest.js b/src/Components/PageProfessorComponents/SuccessfulRequest.js index 8d243f7677a92f52a5ed1ce7c9c3543e9de63869..ffd481b450846b031f7a209df95675646eaaa022 100644 --- a/src/Components/PageProfessorComponents/SuccessfulRequest.js +++ b/src/Components/PageProfessorComponents/SuccessfulRequest.js @@ -1,29 +1,29 @@ import React from 'react' import styled from 'styled-components' -import { ButtonConfirmar } from './PartOne.js' +import {ButtonConfirmar} from './PartOne.js' //Image Import import { Comentarios } from "ImportImages.js"; -export default function SuccessfulRequest(props) { +export default function SuccessfulRequest (props) { const h4Text = 'Obrigado por fazer parte dessa rede!' const pText = 'Em breve você poderá publicar os seus próprios reursos educacionais digitais. O MEC analisará as suas informações junto a escola e você será avisada(o) aqui na plataforma e em seu email: ' const redirect = () => { props.history.push('/') } - + return ( - <div style={{ maxWidth: "575px", padding: "0 36px" }}> - <div style={{ display: "flex", flexDirection: "column" }}> + <div style={{maxWidth:"575px", padding : "0 36px"}}> + <div style={{display : "flex", flexDirection : "column"}}> <StyledH4>{h4Text}</StyledH4> <TextDiv> <p>{pText} <b>{props.email}</b>.</p> </TextDiv> - <div style={{ display: 'flex', flexDirection: 'row', justifyContent: "center" }}> - <ButtonConfirmar contrast={props.contrast} onClick={redirect}>VOLTAR À PAGINA INICIAL</ButtonConfirmar> + <div style={{display : 'flex', flexDirection : 'row', justifyContent : "center"}}> + <ButtonConfirmar onClick={redirect}>VOLTAR À PAGINA INICIAL</ButtonConfirmar> </div> - <ImageDiv /> + <ImageDiv/> </div> </div> ) diff --git a/src/Components/PasswordRecoveryComponents/Default.js b/src/Components/PasswordRecoveryComponents/Default.js index a11262fa7f83fda8e190cde76b1bde9cc2e314f3..e7a45389a59a27e43ad925db4290a48d12b2c856 100644 --- a/src/Components/PasswordRecoveryComponents/Default.js +++ b/src/Components/PasswordRecoveryComponents/Default.js @@ -1,34 +1,25 @@ import React from 'react' -import { CompletarCadastroButton } from '../TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js' +import {CompletarCadastroButton} from '../TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js' import FormInput from "../FormInput.js" -import styled from 'styled-components' -export default function Default(props) { +export default function Default (props) { return ( - <div style={{ overflow: "hidden", display: "inline-block" }}> - <Title contrast={props.contrast}>Vamos encontrar a sua conta</Title> + <div style={{overflow:"hidden", display:"inline-block"}}> + <h2 style={{fontSize:"32px", fontWeight:"200", marginBottom:"20px"}}>Vamos encontrar a sua conta</h2> <form onSubmit={(e) => { e.preventDefault(); props.onSubmit(e); }}> <FormInput - contrast={props.contrast} inputType={"text"} name={"email"} value={props.value} placeholder={"E-mail"} handleChange={e => props.handleChange(e)} required={true} - error={props.error} + error = {props.error} /> - <div style={{ display: "flex", justifyContent: "center" }}> - <CompletarCadastroButton contrast={props.contrast} type="submit" >BUSCAR</CompletarCadastroButton> + <div style={{display:"flex", justifyContent:"center"}}> + <CompletarCadastroButton type="submit" >BUSCAR</CompletarCadastroButton> </div> </form> </div> ) } - -const Title = styled.h2` - color: ${props => props.contrast === "" ? "" : "white"}; - font-size: 32px; - font-weight: 200; - margin-bottom: 20px; -` diff --git a/src/Components/PasswordRecoveryComponents/Error.js b/src/Components/PasswordRecoveryComponents/Error.js index 6223f3a4f0c7bbd1d319c86b7a8f0c16b8e400dc..38ea3937b4b3713e2ac3b363f8d582ff6d21c0f4 100644 --- a/src/Components/PasswordRecoveryComponents/Error.js +++ b/src/Components/PasswordRecoveryComponents/Error.js @@ -1,49 +1,27 @@ import React from 'react' -import { CompletarCadastroButton } from '../TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js' +import {CompletarCadastroButton} from '../TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js' import FormInput from "../FormInput.js" -import styled from 'styled-components' -export default function Error(props) { +export default function Error (props) { return ( - <StyledDiv contrast={props.contrast}> - <h2 className="title">Ops! Não encontramos essa conta</h2> - <p className="paragraph">{props.value}</p> - <p className="paragraph">Verifique se o e-mail foi digitado corretamente ou se você utilizou algum outro e-mail.</p> + <div style={{overflow:"hidden", display:"inline-block"}}> + <h2 style={{fontSize:"32px", fontWeight:"200", marginBottom:"20px"}}>Ops! Não encontramos essa conta</h2> + <p>{props.value}</p> + <p>Verifique se o e-mail foi digitado corretamente ou se você utilizou algum outro e-mail.</p> <form onSubmit={(e) => props.onSubmit(e)}> <FormInput - contrast={props.contrast} inputType={"text"} name={"email"} value={props.value} placeholder={"E-mail"} handleChange={e => props.handleChange(e)} required={true} - error={props.error} + error = {props.error} /> - <div style={{ display: "flex", justifyContent: "center" }}> - <CompletarCadastroButton contrast={props.contrast} type="submit" >BUSCAR</CompletarCadastroButton> + <div style={{display:"flex", justifyContent:"center"}}> + <CompletarCadastroButton type="submit" >BUSCAR</CompletarCadastroButton> </div> </form> - </StyledDiv> + </div> ) } - - -const StyledDiv = styled.div` - overflow: hidden; - display: inline-block; - font-size: 14px; - text-align: start; - - .paragraph{ - color: ${props => props.contrast === "" ? "" : "white"}; - } - - .title{ - color: ${props => props.contrast === "" ? "" : "white"}; - font-size: 32px; - font-weight: 200; - margin-bottom: 20px; - line-height : 30px; - } -` diff --git a/src/Components/PasswordRecoveryComponents/Success.js b/src/Components/PasswordRecoveryComponents/Success.js index 1f4790bd45136dfee6aae87c7f0a84c5695ba686..34feb617ef2094f169acb826e40ea73cd16d4e8a 100644 --- a/src/Components/PasswordRecoveryComponents/Success.js +++ b/src/Components/PasswordRecoveryComponents/Success.js @@ -1,41 +1,12 @@ import React from 'react' -import styled from 'styled-components' -export default function Default(props) { +export default function Default (props) { return ( - <StyledDiv contrast={props.contrast}> - <h2 className="title">Feito! Confira seu e-mail</h2> - <p className="paragraph"> Enviamos um link para <span className="email">{String(props.email)}</span> que permite alterar sua senha. </p> - <p className="paragraph" style={{ marginBottom: "30px" }}> Caso não chegue em sua caixa de entrada, dê uma olhada em outras pastas, como lixo eletrônico ou spam. </p> - <p className="paragraph"> Não é o seu e-mail? <span className="link" onClick={() => { props.changeSwitch('default') }}> Tente Novamente.</span></p> - </StyledDiv> + <div style={{overflow:"hidden", display:"inline-block", fontSize:"14px", textAlign:"start"}}> + <h2 style={{fontSize:"32px", fontWeight:"200", marginBottom:"20px"}}>Feito! Confira seu e-mail</h2> + <p> Enviamos um link para <span style={{color:"#00bcd4"}}>{String(props.email)}</span> que permite alterar sua senha. </p> + <p style={{marginBottom:"30px"}}> Caso não chegue em sua caixa de entrada, dê uma olhada em outras pastas, como lixo eletrônico ou spam. </p> + <p> Não é o seu e-mail? <span style={{color:"#00bcd4", cursor:"pointer"}} onClick={() => {props.changeSwitch('default')}}> Tente Novamente.</span></p> + </div> ) } - -const StyledDiv = styled.div` - overflow: hidden; - display: inline-block; - font-size: 14px; - text-align: start; - - .paragraph{ - color: ${props => props.contrast === "" ? "" : "white"}; - } - - .title{ - color: ${props => props.contrast === "" ? "" : "white"}; - font-size: 32px; - font-weight: 200; - margin-bottom: 20px; - } - - .email{ - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - } - - .link{ - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${ props => props.contrast === "" ? "none" : "underline"}; - cursor: pointer; - } -` diff --git a/src/Components/PublicationPermissionsContent.js b/src/Components/PublicationPermissionsContent.js index 13894ecf3e4a59212fba19e25cc075dae2b17f6c..2f404e49217f7c9c83541ed84c3852ce94d06b65 100644 --- a/src/Components/PublicationPermissionsContent.js +++ b/src/Components/PublicationPermissionsContent.js @@ -1,5 +1,6 @@ -import React, { useState } from 'react'; +import React, {useState, useEffect} from 'react'; import Typography from '@material-ui/core/Typography'; +import CardContent from '@material-ui/core/CardContent'; import styled from 'styled-components' import RadioGroup from '@material-ui/core/RadioGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; @@ -7,7 +8,7 @@ import Radio from '@material-ui/core/Radio'; import FormControl from '@material-ui/core/FormControl'; import Grid from '@material-ui/core/Grid'; import { withStyles } from '@material-ui/core/styles'; -import { yellow } from "@material-ui/core/colors"; +import {getRequest} from './HelperFunctions/getAxiosConfig' const StyledFormControl = styled(FormControl)` display: "block ruby"; @@ -15,72 +16,109 @@ const StyledFormControl = styled(FormControl)` ` const BlueRadio = withStyles({ - root: { - color: '#666', - '&$checked': { - color: '#00bcd4', - }, + root: { + color: '#666', + '&$checked': { + color: '#00bcd4', }, - checked: {}, + }, + checked: {}, })((props) => <Radio color="default" {...props} />); -const ContrastRadio = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, - }, - checked: {}, -})((props) => <Radio color="default" {...props} />); +export default function PublicationPermissionsContent (props) { + + const [questionsArr, setQuestionsArr] = useState([]) + const handleSetQuestionsArr = (newArr) => {setQuestionsArr(newArr)} -export default function PublicationPermissionsContent(props) { + function handleSuccess (data) { + handleSetQuestionsArr(data) + } - const [questionsArr] = useState(props.questionsArr); + useEffect(() => { + const url = `/questions/` + + getRequest(url, handleSuccess, (error) => {console.log(error)}) + + }, []) return ( - <div style={props.contrast === "" ? { textAlign: "start", lineHeight: "21px", color: "rgb(102, 102, 102)", padding: "65px" } : { textAlign: "start", lineHeight: "21px", color: "white", padding: "65px", backgroundColor: "black" }}> - <Typography variant="h4" style={props.contrast === "" ? { textAlign: "center", color: "rgb(102, 102, 102)", fontSize: "26px" } : { textAlign: "center", color: "white", fontSize: "26px" }}> É necessário que você declare a permissão de publicação do seu Recurso:</Typography> - <div classname="texto-termos"> - <div classname="title"> - <Typography variant="h3" style={props.contrast === "" ? { textAlign: "center", fontSize: "30px", marginTop: "20px", marginBottom: "10px", color: "rgb(102, 102, 102)" } : { textAlign: "center", fontSize: "30px", marginTop: "20px", marginBottom: "10px", color: "white" }}> - PERMISSÃO DE PUBLICAÇÃO - </Typography> - </div> - <p>Ao prosseguir você concede a permissão de publicação do seu recurso ao nosso portal e se compromete a não infringir as políticas de conteúdos, estando então, + <CardContent style={{textAlign: "start", marginBottom: "10px", lineHeight:"21px", color:"rgb(102, 102, 102)", padding:"65px"}}> + <Typography variant="h4" style={{textAlign:"center", color:"rgb(102, 102, 102)", fontSize:"26px"}}> É necessário que você declare a permissão de publicação do seu Recurso:</Typography> + <div classname="texto-termos"> + <div classname="title"> + <Typography variant = "h3" style={{textAlign:"center", fontSize:"30px", marginTop:"20px", marginBottom:"10px", color:"rgb(102, 102, 102)"}}> + PERMISSÃO DE PUBLICAÇÃO + </Typography> + </div> + <p>Ao prosseguir você concede a permissão de publicação do seu recurso ao nosso portal e se compromete a não infringir as políticas de conteúdos, estando então, a partir desse momento passível de responsabilização pelo conteúdo a ser integrado a nossa rede. Para tanto atente-se as pontuações abaixo e verifique se o seu recurso está de acordo, antecipadamente, com as nossas condições. É recomendável a leitura das políticas de conteúdo estabelecidas - (<a href="/termos" style={props.contrast === "" ? { color: "initial" } : { color: "yellow", textDecoration: "underline" }}><strong>Políticas de Conteúdo</strong></a>) - </p> - <Typography variant="h5" style={props.contrast === "" ? { fontWeight: "300", color: "rgb(102, 102, 102)", fontSize: "22px" } : { fontWeight: "300", color: "white", fontSize: "22px" }}> + (<a href="/termos" style={{color:"initial"}}><strong>Políticas de Conteúdo</strong></a>) + </p> + <Typography variant="h5" style={{fontWeight:"300", color:"rgb(102, 102, 102)", fontSize:"22px"}}> Para que o recurso seja publicado na plataforma é preciso que ele esteja de acordo com as diretrizes abaixo, a presença de quaisquer dos itens a seguir inviabiliza a publicação do recurso em nossa rede. - </Typography> - <p><strong>No seu recurso está presente algum destes itens abaixo?</strong></p> + </Typography> + <p><strong>No seu recurso está presente algum destes itens abaixo?</strong></p> - <StyledFormControl component="fieldset" style={{ display: "BlockRuby" }} margin='dense' fullWidth={true}> - <Grid container> + <StyledFormControl component="fieldset" style={{display:"BlockRuby"}} margin='dense' fullWidth={true}> + <Grid container> { questionsArr.map((question, index) => - (question.status === 'active' && question.id !== 4) && - <React.Fragment key={question.id}> - <Grid item xs={10}> - <p>{question.description}</p> - </Grid> - <Grid item xs={2}> - <RadioGroup row name={(question.id)} onChange={props.handleRadios}> - <FormControlLabel value="Sim" control={props.contrast === "" ? <BlueRadio /> : <ContrastRadio />} label={<span style={props.contrast === "" ? {} : { color: "yellow", textDecoration: "underline" }}>Sim</span>} /> <FormControlLabel value="Não" control={props.contrast === "" ? <BlueRadio /> : <ContrastRadio />} label={<span style={props.contrast === "" ? {} : { color: "yellow", textDecoration: "underline" }}>Não</span>} /> - </RadioGroup> - </Grid> - </React.Fragment> + (question.status === 'active' && question.id !== 4) && + <React.Fragment key={question.id}> + <Grid item xs={10}> + <p>{question.description}</p> + </Grid> + <Grid item xs={2}> + <RadioGroup row name={"radio" + (question.id)} onChange={props.handleRadios}> + <FormControlLabel value="Sim" control={<BlueRadio/>} label="Sim"/> <FormControlLabel value="Não" control={<BlueRadio/>} label="Não"/> + </RadioGroup> + </Grid> + </React.Fragment> - ) + ) } </Grid> - </StyledFormControl> - </div> - </div> + </StyledFormControl> + </div> + </CardContent> ) } + +// {/* +// <Grid item xs={10}> +// <p> +// O recurso apresenta conteúdo de cunho político-partidário? (Ex: o conteúdo expressa qualquer forma de manifestação que se caracterize como propaganda política)? +// </p> +// </Grid> +// <Grid item xs={2}> +// <RadioGroup row name="radio1" onChange={props.handleRadios}> +// <FormControlLabel value="Sim" control={<BlueRadio/>} label="Sim"/> <FormControlLabel value="Não" control={<BlueRadio/>} label="Não"/> +// </RadioGroup> +// </Grid> + +// <Grid item xs={10}> +// <p> +// O recurso apresenta conteúdo ofensivo? (Ex: material pornográfico e/ou que invada a privacidade de terceiros, viole os Direitos Humanos ou seja ilegal, ofensivo, e que incite a violência)? +// </p> +// </Grid> +// <Grid item xs={2}> +// <RadioGroup row name="radio2" onChange={props.handleRadios}> +// <FormControlLabel value="Sim" control={<BlueRadio/>} label="Sim"/> <FormControlLabel value="Não" control={<BlueRadio/>} label="Não"/> +// </RadioGroup> +// </Grid> +// <Grid item xs={10}> +// <p> +// O recurso apresenta algum tipo de propaganda ou marca? (Ex: o conteúdo tem cunho comercial)? +// </p> +// </Grid> +// <Grid item xs={2}> +// <RadioGroup row name="radio3" onChange={props.handleRadios}> +// <FormControlLabel value="Sim" control={<BlueRadio/>} label="Sim"/> <FormControlLabel value="Não" control={<BlueRadio/>} label="Não"/> +// </RadioGroup> +// </Grid> +// </Grid> +// */} diff --git a/src/Components/PurpleButton.js b/src/Components/PurpleButton.js new file mode 100644 index 0000000000000000000000000000000000000000..1b57b823d14aedd9bb2604fa0de6b9a4ea73da72 --- /dev/null +++ b/src/Components/PurpleButton.js @@ -0,0 +1,52 @@ +/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana + +This file is part of Plataforma Integrada MEC. + +Plataforma Integrada MEC is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Plataforma Integrada MEC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +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 { Button } from '@material-ui/core'; +import styled from 'styled-components' + +export default function PurpleButton (props) { + return ( + <StyledButton onClick={props.callback}> + {props.text} + </StyledButton> + ) +} + +const StyledButton = styled(Button)` + max-height : 36px !important; + background-color : #673ab7 !important; + color : #fff !important; + text-decoration : none !important; + outline : none !important; + text-align : center !important; + + .button-text { + cursor : pointer; + line-height : 36px; + text-align : center; + color : currentColor; + white-space : nowrap; + text-transform : uppercase; + font-weight : 600 !important; + font-size : 14px; + font-style : inherit; + font-variant : inherit; + padding : 6px 16px !important; + } +` diff --git a/src/Components/RedirectModal.js b/src/Components/RedirectModal.js index 525e65fae1b6b6ac4e6e023503520c954667710a..f826b54ea543053125444fa4ab79d008d67c762f 100644 --- a/src/Components/RedirectModal.js +++ b/src/Components/RedirectModal.js @@ -27,7 +27,7 @@ import CloseIcon from '@material-ui/icons/Close'; function CloseModalButton (props) { return ( <StyledCloseModalButton onClick={props.handleClose}> - <CloseIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }} /> + <CloseIcon/> </StyledCloseModalButton> ) } @@ -62,8 +62,8 @@ export default function RedirectModal (props) { }} > <Fade in={props.open}> - <Container contrast={props.contrast}> - <CloseModalButton contrast={props.contrast} handleClose={props.handleClose}/> + <Container> + <CloseModalButton handleClose={props.handleClose}/> <Header> <span style={{width:"32px"}}/> <h2>Você será redirecionado para outro site</h2> @@ -74,14 +74,8 @@ export default function RedirectModal (props) { Lembre-se de que você pode reportar caso considere o conteúdo abusivo/ofensivo ou caso a página não corresponda a descrição apresentada. </div> <section style={{display : "flex", flexDirection : "row", justifyContent : "center"}}> - <ButtonGrey contrast={props.contrast} onClick={props.handleClose}> - CANCELAR - </ButtonGrey> - <a href={props.link} target="_blank" rel="noreferrer noopener" style={{textDecoration : "none !important"}}> - <ButtonOrange contrast={props.contrast}> - CONTINUAR - </ButtonOrange> - </a> + <ButtonGrey onClick={props.handleClose}>CANCELAR</ButtonGrey> + <a href={props.link} target="_blank" rel="noreferrer noopener" style={{textDecoration : "none !important"}}><ButtonOrange>CONTINUAR</ButtonOrange></a> </section> </Content> </Container> @@ -91,11 +85,10 @@ export default function RedirectModal (props) { } const ButtonOrange = styled(Button)` - color: ${props => props.contrast === "" ? "white" : "yellow"} !important; - background-color: ${props => props.contrast === "" ? "#ff7f00" : "black"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - border: ${props => props.contrast === "" ? "none" : "1px solid white"} !important; box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; + background-color : #ff7f00 !important; + color : #fff !important; + text-decoration : none !important; text-transform : uppercase !important; outline : none !important; text-align : center !important; @@ -107,15 +100,14 @@ const ButtonOrange = styled(Button)` const ButtonGrey = styled(Button)` - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - background-color: inherit !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - &:hover { - background-color : ${props => props.contrast === "" ? "rgba(158,158,158,0.2)" : ""} !important; + background-color : rgba(158,158,158,0.2) !important; } margin-top : 5px !important; margin-right : 15px !important; + background-color : transparent !important; + color : #666 !important; + text-decoration : none !important; outline : none !important; text-align : center !important; font-size : 14px !important; @@ -124,6 +116,7 @@ const ButtonGrey = styled(Button)` ` const Content = styled.div` + color : #666; padding : 20px 30px; overflow : visible; text-align : center; @@ -137,6 +130,7 @@ const Header = styled.div` h2 { font-size : 26px; font-weight : lighter; + color : #666 padding : 10px 20px 0 20px; } @@ -156,10 +150,8 @@ const StyledModal = styled(Modal)` ` const Container = styled.div` box-sizing : border-box; - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; - border: ${props => props.contrast === "" ? "none" : "1px solid white"} !important; box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px gba(0,0,0,.12); + background-color : white; align : center; display : flex; flex-direction : column; diff --git a/src/Components/ReportButton.js b/src/Components/ReportButton.js index d9f029789b18875e59d3dcff15ec21b6e19fbc08..654780a75533a8deac35c1cf08121d8634915f3b 100644 --- a/src/Components/ReportButton.js +++ b/src/Components/ReportButton.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, { useState, useContext } from 'react' +import React, {useState, useContext} from 'react' import styled from 'styled-components' import Menu from '@material-ui/core/Menu'; import MenuItem from '@material-ui/core/MenuItem'; @@ -24,10 +24,10 @@ import ReportIcon from '@material-ui/icons/Error'; import Button from '@material-ui/core/Button'; import MoreVertIcon from '@material-ui/icons/MoreVert'; import ReportModal from './ReportModal.js' -import { Store } from '../Store.js' +import {Store} from '../Store.js' -export default function ReportButton(props) { - const { state } = useContext(Store) +export default function ReportButton (props) { + const {state} = useContext(Store) /*Menu control variables-----------------------------*/ const [anchorEl, setAnchorEl] = React.useState(null); @@ -57,36 +57,33 @@ export default function ReportButton(props) { return ( <> - { - reportModal && - <ReportModal contrast={state.contrast} open={reportModal} handleClose={() => handleModal()} + { + reportModal && + <ReportModal open={reportModal} handleClose={() => handleModal()} form="user" complainableId={props.complainableId} complainableType={props.complainableType} - {...props} /> - } - {/* + {...props}/> + } + {/* loginModal && <LoginModal open={loginModal} handleClose={() => {toggleLoginModal(false)}}/> */} - <Button onClick={handleClick}> - <MoreVertIcon style={state.contrast === "" ? { color: "#666" } : { color: "yellow" }} /> - </Button> - <StyledMenu - id="simple-menu" - anchorEl={anchorEl} - keepMounted - open={Boolean(anchorEl)} - onClose={handleClose} - style={{ borderRadius: "0" }} - MenuListProps={{ - disablePadding: true - }} - > - <MenuItem onClick={() => { handleModal() }} style={state.contrast === "" ? { color: "#666", backgroundColor: "white" } : { color: "white", backgroundColor: "black" }}> - <ReportIcon /> - <span style={state.contrast === "" ? { paddingLeft: "3px" } : { paddingLeft: "3px", color: "yellow", textDecoration: "underline" }}>Reportar</span> - </MenuItem> - </StyledMenu> + <Button onClick={handleClick}> + <MoreVertIcon style={{color : "#666"}}/> + </Button> + <StyledMenu + id="simple-menu" + anchorEl={anchorEl} + keepMounted + open={Boolean(anchorEl)} + onClose={handleClose} + style={{borderRadius : "0"}} + > + <MenuItem onClick={() => {handleModal()}} style={{color : "#666"}}> + <ReportIcon/> + <span style={{paddingLeft : "3px"}}>Reportar</span> + </MenuItem> + </StyledMenu> </> ) } diff --git a/src/Components/ReportColecaoForm.js b/src/Components/ReportColecaoForm.js index 56141563f70cc9d4772114be109f2d96f0132b57..37c4a77336c79e8f58496143cbe8840725d7c4da 100644 --- a/src/Components/ReportColecaoForm.js +++ b/src/Components/ReportColecaoForm.js @@ -21,24 +21,23 @@ import styled from 'styled-components' import Radio from '@material-ui/core/Radio'; import RadioGroup from '@material-ui/core/RadioGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; -import {StyledFormControl, ButtonsDiv, ButtonCancelar, StyledTextField, useStyles} from './ReportUserForm.js' +import TextField from '@material-ui/core/TextField'; +import {StyledFormControl, ButtonsDiv, ButtonCancelar} from './ReportUserForm.js' import { withStyles } from '@material-ui/core/styles'; const StyledRadio = withStyles({ - root: { - color: '#666', - '&$checked': { - color: '#673ab7', - }, + root: { + color: '#666', + '&$checked': { + color: '#673ab7', }, - checked: {}, + }, + checked: {}, })((props) => <Radio color="default" {...props} />); export default function ReportColecaoForm (props) { const [value, setValue] = React.useState(-1); - const classes = useStyles(); - const handleChange = (event) => { setValue(event.target.value); }; @@ -74,11 +73,14 @@ export default function ReportColecaoForm (props) { if( finalRadioValue !== -1 && !(finalMoreInfo.key)) { props.handleSubmit(finalRadioValue, finalMoreInfo.value) } + else { + console.log('oops') + } } return ( <form onSubmit={(e) => handleSubmit(e)} style={{textAlign : "left"}}> - <StyledFormControl contrast={props.contrast} component="fieldset"> + <StyledFormControl component="fieldset"> <RadioGroup value={value} onChange={handleChange}> { options.map(option => @@ -89,7 +91,6 @@ export default function ReportColecaoForm (props) { </StyledFormControl> <StyledTextField - contrast={props.contrast} id = {"report-text-field"} label={"Escreva mais sobre o problema"} value = {moreInfo.value} @@ -98,24 +99,38 @@ export default function ReportColecaoForm (props) { multiline={true} rowsMax = {"5"} error = {moreInfo.key} - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} required = {false} style={{width : "100%"}} /> <ButtonsDiv> - <ButtonCancelar contrast={props.contrast} onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonEnviar contrast={props.contrast} type="submit">ENVIAR</ButtonEnviar> + <ButtonCancelar onClick={props.handleClose}>CANCELAR</ButtonCancelar> + <ButtonEnviar type="submit">ENVIAR</ButtonEnviar> </ButtonsDiv> </form> ) } +const StyledTextField = styled(TextField)` + .MuiFormHelperText-root { + text-align : left; + } + + label.Mui-focused { + color : #673ab7; + } + + label.Mui-focused.Mui-error { + color : red; + } + + .MuiInput-underline::after { + border-bottom: 2px solid #673ab7; + } +` const ButtonEnviar = styled(Button)` - color: ${props => props.contrast === "" ? "white" : "yellow"} !important; - background-color: ${props => props.contrast === "" ? "#673ab7" : "black"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - border: ${props => props.contrast === "" ? "none" : "1px solid white"} !important; + background-color : #673ab7 !important; + color : #fff !important; font-size: 14px !important; font-weight: 500 !important; height: 36px !important; @@ -127,6 +142,7 @@ const ButtonEnviar = styled(Button)` min-width : 88px !important; vertical-align : middle !important; margin : 6px 8px !important; + text-decoration : none !important; .MuiButton-label { padding-right : 16px; diff --git a/src/Components/ReportModal.js b/src/Components/ReportModal.js index 0bccdb086451935d80d3703b8fa321f8a96d99a2..079ca75fd3dd6454d6e26263767ac33d3ad3b556 100644 --- a/src/Components/ReportModal.js +++ b/src/Components/ReportModal.js @@ -33,7 +33,7 @@ import SnackbarComponent from './SnackbarComponent.js' function CloseModalButton (props) { return ( <StyledCloseModalButton onClick={props.handleClose}> - <CloseIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }}/> + <CloseIcon/> </StyledCloseModalButton> ) } @@ -55,6 +55,7 @@ export default function ReportModal (props) { } postRequest(url, payload, (data) => { + console.log(data) props.handleClose(); handleSnackbar(true); }, (error) => {console.log(error)}) @@ -65,22 +66,23 @@ export default function ReportModal (props) { switch (formType) { case 'colecao': return ( - <ReportColecaoForm contrast={props.contrast} handleClose={props.handleClose} handleSubmit={handleSubmit}/> + <ReportColecaoForm handleClose={props.handleClose} handleSubmit={handleSubmit}/> ) case 'recurso': - return ( - <ReportRecursoForm contrast={props.contrast} handleClose={props.handleClose} handleSubmit={handleSubmit}/> + return ( + <ReportRecursoForm handleClose={props.handleClose} handleSubmit={handleSubmit}/> ) default: return ( - <ReportUserForm contrast={props.contrast} handleClose={props.handleClose} handleSubmit={handleSubmit}/> + <ReportUserForm handleClose={props.handleClose} handleSubmit={handleSubmit}/> ) } } return ( <React.Fragment> - <SnackbarComponent snackbarOpen={snackbarOpen} severity={"success"} handleClose={() => {handleSnackbar(false)}} text={"Sua reclamação foi recebida."}/> + <SnackbarComponent snackbarOpen={snackbarOpen} severity={"success"} handleClose={() => {handleSnackbar(false)}} text={"Sua reclamação foi recebida."} + /> <StyledModal aria-labelledby="transition-modal-title" aria-describedby="transition-modal-description" @@ -95,11 +97,11 @@ export default function ReportModal (props) { }} > <Fade in={props.open}> - <ReportContainer className={`${props.contrast}BackColor ${props.contrast}Text ${props.contrast}Border`}> + <ReportContainer> <Header> <span style={{width:"32px"}}/> <h2>O que está acontecendo?</h2> - <CloseModalButton contrast={props.contrast} handleClose={props.handleClose}/> + <CloseModalButton handleClose={props.handleClose}/> </Header> <Content> @@ -118,10 +120,10 @@ export default function ReportModal (props) { const Content = styled.div` padding : 20px 30px; overflow : visible; + max-width : 470px; ` const Header = styled.div` - text-align : center; display : flex; flex-direction : row; padding : 10px 26px 0 26px; @@ -132,6 +134,7 @@ const Header = styled.div` h2 { font-size : 26px; font-weight : lighter; + color : #666 } ` @@ -152,6 +155,7 @@ const StyledModal = styled(Modal)` display : flex; align-items: center; justify-content : center; + text-align : center; padding : 10px !important; max-width : none; max-height : none; @@ -159,6 +163,7 @@ const StyledModal = styled(Modal)` const ReportContainer = styled.div` box-sizing : border-box; + background-color : white; max-width : none; align : center; display : flex; @@ -171,5 +176,6 @@ const ReportContainer = styled.div` @media screen and (max-width : 899px) { width : 100%; + height : 100%; } ` diff --git a/src/Components/ReportRecursoForm.js b/src/Components/ReportRecursoForm.js index 34de454775fd546fa6887b50b6a0386765ddd038..a1c7312713319d9b4320cf4bc844d3c160c5ed79 100644 --- a/src/Components/ReportRecursoForm.js +++ b/src/Components/ReportRecursoForm.js @@ -16,12 +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 from 'react'; -import { Button } from '@material-ui/core'; -import styled from 'styled-components' import Radio from '@material-ui/core/Radio'; import RadioGroup from '@material-ui/core/RadioGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; -import {StyledFormControl, StyledTextField, ButtonsDiv, ButtonCancelar, useStyles} from './ReportUserForm.js' +import {StyledFormControl, StyledTextField, ButtonsDiv, ButtonCancelar, ButtonEnviar} from './ReportUserForm.js' import { withStyles } from '@material-ui/core/styles'; const StyledRadio = withStyles({ @@ -37,8 +35,6 @@ const StyledRadio = withStyles({ export default function ReportRecursoForm (props) { const [value, setValue] = React.useState(-1); - const classes = useStyles(); - const handleChange = (event) => { setValue(event.target.value); }; @@ -74,11 +70,14 @@ export default function ReportRecursoForm (props) { if( finalRadioValue !== -1 && !(finalMoreInfo.key)) { props.handleSubmit(finalRadioValue, finalMoreInfo.value) } + else { + console.log('oops') + } } return ( <form onSubmit={(e) => handleSubmit(e)} style={{textAlign : "left"}}> - <StyledFormControl contrast={props.contrast} component="fieldset"> + <StyledFormControl component="fieldset"> <RadioGroup value={value} onChange={handleChange}> { options.map(option => @@ -89,7 +88,6 @@ export default function ReportRecursoForm (props) { </StyledFormControl> <StyledTextField - contrast={props.contrast} id = {"report-text-field"} label={"Escreva mais sobre o problema"} value = {moreInfo.value} @@ -98,38 +96,14 @@ export default function ReportRecursoForm (props) { multiline={true} rowsMax = {"5"} error = {moreInfo.key} - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} required = {false} style={{width : "100%"}} /> <ButtonsDiv> - <ButtonCancelar contrast={props.contrast} onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonEnviar contrast={props.contrast} type="submit">ENVIAR</ButtonEnviar> + <ButtonCancelar onClick={props.handleClose}>CANCELAR</ButtonCancelar> + <ButtonEnviar type="submit">ENVIAR</ButtonEnviar> </ButtonsDiv> </form> ) } - -export const ButtonEnviar = styled(Button)` - color: ${props => props.contrast === "" ? "white !important" : "yellow !important"}; - background-color: ${props => props.contrast === "" ? "#f07e05 !important" : "black !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "yellow underline !important"}; - border: ${props => props.contrast === "" ? "none !important" : "1px solid white !important"}; - font-size: 14px !important; - font-weight: 500 !important; - height: 36px !important; - border-radius: 3px !important; - padding-left: 16px !important; - padding-right: 16px !important; - box-shadow: 0 2px 5px 0 rgba(0,0,0,.26) !important; - outline : none !important; - min-width : 88px !important; - vertical-align : middle !important; - margin : 6px 8px !important; - - .MuiButton-label { - padding-right : 16px; - padding-left : 16px; - } -` \ No newline at end of file diff --git a/src/Components/ReportUserForm.js b/src/Components/ReportUserForm.js index 28321b533bae36824d4b8c2b1421bc67258b4605..370865722d5a85cb2b458f326b891dbfe962a3e8 100644 --- a/src/Components/ReportUserForm.js +++ b/src/Components/ReportUserForm.js @@ -23,37 +23,20 @@ import RadioGroup from '@material-ui/core/RadioGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import FormControl from '@material-ui/core/FormControl'; import TextField from '@material-ui/core/TextField'; -import { withStyles, makeStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/core/styles'; const StyledRadio = withStyles({ - root: { - '&$checked': { - color: '#ff7f00 !important', - }, + root: { + '&$checked': { + color: '#ff7f00 !important', }, - checked: {}, -})((props) => <Radio {...props} />); - -export const useStyles = makeStyles(theme => ({ - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - color: "white", - width: "100%" - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - color: "black", - width: "100%" - } -})); + }, + checked: {}, +})((props) => <Radio color="default" {...props} />); export default function ReportForm (props) { const [value, setValue] = useState(-1); - const classes = useStyles(); - const handleChange = (event) => { setValue(event.target.value); }; @@ -95,18 +78,17 @@ export default function ReportForm (props) { return ( <form onSubmit={(e) => {formSubmit(e)}}> - <StyledFormControl contrast={props.contrast} component="fieldset"> + <StyledFormControl component="fieldset"> <RadioGroup value={value} onChange={handleChange}> { options.map(option => - <FormControlLabel value={option.value} control={<StyledRadio contrast={props.contrast}/>} label={option.text} /> + <FormControlLabel value={option.value} control={<StyledRadio/>} label={option.text} /> ) } </RadioGroup> </StyledFormControl> <StyledTextField - contrast={props.contrast} id = {"Escreva mais sobre o problema"} label={"Escreva mais sobre o problema"} type = {"text"} @@ -116,14 +98,13 @@ export default function ReportForm (props) { multiline={true} rowsMax = {"5"} error = {moreInfo.key} - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} required = {false} style={{width:"100%"}} /> <ButtonsDiv> - <ButtonCancelar contrast={props.contrast} onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonEnviar contrast={props.contrast} type="submit">ENVIAR</ButtonEnviar> + <ButtonCancelar onClick={props.handleClose}>CANCELAR</ButtonCancelar> + <ButtonEnviar type="submit">ENVIAR</ButtonEnviar> </ButtonsDiv> </form> ); @@ -137,23 +118,23 @@ export const ButtonsDiv = styled.div` ` export const ButtonCancelar = styled(Button)` - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; + &:hover { + background-color : rgba(158,158,158,0.2) !important; + } height : 36px !important; padding-left : 16px !important; padding-right : 16px !important; font-weight : 500 !important; border-radius : 3px !important; + color :#666 !important; background-color: transparent; min-width : 88px !important; height : 36px !important; ` export const ButtonEnviar = styled(Button)` - color: ${props => props.contrast === "" ? "white" : "yellow"} !important; - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - border: ${props => props.contrast === "" ? "none" : "1px solid white"} !important; + background-color : #ff7f00 !important; + color : #fff !important; font-size: 14px !important; font-weight: 500 !important; height: 36px !important; @@ -165,6 +146,7 @@ export const ButtonEnviar = styled(Button)` min-width : 88px !important; vertical-align : middle !important; margin : 6px 8px !important; + text-decoration : none !important; .MuiButton-label { padding-right : 16px; @@ -172,43 +154,26 @@ export const ButtonEnviar = styled(Button)` } ` export const StyledTextField = styled(TextField)` - - padding: 20px 20px 20px 20px; - .MuiOutlinedInput-root { - &.Mui-focused fieldset { - border-color: ${props => props.contrast === "" ? "#ff7f00" : "yellow"}; - } - fieldset { - border-color: ${props => props.contrast === "" ? "#666" : "white"}; - } - } - - label{ - color: ${props => props.contrast === "" ? "#666" : "white"}; + .MuiFormHelperText-root { + text-align : left; } label.Mui-focused { - color: ${props => props.contrast === "" ? "#ff7f00" : "yellow"}; + color : orange; } - .MuiFormHelperText-root { - text-align : left; - color: ${props => props.contrast === "" ? "#666" : "white"}; + label.Mui-focused.Mui-error { + color : red; } .MuiInput-underline::after { - border-bottom: 2px solid ${props => props.contrast === "" ? "#ff7f00" : "yellow"}; + border-bottom: 2px solid orange; } - ` export const StyledFormControl = styled(FormControl)` .MuiFormControlLabel-root { - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } - .MuiIconButton-label { - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; } .PrivateRadioButtonIcon-checked { diff --git a/src/Components/ResourceCardFunction.js b/src/Components/ResourceCardFunction.js index 009310081359e26e51a92cc2fb07395fba1f9bf2..d81a0ade52633603458f126908d9bf1e826c34f6 100644 --- a/src/Components/ResourceCardFunction.js +++ b/src/Components/ResourceCardFunction.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, useEffect, useContext } from 'react'; -import { Store } from '../Store' -import "./carousel.css"; +import React, { useState, useContext, useEffect } from 'react'; +import { Store } from '../Store.js' import Card from '@material-ui/core/Card'; import { apiDomain } from '../env'; import ResourceCardOptions from './ResourceCardOptions' @@ -44,7 +43,7 @@ import { noAvatar } from "ImportImages.js"; import { IcDefault } from "ImportImages.js"; export default function ResourceCardFunction(props) { - const { state } = useContext(Store); + const { state } = useContext(Store) const [thumbnail, setThumbnail] = useState(null) // eslint-disable-next-line const [label, setLabel] = useState(props.type) @@ -68,7 +67,7 @@ export default function ResourceCardFunction(props) { setThumbnail(`${apiDomain}` + props.thumbnail) } else { - setThumbnail(getDefaultThumbnail(label)) + setThumbnail(getDefaultThumbnail(label)) } if (props.avatar) { @@ -86,14 +85,10 @@ export default function ResourceCardFunction(props) { } const handleLike = () => { - if (!state.currentUser.id) { + if (state.currentUser.id) + putRequest(`/learning_objects/${props.id}/like/`, {}, handleSuccessLike, (error) => { console.log(error) }) + else handleLogin() - } - else { - const url = `/learning_objects/${props.id}/like/` - - putRequest(url, {}, handleSuccessLike, (error) => { console.log(error) }) - } } const handleLogin = () => { @@ -111,9 +106,9 @@ export default function ResourceCardFunction(props) { handleSuccessfulLogin(false); } - const SlideAnimationContent = (contrast) => { + const SlideAnimationContent = () => { return ( - <SlideContentDiv style={contrast === '' ? { backgroundColor: "#ff9226" } : { backgroundColor: "inherit" }}> + <SlideContentDiv> <div style={{ padding: 7 }}> <HeaderContainer container="row" justify="flex-start" alignItems="center" >{/*marginBottom:10px*/} <AvatarDiv item xs={2}> @@ -124,13 +119,13 @@ export default function ResourceCardFunction(props) { <p>{props.author}</p> </EnviadoPor> </HeaderContainer> - { //className={`${props.contrast}BackColor`} --- + { props.tags ? <TagContainer container direction="row"> { props.tags.map((tag) => <Grid item key={tag.id}> - <span className={`${props.contrast}BackColor ${props.contrast}Text`}>{tag.name}</span> + <span >{tag.name}</span> </Grid> ) } @@ -144,9 +139,9 @@ export default function ResourceCardFunction(props) { return ( <React.Fragment> - <SignUpModal contrast={props.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> - <LoginModal contrast={props.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} openSnackbar={() => { handleSuccessfulLogin(true) }} /> <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleLoginSnackbar} @@ -155,7 +150,7 @@ export default function ResourceCardFunction(props) { <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> </Snackbar> <StyledCard> - <CardDiv className={`${props.contrast}Text ${props.contrast}Border`}> + <CardDiv> <CardReaDiv> <Link to={props.href}> <Header onMouseEnter={controlSlide} onMouseLeave={controlSlide}> @@ -164,25 +159,25 @@ export default function ResourceCardFunction(props) { </div> { <div className={`slideContentLinkAfterActive${slideIn}`}> - <div className={`${props.contrast}Text ${props.contrast}BackColor`} style={{ width: "100%" }}> - {SlideAnimationContent(props.contrast)} + <div className="text" > + {SlideAnimationContent()} </div> </div> } </Header> </Link> - <Description className={`${props.contrast}BackColor`}> - <Link to={props.href} className={`${props.contrast}Text`} style={{ height: '45px', width: "100%" }}> {/*add link to learningObject*/} - <Title className={`${props.contrast}LinkColor`}> + <Description> + <Link to={props.href} className="text" style={{ height: '45px' }}> {/*add link to learningObject*/} + <Title> {props.title} </Title> </Link> <Rating - style={props.contrast === "" ? {} : { color: "white" }} name="customized-empty" value={props.rating} readOnly - emptyIcon={<StarBorderIcon className={`${props.contrast}Text`} fontSize="inherit" />} + style={{ color: "#666" }} + emptyIcon={<StarBorderIcon fontSize="inherit" />} /> <Footer> <Type> @@ -192,29 +187,24 @@ export default function ResourceCardFunction(props) { <LikeCounter> <span>{likesCount}</span> <ButtonNoWidth onClick={handleLike}> - <FavoriteIcon className={`${props.contrast}LinkColor`} style={props.contrast === "" ? { color: liked ? "red" : "#666" } : { color: liked ? "red" : "white" }} /> + <FavoriteIcon style={{ color: liked ? "red" : "#666" }} /> </ButtonNoWidth> </LikeCounter> </Footer> </Description> </CardReaDiv> - <CardReaFooter className={`${props.contrast}BackColor`}> - <Grid container> - <Grid item xs={2}></Grid> - <Grid item xs={8} style={{ display: "flex", justifyContent: "center" }}> - <ButtonGuardarColecao contrast={props.contrast} thumb={props.thumbnail} title={props.title} learningObjectId={props.id} /> - </Grid> - <Grid item xs={2} style={{ display: "flex", justifyContent: "flex-end" }}> - <ResourceCardOptions - contrast={props.contrast} - learningObjectId={props.id} - downloadableLink={props.downloadableLink} - thumb={props.thumbnail} - title={props.title} - handleLogin={handleLogin} - /> - </Grid> - </Grid> + <CardReaFooter> + <div style={{ display: "flex", height: "100%" }}> + <ButtonGuardarColecao thumb={props.thumbnail} title={props.title} learningObjectId={props.id} + /> + </div> + <ResourceCardOptions + learningObjectId={props.id} + downloadableLink={props.downloadableLink} + thumb={props.thumbnail} + title={props.title} + handleLogin={handleLogin} + /> </CardReaFooter> </CardDiv> </StyledCard> @@ -233,16 +223,18 @@ export const TagContainer = styled(Grid)` ${'' /* border : 2px solid red; */} span { word-wrap: break-word; + background-color : #fff; display : flex; justify-content : center; align-items : center; height : 22px; - text-align: center; + tet-align : center; margin: 3px; -webkit-box-direction: normal; overflow : hidden; padding : 1px 8px; border-radius : 10px; + color : #666; font-size : 11px; } ` @@ -277,6 +269,7 @@ export const AvatarDiv = styled(Grid)` ` const SlideContentDiv = styled.div` + background-color : #ff9226; ${'' /* padding : 10px; */} width : 272.5px; height : 189px; @@ -287,6 +280,8 @@ const CardReaFooter = styled.div` height : 60px; display : flex; justify-content : space-between; + border-top : 1px solid #e5e5e5; + border-bottom : 1px solid #e5e5e5; align-items : center; padding : 0 15px 0 15px; ` @@ -297,6 +292,7 @@ export const ButtonNoWidth = styled(Button)` min-width : 24px !important; max-height : 24px !important; padding : 0 !important; + background-color : #fff !important; color : #a5a5a5 !important; border : 0 !important; @@ -319,6 +315,7 @@ export const LikeCounter = styled.div` .btn-like { padding : 0 !important; + background-color : #fff !important; border : 0 !important; min-width : min-content; } @@ -337,7 +334,7 @@ const Type = styled.div` height : 27px; width : 27px; padding-right : .4em; - vertical-align : middle; + vertical-align : middle align-self : center; .st1 { @@ -356,6 +353,7 @@ export const Footer = styled.div` const Description = styled.div` display : flex; flex : 1; + background-color : #fff; flex-direction : column; justify-content: space-between; padding : 15px; @@ -404,6 +402,7 @@ export const CardReaDiv = styled.div` ` export const CardDiv = styled.div` + background-color : #fff; text-align : start; font-family : 'Roboto', sans serif; color : #666; @@ -411,7 +410,7 @@ export const CardDiv = styled.div` export const StyledCard = styled(Card)` width : 272.5px; - min-height : 380px; + max-height : 380px; margin-top : 10px; margin-bottom : 10px; ${'' /* max-width : 345px; */} diff --git a/src/Components/ResourceCardOptions.js b/src/Components/ResourceCardOptions.js index acec633b1e0d3bbe05a79efd69728920a51bab1d..1ac22f4a6e309b55d70acb582516257aa1def8d0 100644 --- a/src/Components/ResourceCardOptions.js +++ b/src/Components/ResourceCardOptions.js @@ -115,61 +115,57 @@ export default function ResourceCardOptions(props) { <> <React.Fragment> - <ReportModal contrast={props.contrast} open={reportModal} handleClose={() => handleModalReportar(false)} + <ReportModal open={reportModal} handleClose={() => handleModalReportar(false)} form="recurso" complainableId={props.learningObjectId} complainableType={"LearningObject"} {...props} /> - <GuardarModal contrast={props.contrast} open={saveToCol} handleClose={() => { toggleSave(false) }} + <GuardarModal open={saveToCol} handleClose={() => { toggleSave(false) }} thumb={props.thumb} title={props.title} recursoId={props.learningObjectId} /> - <ShareModal contrast={props.contrast} open={shareOpen} handleClose={() => { toggleShare(false) }} + <ShareModal open={shareOpen} handleClose={() => { toggleShare(false) }} thumb={props.thumb} title={props.title} link={getShareablePageLink()} /> <SnackbarComponent snackbarOpen={snackbarOpen} severity={"info"} handleClose={() => { toggleSnackbar(false) }} text={"Baixando o Recurso... Lembre-se de relatar sua experiência após o uso do Recurso!"} /> <div style={{ fontSize: "12px", display: "flex", flexDirection: "column", justifyContent: "center" }}> - <ButtonNoWidth aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick}> - <MoreVertIcon className={`${props.contrast}LinkColor ${props.contrast}Text`} /> + <ButtonNoWidth aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick} style={{ color: "#666" }}> + <MoreVertIcon style={{ color: "#666" }} /> </ButtonNoWidth> <Menu - className={`${props.contrast}Text`} id="simple-menu" anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose} - MenuListProps={{ - disablePadding: true - }} - > - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={handleClose}> + > + <StyledMenuItem> <Link to={"/recurso/" + props.learningObjectId}> - <ListItemIcon className={`${props.contrast}IconColor`}><OpenIcon /></ListItemIcon>Abrir + <ListItemIcon><OpenIcon /></ListItemIcon>Abrir </Link> </StyledMenuItem> - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={() => window.open("/recurso/" + props.learningObjectId, "_blank")}> - <ListItemIcon className={`${props.contrast}IconColor`}><OpenInBrowserIcon /></ListItemIcon> Abrir em nova guia + <StyledMenuItem onClick={() => window.open("/recurso/" + props.learningObjectId, "_blank")}> + <ListItemIcon><OpenInBrowserIcon /></ListItemIcon> Abrir em nova guia </StyledMenuItem> { props.downloadableLink && - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={() => { enableDownload(); handleClose() }}> - <ListItemIcon className={`${props.contrast}IconColor`}><DownloadIcon /></ListItemIcon>Baixar + <StyledMenuItem onClick={() => { enableDownload(); handleClose() }}> + <ListItemIcon><DownloadIcon /></ListItemIcon>Baixar </StyledMenuItem> } - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={handleShare}> - <ListItemIcon className={`${props.contrast}IconColor`}><ShareIcon /></ListItemIcon>Compartilhar + <StyledMenuItem onClick={handleShare}> + <ListItemIcon><ShareIcon /></ListItemIcon>Compartilhar </StyledMenuItem> - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={handleGuardar}> - <ListItemIcon className={`${props.contrast}IconColor`}><AddIcon /></ListItemIcon>Guardar + <StyledMenuItem onClick={handleGuardar}> + <ListItemIcon><AddIcon /></ListItemIcon>Guardar </StyledMenuItem> - <StyledMenuItem className={`${props.contrast}LinkColor ${props.contrast}Text`} contrast={props.contrast} onClick={() => { handleReport() }}> - <ListItemIcon className={`${props.contrast}IconColor`}><ReportIcon /></ListItemIcon>Reportar + <StyledMenuItem onClick={() => { handleReport() }}> + <ListItemIcon><ReportIcon /></ListItemIcon>Reportar </StyledMenuItem> </Menu> @@ -184,6 +180,9 @@ const ButtonNoWidth = styled(Button)` min-width : 24px !important; max-height : 24px !important; padding : 0 !important; + background-color : #fff !important; + color : #a5a5a5 !important; + border : 0 !important; .MuiButton-root { width : 24px !important; @@ -201,11 +200,12 @@ const ButtonNoWidth = styled(Button)` ` const StyledMenuItem = styled(MenuItem)` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; + color : #666 !important; .MuiSvgIcon-root { vertical-align : middle !important; } a { - color: inherit !important; + text-decoration : none !important; + color : #666 !important; } ` diff --git a/src/Components/ResourceList.js b/src/Components/ResourceList.js index e708c007b8b2f258d8dcf81c90d009d25adb48de..e32176c7166f62820cf88517c7f8f5dc8faf503c 100644 --- a/src/Components/ResourceList.js +++ b/src/Components/ResourceList.js @@ -124,27 +124,27 @@ export default function ResourceList(props) { <ResourceListContainer> <Grid container direction="row" justify="space-around" alignItems="center"> <Grid item> - <Title contrast={props.contrast}> + <Title> {props.resources.length ? props.resources.length + " recurso" + (props.resources.length === 1 ? "" : "s") - : "Nenhum recurso encontrado"} + : "Carregando coleção"} </Title> </Grid> <Grid item> - <Button onClick={() => setSelectable(!selectable)}> - <PanelButtonText contrast={props.contrast}> + <Button color="primary" onClick={() => setSelectable(!selectable)}> + <PanelButtonText> {selectable ? "Desativar" : "Ativar"} seleção </PanelButtonText> </Button> </Grid> <Grid item> <Button - style={props.contrast === "" ? {color: "#3f51b5", border: "1px solid #3f51b5"} : {color: "white", border: "1px solid white"}} + color="primary" variant="outlined" startIcon={<GetAppIcon fontSize="large" />} onClick={handleDownloadSelection} > - <PanelButtonText contrast={props.contrast}>baixar seleção</PanelButtonText> + <PanelButtonText>baixar seleção</PanelButtonText> </Button> </Grid> </Grid> @@ -153,7 +153,6 @@ export default function ResourceList(props) { return ( <ResourceGrid item key={card.title}> <ResourceCardFunction - contrast={props.contrast} avatar={card.avatar} id={card.id} thumbnail={card.thumbnail} @@ -170,8 +169,8 @@ export default function ResourceList(props) { /> {selectable ? (<SelectButton - contrast={props.contrast} variant="outline" + color="primary" startIcon={checkBoxIcon(selected[props.resources.indexOf(card)])} onClick={() => updateSelected(props.resources.indexOf(card))} > @@ -206,19 +205,15 @@ const ResourceListContainer = styled.div` margin-right: 20; ` const Title = styled.p` - color: ${props => props.contrast === "" ? "#666 !important" : "white !important"}; + color: rgb(102, 102, 102); font-size: 2em; font-weigth: 300; ` const SelectButton = styled(Button)` width: 100%; - color: ${props => props.contrast === "" ? "#666 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "yellow underline !important"}; ` const PanelButtonText = styled.span` font-weight: 900; - color: ${props => props.contrast === "" ? "#3f51b5 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "yellow underline !important"}; ` const ResourceGrid = styled(Grid)` padding-right: 7px; diff --git a/src/Components/ResourcePageComponents/CommentForm.js b/src/Components/ResourcePageComponents/CommentForm.js index 7fe1093b5e82891a83c8f895011d6e2b992b2147..0272d76fc6f63b264b9197d390818729caa46cc1 100644 --- a/src/Components/ResourcePageComponents/CommentForm.js +++ b/src/Components/ResourcePageComponents/CommentForm.js @@ -1,86 +1,65 @@ -import React, { useState } from "react"; -import styled from "styled-components"; -import Rating from "@material-ui/lab/Rating"; -import StarIcon from "@material-ui/icons/Star"; +import React, { useState } from 'react' +import styled from 'styled-components' +import Rating from '@material-ui/lab/Rating'; +import StarIcon from '@material-ui/icons/Star'; import TextField from "@material-ui/core/TextField"; -import { Button } from "@material-ui/core"; -import EditIcon from "@material-ui/icons/Edit"; -import Grid from "@material-ui/core/Grid"; -import { postRequest } from "../HelperFunctions/getAxiosConfig"; -import { makeStyles } from "@material-ui/styles"; - -const useStyles = makeStyles((theme) => ({ - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "white", - width: "100%", - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "black", - width: "100%", - }, -})); +import { Button } from '@material-ui/core'; +import EditIcon from '@material-ui/icons/Edit'; +import Grid from '@material-ui/core/Grid'; +import { postRequest } from '../HelperFunctions/getAxiosConfig' export default function CommentForm(props) { - const classes = useStyles(); - const [rating, setRating] = useState({ error: true, - value: 0, - }); + value: 0 + }) const [comment, setComment] = useState({ error: false, - value: "", - }); + value: '' + }) const handleChange = (e) => { - const userInput = e.target.value; - const flag = userInput.length === 0 ? true : false; - setComment({ ...comment, error: flag, value: userInput }); - }; + const userInput = e.target.value + const flag = (userInput.length === 0 ? true : false); + setComment({ ...comment, error: flag, value: userInput }) + } - const [attemptedSubmit, setAttempt] = useState(false); + const [attemptedSubmit, setAttempt] = useState(false) function handleSuccess(data) { - props.handleSnackbar(1); - props.rerenderCallback(); + props.handleSnackbar(1) + props.rerenderCallback() } const handleSubmit = (e) => { - e.preventDefault(); - const finalRating = rating; - const finalComment = comment; + e.preventDefault() + const finalRating = rating + const finalComment = comment if (!(finalRating.error || finalComment.error)) { - let type = props.recurso ? "learning_objects" : "collections"; - const url = `/${type}/${props.recursoId}/reviews`; + let type = props.recurso ? 'learning_objects' : 'collections' + const url = `/${type}/${props.recursoId}/reviews` let payload = { - review: { - description: finalComment.value, - review_ratings_attributes: [ + "review": { + "description": finalComment.value, + "review_ratings_attributes": [ { - rating_id: 1, - value: finalRating.value, - }, - ], - }, - }; + "rating_id": 1, + "value": finalRating.value + } + ] + } + } - postRequest(url, payload, handleSuccess, (error) => { - console.log(error); - }); - } else { - setAttempt(true); + postRequest(url, payload, handleSuccess, (error) => { console.log(error) }) + } + else { + setAttempt(true) } - }; + } return ( - <StyledForm onSubmit={handleSubmit} contrast={props.contrast}> + <StyledForm onSubmit={handleSubmit}> <label htmlFor="avaliacao-estrelas" className="start-label"> {props.recurso ? "Este recurso foi útil?*" : "Esta coleção foi útil?*"} </label> @@ -89,185 +68,96 @@ export default function CommentForm(props) { name="avaliacao-estrelas" value={rating.value} precision={0.5} - style={ - props.contrast === "" ? { color: "#ff9226" } : { color: "yellow" } - } - onChange={(e, newValue) => { - setRating({ - ...rating, - error: newValue === null ? true : false, - value: newValue, - }); - }} - emptyIcon={ - <StarIcon - fontSize="inherit" - style={ - props.contrast === "" ? { color: "#666" } : { color: "white" } - } - /> - } - getLabelText={(value) => { - return value + " Estrela" + (value !== 1 ? "s" : ""); - }} + style={{ color: "#ff9226" }} + onChange={(e, newValue) => { setRating({ ...rating, error: newValue === null ? true : false, value: newValue }) }} + emptyIcon={<StarIcon fontSize="inherit" style={{ color: "#666" }} />} + getLabelText={(value) => { return (value + ' Estrela' + (value !== 1 ? 's' : '')) }} /> </div> - <div - className="star-alert" - style={ - attemptedSubmit ? { visibility: "visible" } : { visibility: "hidden" } - } - > - {props.recurso - ? "Avalie se o recurso foi útil." - : "Avalie se esta coleção foi útil."} - </div> + <div className="star-alert" style={attemptedSubmit ? { visibility: "visible" } : { visibility: "hidden" }}>{props.recurso ? "Avalie se o recurso foi útil." : "Avalie se esta coleção foi útil."}</div> <Grid container> <Grid item xs={12} md={9}> <StyledTextField - contrast={props.contrast} colecao={!props.recurso} value={comment.value} - InputProps={ - props.contrast === "" - ? { className: classes.lightTextField } - : { className: classes.darkTextField } - } multiline rows="5" - variant="outlined" error={comment.error} label="Relate sua experiência" - onChange={(e) => handleChange(e)} + onChange={e => handleChange(e)} required={true} - help={ - comment.error - ? props.recurso - ? "Escreva aqui a sua experiência com este Recurso" - : "Escreva aqui a sua experiência com esta Coleção" - : "" - } + help={comment.error ? (props.recurso ? "Escreva aqui a sua experiência com este Recurso" : "Escreva aqui a sua experiência com esta Coleção") : ''} /> </Grid> <Grid item xs={12} md={3}> - <div - style={{ - height: "100%", - display: "flex", - flexDirection: "column", - justifyContent: "flex-end", - }} - > - {props.recurso ? ( - <OrangeButton contrast={props.contrast} type="submit"> - Publicar - </OrangeButton> - ) : ( - <PurpleButton contrast={props.contrast} type="submit"> - <EditIcon style={props.contrast === "" ? { marginRight: "0.3em" } : { color: "white", marginRight: "0.3em" }} /> - Enviar - </PurpleButton> - )} + <div style={{ height: "100%", display: "flex", flexDirection: "column", justifyContent: "flex-end" }}> + { + props.recurso ? + ( + <OrangeButton type="submit">Publicar</OrangeButton> + ) + : + ( + <PurpleButton type="submit"><EditIcon />Enviar</PurpleButton> + ) + } </div> </Grid> <div className="campos-obrigatorios">* Campos obrigatórios.</div> - </Grid> + </Grid > </StyledForm> - ); + ) } const PurpleButton = styled(Button)` - color: ${(props) => - props.contrast === "" - ? "rgba(255,255,255,0.87) !important" - : "yellow !important"}; - text-decoration: ${(props) => - props.contrast === "" ? "none !important" : "underline !important"}; - box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26) !important; - font-weight: 600 !important; - background-color: ${(props) => - props.contrast === "" ? "#673ab7 !important" : "black !important"}; - border: ${(props) => - props.contrast === "" ? "0 !important" : "1px solid white !important"}; - :hover { - background-color: ${(props) => - props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } + background-color : #673ab7 !important; + box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; + font-weight : 600 !important; + color : #fff !important; .icon { - vertical-align: middle !important; - font-weight: normal !important; - font-style: normal !important; - font-size: 24px !important; - line-height: 1 !important; - letter-spacing: normal !important; - text-transform: none !important; - display: inline-block !important; - white-space: nowrap !important; - word-wrap: normal !important; - direction: ltr !important; - padding-right: 2px; + vertical-align : middle !important; + font-weight : normal !important; + font-style : normal !important; + font-size : 24px !important; + line-height : 1 !important; + letter-spacing : normal !important; + text-transform : none !important; + display : inline-block !important; + white-space : nowrap !important; + word-wrap : normal !important; + direction : ltr !important; + padding-right : 2px; } -`; +` const OrangeButton = styled(Button)` - color: ${(props) => - props.contrast === "" - ? "rgba(255,255,255,0.87) !important" - : "yellow !important"}; - text-decoration: ${(props) => - props.contrast === "" ? "none !important" : "underline !important"}; - box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26) !important; - font-weight: 600 !important; - background-color: ${(props) => - props.contrast === "" ? "#ff7f00 !important" : "black !important"}; - border: ${(props) => - props.contrast === "" ? "0 !important" : "1px solid white !important"}; - :hover { - background-color: ${(props) => - props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } -`; + color : rgba(255,255,255,0.87) !important; + box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; + font-weight : 600 !important; + background-color : #ff7f00 !important; +` const StyledTextField = styled(TextField)` .MuiInputBase-root { - margin-bottom: 5px; - } - - .MuiOutlinedInput-root { - &.Mui-focused fieldset { - border-color: ${(props) => - props.contrast === "" - ? props.colecao - ? "#673ab7" - : "rgb(255,127,0)" - : "yellow"}; - } - fieldset { - border-color: ${(props) => (props.contrast === "" ? "#666" : "white")}; - } + margin-bottom : 5px; } - label { - color: ${(props) => (props.contrast === "" ? "#666" : "white")}; + label.Mui-focused { + color : ${props => props.colecao ? "#673ab7" : "rgb(255,127,0)"} } - label.Mui-focused { - color: ${(props) => - props.contrast === "" - ? props.colecao - ? "#673ab7" - : "rgb(255,127,0)" - : "yellow"}; + .MuiInput-underline::after { + border-bottom: ${props => props.colecao ? "2px solid #673ab7" : "2px solid rgb(255,127,0)"}; } label.Mui-focused.Mui-error { - color: red; + color : red; } width: 95%; -`; +` const StyledForm = styled.form` display : flex; @@ -279,7 +169,7 @@ const StyledForm = styled.form` max-width : 100%; display : inline-block; margin-bottom : 0; - color : ${(props) => (props.contrast === "" ? "#666" : "white")} + color : #a5a5a5; font-weight : 400; } @@ -304,4 +194,4 @@ const StyledForm = styled.form` font-size : 12px; color :#a5a5a5; } -`; +` diff --git a/src/Components/ResourcePageComponents/CommentsArea.js b/src/Components/ResourcePageComponents/CommentsArea.js index 990e60982fc38606d8a4461a773154a0b30749ce..1ee202d977fc2d919a473fcb03ac6dbf13c11e47 100644 --- a/src/Components/ResourcePageComponents/CommentsArea.js +++ b/src/Components/ResourcePageComponents/CommentsArea.js @@ -49,7 +49,7 @@ export default function CommentsArea(props) { const [totalReviews, setTotalReviews] = useState(0); const [currPageReviews, setCurrPageReviews] = useState(0); const [gambiarra, setState] = useState(0) - const forceUpdate = () => { setCurrPageReviews(0); setState(gambiarra + 1); } + const forceUpdate = () => { setState(gambiarra + 1) } const [loginOpen, setLogin] = useState(false) const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) const [signUpOpen, setSignUp] = useState(false) @@ -96,71 +96,6 @@ export default function CommentsArea(props) { handleSuccessfulLogin(false); } - const NoCommentsMessage = (contrast) => { - const NoCommentsContainer = styled.div` - text-align: center; - margin-left: 9vw; - margin-right: 9vw; - ` - const BlueTitle = styled.h2` - color: ${props => props.contrast === "" ? "#F07E05" : "white"}; - ` - const Secondary = styled.h3` - font-weight: 100; - color: ${props => props.contrast === "" ? "#666" : "white"}; - ` - const Image = styled.img` - margin: auto; - object-fit : contain !important; - background-color : transparent !important; - ` - return ( - <> - <Image src={Comentarios} style={{ width: "100%", height: "45%", maxWidth: 234 }} /> - <NoCommentsContainer> - <BlueTitle contrast={contrast}>Compartilhe sua opinião com a rede!</BlueTitle> - <Secondary contrast={contrast}>Gostou deste recurso? Comente e compartilhe com a rede sua opinião. Interagindo com a rede, você contribui para que mais recursos como este sejam criados.</Secondary> - </NoCommentsContainer> - </> - ); - } - - const ResourceComments = (contrast) => { - return ( - <ComentariosBox contrast={contrast}> - { - comentarios.map(comentario => - <div className="comentario-template" key={comentario.id}> - <Comment - contrast={contrast} - isCollection={false} - authorID={comentario.user ? comentario.user.id : null} - authorAvatar={comentario.user ? comentario.user.avatar : null} - authorName={comentario.user ? comentario.user.name : null} - name={comentario.name} - rating={comentario.rating_average} - reviewRatings={comentario.review_ratings} - description={comentario.description} - createdAt={comentario.created_at} - recurso={true} - reviewID={comentario.id} - objectID={props.recursoId} - handlePost={handlePost} - rerenderCallback={forceUpdate} - handleSnackbar={props.handleSnackbar} - /> - </div> - ) - } - <div className="load-more"> - <IconButton className="button" onClick={handleLoadMoreReviews}> - <KeyboardArrowDownIcon className="icon" /> - </IconButton> - </div> - </ComentariosBox> - ); - } - function handleLoadMoreReviews() { if (comentarios.length !== parseInt(totalReviews)) setCurrPageReviews((previous) => previous + 1) @@ -177,10 +112,7 @@ export default function CommentsArea(props) { function handleSuccess(data, headers) { setIsLoading(false) - if (currPageReviews !== 0) - setComentarios((previous) => previous.concat(data.sort((a, b) => a.updated_at > b.updated_at ? -1 : 1))) - else - setComentarios(data.sort((a, b) => a.updated_at > b.updated_at ? -1 : 1)) + setComentarios((previous) => previous.concat(data.sort((a, b) => a.updated_at > b.updated_at ? -1 : 1))) if (headers.has('X-Total-Count')) setTotalReviews(headers.get('X-Total-Count')) } @@ -206,17 +138,17 @@ export default function CommentsArea(props) { <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> </Snackbar> {/*-------------------------------MODALS---------------------------------------*/} - <LoginModal contrast={props.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} openSnackbar={() => { handleSuccessfulLogin(true) }} /> - <SignUpModal contrast={props.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> {/*----------------------------------------------------------------------------*/} <Grid container spacing={2} style={{ padding: "10px" }}> { (state.currentUser.id !== '') ? ( <Grid item xs={12} > - <GrayContainer contrast={state.contrast}> + <GrayContainer> <h3>Conte sua experiência com o Recurso</h3> <Grid container style={{ paddingTop: "20px" }} spacing={1}> <Grid item xs={12} sm={2} style={{ paddingLeft: "15px", paddingRight: "15px" }}> @@ -226,7 +158,6 @@ export default function CommentsArea(props) { </Grid> <Grid item xs={12} sm={10}> <CommentForm - contrast={state.contrast} recursoId={props.recursoId} handleSnackbar={props.handleSnackbar} rerenderCallback={forceUpdate} @@ -240,10 +171,10 @@ export default function CommentsArea(props) { : ( <Grid item xs={12}> - <LogInToComment contrast={state.contrast}> + <LogInToComment> <span className="span-laranja">Você precisa entrar para comentar</span> - <Button onClick={() => handleLogin(true)} style={state.contrast === "" ? { textTransform: "uppercase", color: "#666", fontWeight: "700" } : { textTransform: "uppercase", color: "yellow", fontWeight: "700", textDecoration: "underline" }}> - <ExitToAppIcon style={state.contrast === "" ? { color: "inherit" } : { color: "white" }} />ENTRAR + <Button onClick={() => handleLogin(true)} style={{ textTransform: "uppercase", color: "#666", fontWeight: "700" }}> + <ExitToAppIcon />ENTRAR </Button> </LogInToComment> </Grid> @@ -251,11 +182,56 @@ export default function CommentsArea(props) { } { isLoading ? - <LoadingDiv contrast={state.contrast}> + <LoadingDiv> <CircularProgress className="loading" /> </LoadingDiv> : - totalReviews !== "0" ? ResourceComments(state.contrast) : NoCommentsMessage(state.contrast) + totalReviews !== 0 ? + ( + <ComentariosBox> + <h3>{totalReviews} {totalReviews !== 1 ? 'Relatos' : 'Relato'} sobre o uso do Recurso</h3> + { + comentarios.map(comentario => + <div className="comentario-template" key={comentario.id}> + <Comment + isCollection={false} + authorID={comentario.user ? comentario.user.id : null} + authorAvatar={comentario.user ? comentario.user.avatar : null} + authorName={comentario.user ? comentario.user.name : null} + name={comentario.name} + rating={comentario.rating_average} + reviewRatings={comentario.review_ratings} + description={comentario.description} + createdAt={comentario.created_at} + recurso={true} + reviewID={comentario.id} + objectID={props.recursoId} + handlePost={handlePost} + rerenderCallback={forceUpdate} + handleSnackbar={props.handleSnackbar} + /> + </div> + ) + } + <div className="load-more"> + <IconButton className="button" onClick={handleLoadMoreReviews}> + <KeyboardArrowDownIcon /> + </IconButton> + </div> + </ComentariosBox> + ) + : + ( + <Grid item xs={12}> + <LogInToComment> + <img alt="" src={Comentarios} /> + <span className="span-laranja">Compartilhe sua experiência com a Rede!</span> + <AoRelatar> + Ao relatar sua experiência de uso do Recurso você estará auxiliando professores de todo país. + </AoRelatar> + </LogInToComment> + </Grid> + ) } </Grid> </React.Fragment> @@ -270,7 +246,7 @@ const LoadingDiv = styled.div` align-items: center; .loading{ align-self: center; - color: ${props => props.contrast === "" ? "#ff7f00" : "white"}; + color: #ff7f00; size: 24px; } ` @@ -285,7 +261,7 @@ const ComentariosBox = styled.div` font-family: 'Roboto Light','Roboto Regular',Roboto; font-weight: 300; font-style: normal; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color:#666; font-size: 1.857em; margin: 15px 2%; text-align : flex-start; @@ -298,7 +274,6 @@ const ComentariosBox = styled.div` } .load-more{ - margin-top : 10px; width: 100%; display: flex; flex-direction: row; @@ -307,16 +282,15 @@ const ComentariosBox = styled.div` } .button{ - border: ${props => props.contrast === "" ? "0" : "1px solid white"}; box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); - :hover{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; - } } - - .icon{ - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - } +` +const AoRelatar = styled.div` + width : 70%; + font-size : 20px; + font-weight : 300; + text-align : center; + padding-bottom : 20px; ` const LogInToComment = styled.div` @@ -330,7 +304,7 @@ const LogInToComment = styled.div` font-size : 24px; font-weight : 700; padding-bottom : 5px; - color: ${props => props.contrast === "" ? "#ff7f00" : "white"}; + color : #ff7f00; } img { @@ -340,7 +314,7 @@ const LogInToComment = styled.div` ` const GrayContainer = styled.div` - background-color: ${props => props.contrast === "" ? "white" : "black"}; + background-color : #fafafa; font-weight : 400; font-size : 14px; padding-bottom : 20px; @@ -357,7 +331,7 @@ const GrayContainer = styled.div` text-align: center; font-weight: 300; font-style: normal; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; font-size: 1.857em; margin-bottom : 10px; margin-left : 2%; diff --git a/src/Components/ResourcePageComponents/Footer.js b/src/Components/ResourcePageComponents/Footer.js index f1bc74654af9d90ee856c4ef8a8647649c05a72e..98e7fcd119baab3a54029a86ada0860dc0526dd8 100644 --- a/src/Components/ResourcePageComponents/Footer.js +++ b/src/Components/ResourcePageComponents/Footer.js @@ -47,17 +47,17 @@ function ReportButton(props) { return ( !props.complained ? ( - <ButtonGrey contrast={props.contrast} onClick={props.userLoggedIn ? props.toggleReport : props.openLogin}> + <ButtonGrey onClick={props.userLoggedIn ? props.toggleReport : props.openLogin}> <span className="button-text"> - <ErrorIcon className="icon" />Reportar abuso ou erro + <ErrorIcon className="icon" /> Reportar abuso ou erro </span> </ButtonGrey> ) : ( - <ButtonGrey contrast={props.contrast}> + <ButtonGrey> <span className="button-text-report"> - <ErrorIcon className="icon" />Você já reportou este recurso + <ErrorIcon className="icon" /> Você já reportou este recurso </span> </ButtonGrey> ) @@ -68,28 +68,24 @@ function DownloadButton(props) { return ( props.downloadableLink ? ( - <ButtonOrange contrast={props.contrast} onClick={props.enableDownload}> - <span> - <GetAppIcon className="icon" />Baixar Recurso - </span> + <ButtonOrange onClick={props.enableDownload}> + <span className="text"> + <GetAppIcon className="icon" /> Baixar Recurso + </span> </ButtonOrange> ) : props.link ? ( - <ButtonOrange contrast={props.contrast} onClick={props.toggleRedirect}> - <span > - <CallMadeIcon className="icon" />Abrir Recurso - </span> + <ButtonOrange onClick={props.toggleRedirect}> + <span className="text"> + <CallMadeIcon className="icon" /> Abrir Recurso + </span> </ButtonOrange> ) : ( - <ButtonOrange contrast={props.contrast}> - <span> - Erro - </span> - </ButtonOrange> + <React.Fragment /> ) ) } @@ -154,29 +150,29 @@ export default function Footer(props) { <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> </Snackbar> {/*-------------------------------MODALS---------------------------------------*/} - <ReportModal contrast={props.contrast} open={reportOpen} handleClose={() => { toggleReport(false) }} + <ReportModal open={reportOpen} handleClose={() => { toggleReport(false) }} form="recurso" complainableId={props.recursoId} complainableType={"LearningObject"} /> - <ShareModal contrast={props.contrast} open={shareOpen} handleClose={() => { toggleShare(false) }} + <ShareModal open={shareOpen} handleClose={() => { toggleShare(false) }} thumb={props.thumb} title={props.title} link={props.currPageLink} /> - <GuardarModal contrast={props.contrast} open={saveToCol} handleClose={() => { toggleSave(false) }} + <GuardarModal open={saveToCol} handleClose={() => { toggleSave(false) }} thumb={props.thumb} title={props.title} recursoId={props.recursoId} /> - <RedirectModal contrast={props.contrast} open={redirectOpen} handleClose={() => { toggleRedirect(false) }} + <RedirectModal open={redirectOpen} handleClose={() => { toggleRedirect(false) }} link={props.link} /> - <LoginModal contrast={props.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} openSnackbar={() => { handleSuccessfulLogin(true) }} /> - <SignUpModal contrast={props.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> {/*----------------------------------------------------------------------------*/} {/*-----------------------------BUTTONS----------------------------------------*/} - <OpcoesDiv contrast={props.contrast}> + <OpcoesDiv> <StyledGrid container> { windowWidth > 990 ? @@ -185,7 +181,6 @@ export default function Footer(props) { {/*Botao Reportar*/} <Grid item xs={3}> <ReportButton - contrast={props.contrast} userLoggedIn={state.currentUser.id === '' ? false : true} toggleReport={() => { toggleReport(true) }} openLogin={handleLogin} @@ -195,25 +190,24 @@ export default function Footer(props) { {/*Botao Compartilhar*/} <Grid item xs={3}> - <ButtonGrey contrast={props.contrast} onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleShare(true)}> + <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleShare(true)}> <span className="button-text"> - <ShareIcon className="icon" />Compartilhar - </span> + <ShareIcon className="icon" /> Compartilhar + </span> </ButtonGrey> </Grid> {/*Botao Guardar*/} <Grid item xs={3}> - <ButtonGrey contrast={props.contrast} onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleSave(true)}> + <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleSave(true)}> <span className="button-text"> <FolderIcon className="icon" />Guardar - </span> + </span> </ButtonGrey> </Grid> <Grid item xs={3} style={{ justifyContent: "right !important" }}> <DownloadButton - contrast={props.contrast} downloadableLink={props.downloadableLink} link={props.link} enableDownload={enableDownload} @@ -227,16 +221,15 @@ export default function Footer(props) { <React.Fragment> {/*Botao Guardar*/} <Grid item xs={4}> - <ButtonGrey contrast={props.contrast} onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleSave(true)}> + <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleSave(true)}> <span className="button-text"> <FolderIcon className="icon" />Guardar - </span> + </span> </ButtonGrey> </Grid> <Grid item xs={7}> <DownloadButton - contrast={props.contrast} downloadableLink={props.downloadableLink} link={props.link} enableDownload={enableDownload} @@ -245,7 +238,7 @@ export default function Footer(props) { </Grid> <Grid item xs={1}> - <Button aria-haspopup="true" onClick={handleClick} style={props.contrast === "" ? { color: "#666" } : {color: "yellow"}}> + <Button aria-haspopup="true" onClick={handleClick} style={{ color: "#666" }}> <MoreVertIcon /> </Button> <Menu @@ -254,24 +247,20 @@ export default function Footer(props) { keepMounted open={Boolean(anchorEl)} onClose={handleClose} - MenuListProps={{ - disablePadding: true - }} > - <MenuItem className={`${props.contrast}BackColor`}> + <MenuItem> <ReportButton - contrast={props.contrast} userLoggedIn={state.currentUser.id === '' ? false : true} toggleReport={() => { toggleReport(true) }} openLogin={handleLogin} complained={props.complained} /> </MenuItem> - <MenuItem className={`${props.contrast}BackColor`}> - <ButtonGrey contrast={props.contrast} onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleShare(true)}> + <MenuItem> + <ButtonGrey onClick={state.currentUser.id === '' ? () => handleLogin(true) : () => toggleShare(true)}> <span className="button-text"> <ShareIcon className="icon" /> Compartilhar - </span> + </span> </ButtonGrey> </MenuItem> </Menu> @@ -288,21 +277,20 @@ export default function Footer(props) { } const OpcoesDiv = styled.div` - margin: 1em 0em; display : flex; align-items : center; height : 65px; - background-color: ${props => props.contrast === "" ? "white" : "black"}; + background-color : #fafafa; ` const StyledGrid = styled(Grid)` @media screen and (min-width: 990px) { - padding-left : 12px !important; + padding-left : 15px !important; } .MuiGrid-item { - padding-right : 12px; - padding-left : 12px; + padding-right : 15px; + padding-left : 15px; display : flex; justify-content : center; } @@ -310,16 +298,15 @@ const StyledGrid = styled(Grid)` const ButtonGrey = styled(Button)` &:hover { - background-color: ${props => props.contrast === "" ? "rgba(158,158,158,0.2)" : "rgba(255,255,0,0.24)"} !important; + background-color : rgba(158,158,158,0.2) !important; } - background-color : ${props => props.contrast === "" ? "transparent" : "black"} !important; - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} !important; + background-color : transparent !important; + color : #666 !important; + text-decoration : none !important; outline : none !important; text-align : center !important; .icon { - color: ${props => props.contrast === "" ? "inherit" : "white"} !important; vertical-align : middle !important; font-weight : normal !important; font-style : normal !important; @@ -332,12 +319,14 @@ const ButtonGrey = styled(Button)` word-wrap : normal !important; direction : ltr !important; padding-right : 2px; + color : inherit !important; } .button-text { cursor : pointer; line-height : 36px; text-align : center; + color : currentColor; white-space : nowrap; text-transform : uppercase; font-weight : 600; @@ -360,22 +349,17 @@ const ButtonGrey = styled(Button)` ` const ButtonOrange = styled(Button)` - &:hover { - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; - background-color: ${props => props.contrast === "" ? "#ff7f00" : "black"} !important; - color: ${props => props.contrast === "" ? "white" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} !important; - border: ${props => props.contrast === "" ? "0" : "1px solid white"} !important; + background-color : #ff7f00 !important; + color : #fff !important; + text-decoration : none !important; text-transform : uppercase !important; outline : none !important; - /* max-height: 36px !important; */ text-align : center !important; + max-height : 36px; margin-top : 5px !important; .icon { - color: white !important; vertical-align : middle !important; font-weight : normal !important; font-style : normal !important; @@ -391,7 +375,6 @@ const ButtonOrange = styled(Button)` } .text { - color: ${props => props.contrast === "" ? "white" : "yellow"} !important; font-size : 14px; font-weight : 600; } diff --git a/src/Components/ResourcePageComponents/Sobre.js b/src/Components/ResourcePageComponents/Sobre.js index 63f646ae6aa9aa3c0299309ae70753e2ec61fa06..f1e20fa480dc7e76b4c55a448258f44106e61e65 100644 --- a/src/Components/ResourcePageComponents/Sobre.js +++ b/src/Components/ResourcePageComponents/Sobre.js @@ -16,13 +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, { useContext, useState, useEffect } from 'react' -import { Store } from '../../Store' +import React, {useContext, useState, useEffect} from 'react' +import {Store} from '../../Store' import styled from 'styled-components' import Grid from '@material-ui/core/Grid'; -import { Link } from 'react-router-dom' -import { NoIcon } from '../ContactButtons/FollowButton.js' -import { NoIconFollowing } from '../ContactButtons/FollowingButton.js' +import {Link} from 'react-router-dom' +import {NoIcon} from '../ContactButtons/FollowButton.js' +import {NoIconFollowing} from '../ContactButtons/FollowingButton.js' import Collapse from '@material-ui/core/Collapse'; import SdCardIcon from '@material-ui/icons/SdCard'; import TranslateIcon from '@material-ui/icons/Translate'; @@ -45,7 +45,7 @@ function Alert(props) { return <MuiAlert elevation={6} variant="filled" {...props} />; } -function AdditionalInfoItem(props) { +function AdditionalInfoItem (props) { return ( <span className="meta-objeto"> {props.icon} @@ -55,11 +55,11 @@ function AdditionalInfoItem(props) { ) } -export default function Sobre(props) { - const { state } = useContext(Store) +export default function Sobre (props) { + const {state} = useContext(Store) const [collapsed, setCollapsed] = useState(false) - const toggleCollapsed = () => { setCollapsed(!collapsed) }; + const toggleCollapsed = () => {setCollapsed(!collapsed)}; const [loginOpen, setLogin] = useState(false) const [successfulLoginOpen, handleSuccessfulLogin] = useState(false) const [signUpOpen, setSignUp] = useState(false) @@ -76,8 +76,8 @@ export default function Sobre(props) { if (reason === 'clickaway') { return; } - - handleSuccessfulLogin(false); + + handleSuccessfulLogin(false); } var moment = require('moment') @@ -87,58 +87,58 @@ export default function Sobre(props) { useEffect(() => { let aux = [] - if (props.attachments && props.attachments[0]) { + if (props.attachments && props.attachments[0]){ aux.push(<AdditionalInfoItem - icon={<SdCardIcon />} + icon={<SdCardIcon/>} label={'Tamanho: '} value={(props.attachments[0].size / 1000000).toFixed(2) + ' Mb'} key={props.attachments[0].id} - />) + />) } - if (props.language) { - props.language.map((lang) => + if(props.language){ + props.language.map( (lang) => aux.push(<AdditionalInfoItem - icon={<TranslateIcon />} + icon={<TranslateIcon/>} label={'Idioma: '} value={lang.name} key={lang.id} - /> - )) + /> + )) } - if (props.mimeType) { + if (props.mimeType){ aux.push(<AdditionalInfoItem - icon={<InsertDriveFileIcon />} + icon={<InsertDriveFileIcon/>} label={'Formato: '} value={props.mimeType} key={props.mimeType} - />) + />) } if (props.createdAt) { aux.push(<AdditionalInfoItem - icon={<DateRangeIcon />} + icon={<DateRangeIcon/>} label={'Data de Envio: '} value={moment(props.createdAt).format("DD/MM/YYYY")} key={"dateCreatedAt"} - />) + />) } if (props.updatedAt) { aux.push(<AdditionalInfoItem - icon={<UpdateIcon />} + icon={<UpdateIcon/>} label={'Modificado em: '} value={moment(props.createdAt).format("DD/MM/YYYY")} key={"dateUpdatedAt"} - />) + />) } if (props.license) { aux.push(<AdditionalInfoItem - icon={<AssignmentIcon />} + icon={<AssignmentIcon/>} label={'Tipo de licença: '} value={ <div className="license-link"> <a href={props.license.url}> - <img src={License} alt="license" /> + <img src={License} alt="license"/> </a> <p> {props.license.name} @@ -146,11 +146,11 @@ export default function Sobre(props) { </div> } key={props.license.id} - />) + />) } else { aux.push(<AdditionalInfoItem - icon={<AssignmentIcon />} + icon={<AssignmentIcon/>} label={'Tipo de licença: '} value={ <div className="license-link"> @@ -159,7 +159,7 @@ export default function Sobre(props) { </p> </div> } - key={"no-license"} />) + key={"no-license"}/>) } setAdditionalInfo(aux) }, []) @@ -167,7 +167,7 @@ export default function Sobre(props) { let windowWidth = window.innerWidth const [followed, setFollowed] = useState(props.followed) - const toggleFollowed = () => { setFollowed(!followed) } + const toggleFollowed = () => {setFollowed(!followed)} return ( <React.Fragment> @@ -177,16 +177,16 @@ export default function Sobre(props) { <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert> </Snackbar> {/*-------------------------------MODALS---------------------------------------*/} - <LoginModal contrast={state.contrast} open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} + <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp} openSnackbar={() => { handleSuccessfulLogin(true) }} /> - <SignUpModal contrast={state.contrast} open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> + <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} /> {/*----------------------------------------------------------------------------*/} - <Grid container style={{ paddingRight: "15px", paddingLeft: "15px" }}> + <Grid container style={{paddingRight : "15px", paddingLeft : "15px"}}> - <Grid item xs={windowWidth > 990 ? 9 : 12} style={{ paddingRight: "15px" }}> + <Grid item xs={windowWidth > 990 ? 9 : 12} style={{paddingRight : "15px"}}> <Collapse in={collapsed} collapsedHeight={338}> - <SobreDiv contrast={state.contrast}> + <SobreDiv> <div className="titulo"> Sobre o Recurso </div> @@ -195,7 +195,7 @@ export default function Sobre(props) { <div className="tags-container"> { props.tags && - props.tags.map((tag) => + props.tags.map( (tag) => <span key={tag.name}>{tag.name}</span> ) } @@ -222,7 +222,7 @@ export default function Sobre(props) { </Grid> <Grid item xs={windowWidth > 990 ? 3 : 12}> - <MetasObjeto contrast={state.contrast}> + <MetasObjeto> <div className="enviado-por"> Enviado por: </div> @@ -230,54 +230,54 @@ export default function Sobre(props) { <div className="foto-autor"> <Link to={"/usuario-publico/" + props.id}> - <img src={props.avatar} alt="user avatar" /> + <img src={props.avatar} alt="user avatar"/> </Link> </div> <div className="nome-autor"> - <Link to={"/usuario-publico/" + props.id} style={{ textDecoration: "none" }}> + <Link to={"/usuario-publico/" + props.id} style={{textDecoration : "none"}}> <span className="span-st">{props.publisher}</span> </Link> </div> - <div style={{ paddingTop: "0.75em", display: "flex", justifyContent: "center" }}> - { - (props.id !== state.currentUser.id) && - followed ? ( - <> - <NoIconFollowing contrast={state.contrast} followedID={props.id} toggleFollowed={toggleFollowed} /> - <ContactCardOptions contrast={state.contrast} followed={followed} followableID={props.id} toggleFollowed={toggleFollowed} /> - </> - ) - : - ( - <> - <NoIcon contrast={state.contrast} followableID={props.id} toggleFollowed={toggleFollowed} /> - <ContactCardOptions contrast={state.contrast} followed={followed} followableID={props.id} toggleFollowed={toggleFollowed} /> - </> - ) - } + <div style={{paddingTop : "0.75em", display : "flex", justifyContent : "center"}}> + { + (props.id !== state.currentUser.id) && + followed ? ( + <> + <NoIconFollowing followedID={props.id} toggleFollowed={toggleFollowed}/> + <ContactCardOptions followed={followed} followableID={props.id} toggleFollowed={toggleFollowed}/> + </> + ) + : + ( + <> + <NoIcon followableID={props.id} toggleFollowed={toggleFollowed}/> + <ContactCardOptions followed={followed} followableID={props.id} toggleFollowed={toggleFollowed}/> + </> + ) + } </div> </MetasObjeto> </Grid> - <Grid item xs={12} style={{ paddingTop: "15px" }}> - <CollapseControl onClick={() => { toggleCollapsed() }}> + <Grid item xs={12} style={{paddingTop : "15px"}}> + <CollapseControl onClick={() => {toggleCollapsed()}}> { collapsed ? - ( + ( <React.Fragment> - <span style={state.contrast === "" ? { color: "#666" } : { color: "yellow", textDecoration: "underline" }}>VER MENOS</span> - <ExpandLessIcon style={state.contrast === "" ? { color: "#666" } : { color: "white" }} /> + <span>VER MENOS</span> + <ExpandLessIcon/> </React.Fragment> - ) - : - ( + ) + : + ( <React.Fragment> - <span style={state.contrast === "" ? { color: "#666" } : { color: "yellow", textDecoration: "underline" }}>VER MAIS</span> - <ExpandMoreIcon style={state.contrast === "" ? { color: "#666" } : { color: "white" }} /> + <span>VER MAIS</span> + <ExpandMoreIcon/> </React.Fragment> - ) + ) } </CollapseControl> </Grid> @@ -308,7 +308,6 @@ const CollapseControl = styled.div` ` const SobreDiv = styled.div` - background-color: ${props => props.contrast === "" ? "white" : "black"}; padding-left : 3% !important; padding-top : 3% !important; .titulo { @@ -318,7 +317,7 @@ const SobreDiv = styled.div` font-family : 'Roboto Light','Roboto Regular',Roboto; font-weight : 300; font-style : normal; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; font-size : 1.857em; } @@ -334,13 +333,12 @@ const SobreDiv = styled.div` text-transform : capitalize; display : inline-flex; border-radius : 15px; - background-color: ${props => props.contrast === "" ? "#e5e5e5" : "black"}; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; + background-color : #e5e5e5; margin-right : 3px; padding : 3px 7px; line-height : 18px; margin-bottom : 3px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; font-size : .8em } } @@ -348,13 +346,11 @@ const SobreDiv = styled.div` .conteudo { font-size : 14px; .descricao-objeto { - color: ${props => props.contrast === "" ? "#666" : "white"}; text-align: justify; margin-bottom: 20px; margin-top: 20px; } .autoria { - color: ${props => props.contrast === "" ? "#666" : "white"}; margin-bottom : 30px; } @@ -369,14 +365,12 @@ const SobreDiv = styled.div` display: inline-block; margin-bottom: 15px; font-size : 14px; - color: ${props => props.contrast === "" ? "#666" : "white !important"}; .MuiSvgIcon-root { - vertical-align : middle; + vertical-align : middle } span { - color: ${props => props.contrast === "" ? "#666" : "white"}; margin-left : 2%; font-weight : 700; } @@ -386,8 +380,8 @@ const SobreDiv = styled.div` display : inline-grid; a { - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; - color: ${props => props.contrast === "" ? "initial" : "yellow"}; + text-decoration : none !important; + color : initial; img { vertical-align : middle; @@ -415,7 +409,6 @@ const MetasObjeto = styled.div` justify-content : flex-start; padding : 20px; text-align : center; - color: ${props => props.contrast === "" ? "#666" : "white"}; @media screen and (min-width : 990px) { border-left : 1px solid #e5e5e5; @@ -424,13 +417,12 @@ const MetasObjeto = styled.div` .span-st { position : relative; font-size : 14px; - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color: #666; } .enviado-por { font-size : 14px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color :#666; font-weight : 500; margin-bottom : 5px; margin-top : 20px; diff --git a/src/Components/ResourcePageComponents/TextoObjeto.js b/src/Components/ResourcePageComponents/TextoObjeto.js index f40324cf53c37c6909325ef65bf238c8e9ef4b67..f19b82e1d1c55de62c7884e36c63827c7fe77b70 100644 --- a/src/Components/ResourcePageComponents/TextoObjeto.js +++ b/src/Components/ResourcePageComponents/TextoObjeto.js @@ -102,7 +102,7 @@ export default function TextoObjeto (props) { } return ( - <TextoObjetoDiv contrast={props.contrast}> + <TextoObjetoDiv> { publisherDeletedObject && <Redirect to={{ @@ -124,7 +124,6 @@ export default function TextoObjeto (props) { { props.stateRecurso !== "submitted" && <Firulas - contrast={state.contrast} rating={props.rating} likesCount={props.likesCount} liked={props.likedBool} @@ -186,10 +185,10 @@ export default function TextoObjeto (props) { { (checkAccessLevel('publisher') || props.stateRecurso === "draft") && <Link to={"/editar-recurso/" + props.recursoId}> - <Button className={`${props.contrast}LinkColor`} style={{color : "#666"}}><EditIcon/></Button> + <Button style={{color : "#666"}}><EditIcon/></Button> </Link> } - <Button className={`${props.contrast}LinkColor`} style={{color : "#666"}} onClick={() => {handleDelete()}}><DeleteForeverIcon/></Button> + <Button style={{color : "#666"}} onClick={() => {handleDelete()}}><DeleteForeverIcon/></Button> </React.Fragment> } @@ -200,7 +199,6 @@ export default function TextoObjeto (props) { } const TextoObjetoDiv = styled.div` - background-color: ${props => props.contrast === "" ? "white" : "black"}; padding : 20px 20px 0 20px; display : flex; flex-direction : column; @@ -210,7 +208,6 @@ const TextoObjetoDiv = styled.div` align-items : flex-start; h3 { - color: ${props => props.contrast === "" ? "#666" : "white"}; font-size : 26px; font-weight : 400; margin : 0; @@ -218,7 +215,6 @@ const TextoObjetoDiv = styled.div` } .info-recurso { - color: ${props => props.contrast === "" ? "#666" : "white"}; display : inline-block; width : 100%; font-size : 15px; @@ -227,35 +223,33 @@ const TextoObjetoDiv = styled.div` } .info-cabecalho-recurso { - color: ${props => props.contrast === "" ? "#666" : "white"}; font-size : 15px; } .dado-recurso { - color: ${props => props.contrast === "" ? "#666" : "white"}; font-size : 15px; font-weight : 600; } .views-downloads { - color: ${props => props.contrast === "" ? "#666" : "white"}; font-size : 15px; font-weight : lighter; margin-bottom : 12px; } .icon { - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; vertical-align : middle; margin-right : 2px; } .alert-warning { - color: ${props => props.contrast === "" ? "#8a6d3b" : "white"}; - background-color : ${props => props.contrast === "" ? "#fcf8e3" : "black"}; - border: 1px solid ${props => props.contrast === "" ? "#faebcc" : "white"}; + color : #8a6d3b; + background-color : #fcf8e3; + border-color : #faebcc; padding: 15px; margin-bottom: 20px; + border: 1px solid transparent; border-radius: 4px; font-size : 14px; } @@ -268,7 +262,7 @@ const TextoObjetoDiv = styled.div` height : 32px; width : 100%; margin : 10px 0 8px 0; - background-color: ${props => props.contrast === "" ? "#e5e5e5" : "black"}; + background-color : #e5e5e5; } .audio { diff --git a/src/Components/ResourcePageComponents/VideoPlayer.js b/src/Components/ResourcePageComponents/VideoPlayer.js index 6b5a982235d53b426812c45a03ae33a6e1362744..57b1b06c0271db6a4d36133db6426159f7082255 100644 --- a/src/Components/ResourcePageComponents/VideoPlayer.js +++ b/src/Components/ResourcePageComponents/VideoPlayer.js @@ -37,6 +37,7 @@ function GetEmbeddedLink(link) { } else if (link.indexOf("vimeo") !== -1) { //if the 13th character = o (vimeo videos) link_id = link.split("?")[0].split("/") + console.log(link_id) //key # = from 19th character on embed = "https://player.vimeo.com/video/" + link_id.pop(); //Add vimeo link before key # } return embed @@ -68,7 +69,7 @@ export default function VideoPlayer(props) { </video> </VideoContainer> : - <ErrorParagraph contrast={props.contrast}> + <ErrorParagraph> Seu navegador não permite a exibição deste vídeo. É necessário baixar o vídeo para poder visualizá-lo. </ErrorParagraph> ) @@ -94,5 +95,4 @@ const VideoContainer = styled.div` const ErrorParagraph = styled.p` text-align: center; - color: ${props => props.contrast === "" ? "#666" : "white"}; ` diff --git a/src/Components/SearchBar.js b/src/Components/SearchBar.js index aa07439411ba0c11bae6144a1ad66c5273d80bde..8e0ea969a6655039cd1b71419fbc34367e385a77 100644 --- a/src/Components/SearchBar.js +++ b/src/Components/SearchBar.js @@ -26,18 +26,18 @@ import styled from 'styled-components' import { Store } from '../Store'; import { v4 as uuidv4 } from 'uuid' import Grid from "@material-ui/core/Grid" -import {useStyles} from './ReportUserForm.js' + const dividerStyled = { - background: '#e0e0e0', - width: '1px', - content: "", - display: 'block', - top: '0', - bottom: '0', - right: '0', - minHeight: '70px', - margin: '0 20px' + background: '#e0e0e0', + width: '1px', + content: "", + display: 'block', + top: '0', + bottom: '0', + right: '0', + minHeight: '70px', + margin: '0 20px' } const DividerVertical = () => <em style={dividerStyled}></em> @@ -46,212 +46,178 @@ const ButtonStyled = styled(Button)` text-transform: capitalize !important; ` const IconSearchStyled = styled(IconSearch)` - color: ${props => props.contrast === "" ? "#16b8dd" : "yellow"}; + color: #16b8dd; ` const TextFieldStyled = styled(TextField)` - flex-grow: 2; - margin: 0 2vw !important; - - .MuiOutlinedInput-root { - &.Mui-focused fieldset { - border-color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - } - fieldset { - border-color: ${props => props.contrast === "" ? "#666" : "white"}; - } - } - - label{ - color: ${props => props.contrast === "" ? "#666" : "white"}; - } - - label.Mui-focused { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - } - - label.Mui-focused.Mui-error { - color : red; - } -` - -const FormLearnObjControlLabelStyled = styled(FormControlLabel)` - *{ - text-transform: uppercase; - color: ${props => props.contrast === "" ? "#ff8a17 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: bolder; - } + flex-grow: 2; + margin: 0 2vw !important; ` -const FormCollectionControlLabelStyled = styled(FormControlLabel)` - *{ - text-transform: uppercase; - color: ${props => props.contrast === "" ? "#673ab7 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: bolder; - } +/* +const RadioGroupStyled = styled(RadioGroup)` + display: flex; + flex-direction: row; + flex-grow: 1; ` +*/ -const FormUserControlLabelStyled = styled(FormControlLabel)` - *{ - text-transform: uppercase; - color: ${props => props.contrast === "" ? "#00bcd4 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: bolder; - } +const FormControlLabelStyled = styled(FormControlLabel)` + *{ + text-transform: uppercase; + color: #ff8a17 !important; + fontWeight: bolder; + } ` -const RadioLearnObjStyled = styled(Radio)` - color: #ff8a17; -` -const RadioCollectionStyled = styled(Radio)` - color: #673ab7; -` -const RadioUserStyled = styled(Radio)` - color: #00bcd4; +const RadioStyled = styled(Radio)` + color: #ff8a17; ` const SelectStyled = styled(Select)` - margin-right: 2vw; - *{ - text-transform: uppercase; - color: ${props => props.contrast === "" ? "#ff8a17 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: bolder; - } + margin-right: 2vw; + *{ + text-transform: uppercase; + color: #ff8a17 !important; + fontWeight: bolder; + } ` const MenuItemStyled = styled(MenuItem)` text-transform: uppercase; - font-weight: bolder; + fontWeight: bolder; ` -export default function SearchBar(props) { - const [query, setQuery] = useState('') - - const classes = useStyles(); +/*const Bar = styled.div` + display: flex; + align-items: center; + justify-content: space-between; + border-top: 1px rgba(0,0,0,.1) solid; +` +const Flex = styled.span` + display: flex; + align-items: center; + color: #787380; +`*/ - const [searchClass, setSearchClass] = useState('LearningObject') +export default function SearchBar(props) { + const [query, setQuery] = useState('') + const [searchClass, setSearchClass] = useState('LearningObject') + + const { state, dispatch } = useContext(Store) + + const [goSearch, setGoSearch] = useState(false) + + useEffect(() => { + if (window.location.pathname.includes('busca')) { + const urlParams = new URLSearchParams(window.location.search) + const urlQuery = urlParams.get('query') + const urlSearchClass = urlParams.get('search_class') + if (searchClass !== urlSearchClass || query !== urlQuery) { + setQuery(urlQuery) + setSearchClass(urlSearchClass) + } + } + }, []) - const { state, dispatch } = useContext(Store) + useEffect(() => setGoSearch(false), [goSearch]) - const [goSearch, setGoSearch] = useState(false) + const handleChange = (event) => { + setQuery(event.target.value) + } - useEffect(() => { - if (window.location.pathname.includes('busca')) { - const urlParams = new URLSearchParams(window.location.search) - const urlQuery = urlParams.get('query') - const urlSearchClass = urlParams.get('search_class') - if (searchClass !== urlSearchClass || query !== urlQuery) { - setQuery(urlQuery) - setSearchClass(urlSearchClass) - } + const handleKeyDown = (event) => { + if (event.key === 'Enter' || event.type === 'click') { + dispatch({ + type: 'SAVE_SEARCH', + newSearch: { + query: query !== '' ? query : '*', + class: searchClass } - }, []) - - useEffect(() => setGoSearch(false), [goSearch]) - - const handleChange = (event) => { - setQuery(event.target.value) + }) + setGoSearch(true) } + } - const handleKeyDown = (event) => { - if (event.key === 'Enter' || event.type === 'click') { - dispatch({ - type: 'SAVE_SEARCH', - newSearch: { - query: query !== '' ? query : '*', - class: searchClass - } - }) - setGoSearch(true) - } + const linkTarget = { + pathname: `/busca?page=0&results_per_page=12&order=review_average&query=${state.search.query}&search_class=${state.search.class}`, + key: uuidv4(), // we could use Math.random, but that's not guaranteed unique. + state: { + applied: true } - - const linkTarget = { - pathname: `/busca?page=0&results_per_page=12&order=review_average&query=${state.search.query}&search_class=${state.search.class}`, - key: uuidv4(), // we could use Math.random, but that's not guaranteed unique. - state: { - applied: true - } - }; - - return ( - <Grid container style={state.contrast === "" ? { paddingTop: "1em" } : { backgroundColor: "black", paddingTop: "1em" }}> - <Grid container item xs={12} sm={6} md={6} lg={6} xl={6}> - {goSearch && <Redirect to={`/busca?page=0&results_per_page=12&order=review_average&query=${state.search.query}&search_class=${state.search.class}`} />} - <TextFieldStyled - contrast={state.contrast} - id="standard-search" - label="O que você está buscando?" - type="search" - margin="normal" - variant="outlined" - value={query} - InputProps={state.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} - onChange={handleChange} - onKeyPress={handleKeyDown} - /> - </Grid> - <Grid container item justify="center" alignItems="center" xs={12} sm={6} md={6} lg={6} xl={6}> - {state.windowSize.width >= 960 ? - <React.Fragment> - <Grid container item justify="center" alignItems="center" xs={12} sm={1} md={1} lg={1} xl={1}> - <Link - to={linkTarget} - > - <ButtonStyled title="Pesquisar" onClick={handleKeyDown} ><IconSearchStyled contrast={state.contrast} /></ButtonStyled> - </Link> - </Grid> - <Grid container item justify="center" alignItems="center" xs={12} sm={3} md={3} lg={3} xl={3}> - <span style={state.contrast === "" ? {} : { color: "white" }}>Pressione "Enter" ou click na lupa</span> - </Grid> - <Grid container item justify="center" alignItems="center" xs={12} sm={1} md={1} lg={1} xl={1}> - <DividerVertical /> - </Grid> - <Grid container item justify="center" alignItems="center" xs={12} sm={7} md={7} lg={7} xl={7}> - <RadioGroup row={true} - aria-label="Tipo" - name="types" value={searchClass} - onChange={ - (event) => setSearchClass(event.target.value) - } - justify="center" alignItems="center" - > - <FormLearnObjControlLabelStyled contrast={state.contrast} value="LearningObject" control={<RadioLearnObjStyled contrast={state.contrast} />} label="Recursos" /> - <FormCollectionControlLabelStyled contrast={state.contrast} value="Collection" control={<RadioCollectionStyled contrast={state.contrast} />} label="Coleções" /> - <FormUserControlLabelStyled contrast={state.contrast} value="User" control={<RadioUserStyled contrast={state.contrast} />} label="Usuários" /> - </RadioGroup> - </Grid> - </React.Fragment> - : - <React.Fragment> - <Grid container item justify="center" alignItems="center" xs={5} sm={5} md={5} lg={5} xl={5}> - <FormControl> - <SelectStyled - contrast={state.contrast} - value={searchClass} - onChange={(event) => setSearchClass(event.target.value)} - > - <MenuItemStyled style={state.contrast === "" ? { color: "#ff7f00" } : { color: "yellow", backgroundColor: "black", textDecoration: "underline" }} value="LearningObject" aria-label="Recursos">Recursos</MenuItemStyled> - <MenuItemStyled style={state.contrast === "" ? { color: "#673ab7" } : { color: "yellow", backgroundColor: "black", textDecoration: "underline" }} value="Collection" aria-label="Coleções">Coleções</MenuItemStyled> - <MenuItemStyled style={state.contrast === "" ? { color: "#00bcd4" } : { color: "yellow", backgroundColor: "black", textDecoration: "underline" }} value="User" aria-label="Usuários">Usuários</MenuItemStyled> - </SelectStyled> - </FormControl> - </Grid> - <Grid container item justify="center" alignItems="center" xs={2} sm={2} md={2} lg={2} xl={2}> - <DividerVertical /> - </Grid> - <Grid container item justify="center" alignItems="center" xs={5} sm={5} md={5} lg={5} xl={5}> - <Link - to={linkTarget} - > - <ButtonStyled title="Pesquisar" onClick={handleKeyDown} ><IconSearchStyled contrast={state.contrast} /></ButtonStyled> - </Link> - </Grid> - </React.Fragment> - } - </Grid> - </Grid > - ) + }; + + return ( + <Grid container> + <Grid container item xs={12} sm={6} md={6} lg={6} xl={6}> + {goSearch && <Redirect to={`/busca?page=0&results_per_page=12&order=review_average&query=${state.search.query}&search_class=${state.search.class}`} />} + <TextFieldStyled + id="standard-search" + label="O que você está buscando" + type="search" + margin="normal" + value={query} + onChange={handleChange} + onKeyPress={handleKeyDown} + /> + </Grid> + <Grid container item justify="center" alignItems="center" xs={12} sm={6} md={6} lg={6} xl={6}> + {state.windowSize.width >= 960 ? + <React.Fragment> + <Grid container item justify="center" alignItems="center" xs={12} sm={1} md={1} lg={1} xl={1}> + <Link + to={linkTarget} + > + <ButtonStyled onClick={handleKeyDown} ><IconSearchStyled /></ButtonStyled> + </Link> + </Grid> + <Grid container item justify="center" alignItems="center" xs={12} sm={3} md={3} lg={3} xl={3}> + <span>Pressione "Enter" ou click na lupa</span> + </Grid> + <Grid container item justify="center" alignItems="center" xs={12} sm={1} md={1} lg={1} xl={1}> + <DividerVertical /> + </Grid> + <Grid container item justify="center" alignItems="center" xs={12} sm={7} md={7} lg={7} xl={7}> + <RadioGroup row={true} + aria-label="Tipo" + name="types" value={searchClass} + onChange={ + (event) => setSearchClass(event.target.value) + } + justify="center" alignItems="center" + > + <FormControlLabelStyled value="LearningObject" control={<RadioStyled />} label="Recursos" /> + <FormControlLabelStyled value="Collection" control={<RadioStyled />} label="Coleções" /> + <FormControlLabelStyled value="User" control={<RadioStyled />} label="Usuários" /> + </RadioGroup> + </Grid> + </React.Fragment> + : + <React.Fragment> + <Grid container item justify="center" alignItems="center" xs={5} sm={5} md={5} lg={5} xl={5}> + <FormControl> + <SelectStyled + value={searchClass} + onChange={(event) => setSearchClass(event.target.value)} + > + <MenuItemStyled style={{color : "#ff7f00"}} value="LearningObject" aria-label="Recursos">Recursos</MenuItemStyled> + <MenuItemStyled style={{color : "#673ab7"}} value="Collection" aria-label="Coleções">Coleções</MenuItemStyled> + <MenuItemStyled style={{color : "#00bcd4"}} value="User" aria-label="Usuários">Usuários</MenuItemStyled> + </SelectStyled> + </FormControl> + </Grid> + <Grid container item justify="center" alignItems="center" xs={2} sm={2} md={2} lg={2} xl={2}> + <DividerVertical /> + </Grid> + <Grid container item justify="center" alignItems="center" xs={5} sm={5} md={5} lg={5} xl={5}> + <Link + to={linkTarget} + > + <ButtonStyled onClick={handleKeyDown} ><IconSearchStyled /></ButtonStyled> + </Link> + </Grid> + </React.Fragment> + } + </Grid> + </Grid> + ) } \ No newline at end of file diff --git a/src/Components/SearchExpansionPanel/SearchEPCompCurriculum.js b/src/Components/SearchExpansionPanel/SearchEPCompCurriculum.js index ed4a026ec6187dcf7b7c3ad13fd41958c2e91fb1..43941d039dc31f98950b9c0fe2857bea2486bf4a 100644 --- a/src/Components/SearchExpansionPanel/SearchEPCompCurriculum.js +++ b/src/Components/SearchExpansionPanel/SearchEPCompCurriculum.js @@ -1,34 +1,26 @@ import React from "react"; -import { withStyles } from '@material-ui/core/styles'; +import { makeStyles } from "@material-ui/core/styles"; +import List from "@material-ui/core/List"; +import ListItem from "@material-ui/core/ListItem"; +import ListItemIcon from "@material-ui/core/ListItemIcon"; +import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; +import ListItemText from "@material-ui/core/ListItemText"; import Checkbox from "@material-ui/core/Checkbox"; -import { yellow, orange } from "@material-ui/core/colors"; -import FormControlLabel from '@material-ui/core/FormControlLabel'; -import FormGroup from '@material-ui/core/FormGroup'; +import IconButton from "@material-ui/core/IconButton"; -const OrangeCheckBox = withStyles({ +const useStyles = makeStyles(theme => ({ root: { - color: orange[400], - '&$checked': { - color: orange[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); + width: "100%", + maxWidth: 360, + backgroundColor: theme.palette.background.paper, + color: "#666" + } +})); -const ContrastCheckBox = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -export default function SearchEPCompCurriculum({ curriculumComponents, setCurriculum, contrast }) { +export default function SearchEPCompCurriculum({ onChange, curriculumComponents, setCurriculum }) { + const classes = useStyles(); - const handleChange = (event) => { - const index = event.target.name; + const handleToggle = (index) => () => { const newCurriculumComponents = [...curriculumComponents]; newCurriculumComponents[index].isChecked = !newCurriculumComponents[index].isChecked setCurriculum(newCurriculumComponents); @@ -36,17 +28,34 @@ export default function SearchEPCompCurriculum({ curriculumComponents, setCurric if (curriculumComponents) return ( - <FormGroup row> - { - curriculumComponents.map((item, index) => { - return <FormControlLabel - name={index} + <List className={classes.root}> + {curriculumComponents.map((item, index) => { + const labelId = `checkbox-list-label-${item.value}`; + + return ( + <ListItem key={item.exemplo} - control={contrast === "" ? <OrangeCheckBox checked={item.isChecked} onChange={handleChange} /> : <ContrastCheckBox checked={item.isChecked} onChange={handleChange} />} - label={<span style={contrast === "" ? {} : { color: "yellow", textDecoration: "underline" }}>{item.exemplo}</span>} - /> - }) - } - </FormGroup> - ) + role={undefined} + dense + button + onClick={handleToggle(index)} + > + <ListItemIcon> + <Checkbox + edge="start" + checked={item.isChecked} + tabIndex={-1} + disableRipple + inputProps={{ "aria-labelledby": labelId }} + /> + </ListItemIcon> + <ListItemText id={labelId} primary={item.exemplo} /> + <ListItemSecondaryAction> + <IconButton edge="end" aria-label="comments"></IconButton> + </ListItemSecondaryAction> + </ListItem> + ); + })} + </List> + ); } diff --git a/src/Components/SearchExpansionPanel/SearchEPIdiomas.js b/src/Components/SearchExpansionPanel/SearchEPIdiomas.js index fcb1c65ceadbf00a2764a2e71ba493d8d198d595..06715e4615b21f96a5ab87d6caad1cdc5f2d8eac 100644 --- a/src/Components/SearchExpansionPanel/SearchEPIdiomas.js +++ b/src/Components/SearchExpansionPanel/SearchEPIdiomas.js @@ -1,52 +1,61 @@ import React from "react"; -import { withStyles } from '@material-ui/core/styles'; +import { makeStyles } from "@material-ui/core/styles"; +import List from "@material-ui/core/List"; +import ListItem from "@material-ui/core/ListItem"; +import ListItemIcon from "@material-ui/core/ListItemIcon"; +import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; +import ListItemText from "@material-ui/core/ListItemText"; import Checkbox from "@material-ui/core/Checkbox"; -import { yellow, orange } from "@material-ui/core/colors"; -import FormControlLabel from '@material-ui/core/FormControlLabel'; -import FormGroup from '@material-ui/core/FormGroup'; +import IconButton from "@material-ui/core/IconButton"; -const OrangeCheckBox = withStyles({ +const useStyles = makeStyles(theme => ({ root: { - color: orange[400], - '&$checked': { - color: orange[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); + width: "100%", + maxWidth: 360, + backgroundColor: theme.palette.background.paper, + color: "#666" + } +})); -const ContrastCheckBox = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -export default function SearchEPCompCurriculum({ languages, setLanguages, contrast }) { +export default function SearchEPIdiomas({ languages, setLanguages }) { + const classes = useStyles(); - const handleChange = (event) => { - const index = event.target.name; - const newCurriculumComponents = [...languages]; - newCurriculumComponents[index].isChecked = !newCurriculumComponents[index].isChecked - setLanguages(newCurriculumComponents); + const handleToggle = (index) => () => { + const newLanguages = [...languages]; + newLanguages[index].isChecked = !newLanguages[index].isChecked + setLanguages(newLanguages); }; if (languages) return ( - <FormGroup row> - { - languages.map((item, index) => { - return <FormControlLabel - name={index} + <List className={classes.root}> + {languages.map((item, index) => { + const labelId = `checkbox-list-label-${item.value}`; + + return ( + <ListItem key={item.exemplo} - control={contrast === "" ? <OrangeCheckBox checked={item.isChecked} onChange={handleChange} /> : <ContrastCheckBox checked={item.isChecked} onChange={handleChange} />} - label={<span style={contrast === "" ? {} : { color: "yellow", textDecoration: "underline" }}>{item.exemplo}</span>} - /> - }) - } - </FormGroup> - ) + role={undefined} + dense + button + onClick={handleToggle(index)} + > + <ListItemIcon> + <Checkbox + edge="start" + checked={item.isChecked} + tabIndex={-1} + disableRipple + inputProps={{ "aria-labelledby": labelId }} + /> + </ListItemIcon> + <ListItemText id={labelId} primary={item.exemplo} /> + <ListItemSecondaryAction> + <IconButton edge="end" aria-label="comments"></IconButton> + </ListItemSecondaryAction> + </ListItem> + ); + })} + </List> + ); } diff --git a/src/Components/SearchExpansionPanel/SearchEPTiposRec.js b/src/Components/SearchExpansionPanel/SearchEPTiposRec.js index 9aedc9a55223ed805781b073179a268d22beb30f..41b77adf51206db55b674ce259819f0b8bbf2236 100644 --- a/src/Components/SearchExpansionPanel/SearchEPTiposRec.js +++ b/src/Components/SearchExpansionPanel/SearchEPTiposRec.js @@ -1,52 +1,61 @@ import React from "react"; -import { withStyles } from '@material-ui/core/styles'; +import { makeStyles } from "@material-ui/core/styles"; +import List from "@material-ui/core/List"; +import ListItem from "@material-ui/core/ListItem"; +import ListItemIcon from "@material-ui/core/ListItemIcon"; +import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; +import ListItemText from "@material-ui/core/ListItemText"; import Checkbox from "@material-ui/core/Checkbox"; -import { yellow, orange } from "@material-ui/core/colors"; -import FormControlLabel from '@material-ui/core/FormControlLabel'; -import FormGroup from '@material-ui/core/FormGroup'; +import IconButton from "@material-ui/core/IconButton"; -const OrangeCheckBox = withStyles({ +const useStyles = makeStyles(theme => ({ root: { - color: orange[400], - '&$checked': { - color: orange[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); + width: "100%", + maxWidth: 360, + backgroundColor: theme.palette.background.paper, + color: "#666" + } +})); -const ContrastCheckBox = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -export default function SearchEPCompCurriculum({ typeOfResources, setTypeRes, contrast }) { +export default function SearchEPCompCurriculum({ onChange, typeOfResources, setTypeRes }) { + const classes = useStyles(); - const handleChange = (event) => { - const index = event.target.name; - const newCurriculumComponents = [...typeOfResources]; - newCurriculumComponents[index].isChecked = !newCurriculumComponents[index].isChecked - setTypeRes(newCurriculumComponents); + const handleToggle = (index) => () => { + const newTypeOfRes = [...typeOfResources]; + newTypeOfRes[index].isChecked = !newTypeOfRes[index].isChecked + setTypeRes(newTypeOfRes); }; if (typeOfResources) return ( - <FormGroup row> - { - typeOfResources.map((item, index) => { - return <FormControlLabel - name={index} + <List className={classes.root}> + {typeOfResources.map((item, index) => { + const labelId = `checkbox-list-label-${item.value}`; + + return ( + <ListItem key={item.exemplo} - control={contrast === "" ? <OrangeCheckBox checked={item.isChecked} onChange={handleChange} /> : <ContrastCheckBox checked={item.isChecked} onChange={handleChange} />} - label={<span style={contrast === "" ? {} : { color: "yellow", textDecoration: "underline" }}>{item.exemplo}</span>} - /> - }) - } - </FormGroup> - ) + role={undefined} + dense + button + onClick={handleToggle(index)} + > + <ListItemIcon> + <Checkbox + edge="start" + checked={item.isChecked} + tabIndex={-1} + disableRipple + inputProps={{ "aria-labelledby": labelId }} + /> + </ListItemIcon> + <ListItemText id={labelId} primary={item.exemplo} /> + <ListItemSecondaryAction> + <IconButton edge="end" aria-label="comments"></IconButton> + </ListItemSecondaryAction> + </ListItem> + ); + })} + </List> + ); } diff --git a/src/Components/SearchExpansionPanel/SearchExpansionPanel.js b/src/Components/SearchExpansionPanel/SearchExpansionPanel.js index e36e564bd43489d2c1335edd315ba53b068b1b73..8df336aaa3c5966791ed1159775afc3ff301d23a 100644 --- a/src/Components/SearchExpansionPanel/SearchExpansionPanel.js +++ b/src/Components/SearchExpansionPanel/SearchExpansionPanel.js @@ -9,223 +9,236 @@ import SearchEPCompCurriculum from "./SearchEPCompCurriculum"; import SearchEPTiposRec from "./SearchEPTiposRec"; import SearchEPEtapasEns from "./SesrchEPEtapasEns"; import SearchEPIdiomas from "./SearchEPIdiomas"; +import { TextField } from "@material-ui/core"; +import Grid from '@material-ui/core/Grid'; +import CircularProgress from '@material-ui/core/CircularProgress'; import Paper from '@material-ui/core/Paper'; import styled from 'styled-components'; import './ExpansionPanel.css' -import FormInput from "../FormInput"; const ExpansionPanel = withStyles({ - root: { - border: "1px solid rgba(0, 0, 0, .125)", - boxShadow: "none", - '.MuiButtonBase-root': { - paddingInline: "0 !important" - }, - "&:not(:last-child)": { - borderBottom: 0 - }, - "&:before": { - display: "none" - }, - "&$expanded": { - margin: "auto" - } + root: { + border: "1px solid rgba(0, 0, 0, .125)", + boxShadow: "none", + '.MuiButtonBase-root': { + paddingInline: "0 !important" }, - expanded: {} + "&:not(:last-child)": { + borderBottom: 0 + }, + "&:before": { + display: "none" + }, + "&$expanded": { + margin: "auto" + } + }, + expanded: {} })(MuiExpansionPanel); const ExpansionPanelSummary = withStyles({ - root: { - color: "#666", - marginBottom: -1, - minHeight: 56, - backgroundColor: "#fff", + root: { + color: "#666", + marginBottom: -1, + minHeight: 56, + backgroundColor: "#fff", - "&$expanded": { - minHeight: 56, - backgroundColor: "#fff" - } - }, - content: { - "&$expanded": { - margin: "12px 0" - } - }, - expanded: {} + "&$expanded": { + minHeight: 56, + backgroundColor: "#fff" + } + }, + content: { + "&$expanded": { + margin: "12px 0" + } + }, + expanded: {} })(MuiExpansionPanelSummary); +const TesteTypography = withStyles({ + root: { + fontSize: "17px" + } +})(Typography); const ExpansionPanelDetails = withStyles(theme => ({ - root: { - // padding: theme.spacing(2) - } + root: { + // padding: theme.spacing(2) + } }))(MuiExpansionPanelDetails); export default function SearchExpansionPanel(props) { - const [keyWords, setKeyWords] = useState(""); - const [errorInKeyWord, setErrorInKeyWord] = useState({ - message: "", - state: false - }) - - const onKeyPressed = (e) => { - if (e.key === "Enter") { - if (keyWords.length === 0) { - setErrorInKeyWord({ - state: true, - message: "Preencha o campo" - }) - } - else - props.setTag(keyWords) - } - } - - const HandleChangeText = (e) => { - if (errorInKeyWord.state) - setErrorInKeyWord({ - state: false, - message: "" - }) - setKeyWords(e.target.value); + const [keyWords, setKeyWords] = useState(""); + const [errorInKeyWord, setErrorInKeyWord] = useState({ + message: "", + state: false + }) + + const onKeyPressed = (e) => { + if (e.key === "Enter") { + if (keyWords.length === 0) { + setErrorInKeyWord({ + state: true, + message: "Preencha o campo" + }) + } + else + props.setTag(keyWords) } - - return ( - <MainPaper square elevation={4} contrast={props.contrast}> - <link - href="https://fonts.googleapis.com/css?family=Roboto:400,500&display=swap" - rel="stylesheet" + } + + const HandleChangeText = (e) => { + if (errorInKeyWord.state) + setErrorInKeyWord({ + state: false, + message: "" + }) + setKeyWords(e.target.value); + } + + return ( + <MainPaper square elevation={4}> + <link + href="https://fonts.googleapis.com/css?family=Roboto:400,500&display=swap" + rel="stylesheet" + /> + + <ExpansionPanel square> + <ExpansionPanelSummary + aria-controls="panel1d-content" + id="panel1d-header" + > + <Grid + container + direction="row" + justify="space-between" + > + <Grid item > + <Typography + style={{ + fontSize: "18px", + textTransform: "uppercase", + fontWeight: "500", + }} + > + Filtros + </Typography> + </Grid> + <Grid item> + { + props.onFiltering ? <CircularProgress size={24} color="secondary" /> : null + } + </Grid> + </Grid> + </ExpansionPanelSummary> + </ExpansionPanel> + + <ExpansionPanel square> + <ExpansionPanelSummary + expandIcon={<ExpandMoreIcon />} + + aria-controls="panel2d-content" + id="panel2d-header" + > + <TesteTypography>Componentes Curriculares</TesteTypography> + </ExpansionPanelSummary> + <ExpansionPanelDetails> + <div> + <SearchEPCompCurriculum + onChange={props.onChange} + curriculumComponents={props.curriculumComponents} + setCurriculum={props.setCurriculum} /> - <ExpansionPanel square> - <ExpansionPanelSummary - aria-controls="panel1d-content" - id="panel1d-header" - style={props.contrast === "" ? {} : { backgroundColor: "black" }} - > - <Typography - style={props.contrast === "" ? { - fontSize: "18px", - textTransform: "uppercase", - fontWeight: "500", - } : { - fontSize: "18px", - textTransform: "uppercase", - fontWeight: "500", - color: "white" - }} - > - Filtros - </Typography> - </ExpansionPanelSummary> - </ExpansionPanel> - - <ExpansionPanel square> - <ExpansionPanelSummary - expandIcon={<ExpandMoreIcon style={props.contrast === "" ? {} : { color: "white" }} />} - style={props.contrast === "" ? {} : { backgroundColor: "black" }} - aria-controls="panel2d-content" - id="panel2d-header" - > - <Typography style={props.contrast === "" ? {} : { color: "white" }}>Componentes Curriculares</Typography> - </ExpansionPanelSummary> - <ExpansionPanelDetails style={props.contrast === "" ? {} : { backgroundColor: "black" }}> - <SearchEPCompCurriculum - contrast={props.contrast} - curriculumComponents={props.curriculumComponents} - setCurriculum={props.setCurriculum} - /> - </ExpansionPanelDetails> - </ExpansionPanel> - - <ExpansionPanel square> - <ExpansionPanelSummary - style={props.contrast === "" ? {} : { backgroundColor: "black" }} - expandIcon={<ExpandMoreIcon style={props.contrast === "" ? {} : { color: "white" }} />} - aria-controls="panel3d-content" - id="panel3d-header" - > - <Typography style={props.contrast === "" ? {} : { color: "white" }}>Tipos de Recurso</Typography> - </ExpansionPanelSummary> - <ExpansionPanelDetails style={props.contrast === "" ? {} : { backgroundColor: "black" }}> - <SearchEPTiposRec - contrast={props.contrast} - typeOfResources={props.typeOfResources} - setTypeRes={props.setTypeRes} - /> - </ExpansionPanelDetails> - </ExpansionPanel> - - <ExpansionPanel square> - <ExpansionPanelSummary - style={props.contrast === "" ? {} : { backgroundColor: "black" }} - aria-controls="panel4d-content" - expandIcon={<ExpandMoreIcon style={props.contrast === "" ? {} : { color: "white" }} />} - id="panel4d-header" - > - <Typography style={props.contrast === "" ? {} : { color: "white" }}>Etapas de Ensino</Typography> - </ExpansionPanelSummary> - <ExpansionPanelDetails style={props.contrast === "" ? {} : { backgroundColor: "black" }}> - <SearchEPEtapasEns - contrast={props.contrast} - teachingStage={props.teachingStage} - setTeachingStage={props.setTeachingStage} - /> - </ExpansionPanelDetails> - </ExpansionPanel> - - <ExpansionPanel square> - <ExpansionPanelSummary - style={props.contrast === "" ? {} : { backgroundColor: "black" }} - aria-controls="panel5d-content" - expandIcon={<ExpandMoreIcon style={props.contrast === "" ? {} : { color: "white" }} />} - id="panel5d-header" - > - <Typography style={props.contrast === "" ? {} : { color: "white" }}>Idiomas</Typography> - </ExpansionPanelSummary> - <ExpansionPanelDetails style={props.contrast === "" ? {} : { backgroundColor: "black" }}> - <SearchEPIdiomas - contrast={props.contrast} - languages={props.languages} - setLanguages={props.setLanguages} - /> - </ExpansionPanelDetails> - </ExpansionPanel> - - <ExpansionPanel square> - <ExpansionPanelSummary - style={props.contrast === "" ? {} : { backgroundColor: "black", borderBottom: "1px solid white" }} - aria-controls="panel6d-content" - expandIcon={<ExpandMoreIcon style={props.contrast === "" ? {} : { color: "white" }} />} - id="panel6d-header" - > - <Typography style={props.contrast === "" ? {} : { color: "white" }}>Palavra-Chave</Typography> - </ExpansionPanelSummary> - <ExpansionPanelDetails style={props.contrast === "" ? {} : { backgroundColor: "black" }}> - <FormInput - contrast={props.contrast} - placeholder="Palavra chave + enter " - id="outlined-margin-dense" - variant="outlined" - handleChange={e => HandleChangeText(e)} - onKeyDown={e => onKeyPressed(e)} - error={errorInKeyWord.state} - helperText={errorInKeyWord.state ? errorInKeyWord.message : ""} - /> - </ExpansionPanelDetails> - </ExpansionPanel> - </MainPaper> - ); + </div> + </ExpansionPanelDetails> + </ExpansionPanel> + + <ExpansionPanel square> + <ExpansionPanelSummary + expandIcon={<ExpandMoreIcon />} + aria-controls="panel3d-content" + id="panel3d-header" + > + <Typography>Tipos de Recurso</Typography> + </ExpansionPanelSummary> + <ExpansionPanelDetails> + <SearchEPTiposRec + onChange={props.onChange} + typeOfResources={props.typeOfResources} + setTypeRes={props.setTypeRes} + /> + </ExpansionPanelDetails> + </ExpansionPanel> + + <ExpansionPanel square> + <ExpansionPanelSummary + aria-controls="panel4d-content" + expandIcon={<ExpandMoreIcon />} + id="panel4d-header" + > + <Typography>Etapas de Ensino</Typography> + </ExpansionPanelSummary> + <ExpansionPanelDetails> + <SearchEPEtapasEns + onChange={props.onChange} + teachingStage={props.teachingStage} + setTeachingStage={props.setTeachingStage} + /> + </ExpansionPanelDetails> + </ExpansionPanel> + + <ExpansionPanel square> + <ExpansionPanelSummary + aria-controls="panel5d-content" + expandIcon={<ExpandMoreIcon />} + id="panel5d-header" + > + <Typography>Idiomas</Typography> + </ExpansionPanelSummary> + <ExpansionPanelDetails> + <SearchEPIdiomas + onChange={props.onChange} + languages={props.languages} + setLanguages={props.setLanguages} + /> + </ExpansionPanelDetails> + </ExpansionPanel> + + <ExpansionPanel square> + <ExpansionPanelSummary + aria-controls="panel6d-content" + expandIcon={<ExpandMoreIcon />} + id="panel6d-header" + > + <Typography>Palavra-Chave</Typography> + </ExpansionPanelSummary> + <ExpansionPanelDetails> + <TextField + label="Palavra chave + enter " + id="outlined-margin-dense" + variant="outlined" + onChange={e => HandleChangeText(e)} + onKeyDown={e => onKeyPressed(e)} + error={errorInKeyWord.state} + helperText={errorInKeyWord.state ? errorInKeyWord.message : ""} + /> + </ExpansionPanelDetails> + </ExpansionPanel> + </MainPaper> + ); } const MainPaper = styled(Paper)` - text-align: center; - margin-top: 5px; - margin-bottom: 30px; - color: #666; - - .textInfo{ - text-align: start; - } + /* height: 150px; */ + text-align: center; + background-color: #fff; + margin-top: 5px; + margin-bottom: 30px; + color: #666; + .textInfo{ + text-align: start; + } `; diff --git a/src/Components/SearchExpansionPanel/SesrchEPEtapasEns.js b/src/Components/SearchExpansionPanel/SesrchEPEtapasEns.js index e5c88bad2fa1620c4e77512024366ff25b13ea1f..632009aee017ee3b0347a8e1075d30d15376c89c 100644 --- a/src/Components/SearchExpansionPanel/SesrchEPEtapasEns.js +++ b/src/Components/SearchExpansionPanel/SesrchEPEtapasEns.js @@ -1,52 +1,61 @@ import React from "react"; -import { withStyles } from '@material-ui/core/styles'; +import { makeStyles } from "@material-ui/core/styles"; +import List from "@material-ui/core/List"; +import ListItem from "@material-ui/core/ListItem"; +import ListItemIcon from "@material-ui/core/ListItemIcon"; +import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; +import ListItemText from "@material-ui/core/ListItemText"; import Checkbox from "@material-ui/core/Checkbox"; -import { yellow, orange } from "@material-ui/core/colors"; -import FormControlLabel from '@material-ui/core/FormControlLabel'; -import FormGroup from '@material-ui/core/FormGroup'; +import IconButton from "@material-ui/core/IconButton"; -const OrangeCheckBox = withStyles({ +const useStyles = makeStyles(theme => ({ root: { - color: orange[400], - '&$checked': { - color: orange[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); + width: "100%", + maxWidth: 360, + backgroundColor: theme.palette.background.paper, + color: "#666" + } +})); -const ContrastCheckBox = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -export default function SearchEPCompCurriculum({ teachingStage, setTeachingStage, contrast }) { +export default function SearchEPEtapasEns({ teachingStage, setTeachingStage }) { + const classes = useStyles(); - const handleChange = (event) => { - const index = event.target.name; - const newCurriculumComponents = [...teachingStage]; - newCurriculumComponents[index].isChecked = !newCurriculumComponents[index].isChecked - setTeachingStage(newCurriculumComponents); + const handleToggle = (index) => () => { + const newTypeTeachingStage = [...teachingStage]; + newTypeTeachingStage[index].isChecked = !newTypeTeachingStage[index].isChecked + setTeachingStage(newTypeTeachingStage); }; if (teachingStage) return ( - <FormGroup row> - { - teachingStage.map((item, index) => { - return <FormControlLabel - name={index} + <List className={classes.root}> + {teachingStage.map((item, index) => { + const labelId = `checkbox-list-label-${item.value}`; + + return ( + <ListItem key={item.exemplo} - control={contrast === "" ? <OrangeCheckBox checked={item.isChecked} onChange={handleChange} /> : <ContrastCheckBox checked={item.isChecked} onChange={handleChange} />} - label={<span style={contrast === "" ? {} : { color: "yellow", textDecoration: "underline" }}>{item.exemplo}</span>} - /> - }) - } - </FormGroup> - ) + role={undefined} + dense + button + onClick={handleToggle(index)} + > + <ListItemIcon> + <Checkbox + edge="start" + checked={item.isChecked} + tabIndex={-1} + disableRipple + inputProps={{ "aria-labelledby": labelId }} + /> + </ListItemIcon> + <ListItemText id={labelId} primary={item.exemplo} /> + <ListItemSecondaryAction> + <IconButton edge="end" aria-label="comments"></IconButton> + </ListItemSecondaryAction> + </ListItem> + ); + })} + </List> + ); } diff --git a/src/Components/SearchPageComponents/CollectionTemplate.js b/src/Components/SearchPageComponents/CollectionTemplate.js index b2038c24285b79fd812209dc33ccc6daf0908ce0..d75c13a435210b70a5121fb1bf9c4faf664b30bd 100644 --- a/src/Components/SearchPageComponents/CollectionTemplate.js +++ b/src/Components/SearchPageComponents/CollectionTemplate.js @@ -9,134 +9,118 @@ import ArrowBackIcon from '@material-ui/icons/ArrowBack'; import ArrowForwardIcon from '@material-ui/icons/ArrowForward'; //Image Import -import { ColecaoVazia } from "ImportImages.js"; +import { ColecaoVazia } from "ImportImages.js"; -export default function ResourceTemplate({ isLoading, resources, totalResources, currPage, handlePreviousPage, handleNextPage, contrast }) { - const topRef = React.useRef(); - const totalPages = parseInt(totalResources) === 0 ? 0 : Math.ceil(totalResources / 12) - 1; //Dividing by 12 because i want to cath total pages, and results per page is 12 +export default function ResourceTemplate({ isLoading, resources, totalResources, currPage, handlePreviousPage, handleNextPage }) { + const topRef = React.useRef(); + const totalPages = parseInt(totalResources) === 0 ? 0 : Math.ceil(totalResources / 12) - 1; //Dividing by 12 because i want to cath total pages, and results per page is 12 - useEffect(() => { - topRef.current.scrollIntoView() - }, [isLoading]) + useEffect(() => { + topRef.current.scrollIntoView() + }, [isLoading]) - return ( - <ResourcePaper elevation={4} square contrast={contrast}> - <div ref={topRef} /> - <div className="main"> - <Title contrast={contrast}> - Coleções encontradas ({totalResources}) - </Title> - { - isLoading ? - <LoadingSpinner contrast={contrast} text='Carregando Coleções...' /> - : - <Grid container justify='center' alignItems='center' spacing={3}> - { - resources.length >= 1 ? - resources.map((card) => { - return ( - <Grid item key={new Date().toISOString() + card.id} > - <CollectionCardFunction - contrast={contrast} - name={card.name} - tags={card.tags} - rating={card.review_average} - id={card.id} - author={card.owner ? card.owner.name : ""} - description={card.description} - thumbnails={card.items_thumbnails} - avatar={card.owner ? card.owner.avatar : ""} - likeCount={card.likes_count} - followed={card.followed} - liked={card.liked} - collections={card.collection_items} - authorID={card.owner.id} - /> - </Grid> - ) - }) - : - <NoContentDiv contrast={contrast}> - <h3> - Desculpe, não há dados nessa página. - </h3> - <img src={ColecaoVazia} alt='No cards' /> - </NoContentDiv> - } - </Grid> - } - { - !isLoading && - <Grid container direction='row' alignItems='center' justify='center' spacing={3}> - <Grid item> - <StyledIconButton contrast={contrast} elevation={4} disabled={currPage === 0}> - <IconButton onClick={handlePreviousPage} disabled={currPage === 0}> - <ArrowBackIcon className='icon' /> - </IconButton> - </StyledIconButton> - </Grid> - <Grid item> - <ActualPage contrast={contrast}> - {currPage + 1} - </ActualPage> - <TotalPages contrast={contrast}> - ...{totalPages + 1} - </TotalPages> - </Grid> - <Grid item> - <StyledIconButton contrast={contrast} elevation={4} disabled={currPage === totalPages}> - <IconButton onClick={handleNextPage} disabled={currPage === totalPages}> - <ArrowForwardIcon className='icon' /> - </IconButton> - </StyledIconButton> - </Grid> - </Grid> - } - </div > - </ResourcePaper > - ) + return ( + <ResourcePaper elevation={4} square> + <div ref={topRef} /> + <Title> + Coleções encontradas ({totalResources}) + </Title> + { + isLoading ? + <LoadingSpinner text='Carregando Coleções...' /> + : + <Grid container justify='center' alignItems='center' spacing={3}> + { + resources.length >= 1 ? + resources.map((card) => { + return <Grid item key={new Date().toISOString() + card.id} > + <CollectionCardFunction + name={card.name} + tags={card.tags} + rating={card.review_average} + id={card.id} + author={card.owner ? card.owner.name : ""} + description={card.description} + thumbnails={card.items_thumbnails} + avatar={card.owner ? card.owner.avatar : ""} + likeCount={card.likes_count} + followed={card.followed} + liked={card.liked} + collections={card.collection_items} + authorID={card.owner.id} + /> + </Grid> + }) + : + <NoContentDiv> + <h3> + Desculpe, não há dados nessa página. + </h3> + <img src={ColecaoVazia} alt='No cards' /> + </NoContentDiv> + } + </Grid> + } + { + !isLoading && + <Grid container direction='row' alignItems='center' justify='center' spacing={3}> + <Grid item> + <StyledIconButton elevation={4} disabled={currPage === 0}> + <IconButton onClick={handlePreviousPage} disabled={currPage === 0}> + <ArrowBackIcon className='icon' /> + </IconButton> + </StyledIconButton> + </Grid> + <Grid item> + <ActualPage> + {currPage} + </ActualPage>...{totalPages} + </Grid> + <Grid item> + <StyledIconButton elevation={4} disabled={currPage === totalPages}> + <IconButton onClick={handleNextPage} disabled={currPage === totalPages}> + <ArrowForwardIcon className='icon' /> + </IconButton> + </StyledIconButton> + </Grid> + </Grid> + } + </ResourcePaper> + ) }; const Title = styled.h4` - text-transform: uppercase; - font-weight: 500; - text-align: left; - color: ${props => props.contrast === "" ? "#673ab7" : "white"}; + text-transform: uppercase; + font-weight: 500; + text-align: left; + color: #673ab7; ` const NoContentDiv = styled.div` - h3{ - color: ${props => props.contrast === "" ? "#673ab7" : "white"}; - text-align: center; - } + >h3{ + color: #673ab7; + text-align: center; + } ` const ActualPage = styled.span` - color: ${props => props.contrast === "" ? "#666" : "white"}; -` -const TotalPages = styled.span` - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #673ab7; ` const StyledIconButton = styled(Paper)` - border-radius: 50% !important; - background-color: ${props => props.contrast === "" ? props.disabled ? "#666" : "#673ab7" : "black"} !important; - .icon{ - color: ${props => props.contrast === "" ? "white": props.disabled ? "white" : "yellow"} !important; - } - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; + border-radius: 50% !important; + background-color: ${props => props.disabled ? "#666" : "#673ab7"} !important; + .icon{ + color: ${props => props.disabled ? "#d4d4d4" : "white"}; + } ` const ResourcePaper = styled(Paper)` - /* height: 150px; */ - text-align: center; - margin-top: 5px; - margin-bottom: 30px; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; - - .main{ - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - padding: 0.5em 1em; - } - - .textInfo{ - text-align: start; - } + /* height: 150px; */ + text-align: center; + background-color: #fff; + margin-top: 5px; + margin-bottom: 30px; + padding: 0.5em 1em; + color: #666; + .textInfo{ + text-align: start; + } `; \ No newline at end of file diff --git a/src/Components/SearchPageComponents/Error.js b/src/Components/SearchPageComponents/Error.js index 523bae93b4e9ccb04a254792ce18975a993d04f4..7cb9d98ce01c0006ef33a45422ba1357a119323d 100644 --- a/src/Components/SearchPageComponents/Error.js +++ b/src/Components/SearchPageComponents/Error.js @@ -2,32 +2,29 @@ import React from 'react'; import styled from 'styled-components'; import Paper from '@material-ui/core/Paper'; -export default function Error({ contrast }) { - return <ResourcePaper square elevation={4} contrast={contrast}> - <div className="div"> - <Title contrast={contrast}> - Houve um erro durante a obtenção de dados :( - </Title> - </div> +export default function Error() { + return <ResourcePaper square elevation={4}> + <Title> + Houve um erro durante a obtenção de dados :( + </Title> </ResourcePaper> } const ResourcePaper = styled(Paper)` - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; + /* height: 150px; */ text-align: center; + background-color: #fff; + margin-top: 5px; + margin-bottom: 30px; + padding: 0.5em 1em; color: #666; width: 100%; - - .div{ - padding: 0.5em 1em; - background: ${props => props.contrast === "" ? "" : "black"}; - } `; const Title = styled.h4` text-transform: uppercase; font-weight: 500; text-align: left; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; text-align: center; ` \ No newline at end of file diff --git a/src/Components/SearchPageComponents/FilterSummary.js b/src/Components/SearchPageComponents/FilterSummary.js index 3c0790bf8d80c88c6015eb2b5a8cae6df1d6c54a..9cc1a9aeea7868cf92bd7254adb7ab7dcaeb3aee 100644 --- a/src/Components/SearchPageComponents/FilterSummary.js +++ b/src/Components/SearchPageComponents/FilterSummary.js @@ -3,160 +3,128 @@ import styled from 'styled-components'; import Paper from '@material-ui/core/Paper'; import Grid from '@material-ui/core/Grid'; import Chip from '@material-ui/core/Chip'; +import Button from "@material-ui/core/Button"; -export default function FilterSummary({ curriculumComponents, typeOfResources, languages, teachingStage, tag, onButtonClicked, contrast }) { - return ( - <FilterSummaryPaper square elevation={4} contrast={contrast}> - <div className="main"> - <h3 className="title"> - Resumo dos filtros selecionados - </h3> - <Grid container direction='column' spacing={2}> - <Grid item> - <Grid container direction='row' spacing={1} alignItems='center'> - <Grid item className="subtitle"> - Componentes curriculares: - </Grid> - <Grid item> - { - curriculumComponents.map((item) => { - return ( - item.isChecked && - <StyledChip contrast={contrast} key={new Date().toISOString() + item.value} size="small" label={item.exemplo} /> - ); +export default function FilterSummary + ({ curriculumComponents, typeOfResources, languages, teachingStage, tag, onButtonClicked }) { + return ( + <FilterSummaryPaper square elevation={4}> + <h3 className="title"> + Resumo dos filtros selecionados + </h3> + <Grid container direction='column' spacing={2}> + <Grid item> + <Grid container direction='row' spacing={1} alignItems='center'> + <Grid item> + Componentes curriculares: + </Grid> + <Grid item> + { + curriculumComponents.map((item) => { + return ( + item.isChecked && + <StyledChip key={new Date().toISOString() + item.value} size="small" label={item.exemplo} /> + ); - }) - } - </Grid> - </Grid> - </Grid> - <Grid item> - <Grid container direction='row' spacing={1} alignItems='center'> - <Grid item className="subtitle"> - Tipos de recursos: - </Grid> - <Grid item> - { - typeOfResources.map((item) => { - return ( - item.isChecked && - <StyledChip contrast={contrast} key={new Date().toISOString() + item.value} size="small" label={item.exemplo} /> - ); - }) - } - </Grid> - </Grid> - </Grid> - <Grid item> - <Grid container direction='row' spacing={1} alignItems='center'> - <Grid item className="subtitle"> - Etapas de ensino: - </Grid> - <Grid item> - { - teachingStage.map((item) => { - return ( - item.isChecked && - <StyledChip contrast={contrast} key={new Date().toISOString() + item.value} size="small" label={item.exemplo} /> - ); - }) - } - </Grid> - </Grid> - </Grid> - <Grid item> - <Grid container direction='row' spacing={1} alignItems='center'> - <Grid item className="subtitle"> - Idiomas: - </Grid> - <Grid item> - { - languages.map((item) => { - return ( - item.isChecked && - <StyledChip contrast={contrast} key={new Date().toISOString() + item.value} size="small" label={item.exemplo} /> - ); - }) - } - </Grid> - </Grid> - </Grid> - <Grid item> - <Grid container direction='row' spacing={1} alignItems='center'> - <Grid item className="subtitle"> - Palavra chave: - </Grid> - <Grid item> - { - tag && - <StyledChip contrast={contrast} size="small" label={tag} /> - } - </Grid> - </Grid> - </Grid> - <Grid item> - <Button contrast={contrast} variant="contained" onClick={onButtonClicked}> - Aplicar filtro - </Button> - </Grid> - </Grid> - </div> - </FilterSummaryPaper> - ) + }) + } + </Grid> + </Grid> + </Grid> + <Grid item> + <Grid container direction='row' spacing={1} alignItems='center'> + <Grid item> + Tipos de recursos: + </Grid> + <Grid item> + { + typeOfResources.map((item) => { + return ( + item.isChecked && + <StyledChip key={new Date().toISOString() + item.value} size="small" label={item.exemplo} /> + ); + }) + } + </Grid> + </Grid> + </Grid> + <Grid item> + <Grid container direction='row' spacing={1} alignItems='center'> + <Grid item> + Etapas de ensino: + </Grid> + <Grid item> + { + teachingStage.map((item) => { + return ( + item.isChecked && + <StyledChip key={new Date().toISOString() + item.value} size="small" label={item.exemplo} /> + ); + }) + } + </Grid> + </Grid> + </Grid> + <Grid item> + <Grid container direction='row' spacing={1} alignItems='center'> + <Grid item> + Idiomas: + </Grid> + <Grid item> + { + languages.map((item) => { + return ( + item.isChecked && + <StyledChip key={new Date().toISOString() + item.value} size="small" label={item.exemplo} /> + ); + }) + } + </Grid> + </Grid> + </Grid> + <Grid item> + <Grid container direction='row' spacing={1} alignItems='center'> + <Grid item> + Palavra chave: + </Grid> + <Grid item> + { + tag && + <StyledChip size="small" label={tag} /> + } + </Grid> + </Grid> + </Grid> + <Grid item> + <StyledButton variant="contained" onClick={onButtonClicked}> + <span className="text"> + Aplicar filtro + </span> + </StyledButton> + </Grid> + </Grid> + </FilterSummaryPaper> + ) } const FilterSummaryPaper = styled(Paper)` - margin-top: 5px; - margin-bottom: 30px; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; - - .title{ - text-transform: uppercase; - color: ${props => props.contrast === "" ? "#666" : "white"}; - font-weight: 500; - } - - .main{ - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - padding: 0.5em 1em; - } - - .subtitle{ - color: ${props => props.contrast === "" ? "#666" : "white"}; - } -` -const Button = styled.button` - background: ${props => props.contrast === "" ? "#ff7f00" : "black"}; + background-color: #fff; + margin-top: 5px; + margin-bottom: 30px; + padding: 0.5em 1em; + .title{ text-transform: uppercase; - color: ${props => props.contrast === "" ? "white" : "yellow"}; - font-family: Roboto,sans-serif; - font-size: 14px; - font-weight: 500; - height: 36px; - border-radius: 3px; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; - box-shadow: 0 2px 5px 0 rgba(0,0,0,.26); - display: inline-block; - position: relative; - cursor: pointer; - min-height: 36px; - min-width: 88px; - line-height: 36px; - vertical-align: middle; - -webkit-box-align: center; - outline: none; - text-align: center; - padding: 0em 1em; - white-space: nowrap; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - :active{ - transform: translateY(2px); - } + color: #666; + font-weight: 500; + } +` +const StyledButton = styled(Button)` + background-color: #ff7f00 !important; + .text{ + color: white; + } ` const StyledChip = styled(Chip)` - margin: 0.2em; - background-color: ${props => props.contrast === "" ? 0 : "black !important"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white !important"}; - color: ${props => props.contrast === "" ? 0 : "white !important"}; + margin: 0.2em ` diff --git a/src/Components/SearchPageComponents/HeaderFilters.js b/src/Components/SearchPageComponents/HeaderFilters.js index b9ae795dd0594fc2aa020eb091d088277f7744c6..21bcc78c8527f9f6ee276af7ca6c1dc188352330 100644 --- a/src/Components/SearchPageComponents/HeaderFilters.js +++ b/src/Components/SearchPageComponents/HeaderFilters.js @@ -5,158 +5,128 @@ import Grid from '@material-ui/core/Grid'; import TextField from '@material-ui/core/TextField'; import MenuItem from '@material-ui/core/MenuItem'; -export default function HeaderFilters({ options, contrast, orders, currOption, currOrder, handleChangeOption, handleChangeOrder }) { - if (currOption !== 'User') - return ( - <FiltersPaper contrast={contrast} elevation={4} square> - <Grid className="gridStyle" container direction='row' alignItems='center'> - <Grid item xs={12} sm={6}> - <Grid container alignItems='center'> - <Grid item xs={12} md={2}> - <Label contrast={contrast}> - Buscar por: - </Label> - </Grid> - <Grid item xs={12} md={10}> - <StyledTextField - contrast={contrast} - select - fullWidth - value={currOption} - onChange={handleChangeOption} - variant="outlined" - > - {options.map((option) => ( - <StyledMenuItem - contrast={contrast} - key={option.value} - value={option.name} - name={option.value} - > - <span style={currOption === option.name ? { color: option.color, fontWeight: "500" } : { color: option.color, fontWeight: "lighter" }}> - {option.value} - </span> - </StyledMenuItem> - ))} - </StyledTextField> - </Grid> - </Grid> - </Grid> +export default function HeaderFilters({ options, orders, currOption, currOrder, handleChangeOption, handleChangeOrder }) { - <Grid item xs={12} sm={6}> - <Grid container alignItems='center'> - <Grid item xs={12} md={2}> - <Label contrast={contrast}> - Ordenar por: - </Label> - </Grid> - <Grid item xs={12} md={10}> - <StyledTextField - contrast={contrast} - select - fullWidth - value={currOrder} - onChange={handleChangeOrder} - variant="outlined" - > - {orders.map((option) => ( - <StyledMenuItem - contrast={contrast} - color={option.color} - key={option.value} - value={option.name} - name={option.value} - > - <span style={currOrder === option.name ? { color: option.color, fontWeight: "500" } : { color: option.color, fontWeight: "lighter" }}> - {option.value} - </span> - </StyledMenuItem> - ))} - </StyledTextField> - </Grid> - </Grid> - </Grid> - </Grid > - </FiltersPaper > - ) - else - return ( - <FiltersPaper contrast={contrast} elevation={4} square> - <Grid className="gridStyle" container direction='row' alignItems='center'> - <Grid item xs={12}> - <Grid container alignItems='center'> - <Grid item xs={12} md={2}> - <Label contrast={contrast}> - Buscar por: - </Label> - </Grid> - <Grid item xs={12} md={10}> - <StyledTextField - contrast={contrast} - select - fullWidth - value={currOption} - onChange={handleChangeOption} - variant="outlined" - > - {options.map((option) => ( - <StyledMenuItem - contrast={contrast} - color={option.color} - key={option.value} - value={option.name} - name={option.value} - > - <span style={currOption === option.name ? { color: option.color, fontWeight: "500" } : { color: option.color, fontWeight: "lighter" }}> - {option.value} - </span> - </StyledMenuItem> - ))} - </StyledTextField> - </Grid> - </Grid> - </Grid> - </Grid> - </FiltersPaper > - ) + if (currOption !== 'User') + return ( + <FiltersPaper elevation={4} square> + <Grid container direction='row' spacing={2} alignItems='center'> + <Grid item xs={12} sm={6}> + <Grid container alignItems='center'> + <Grid item xs={12} md={2}> + <Label> + Buscar por: + </Label> + </Grid> + <Grid item xs={12} md={10}> + <TextField + select + fullWidth + value={currOption} + onChange={handleChangeOption} + variant="outlined" + > + {options.map((option) => ( + <MenuItem + key={option.value} + value={option.name} + name={option.value} + > + <span style={{ color: option.color }}> + {option.value} + </span> + </MenuItem> + ))} + </TextField> + </Grid> + </Grid> + </Grid> + + <Grid item xs={12} sm={6}> + <Grid container alignItems='center'> + <Grid item xs={12} md={2}> + <Label> + Ordenar por: + </Label> + </Grid> + <Grid item xs={12} md={10}> + <TextField + select + fullWidth + value={currOrder} + onChange={handleChangeOrder} + variant="outlined" + > + {orders.map((option) => ( + <MenuItem + key={option.value} + value={option.name} + name={option.value} + > + {option.value} + </MenuItem> + ))} + </TextField> + </Grid> + </Grid> + </Grid> + </Grid> + </FiltersPaper> + ) + else + return ( + <FiltersPaper elevation={4} square> + <Grid container direction='row' alignItems='center'> + <Grid item xs={12}> + <Grid container alignItems='center'> + <Grid item xs={12} md={2}> + <Label> + Buscar por: + </Label> + </Grid> + <Grid item xs={12} md={10}> + <TextField + select + fullWidth + value={currOption} + onChange={handleChangeOption} + variant="outlined" + > + {options.map((option) => ( + <MenuItem + key={option.value} + value={option.name} + name={option.value} + > + <span style={{ color: option.color }}> + {option.value} + </span> + </MenuItem> + ))} + </TextField> + </Grid> + </Grid> + </Grid> + </Grid> + </FiltersPaper> + ) } const Label = styled.p` - text-align: center; - font-weight: 600; - color: ${props => props.contrast === "" ? "" : "white"}; -` - -const StyledTextField = styled(TextField)` - .MuiOutlinedInput-root { - &.Mui-focused fieldset { - border-color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - } - fieldset { - border-color: ${props => props.contrast === "" ? "#666" : "white"}; - } - } - text-decoration: ${props => props.contrast === "" ? "none" : "underline yellow !important"}; + text-align: center; + font-weight: 600; ` -const StyledMenuItem = styled(MenuItem)` - background-color: ${props => props.contrast === "" ? "" : "black !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline yellow !important"}; -` const FiltersPaper = styled(Paper)` - text-align: center; - margin-top: 5px; - margin-bottom: 30px; - color: ${props => props.contrast === "" ? "#666" : "white"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; - - .textInfo{ - text-align: start; - } - - .gridStyle{ - padding: 0.5em 1em; - background: ${props => props.contrast === "" ? "#fff" : "black"}; - } + /* height: 150px; */ + text-align: center; + background-color: #fff; + margin-top: 5px; + margin-bottom: 30px; + padding: 0.5em 1em; + color: #666; + .textInfo{ + text-align: start; + } `; \ No newline at end of file diff --git a/src/Components/SearchPageComponents/ResourceTemplate.js b/src/Components/SearchPageComponents/ResourceTemplate.js index d5a0a22620436e807ec46e35a032e93882049a4d..362bf17d518ba1511233f4a1eebf46d942223351 100644 --- a/src/Components/SearchPageComponents/ResourceTemplate.js +++ b/src/Components/SearchPageComponents/ResourceTemplate.js @@ -9,134 +9,118 @@ import ArrowBackIcon from '@material-ui/icons/ArrowBack'; import ArrowForwardIcon from '@material-ui/icons/ArrowForward'; //Image Import -import { RecursoVazio } from "ImportImages.js"; +import { RecursoVazio } from "ImportImages.js"; -export default function ResourceTemplate({ isLoading, resources, totalResources, currPage, handlePreviousPage, handleNextPage, contrast }) { - const totalPages = parseInt(totalResources) === 0 ? 0 : Math.ceil(totalResources / 12) - 1; //Dividing by 12 because i want to cath total pages, and results per page is 12 - const topRef = React.useRef(); +export default function ResourceTemplate({ isLoading, resources, totalResources, currPage, handlePreviousPage, handleNextPage }) { + const totalPages = parseInt(totalResources) === 0 ? 0 : Math.ceil(totalResources / 12) - 1; //Dividing by 12 because i want to cath total pages, and results per page is 12 + const topRef = React.useRef(); - useEffect(() => { - topRef.current.scrollIntoView(); - }, [isLoading]) + useEffect(() => { + topRef.current.scrollIntoView(); + }, [isLoading]) - return ( - <ResourcePaper elevation={4} square contrast={contrast}> - <div ref={topRef} /> - <div className="main"> - <Title contrast={contrast}> - Recursos encontrados ({totalResources}) - </Title> - { - isLoading ? - <LoadingSpinner text='Carregando recursos...' contrast={contrast} /> - : - <Grid container justify='center' alignItems='center' spacing={3}> - { - resources.length >= 1 ? - resources.map((card) => { - return ( - <Grid item key={new Date().toISOString() + card.id} > - <ResourceCardFunction - contrast={contrast} - avatar={card.publisher ? card.publisher.avatar : ""} - id={card.id} - thumbnail={card.thumbnail} - type={card.object_type ? card.object_type : "Outros"} - title={card.name} - published={card.state === "published" ? true : false} - likeCount={card.likes_count} - liked={card.liked} - rating={card.review_average} - author={card.author} - tags={card.tags} - href={"/recurso/" + card.id} - downloadableLink={card.default_attachment_location} - /> - </Grid> - ) - }) - : - <NoContentDiv contrast={contrast}> - <h3> - Desculpe, não há dados nessa página. - </h3> - <img src={RecursoVazio} alt='No cards' /> - </NoContentDiv> - } - </Grid> - } - { - !isLoading && - <Grid container direction='row' alignItems='center' justify='center' spacing={3}> - <Grid item> - <StyledIconButton contrast={contrast} elevation={4} disabled={currPage === 0}> - <IconButton onClick={handlePreviousPage} disabled={currPage === 0}> - <ArrowBackIcon className='icon' /> - </IconButton> - </StyledIconButton> - </Grid> - <Grid item> - <ActualPage contrast={contrast}> - {currPage + 1} - </ActualPage> - <TotalPages contrast={contrast}> - ...{totalPages + 1} - </TotalPages> - </Grid> - <Grid item> - <StyledIconButton contrast={contrast} elevation={4} disabled={currPage === totalPages}> - <IconButton onClick={handleNextPage} disabled={currPage === totalPages}> - <ArrowForwardIcon className='icon' /> - </IconButton> - </StyledIconButton> - </Grid> - </Grid> - } - </div> - </ResourcePaper> - ) + return ( + <ResourcePaper elevation={4} square> + <div ref={topRef} /> + <Title> + Recursos encontrados ({totalResources}) + </Title> + { + isLoading ? + <LoadingSpinner text='Carregando recursos...' /> + : + <Grid container justify='center' alignItems='center' spacing={3}> + { + resources.length >= 1 ? + resources.map((card) => { + return <Grid item key={new Date().toISOString() + card.id} > + <ResourceCardFunction + avatar={card.publisher ? card.publisher.avatar : ""} + id={card.id} + thumbnail={card.thumbnail} + type={card.object_type ? card.object_type : "Outros"} + title={card.name} + published={card.state === "published" ? true : false} + likeCount={card.likes_count} + liked={card.liked} + rating={card.review_average} + author={card.author} + tags={card.educational_stages} + href={"/recurso/" + card.id} + downloadableLink={card.default_attachment_location} + /> + </Grid> + }) + : + <NoContentDiv> + <h3> + Desculpe, não há dados nessa página. + </h3> + <img src={RecursoVazio} alt='No cards' /> + </NoContentDiv> + } + </Grid> + } + { + !isLoading && + <Grid container direction='row' alignItems='center' justify='center' spacing={3}> + <Grid item> + <StyledIconButton elevation={4} disabled={currPage === 0}> + <IconButton onClick={handlePreviousPage} disabled={currPage === 0}> + <ArrowBackIcon className='icon' /> + </IconButton> + </StyledIconButton> + </Grid> + <Grid item> + <ActualPage> + {currPage} + </ActualPage>...{totalPages} + </Grid> + <Grid item> + <StyledIconButton elevation={4} disabled={currPage === totalPages}> + <IconButton onClick={handleNextPage} disabled={currPage === totalPages}> + <ArrowForwardIcon className='icon' /> + </IconButton> + </StyledIconButton> + </Grid> + </Grid> + } + </ResourcePaper> + ) }; const Title = styled.h4` - text-transform: uppercase; - font-weight: 500; - text-align: left; - color: ${props => props.contrast === "" ? "#ff7f00" : "white"}; + text-transform: uppercase; + font-weight: 500; + text-align: left; + color: #ff7f00; ` const NoContentDiv = styled.div` - h3{ - color: ${props => props.contrast === "" ? "#ff7f00" : "white"}; - text-align: center; - } + >h3{ + color: #ff7f00; + text-align: center; + } ` const ActualPage = styled.span` - color: ${props => props.contrast === "" ? "#666" : "white"}; -` -const TotalPages = styled.span` - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #ff7f00; ` const StyledIconButton = styled(Paper)` - border-radius: 50% !important; - background-color: ${props => props.contrast === "" ? props.disabled ? "#666" : "orange" : "black"} !important; - .icon{ - color: ${props => props.contrast === "" ? "white": props.disabled ? "white" : "yellow"} !important; - } - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; + border-radius: 50% !important; + background-color: ${props => props.disabled ? "#666" : "#ff7f00"} !important; + .icon{ + color: ${props => props.disabled ? "#d4d4d4" : "white"}; + } ` const ResourcePaper = styled(Paper)` - /* height: 150px; */ - text-align: center; - margin-top: 5px; - margin-bottom: 30px; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; - - .main{ - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - padding: 0.5em 1em; - } - - .textInfo{ - text-align: start; - } + /* height: 150px; */ + text-align: center; + background-color: #fff; + margin-top: 5px; + margin-bottom: 30px; + padding: 0.5em 1em; + color: #666; + .textInfo{ + text-align: start; + } `; \ No newline at end of file diff --git a/src/Components/SearchPageComponents/UserTemplate.js b/src/Components/SearchPageComponents/UserTemplate.js index cd61d982ab1bc9a922100a62065c4b88e3b9d37b..991a31d30efa8161dd15584f3455380d20c3b31e 100644 --- a/src/Components/SearchPageComponents/UserTemplate.js +++ b/src/Components/SearchPageComponents/UserTemplate.js @@ -9,7 +9,7 @@ import ArrowBackIcon from '@material-ui/icons/ArrowBack'; import ArrowForwardIcon from '@material-ui/icons/ArrowForward'; import { apiDomain } from '../../env'; -export default function ResourceTemplate({ isLoading, resources, totalResources, currPage, handlePreviousPage, handleNextPage, contrast }) { +export default function ResourceTemplate({ isLoading, resources, totalResources, currPage, handlePreviousPage, handleNextPage }) { const totalPages = parseInt(totalResources) === 0 ? 0 : Math.ceil(totalResources / 12) - 1; //Dividing by 12 because i want to cath total pages, and results per page is 12 const topRef = React.useRef(); @@ -18,72 +18,66 @@ export default function ResourceTemplate({ isLoading, resources, totalResources, }, [isLoading]) return ( - <ResourcePaper elevation={4} square contrast={contrast}> + <ResourcePaper elevation={4} square> <div ref={topRef} /> - <div className="main"> - <Title contrast={contrast}> - Usuários encontrados ({totalResources}) - </Title> - { - isLoading ? - <LoadingSpinner contrast={contrast} text='Carregando recursos...' /> - : - <Grid container justify='center' alignItems='center' spacing={3}> - { - resources.length >= 1 ? - resources.map((card) => { - return <Grid item key={new Date().toISOString() + card.id} > - <ContactCard - contrast={contrast} - name={card.name} - avatar={card.avatar ? apiDomain + card.avatar : null} - cover={card.cover ? apiDomain + card.cover : null} - numCollections={card.collections_count} - numLearningObjects={card.learning_objects_count} - follow_count={card.follows_count} - followed={card.followed || null} - followerID={card.id} - href={'/usuario-publico/' + card.id} - /> - </Grid> - }) - : - <NoContentDiv contrast={contrast}> - <h3> - Desculpe, não há dados nessa página. + <Title> + Usuários encontrados ({totalResources}) + </Title> + { + isLoading ? + <LoadingSpinner text='Carregando recursos...' /> + : + <Grid container justify='center' alignItems='center' spacing={3}> + { + resources.length >= 1 ? + resources.map((card) => { + return <Grid item key={new Date().toISOString() + card.id} > + <ContactCard + name={card.name} + avatar={card.avatar ? apiDomain + card.avatar : null} + cover={card.cover ? apiDomain + card.cover : null} + numCollections={card.collections_count} + numLearningObjects={card.learning_objects_count} + follow_count={card.follows_count} + followed={card.followed || null} + followerID={card.id} + href={'/usuario-publico/' + card.id} + /> + </Grid> + }) + : + <NoContentDiv> + <h3> + Desculpe, não há dados nessa página. </h3> - </NoContentDiv> - } - </Grid> - } - { - !isLoading && - <Grid container direction='row' alignItems='center' justify='center' spacing={3}> - <Grid item> - <StyledIconButton contrast={contrast} elevation={4} disabled={currPage === 0}> - <IconButton onClick={handlePreviousPage} disabled={currPage === 0}> - <ArrowBackIcon className='icon' /> - </IconButton> - </StyledIconButton> - </Grid> - <Grid item> - <ActualPage contrast={contrast}> - {currPage + 1} - </ActualPage> - <TotalPages contrast={contrast}> - ...{totalPages + 1} - </TotalPages> - </Grid> - <Grid item> - <StyledIconButton contrast={contrast} elevation={4} disabled={currPage === totalPages}> - <IconButton onClick={handleNextPage} disabled={currPage === totalPages}> - <ArrowForwardIcon className='icon' /> - </IconButton> - </StyledIconButton> - </Grid> + </NoContentDiv> + } </Grid> - } - </div> + } + { + !isLoading && + <Grid container direction='row' alignItems='center' justify='center' spacing={3}> + <Grid item> + <StyledIconButton elevation={4} disabled={currPage === 0}> + <IconButton onClick={handlePreviousPage} disabled={currPage === 0}> + <ArrowBackIcon className='icon' /> + </IconButton> + </StyledIconButton> + </Grid> + <Grid item> + <ActualPage> + {currPage} + </ActualPage>...{totalPages} + </Grid> + <Grid item> + <StyledIconButton elevation={4} disabled={currPage === totalPages}> + <IconButton onClick={handleNextPage} disabled={currPage === totalPages}> + <ArrowForwardIcon className='icon' /> + </IconButton> + </StyledIconButton> + </Grid> + </Grid> + } </ResourcePaper> ) }; @@ -92,41 +86,33 @@ const Title = styled.h4` text-transform: uppercase; font-weight: 500; text-align: left; - color: ${props => props.contrast === "" ? "#00bcd4" : "white"}; + color: #00bcd4; ` const NoContentDiv = styled.div` >h3{ - color: ${props => props.contrast === "" ? "#00bcd4" : "white"}; + color: #00bcd4; text-align: center; } ` const ActualPage = styled.span` - color: ${props => props.contrast === "" ? "#666" : "white"}; -` -const TotalPages = styled.span` - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #00bcd4; ` const StyledIconButton = styled(Paper)` - border-radius: 50% !important; - background-color: ${props => props.contrast === "" ? props.disabled ? "#666" : "#00bcd4" : "black"} !important; - .icon{ - color: ${props => props.contrast === "" ? "white": props.disabled ? "white" : "yellow"} !important; - } - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; + border-radius: 50% !important; + background-color: ${props => props.disabled ? "#666" : "#00bcd4"} !important; + .icon{ + color: ${props => props.disabled ? "#d4d4d4" : "white"}; + } ` const ResourcePaper = styled(Paper)` /* height: 150px; */ text-align: center; + background-color: #fff; margin-top: 5px; margin-bottom: 30px; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; - - .main{ - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - padding: 0.5em 1em; - } - + padding: 0.5em 1em; + color: #666; .textInfo{ text-align: start; } diff --git a/src/Components/SearchSectionFunction.js b/src/Components/SearchSectionFunction.js index 6362110e0b456af61302e9ecfc2db02914350903..7921c9ffeebd4af460f533cc30cb92249211b6e8 100644 --- a/src/Components/SearchSectionFunction.js +++ b/src/Components/SearchSectionFunction.js @@ -16,82 +16,81 @@ 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 '../App.css'; import styled from 'styled-components' // import SearchBar from './SearchBar'; -import { Row } from 'react-grid-system'; -import { MdInfoOutline } from "react-icons/md" -import { FaRegPlayCircle } from "react-icons/fa"; +import {Row} from 'react-grid-system'; +import {MdInfoOutline} from "react-icons/md" +import { FaRegPlayCircle} from "react-icons/fa"; import ModalVideoApresentacao from "./ModalVideoApresentacao.js" -import { Link } from 'react-router-dom' +import {Link} from 'react-router-dom' import Grid from '@material-ui/core/Grid'; import HomeScreenSearchBar from './HomeScreenSearchBar' -import { Store } from '../Store' //Image Import import { banner } from "ImportImages.js"; import { bannerMobile } from "ImportImages.js"; -export default function SearchSection(props) { - const { state } = useContext(Store) +export default function SearchSection (props) { const [modalOpen, handleModal] = useState(false) - const toggleModal = () => { handleModal(!modalOpen) } + const toggleModal = () => {handleModal(!modalOpen)} const WIDTH = window.innerWidth; return ( <React.Fragment> - <ModalVideoApresentacao open={modalOpen} handleClose={toggleModal} /> - <Banner contrast={state.contrast}> - <StyledGrid container direction="row" justify="center"> - <Grid item style={{ paddingRight: "15px", paddingLeft: "15px", paddingBottom: "120px" }}> - <div className="title"> - <h2> - Plataforma MEC de Recursos Educacionais Digitais - </h2> - <h3> - Encontre e compartilhe vídeos, animações e muitos outros Recursos - </h3> - </div> - <HomeScreenSearchBar /> - <div className="links"> - <Link to="/sobre"> - <MdInfoOutline size="24px" style={{ verticalAlign: "middle", paddingRight: "5px", color: "white" }} /> - {WIDTH <= 501 ? <span className={`${state.contrast}LinkColor`}>SOBRE</span> : <span className={`${state.contrast}LinkColor`}>SOBRE A PLATAFORMA</span>} - </Link> - <span onClick={toggleModal} className={`${state.contrast}LinkColor`} style={{ cursor: "pointer" }}> - <FaRegPlayCircle size="20px" style={{ verticalAlign: "middle", paddingRight: "5px", color: "white" }} /> + <ModalVideoApresentacao open={modalOpen} handleClose={toggleModal}/> + <Banner> + <StyledGrid container direction="row" justify="center"> + <Grid item style={{paddingRight : "15px", paddingLeft : "15px", paddingBottom : "120px"}}> + <div className="title"> + <h2> + Plataforma MEC de Recursos Educacionais Digitais + </h2> + <h3> + Encontre e compartilhe vídeos, animações e muitos outros Recursos + </h3> + </div> + <HomeScreenSearchBar/> + <div className="links"> + <Link to="/sobre"> + <MdInfoOutline size="24px" style={{verticalAlign: "middle", paddingRight : "5px"}}/> + {WIDTH <= 501 ? ("SOBRE") : ("SOBRE A PLATAFORMA")} + </Link> + <span onClick={toggleModal} style={{cursor : "pointer"}}> + <FaRegPlayCircle size="20px" style={{verticalAlign: "middle", paddingRight : "5px"}}/> {WIDTH <= 501 ? ("VÍDEO") : ("VÍDEO DE APRESENTAÇÃO")} - </span> - </div> - </Grid> - </StyledGrid> - { - WIDTH > 501 && - <Row justify="center" style={{ marginLeft: 0, marginRight: 0 }}> - <button className="recurso" - onClick={() => { props.function("Recursos") }}> - Recursos Educacionais Digitais - </button> - - <button className="material-formacao" - onClick={() => { props.function("Materiais") }}> - Materiais de Formação - </button> - - <button className="colecao" - onClick={() => { props.function("Colecoes") }}> - Coleções dos Usuários - </button> - </Row> - } - </Banner> - </React.Fragment> + </span> + </div> + </Grid> + </StyledGrid> + { + WIDTH > 501 && + <Row justify="center" style={{marginLeft:0, marginRight:0}}> + <button className="recurso" + onClick={() => {props.function("Recursos")}}> + Recursos Educacionais Digitais + </button> + + <button className="material-formacao" + onClick={() => {props.function("Materiais")}}> + Materiais de Formação + </button> + + <button className="colecao" + onClick={() => {props.function("Colecoes")}}> + Coleções dos Usuários + </button> + </Row> + } + </Banner> + </React.Fragment> ) } const StyledGrid = styled(Grid)` - margin: 0 auto !important; + margin-right : auto !important; + margin-left auto !important; color : #fff !important; text-align : center !important; ` @@ -148,9 +147,7 @@ const Banner = styled.div` line-height: 1.42857143; width: 25%; margin-top: 1%; - color: ${props => props.contrast === "" ? "white" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; + color: white; padding: 1.2%; border-width: 5%; border-style: none; @@ -159,12 +156,12 @@ const Banner = styled.div` } .recurso { - background-color: ${props => props.contrast === "" ? "#ff7f00" : "black"}; + background-color : #ff7f00; } .material-formacao { - background-color: ${props => props.contrast === "" ? "#e81f4f" : "black"}; + background-color : #e81f4f; } .colecao { - background-color: ${props => props.contrast === "" ? "#673ab7" : "black"}; + background-color : #673ab7; } ` diff --git a/src/Components/ShareModal.js b/src/Components/ShareModal.js index 9e6835e90e8f06a6ab6b144addbf99f76c013316..f721b4caf8785d0b6eda4424556f01b90a9ca7fc 100644 --- a/src/Components/ShareModal.js +++ b/src/Components/ShareModal.js @@ -29,7 +29,7 @@ import Twitter from '../img/twitter.svg' import LinkIcon from '../img/link_icon.svg' import CloseModalButton from './CloseModalButton.js' -export default function ShareModal (props) { +export default function ReportModal (props) { const textAreaRef = useRef(props.link); const copyToClipboard = (e) => { @@ -54,32 +54,30 @@ export default function ShareModal (props) { }} > <Fade in={props.open}> - <Container className={`${props.contrast}BackColor ${props.contrast}Text ${props.contrast}Border`}> + <Container> <Header> <span style={{width:"32px"}}/> - <h2>Compartilhar recurso</h2> + <h2>Compartilhar este recurso</h2> <CloseModalButton handleClose={props.handleClose}/> </Header> <Content style={{paddingTop : "0"}}> <ResourceInfo> <img src={props.thumb ? apiDomain + props.thumb : require('../img/logo_small.svg')} alt="thumbnail recurso"/> - <div> + <div className="text"> <strong>{props.title}</strong> + <span>{props.link}</span> </div> </ResourceInfo> - <div style={{marginTop: "10px"}}> - <span>{props.link}</span> - </div> <ShareInfo> <Grid container style={{paddingRight : "15px", paddingLeft : "15px"}}> {/*Share to facebook*/} - <Grid item xs={6} md={4}> + <Grid item xs={4}> <StyledLink href={"https://www.facebook.com/sharer/sharer.php?u=" + props.link} rel="noreferrer" target="_blank"> - <ShareButton className={`${props.contrast}LinkColor`}> + <ShareButton> <img src={Facebook} alt="facebook-logo"/> <p>FACEBOOK</p> </ShareButton> @@ -87,12 +85,12 @@ export default function ShareModal (props) { </Grid> {/*Share to Twitter*/} - <Grid item xs={6} md={4}> + <Grid item xs={4}> <StyledLink href={"https://www.twitter.com/intent/tweet?url=" + props.link} rel="noreferrer" target="_blank"> - <ShareButton className={`${props.contrast}LinkColor`}> + <ShareButton> <img src={Twitter} alt="twitter-logo"/> <p>TWITTER</p> </ShareButton> @@ -100,10 +98,10 @@ export default function ShareModal (props) { </Grid> {/*Get shareable link*/} - <Grid item xs={12} md={4}> + <Grid item xs={4}> { document.queryCommandSupported('copy') && - <ShareButton className={`${props.contrast}LinkColor`} onClick={copyToClipboard}> + <ShareButton onClick={copyToClipboard}> <img src={LinkIcon} alt="link-icon"/> <p>COPIAR LINK</p> <textarea ref={textAreaRef} value={props.link} readOnly style={{height: "0", position: "absolute",zIndex: "-1"}}/> @@ -145,10 +143,12 @@ const ShareButton = styled(Button)` const ShareInfo = styled.div` padding-top : 20px; + color : #000; ` const ResourceInfo = styled.div` - margin-top : 15px; + margin-top : 0; + background-color : #f4f4f4; overflow : hidden; border-radius : 5px; display : flex; @@ -175,7 +175,7 @@ const ResourceInfo = styled.div` float : left; padding : 0; - @media screen and (min-width : 769px) { + @media screen and (min-width : 600px) { margin-right : 20px; margin-bottom : 0; } @@ -184,10 +184,6 @@ const ResourceInfo = styled.div` } } - @media screen and (max-width : 768px) { - flex-direction : column; - } - ` const Content = styled.div` @@ -207,6 +203,7 @@ const Header = styled.div` h2 { font-size : 26px; font-weight : lighter; + color : #666 } ` @@ -226,6 +223,7 @@ const StyledModal = styled(Modal)` const Container = styled.div` box-sizing : border-box; box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12); + background-color : white; align : center; display : flex; flex-direction : column; @@ -241,6 +239,7 @@ const Container = styled.div` @media screen and (max-width : 699px) { width : 100%; + height : 100%; } ` const StyledLink = styled.a` diff --git a/src/Components/SignUpContainerFunction.js b/src/Components/SignUpContainerFunction.js index c66d3d4364c07f3d6b10a9ab6ee4b06595e0d13d..15974aee411a66d7431d73f4ce7d6ba8b87d56a0 100644 --- a/src/Components/SignUpContainerFunction.js +++ b/src/Components/SignUpContainerFunction.js @@ -16,54 +16,55 @@ 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} from "react"; import { Button } from '@material-ui/core'; //import FacebookLogin from 'react-facebook-login'; import CloseIcon from '@material-ui/icons/Close'; import styled from 'styled-components' -import { device } from './device.js' +import {device} from './device.js' import FormInput from "./FormInput.js" -import { StyledCloseModalButton, DialogContentDiv, DialogHeaderStyled, SocialConnectDiv, H3Div } from './LoginContainerFunction.js' -import { apiUrl } from '../env.js' -import { GoogleLoginButton } from './LoginContainerFunction' +import {StyledCloseModalButton, DialogContentDiv, DialogHeaderStyled, SocialConnectDiv, H3Div} from './LoginContainerFunction.js' +import {apiUrl} from '../env.js' +import {GoogleLoginButton} from './LoginContainerFunction' import ValidateUserInput from './HelperFunctions/FormValidationFunction.js' import GoogleLogo from "../img/logo_google.svg" import ReCaptcha from 'react-recaptcha' -async function handleGoogleAttempt() { - let request_url = ( +async function handleGoogleAttempt () { + console.log("handleGoogleAttempt") + let request_url = ( `${apiUrl}/omniauth/google_oauth2?auth_origin_url=` + window.location.href + '&omniauth_window_type=sameWindow&resource_class=User' ) window.location.replace(request_url) } -export default function SignUpContainer(props) { +export default function SignUpContainer (props) { const [unavailableButton, setButtonAvailability] = useState(true); const [formNome, setNome] = useState( { - key: false, - value: "", + key : false, + value : "", } ) const [formEmail, setEmail] = useState( { - key: false, - value: "", + key : false, + value : "", } ) const [formSenha, setSenha] = useState( { - key: false, - value: "" + key : false, + value : "" } ) const [formConfirmation, setConfirmation] = useState( { - key: false, - value: "" + key : false, + value : "" } ) @@ -72,58 +73,54 @@ export default function SignUpContainer(props) { const flag = ValidateUserInput(type, userInput, confirmation) if (type === 'username') { - setNome({ - ...formNome, - key: flag, - value: userInput + setNome({...formNome, + key : flag, + value : userInput }) + console.log(formNome) } - else if (type === 'email') { - setEmail({ - ...formEmail, - key: flag, - value: userInput + else if(type === 'email') { + setEmail({...formEmail, + key : flag, + value : userInput }) + console.log(formEmail) } - else if (type === 'password') { - setSenha({ - ...formSenha, - key: flag, - value: userInput + else if(type === 'password') { + setSenha({...formSenha, + key : flag, + value : userInput }) + console.log(formSenha) } - else if (type === 'confirmation') { - setConfirmation({ - ...formConfirmation, - key: flag, - value: userInput + else if(type === 'confirmation') { + setConfirmation({...formConfirmation, + key : flag, + value : userInput }) + console.log(formConfirmation) } } const limpaCamposForm = () => { - setNome({ - ...formNome, - key: false, - value: '' + setNome({...formNome, + key : false, + value : '' }) - setEmail({ - ...formEmail, - key: false, - value: '' + setEmail({...formEmail, + key : false, + value : '' }); - setSenha({ - ...formSenha, - key: false, - value: '' + setSenha({...formSenha, + key : false, + value : '' }) - setConfirmation({ - ...formConfirmation, - key: false, - value: '' + setConfirmation({...formConfirmation, + key : false, + value : '' }) } @@ -135,7 +132,7 @@ export default function SignUpContainer(props) { const onSubmit = (e) => { e.preventDefault(); - const newLogin = { name: formNome.value, email: formEmail.value, password: formSenha.value, senha: formConfirmation.value } + const newLogin = {name : formNome.value, email : formEmail.value, password : formSenha.value, senha : formConfirmation.value} if (!(formNome.key || formEmail.key || formSenha.key || formConfirmation.key)) { props.handleLoginInfo(newLogin) @@ -143,42 +140,41 @@ export default function SignUpContainer(props) { } } - function captchaVerified(response) { + function captchaVerified (response) { if (response) { setButtonAvailability(false) } } return ( - <ContainerStyled contrast={props.contrast}> + <ContainerStyled > <DialogHeaderStyled> - <span style={{ width: "32px" }} /> - <H2Styled contrast={props.contrast}> Cadastrar-se + <span style={{width:"32px"}}/> + <H2Styled> Cadastrar-se </H2Styled> - <StyledCloseModalButton contrast={props.contrast} onClick={props.handleClose} > - <CloseIcon className="icon" /> + <StyledCloseModalButton onClick={props.handleClose} > + <CloseIcon /> </StyledCloseModalButton> </DialogHeaderStyled> <DialogContentDiv> <SocialConnectDiv> - <GoogleLoginButton contrast={props.contrast} onClick={handleGoogleAttempt}> - <img src={GoogleLogo} alt="google-logo" className="google-logo" /> - <span>Usando o Google</span> - </GoogleLoginButton> + <GoogleLoginButton onClick={handleGoogleAttempt}> + <img src={GoogleLogo} alt="google-logo" className="google-logo"/> + <span>Usando o Google</span> + </GoogleLoginButton> </SocialConnectDiv> <H3Div> - <H3Styled contrast={props.contrast}> - <RightSideStrikedH3 contrast={props.contrast} /> - <span style={{ verticalAlign: "middle" }}>ou</span> - <LeftSideStrikedH3 contrast={props.contrast} /> + <H3Styled> + <RightSideStrikedH3/> + <span style={{verticalAlign:"middle"}}>ou</span> + <LeftSideStrikedH3/> </H3Styled> </H3Div> <form onSubmit={onSubmit}> <FormInput - contrast={props.contrast} inputType={"text"} name={"name"} value={formNome.value} @@ -187,9 +183,8 @@ export default function SignUpContainer(props) { required={true} error={formNome.key} /> - <br /> + <br/> <FormInput - contrast={props.contrast} inputType={"text"} name={"email"} value={formEmail.value} @@ -197,11 +192,10 @@ export default function SignUpContainer(props) { handleChange={e => handleChange(e, 'email')} required={true} error={formEmail.key} - help={formEmail.key ? (formEmail.value.length === 0 ? "Faltou preencher seu e-mail." : <span>Insira um endereço de e-mail válido.<br />Por exemplo: seunome@gmail.com, seunome@hotmail.com</span>) : ""} - /> - <br /> + help = {formEmail.key ? (formEmail.value.length === 0 ? "Faltou preencher seu e-mail." : <span>Insira um endereço de e-mail válido.<br/>Por exemplo: seunome@gmail.com, seunome@hotmail.com</span>) : ""} + /> + <br/> <FormInput - contrast={props.contrast} inputType={"password"} name={"password"} value={formSenha.value} @@ -209,11 +203,10 @@ export default function SignUpContainer(props) { handleChange={e => handleChange(e, 'password')} required={true} error={formSenha.key} - help={formSenha.key ? (formSenha.value.length === 0 ? "Faltou digitar sua senha." : "A senha precisa ter no mínimo 8 caracteres.") : ""} - /> - <br /> + help = {formSenha.key ? (formSenha.value.length === 0 ? "Faltou digitar sua senha." : "A senha precisa ter no mínimo 8 caracteres.") : ""} + /> + <br/> <FormInput - contrast={props.contrast} inputType={"password"} name={"confirmation"} value={formConfirmation.value} @@ -221,10 +214,10 @@ export default function SignUpContainer(props) { handleChange={e => handleChange(e, 'confirmation', formSenha.value)} required={true} error={formConfirmation.key} - help={formConfirmation.key ? (formConfirmation.value.length === 0 ? "Faltou digitar sua senha." : (formConfirmation.value !== formSenha.value ? "As senhas precisam ser iguais" : "A senha precisa ter no mínimo 8 caracteres.")) : ""} - /> - <br /> - <div style={{ margin: "0 auto", width: "304px" }}> + help = {formConfirmation.key ? (formConfirmation.value.length === 0 ? "Faltou digitar sua senha." : (formConfirmation.value !== formSenha.value ? "As senhas precisam ser iguais" : "A senha precisa ter no mínimo 8 caracteres.")) : ""} + /> + <br/> + <div style={{margin:"0 auto", width: "304px"}}> { //<ReCaptcha sitekey={process.env.REACT_APP_SITE_KEY} verifyCallback={captchaVerified} /> //when key set in env <ReCaptcha sitekey="6LfxuKUUAAAAAIzYpCzEtJyeE8QRjBYa44dvHlTX" verifyCallback={captchaVerified} /> //use this one on production @@ -232,34 +225,26 @@ export default function SignUpContainer(props) { } </div> <ConfirmContainerStyled> - { - !unavailableButton && - <StyledSignUpButton contrast={props.contrast} type="submit" variant="contained" disabled={unavailableButton} - style={unavailableButton ? { backgroundColor: "#e9e9e9" } : props.contrast === "" ? { backgroundColor: "#00bcd4" } : { backgroundColor: "black", color: "yellow", textDecoration: "underline" }} + <StyledSignUpButton type="submit" variant="contained" disabled={unavailableButton} + style={unavailableButton ? { backgroundColor: "#e9e9e9" } : { backgroundColor: "#00bcd4" }} + > + <span + style={{paddingLeft:"16px", paddingRight:"16px", borderRadius:"3px", boxSizing:"border-box", + fontFamily:"Roboto, sans serif", fontWeight:"500", color:"#fff"}} > - <span - style={props.contrast === "" ? { - paddingLeft: "16px", paddingRight: "16px", borderRadius: "3px", boxSizing: "border-box", - fontFamily: "Roboto, sans serif", fontWeight: "500", color: "#fff" - } : { - paddingLeft: "16px", paddingRight: "16px", borderRadius: "3px", boxSizing: "border-box", - fontFamily: "Roboto, sans serif", fontWeight: "500", color: "yellow" - }} - > - CADASTRAR + CADASTRAR </span> - </StyledSignUpButton> - } + </StyledSignUpButton> </ConfirmContainerStyled> </form> - <TermosDeUsoStyled contrast={props.contrast}> + <TermosDeUsoStyled> <p>Ao se cadastrar, você está aceitando os Termos de Uso e de Política de Privacidade. <a href="/termos">Ler Termos</a>.</p> </TermosDeUsoStyled> <DialogFooterStyled> - <span style={props.contrast === "" ? { textAlign: "center", fontSize: "14px" } : { textAlign: "center", fontSize: "14px", color: "white" }}>Já possui cadastro? <StyledAnchor contrast={props.contrast} href="" onClick={e => switchModal(e)}>ENTRAR</StyledAnchor></span> + <span style={{textAlign:"center", fontSize: "14px"}}>Já possui cadastro? <StyledAnchor href="" onClick={e => switchModal(e)}>ENTRAR</StyledAnchor></span> </DialogFooterStyled> </DialogContentDiv> </ContainerStyled> @@ -268,22 +253,20 @@ export default function SignUpContainer(props) { const ContainerStyled = styled.div` box-sizing : border-box; - background: ${props => props.contrast === "" ? "white" : "black"}; + background-color : white; max-width : none; align : center; display : flex; flex-direction : column; min-width : 450px; - border: 1px solid ${props => props.contrast === "" ? "#666" : "white"}; - overflow-y: auto; - max-height : 90%; + max-height : none; position : relative; padding : 10px; @media ${device.mobileM} { width : 100%; min-width : unset; - height : 90%; + height : 100%; min-width : unset !important; } @@ -302,21 +285,17 @@ const DialogFooterStyled = styled.div` const TermosDeUsoStyled = styled.div` font-family: 'Roboto', sans serif, 'Helvetica Neue', Helvetica, Arial, sans-serif; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; font-size : 13px; margin : 0 0 10px; max-width : 350px; margin-top : 10px; text-align : start; - a{ - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} - } ` const H2Styled = styled.h2` align-self : center; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; font-size : 26px; font-weight : lighter; justify-content: space-between; @@ -329,12 +308,12 @@ const H3Styled = styled.h3` overflow : hidden; text-align : center; font-size : 14px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; margin : 10px 0; ` const RightSideStrikedH3 = styled.div` display : inline-block; - border-bottom: ${props => props.contrast === "" ? "1px dotted #666" : "1px dotted white"}; + border-bottom: 1px dotted #666; vertical-align : middle; font-weight : 500; margin-right : 5px; @@ -343,7 +322,7 @@ const RightSideStrikedH3 = styled.div` const LeftSideStrikedH3 = styled.div` display : inline-block; - border-bottom: ${props => props.contrast === "" ? "1px dotted #666" : "1px dotted white"}; + border-bottom: 1px dotted #666; vertical-align : middle; font-weight : 500; margin-left : 5px; @@ -351,8 +330,8 @@ const LeftSideStrikedH3 = styled.div` ` const StyledAnchor = styled.a` - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"} + color : #00bcd4; + text-decoration : none; ` //const StyledCloseModalButton = styled(Button)` // display : inline-block; @@ -376,7 +355,7 @@ const ConfirmContainerStyled = styled.div` const StyledSignUpButton = styled(Button)` box-shadow : none !important; outline: none !important; - border: ${props => props.contrast === "" ? "0 !important" : "1px solid white !important"}; + border : 0 !important; overflow : hidden !important; width : 50% !important; display : inline-block !important; @@ -387,6 +366,6 @@ const StyledSignUpButton = styled(Button)` border-radius: 3px !important; align-self : 50% !important; :hover { - background-color: ${props => props.contrast === "" ? "#00acc1 !important" : "rgba(255,255,0,0.24) !important"}; + background-color : #00acc1 !important; } ` diff --git a/src/Components/SignUpModal.js b/src/Components/SignUpModal.js index 3114f8e578e5e8c83bd15bfa08f9c9db81ff1e7f..61c4fb2865b34df44615e742507d94df28e43ad7 100644 --- a/src/Components/SignUpModal.js +++ b/src/Components/SignUpModal.js @@ -15,14 +15,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, { useContext, useState } from 'react'; +import React, {useContext, useState} from 'react'; import Modal from '@material-ui/core/Modal'; import Backdrop from '@material-ui/core/Backdrop'; import Fade from '@material-ui/core/Fade'; import styled from 'styled-components' import SignUpContainer from './SignUpContainerFunction.js' -import { Store } from '../Store.js' -import { authentication } from './HelperFunctions/getAxiosConfig' +import {Store} from '../Store.js' +import {authentication} from './HelperFunctions/getAxiosConfig' import Snackbar from '@material-ui/core/Snackbar'; import MuiAlert from '@material-ui/lab/Alert'; //import {postRequest} from './HelperFunctions/getAxiosConfig' @@ -31,7 +31,7 @@ export function Alert(props) { return <MuiAlert elevation={6} variant="filled" {...props} />; } -export default function SignUpModal(props) { +export default function SignUpModal (props) { const { state, dispatch } = useContext(Store) const [snackbarOpened, handleSnackbar] = useState(false) @@ -44,8 +44,8 @@ export default function SignUpModal(props) { handleSnackbar(false); } - function handleSuccess(data) { - dispatch({ + function handleSuccess (data) { + dispatch ({ type: 'USER_SIGNED_UP', userLoggedIn: !state.userIsLoggedIn, user: data.data @@ -53,17 +53,17 @@ export default function SignUpModal(props) { props.handleClose() } - function handleError(error) { + function handleError (error) { handleSnackbar(true) } const handleLoginInfo = (newLogin) => { const url = `/auth` const payload = { - name: newLogin.name, + name : newLogin.name, email: newLogin.email, - password: newLogin.password, - password_confirmation: newLogin.senha //, + password : newLogin.password, + password_confirmation : newLogin.senha //, // terms_of_service : true, // avatar: "" } @@ -74,7 +74,7 @@ export default function SignUpModal(props) { return ( <> <Snackbar open={snackbarOpened} autoHideDuration={1000} onClose={handleCloseSnackbar} - anchorOrigin={{ vertical: 'top', horizontal: 'right' }} + anchorOrigin = {{ vertical:'top', horizontal:'right' }} > <Alert severity="error">Ocorreu um erro ao se conectar!</Alert> </Snackbar> @@ -93,10 +93,9 @@ export default function SignUpModal(props) { > <Fade in={props.open}> <SignUpContainer - contrast={state.contrast} - handleClose={props.handleClose} - openLogin={props.openLogin} - handleLoginInfo={handleLoginInfo} + handleClose={props.handleClose} + openLogin={props.openLogin} + handleLoginInfo = {handleLoginInfo} /> </Fade> </StyledModalSignUp> diff --git a/src/Components/SnackbarComponent.js b/src/Components/SnackbarComponent.js index 9017c2dc36b44ecb3daa836d5f534e5e1672e948..60692e9c43f7298f34b9eed84eda31ab36cb640b 100644 --- a/src/Components/SnackbarComponent.js +++ b/src/Components/SnackbarComponent.js @@ -16,14 +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, { /*useContext*/ } from 'react' +import React from 'react' import Alert from '../Components/Alert.js'; import Snackbar from '@material-ui/core/Snackbar'; -//import { Store } from '../Store.js' export default function SnackbarComponent(props) { -// const { state } = useContext(Store) - return ( <Snackbar open={props.snackbarOpen} autoHideDuration={3000} onClose={props.handleClose} anchorOrigin={{ vertical: 'top', horizontal: 'right' }} diff --git a/src/Components/StatsBarFunction.js b/src/Components/StatsBarFunction.js index 1c5c465e255af83e7243435448b5300df2cc24d6..857c7393632a50ffdd3a8922044bbc4c14cb5efa 100644 --- a/src/Components/StatsBarFunction.js +++ b/src/Components/StatsBarFunction.js @@ -16,17 +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, useContext } from 'react'; +import React, { useState, useEffect } from 'react'; import styled from 'styled-components' import { apiUrl } from "../env"; import axios from "axios"; import mapaBrasil from '../img/mapa-brasil-line-icon.svg'; import Grid from '@material-ui/core/Grid'; -import { Store } from '../Store'; export default function (props) { - const { state } = useContext(Store) - const [available_resources, setAvailableResources] = useState(0) const [month_publications, setMonthPublications] = useState(0) const [month_downloads, setMonthDownloads] = useState(0) @@ -44,7 +41,7 @@ export default function (props) { }, []) return ( - <StatsTab contrast={state.contrast}> + <StatsTab> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet" /> <Grid container direction={WINDOW_WIDTH <= 670 ? "column" : "row"} justify="center" alignItems="center" spacing={3}> <Grid item> @@ -64,7 +61,7 @@ export default function (props) { </Grid> </Grid> </Grid> - <Grid item style={WINDOW_WIDTH <= 670 ? { width: "100%" } : null}> + <Grid item style={WINDOW_WIDTH <= 670 ? {width: "100%"} : null}> <StyledDivider /> </Grid> <Grid item> @@ -105,9 +102,7 @@ export default function (props) { const StatsTab = styled.div` padding : 20px 0; color : #fff; - border-top: ${props => props.contrast === "" ? "none" : "1px solid white"}; - border-bottom: ${props => props.contrast === "" ? "none" : "1px solid white"}; - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"}; + background-color : #00bcd4; font-family: 'Roboto', sans-serif; ` const StyledDivider = styled.div` diff --git a/src/Components/Stepper.js b/src/Components/Stepper.js index a50f700cc1ea897a999f52ff1d2ca7fe4fae0783..b1315b9844bdd5726e5b7589c1adf6be80d87417 100644 --- a/src/Components/Stepper.js +++ b/src/Components/Stepper.js @@ -1,107 +1,53 @@ -/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre -Departamento de Informatica - Universidade Federal do Parana - -This file is part of Plataforma Integrada MEC. - -Plataforma Integrada MEC is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Plataforma Integrada MEC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -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 from 'react' import styled from 'styled-components' -import Check from '@material-ui/icons/Check'; -import Grid from '@material-ui/core/Grid'; - -export default function CustomizedSteppers(props) { - function isInFinalSTep(step) { - return step === 3; - } +export default function Stepper (props) { return ( - <MainGrid contrast={props.contrast} container direction='row' justify='space-between' alignItems='center'> + <div style={{display:"flex",justifyContent:"center", marginBottom:"50px"}}> + <FeedbackUpload> { - !isInFinalSTep(props.activeStep) ? - - [0, 1, 2, 3].map((index) => { - return ( - <Grid item key={new Date().toISOString() + index}> - <div className={props.activeStep === index ? "currStep" : "step"}> - { - index < props.activeStep ? - <Check style={props.contrast === "" ? { color: "#00bcd4" } : { color: "white" }} /> : index - } - </div> - </Grid> - ) - }) - : - [0, 1, 2, 3].map((index) => { - return ( - <Grid item key={new Date().toISOString() + index}> - <div className={props.activeStep === index ? "currStep" : "finalStep"}> - { - index < props.activeStep ? - <Check style={{ color: 'white' }} /> : - <span style={{ color: 'white' }}> - {index} - </span> - } - </div> - </Grid> - ) - }) + props.items.map((item)=> + <div className={"page-selector " + (item.selected ? 'selected' : '')} > + {item.value} + </div> + ) } - </MainGrid > - ); + </FeedbackUpload> + </div> + ) } -const MainGrid = styled(Grid)` - padding: 1em; - border-radius: 50px; - width: 90%; - margin: 0 auto; - border: ${props => props.contrast === "" ? "2px solid #d4d4d4" : "2px solid white"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - - .currStep{ - height: 30px; - width: 30px; - display: flex; - justify-content: center; - align-items: center; - border: 2px solid rgba(255, 255, 255, 0.6); - border-radius: 50%; +const FeedbackUpload = styled.div` + width : 280px; + display : flex; + background :#e5e5e5; + flex-direction : row; + justify-content : space-between; + height : 50px; + align-items : center; + padding : 7px; + border-radius : 50px; + margin-top : 20px; + + .page-selector { + height : 36px; + width : 36px; + background : #fff; + border-radius : 50%; + color : #00bcd4; + line-height : 32px; + font-size : 20px; + font-weight : 500; + border: solid 3px #00bcd4; + text-align: center; + align-items : center; + vertical-align:middle; } - .step{ - height: 30px; - width: 30px; - display: flex; - justify-content: center; - align-items: center; - border: ${props => props.contrast === "" ? "2px solid #00bcd4" : "2px solid white"}; - border-radius: 50%; - } - - .finalStep{ - height: 30px; - width: 30px; - display: flex; - justify-content: center; - align-items: center; - border: 2px solid white; - border-radius: 50%; - color: white; - } + .selected { + background : #00bcd4; + color : #fff; + border-color : #00bcd4; + } ` - diff --git a/src/Components/TabPanels/Breadcrumbs.js b/src/Components/TabPanels/Breadcrumbs.js index b8d3abe6016c6d10a47a8d5a6c98b9d86d276a05..1d208986d7bd89b210da95806d101796301a36d9 100644 --- a/src/Components/TabPanels/Breadcrumbs.js +++ b/src/Components/TabPanels/Breadcrumbs.js @@ -20,23 +20,29 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React from 'react' import styled from 'styled-components' import Breadcrumbs from '@material-ui/core/Breadcrumbs'; -import { Link } from 'react-router-dom'; +import {Link} from 'react-router-dom'; -export default function CustomizedBreadcrumbs(props) { +export default function CustomizedBreadcrumbs (props) { return ( <BreadcrumbsDiv> - <StyledBreadcrumbs contrast={props.contrast}> - <Link to="/"> + <StyledBreadcrumbs> + <Link to="/" style={{color:"#00bcd4", textDecoration:"none"}}> Página Inicial </Link> { - props.values.map((value, i) => + props.values.map( (value, i) => <span key={i}> {value} </span> ) } + {/*<span> + {props.currentPage} + </span> + <span> + {props.value} + </span> */} </StyledBreadcrumbs> </BreadcrumbsDiv> ) @@ -55,11 +61,7 @@ const StyledBreadcrumbs = styled(Breadcrumbs)` display : flex; justify-content : flex-start; max-width : 1170px; - a{ - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } span { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; + color : #a5a5a5; } ` diff --git a/src/Components/TabPanels/PanelComponents/ButtonsArea.js b/src/Components/TabPanels/PanelComponents/ButtonsArea.js index ac5ad9269e6f51332d688ffc40785dad035c00bb..1b8633ae0b05f6578b98fbbba427a3172775ed96 100644 --- a/src/Components/TabPanels/PanelComponents/ButtonsArea.js +++ b/src/Components/TabPanels/PanelComponents/ButtonsArea.js @@ -23,19 +23,19 @@ import Button from '@material-ui/core/Button'; export function ButtonsAreaRecurso(props) { return ( - <Carregados contrast={props.contrast}> - <p className="total"> + <Carregados> + <p style={{ margin: "0 0 10px", fontSize: "14px" }}> {props.sliceLength} recursos carregados de {props.total} </p> { !props.end && <React.Fragment> - <ButtonMostrarMaisRecurso contrast={props.contrast} onClick={() => props.showMore(4)}> - <span>MOSTRAR MAIS 4</span> + <ButtonMostrarMaisRecurso onClick={() => props.showMore(4)}> + <span style={{ color: "#fff", fontSize: "14px", fontWeight: "500" }}>MOSTRAR MAIS 4</span> </ButtonMostrarMaisRecurso> - <ButtonMostrarTodos contrast={props.contrast} onClick={() => { props.showMore(20) }}> - <span>MOSTRAR MAIS 20</span> + <ButtonMostrarTodos onClick={() => { props.showMore(20) }}> + <span style={{ color: "#666", fontSize: "14px", fontWeight: "500" }}>MOSTRAR MAIS 20</span> </ButtonMostrarTodos> </React.Fragment> } @@ -46,19 +46,19 @@ export function ButtonsAreaRecurso(props) { export function ButtonsAreaColecao(props) { return ( - <Carregados contrast={props.contrast}> - <p className="total"> + <Carregados> + <p style={{ margin: "0 0 10px", fontSize: "14px" }}> {props.sliceLength} coleções carregadas de {props.total} </p> { !props.end && <React.Fragment> - <ButtonMostrarMaisColecao contrast={props.contrast} onClick={() => { props.showMore(4) }}> - <span>MOSTRAR MAIS 4</span> + <ButtonMostrarMaisColecao onClick={() => { props.showMore(4) }}> + <span style={{ color: "#fff", fontSize: "14px", fontWeight: "500" }}>MOSTRAR MAIS 4</span> </ButtonMostrarMaisColecao> - <ButtonMostrarTodos contrast={props.contrast} onClick={() => { props.showMore(20) }}> - <span>MOSTRAR MAIS 20</span> + <ButtonMostrarTodos onClick={() => { props.showMore(20) }}> + <span style={{ color: "#666", fontSize: "14px", fontWeight: "500" }}>MOSTRAR MAIS 20</span> </ButtonMostrarTodos> </React.Fragment> } @@ -68,20 +68,20 @@ export function ButtonsAreaColecao(props) { export function ButtonsAreaRede(props) { return ( - <Carregados contrast={props.contrast}> - <p className="total"> + <Carregados> + <p style={{ margin: "0 0 10px", fontSize: "14px" }}> {props.sliceLength} usuários carregados {props.total} </p> { !props.end && <React.Fragment> - <ButtonMostrarMaisRede contrast={props.contrast} onClick={() => { props.showMore(4) }}> - <span>MOSTRAR MAIS 4</span> + <ButtonMostrarMaisRede onClick={() => { props.showMore(4) }}> + <span style={{ color: "#fff", fontSize: "14px", fontWeight: "500" }}>MOSTRAR MAIS 4</span> </ButtonMostrarMaisRede> - <ButtonMostrarTodos contrast={props.contrast} onClick={() => { props.showMore(20) }}> - <span>MOSTRAR MAIS 20</span> + <ButtonMostrarTodos onClick={() => { props.showMore(20) }}> + <span style={{ color: "#666", fontSize: "14px", fontWeight: "500" }}>MOSTRAR MAIS 20</span> </ButtonMostrarTodos> </React.Fragment> } @@ -92,29 +92,21 @@ export function ButtonsAreaRede(props) { const ButtonMostrarTodos = styled(Button)` &:hover { - background-color: ${props => props.contrast === "" ? "#d5d5d5 !important" : "rgba(255,255,0,0.24) !important"}; + background-color : #d5d5d5 !important; } height : 36px !important; padding-left : 16px !important; padding-right : 16px !important; font-weight : 500 !important; border-radius : 3px !important; - color: ${props => props.contrast === "" ? "#666 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; - background-color: ${props => props.contrast === "" ? "#e8e8e8 !important" : "black !important"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white !important"}; + color :#666 !important; + background-color: #e8e8e8 !important; min-width : 88px !important; height : 36px !important; ` const ButtonMostrarMaisRede = styled(Button)` - &:hover { - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } - color: ${props => props.contrast === "" ? "#fff !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; - background-color: ${props => props.contrast === "" ? "#00bcd4 !important" : "black !important"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white !important"}; + background-color : #00bcd4 !important; font-size: 14px !important; font-weight: 500 !important; height: 36px !important; @@ -126,16 +118,11 @@ const ButtonMostrarMaisRede = styled(Button)` min-width : 88px !important; vertical-align : middle !important; margin : 6px 8px !important; + text-decoration : none !important; ` export const ButtonMostrarMaisColecao = styled(Button)` - &:hover { - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } - color: ${props => props.contrast === "" ? "#fff !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; - background-color: ${props => props.contrast === "" ? "#503096 !important" : "black !important"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white !important"}; + background-color : #503096 !important; font-size: 14px !important; font-weight: 500 !important; height: 36px !important; @@ -147,16 +134,11 @@ export const ButtonMostrarMaisColecao = styled(Button)` min-width : 88px !important; vertical-align : middle !important; margin : 6px 8px !important; + text-decoration : none !important; ` export const ButtonMostrarMaisRecurso = styled(Button)` - &:hover { - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } - color: ${props => props.contrast === "" ? "#fff !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; - background-color: ${props => props.contrast === "" ? "#ff7f00 !important" : "black !important"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white !important"}; + background-color : #ff7f00 !important; font-size: 14px !important; font-weight: 500 !important; height: 36px !important; @@ -168,4 +150,5 @@ export const ButtonMostrarMaisRecurso = styled(Button)` min-width : 88px !important; vertical-align : middle !important; margin : 6px 8px !important; + text-decoration : none !important; ` diff --git a/src/Components/TabPanels/PanelComponents/NoContent.js b/src/Components/TabPanels/PanelComponents/NoContent.js index e0c4be6989d9fed7ae4190d5c0b98b648772338f..f23eb76cd4506d803f8e05e632efa04310ba0b3e 100644 --- a/src/Components/TabPanels/PanelComponents/NoContent.js +++ b/src/Components/TabPanels/PanelComponents/NoContent.js @@ -22,16 +22,16 @@ import styled from 'styled-components' //Image Import import { defaultNoContent } from "ImportImages.js"; -export default function NoContent({ text, image, contrast }) { +export default function NoContent({text, image}) { return ( <DivTextoNoPublications> <InnerDiv> <ImgDiv> - <img alt="" src={image || defaultNoContent} style={{ width: "130px", verticalAlign: "middle", border: "0" }} /> + <img alt="" src={image || defaultNoContent } style={{ width: "130px", verticalAlign: "middle", border: "0" }} /> </ImgDiv> <TextDiv> - <NoPubSpan contrast={contrast}>{text}</NoPubSpan> + <NoPubSpan>{text}</NoPubSpan> </TextDiv> </InnerDiv> </DivTextoNoPublications> @@ -39,7 +39,6 @@ export default function NoContent({ text, image, contrast }) { } const NoPubSpan = styled.span` - color: ${props => props.contrast === "" ? "#666" : "white"}; margin-top : 10px; font-size : 24px; font-family : Roboto; @@ -65,4 +64,10 @@ export const DivTextoNoPublications = styled.div` padding-left : 15px; padding-right : 15px; text-align : center; -` \ No newline at end of file +` + +// {/*const DivConteudoNaoPublicado = styled.div` +// position : relative; +// top : 50%; +// transform : translateY(-50%); +// `*/} diff --git a/src/Components/TabPanels/PanelComponents/PanelTitle.js b/src/Components/TabPanels/PanelComponents/PanelTitle.js index 9214c68b3ec1604beae54e67bbf5672ee29a4605..cb139b40670af05ad9e9d7adc3fc8a873d378d3a 100644 --- a/src/Components/TabPanels/PanelComponents/PanelTitle.js +++ b/src/Components/TabPanels/PanelComponents/PanelTitle.js @@ -2,12 +2,12 @@ import React from 'react' import styled from 'styled-components' import Grid from '@material-ui/core/Grid'; -export default function PanelTitle(props) { +export default function PanelTitle (props) { return ( - <Header container contrast={props.contrast}> + <Header container> <Grid item xs={12}> - <p className="titulo">{props.title} <b style={{ fontWeight: "500", fontSize: "20px" }}>({props.length})</b></p> - <hr /> + <p className="titulo">{props.title} <b style={{fontWeight:"500", fontSize : "20px"}}>({props.length})</b></p> + <hr/> </Grid> </Header> ) @@ -21,7 +21,7 @@ const Header = styled(Grid)` margin : 0; line-height: normal; font-style : normal; - color: ${props => props.contrast === "" ? "#757575" : "white"}; + color : #757575; font-size : 1.857em; padding-left : 15px; padding-right : 15px; diff --git a/src/Components/TabPanels/PanelComponents/TemplateColecao.js b/src/Components/TabPanels/PanelComponents/TemplateColecao.js index f6be75224b38b865c9495559c8deff2b12a82329..b335fbd5110c947dd9979de68dce2d6dfd00bff7 100644 --- a/src/Components/TabPanels/PanelComponents/TemplateColecao.js +++ b/src/Components/TabPanels/PanelComponents/TemplateColecao.js @@ -33,7 +33,6 @@ export default function PanelTemplateColecao(props) { if (followerBoolean) { return ( <CollectionCardFunction - contrast={props.contrast} name={card.name} collections={card.followable.collection_items} rating={card.followable.review_average} @@ -55,7 +54,6 @@ export default function PanelTemplateColecao(props) { else { return ( <CollectionCardFunction - contrast={props.contrast} name={card.name} tags={card.tags} rating={card.review_average} @@ -75,9 +73,8 @@ export default function PanelTemplateColecao(props) { } return ( - <WhiteContainer contrast={props.contrast}> + <WhiteContainer> <Title - contrast={props.contrast} title={props.title} length={props.end} /> @@ -85,18 +82,17 @@ export default function PanelTemplateColecao(props) { { props.error ? <p - className="errorText" + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} > Erro ao tentar obter os dados </p> : props.length === 0 ? ( - <NoContent - contrast={props.contrast} - text={props.noContentText} + <NoContent + text={props.noContentText} image={ColecaoVazia} - /> + /> ) : ( @@ -112,10 +108,9 @@ export default function PanelTemplateColecao(props) { </StyledGrid> { props.loadingMore ? - <LoadingSpinner contrast={props.contrast} text={'Carregando coleções...'} /> + <LoadingSpinner text={'Carregando Recursos...'} /> : <ButtonsAreaColecao - contrast={props.contrast} sliceLength={props.sliceArr.length} length={props.length} showMore={props.showMore} diff --git a/src/Components/TabPanels/PanelComponents/TemplateCuradoria.js b/src/Components/TabPanels/PanelComponents/TemplateCuradoria.js index b6da514b867e5c1ae56f3083c33fd50965702426..d03415734eb03a7a7ea0ecb7671a50840240c815 100644 --- a/src/Components/TabPanels/PanelComponents/TemplateCuradoria.js +++ b/src/Components/TabPanels/PanelComponents/TemplateCuradoria.js @@ -26,10 +26,10 @@ import { ButtonsAreaRecurso } from './ButtonsArea' import LoadingSpinner from '../../LoadingSpinner.js'; export default function Template(props) { + console.log(props.sliceArr); return ( - <WhiteContainer contrast={props.contrast}> + <WhiteContainer> <Title - contrast={props.contrast} title={props.titleText} length={props.end} /> @@ -37,7 +37,7 @@ export default function Template(props) { { props.error ? <p - className="errorText" + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} > Erro ao tentar obter os dados </p> @@ -45,7 +45,7 @@ export default function Template(props) { props.length === 0 ? ( [ - <NoContent contrast={props.contrast} text={props.noContentText} /> + <NoContent text={props.noContentText} /> ] ) : @@ -57,7 +57,6 @@ export default function Template(props) { props.sliceArr.map((card) => <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> <ResourceCardFunction - contrast={props.contrast} avatar={card.submitter.avatar} id={card.learning_object.id} thumbnail={card.learning_object.thumbnail} @@ -78,10 +77,9 @@ export default function Template(props) { </StyledGrid> { props.loadingMore ? - <LoadingSpinner contrast={props.contrast} text="Carregando recurso..." /> + <LoadingSpinner text="Carregando recurso..." /> : <ButtonsAreaRecurso - contrast={props.contrast} sliceLength={props.sliceArr.length} length={props.length} showMore={props.showMore} diff --git a/src/Components/TabPanels/PanelComponents/TemplateRecurso.js b/src/Components/TabPanels/PanelComponents/TemplateRecurso.js index 1243c015b440b54a02bbe59b003ee95e2a7f820e..68e1de28823b08115ab2697d9beebb3f5a972549 100644 --- a/src/Components/TabPanels/PanelComponents/TemplateRecurso.js +++ b/src/Components/TabPanels/PanelComponents/TemplateRecurso.js @@ -31,9 +31,8 @@ import { RecursoVazio } from "ImportImages.js"; export default function Template(props) { return ( - <WhiteContainer contrast={props.contrast}> + <WhiteContainer> <Title - contrast={props.contrast} title={props.titleText} length={props.end} /> @@ -41,7 +40,7 @@ export default function Template(props) { { props.error ? <p - className="errorText" + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} > Erro ao tentar obter os dados </p> @@ -49,7 +48,6 @@ export default function Template(props) { props.length === 0 ? ( <NoContent - contrast={props.contrast} text={props.noContentText} image={RecursoVazio} /> @@ -57,12 +55,11 @@ export default function Template(props) { : ( <React.Fragment> - <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "30px" }}> + <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> { props.slice.map((card) => <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> <ResourceCardFunction - contrast={props.contrast} key={card.id} avatar={card.publisher.avatar} id={card.id} @@ -84,10 +81,9 @@ export default function Template(props) { </StyledGrid> { props.loadingMore ? - <LoadingSpinner contrast={props.contrast} text={'Carregando Recursos...'} /> + <LoadingSpinner text={'Carregando Recursos...'} /> : <ButtonsAreaRecurso - contrast={props.contrast} sliceLength={props.slice.length} length={props.length} showMore={props.showMore} diff --git a/src/Components/TabPanels/PanelComponents/TemplateRede.js b/src/Components/TabPanels/PanelComponents/TemplateRede.js index 076d525e0f417265a86af4e2a6999bd730d62921..e5d2a845a2b2cc388331c622912ac904844379be 100644 --- a/src/Components/TabPanels/PanelComponents/TemplateRede.js +++ b/src/Components/TabPanels/PanelComponents/TemplateRede.js @@ -13,7 +13,6 @@ export default function PanelTemplateRede(props) { if (followerBoolean) { return ( <ContactCard - contrast={props.contrast} name={card.follower.name} avatar={card.follower.avatar !== undefined && card.follower.avatar !== "" ? apiDomain + card.follower.avatar : null} cover={card.follower.cover !== undefined && card.follower.cover !== "" ? apiDomain + card.follower.cover : null} @@ -29,7 +28,6 @@ export default function PanelTemplateRede(props) { else { return ( <ContactCard - contrast={props.contrast} name={card.followable.name ? card.followable.name : null} avatar={card.followable.avatar !== undefined && card.followable.avatar !== "" ? apiDomain + '/' + card.followable.avatar : null} cover={card.followable.cover !== undefined && card.followable.cover !== "" ? apiDomain + card.followable.cover : null} @@ -45,10 +43,9 @@ export default function PanelTemplateRede(props) { } return ( - <WhiteContainer contrast={props.contrast}> + <WhiteContainer> <Title - contrast={props.contrast} title={props.title} length={props.end} /> @@ -59,7 +56,7 @@ export default function PanelTemplateRede(props) { { props.error ? <p - className="errorText" + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} > Erro ao tentar obter os dados </p> @@ -67,7 +64,7 @@ export default function PanelTemplateRede(props) { props.length === 0 ? ( [ - <NoContent contrast={props.contrast} text={props.noContentText} /> + <NoContent text={props.noContentText} /> ] ) : @@ -90,10 +87,9 @@ export default function PanelTemplateRede(props) { </StyledGrid> { props.loadingMore ? - <LoadingSpinner contrast={props.contrast} text={'Carregando Recursos...'} /> + <LoadingSpinner text={'Carregando Recursos...'} /> : <ButtonsAreaRede - contrast={props.contrast} sliceLength={props.sliceArr.length} length={props.length} showMore={props.showMore} @@ -106,6 +102,6 @@ export default function PanelTemplateRede(props) { ) } - </WhiteContainer > + </WhiteContainer> ) } diff --git a/src/Components/TabPanels/PublicUserPageTabs/TabColecoes.js b/src/Components/TabPanels/PublicUserPageTabs/TabColecoes.js index 7f636fcd63ba1610b4bf38f464d1ff1c98d88cc7..9b987347a51274465b78e7db062a99bd6d9a2273 100644 --- a/src/Components/TabPanels/PublicUserPageTabs/TabColecoes.js +++ b/src/Components/TabPanels/PublicUserPageTabs/TabColecoes.js @@ -21,101 +21,100 @@ import { fetchAllRequest, getRequest } from '../../HelperFunctions/getAxiosConfi import PanelTemplateColecao from '../PanelComponents/TemplateColecao.js' import LoadingSpinner from '../../LoadingSpinner.js' -export default function TabColecoes({ id, username, contrast }) { - const [loading, handleLoading] = useState(true) - - const [errorInUserColl, setErrorInUserColl] = useState(false) - - const [userCollections, setUserCollections] = useState([]) - - const [currLimitUserColl, setCurrLimitUserColl] = useState(4) - - const [loadingMoreUserColl, setLoadingMoreUserColl] = useState(false); - - const [endOfUserColl, setEndOfUserColl] = useState(false); - - function handleSuccess(responseArr, headersArr) { - setErrorInUserColl(responseArr[0].errors ? true : false) - - handleLoading(false) - setUserCollections(responseArr[0]) - - if (headersArr[0].has('X-Total-Count')) { - setEndOfUserColl(headersArr[0].get('X-Total-Count')); +export default function TabColecoes({id, username}) { + const [loading, handleLoading] = useState(true) + + const [errorInUserColl, setErrorInUserColl] = useState(false) + + const [userCollections, setUserCollections] = useState([]) + + const [currLimitUserColl, setCurrLimitUserColl] = useState(4) + + const [loadingMoreUserColl, setLoadingMoreUserColl] = useState(false); + + const [endOfUserColl, setEndOfUserColl] = useState(false); + + function handleSuccess(responseArr, headersArr) { + setErrorInUserColl(responseArr[0].errors ? true : false) + + handleLoading(false) + setUserCollections(responseArr[0]) + + if (headersArr[0].has('X-Total-Count')) { + setEndOfUserColl(headersArr[0].get('X-Total-Count')); + } } - } - - function handleError(error) { - handleLoading(false) - setErrorInUserColl(true) - } - - const getInfo = () => { - const urls = [ - `/users/${id}/collections?offset=0&limit=4`, - ] - fetchAllRequest(urls, handleSuccess, handleError) - } - - useEffect(() => { - handleLoading(true) - getInfo() - }, []) - - const showMoreUserCollections = (limite) => { - const limit = limite; - setLoadingMoreUserColl(true); - setCurrLimitUserColl(currLimitUserColl + limit) - const url = `/users/${id}/collections?offset=${currLimitUserColl}&limit=${limit}`; - getRequest(url, - (data) => { - if (data.errors) { + + function handleError(error) { + handleLoading(false) + setErrorInUserColl(true) + } + + const getInfo = () => { + const urls = [ + `/users/${id}/collections?offset=0&limit=4`, + ] + fetchAllRequest(urls, handleSuccess, handleError) + } + + useEffect(() => { + handleLoading(true) + getInfo() + }, []) + + const showMoreUserCollections = (limite) => { + const limit = limite; + setLoadingMoreUserColl(true); + setCurrLimitUserColl(currLimitUserColl + limit) + const url = `/users/${id}/collections?offset=${currLimitUserColl}&limit=${limit}`; + getRequest(url, + (data) => { + if (data.errors) { + setLoadingMoreUserColl(false); + setEndOfUserColl(true) + setErrorInUserColl(true) + } + else if (data.length >= 1) { + let currData = [...userCollections]; + currData = [...currData.concat(data)]; + setLoadingMoreUserColl(false); + setUserCollections(currData); + } + else { + setLoadingMoreUserColl(false); + setEndOfUserColl(true) + } + }, + (error) => { setLoadingMoreUserColl(false); setEndOfUserColl(true) setErrorInUserColl(true) } - else if (data.length >= 1) { - let currData = [...userCollections]; - currData = [...currData.concat(data)]; - setLoadingMoreUserColl(false); - setUserCollections(currData); - } - else { - setLoadingMoreUserColl(false); - setEndOfUserColl(true) - } - }, - (error) => { - setLoadingMoreUserColl(false); - setEndOfUserColl(true) - setErrorInUserColl(true) - } - ) - } + ) + } - return ( - <> - { - loading ? - ( - <LoadingSpinner contrast={contrast} text={`Carregando coleções de ${username}`} /> - ) - : - ( - <PanelTemplateColecao - contrast={contrast} - title={"Coleções Públicas"} - length={userCollections.length} - noContentText={username + " não possui nenhuma coleção."} - sliceArr={userCollections} - showMore={showMoreUserCollections} - loadingMore={loadingMoreUserColl} - end={endOfUserColl} - followed={false} - error={errorInUserColl} - /> - ) - } - </> - ) + return ( + <> + { + loading ? + ( + <LoadingSpinner text={`Carregando coleções de ${username}`} /> + ) + : + ( + <PanelTemplateColecao + title={"Coleções Públicas"} + length={userCollections.length} + noContentText={username + " não possui nenhuma coleção."} + sliceArr={userCollections} + showMore={showMoreUserCollections} + loadingMore={loadingMoreUserColl} + end={endOfUserColl} + followed={false} + error={errorInUserColl} + /> + ) + } + </> + ) } diff --git a/src/Components/TabPanels/PublicUserPageTabs/TabInicio.js b/src/Components/TabPanels/PublicUserPageTabs/TabInicio.js index ceba6bcbc9adb4b1d4c9f56f03e0d79ae2bc91d1..7965d58e5111ad748a22cdf2672c25f05bc3f3ce 100644 --- a/src/Components/TabPanels/PublicUserPageTabs/TabInicio.js +++ b/src/Components/TabPanels/PublicUserPageTabs/TabInicio.js @@ -60,16 +60,15 @@ export function NoContent(props) { ) } -export default function TabInicio({ id, user, learningObjs, collections, contrast }) { +export default function TabInicio({ id, user, learningObjs, collections }) { return ( <React.Fragment> {/*display user description*/} { user.description && - <UserDescription contrast={contrast} text={user.description} /> + <UserDescription text={user.description} /> } <Template - contrast={contrast} length={learningObjs.length} titleText={learningObjs.length === 1 ? `Último Recurso de ${user.name}` : `Últimos recursos de ${user.name}`} noContentText={`${user.name} não publicou nenhum recursos ainda`} @@ -80,7 +79,6 @@ export default function TabInicio({ id, user, learningObjs, collections, contras error={false} /> <PanelTemplateColecao - contrast={contrast} title={`Últimas coleçoes de ${user.name}`} length={collections.length} noContentText={`${user.name} não publicou nenhuma coleção ainda`} diff --git a/src/Components/TabPanels/PublicUserPageTabs/TabRecursos.js b/src/Components/TabPanels/PublicUserPageTabs/TabRecursos.js index 70f07ced9b1ab2e47323e2d5e8dfcb2b16518325..b8f38e36b55e62c26f5df389ba6b80bbdba6a301 100644 --- a/src/Components/TabPanels/PublicUserPageTabs/TabRecursos.js +++ b/src/Components/TabPanels/PublicUserPageTabs/TabRecursos.js @@ -21,7 +21,7 @@ import LoadingSpinner from '../../LoadingSpinner.js' import Template from '../PanelComponents/TemplateRecurso.js' import { getRequest } from '../../HelperFunctions/getAxiosConfig' -export default function TabPanelAtividades({ id, username, contrast }) { +export default function TabPanelAtividades({id, username}) { const [loading, handleLoading] = useState(true) const [errorInLearnObj, setErrorInLearnObj] = useState(false) @@ -83,14 +83,13 @@ export default function TabPanelAtividades({ id, username, contrast }) { { loading ? ( - <LoadingSpinner contrast={contrast} text={`Carregando os recursos de ${username}`} /> + <LoadingSpinner text={`Carregando os recursos de ${username}`} /> ) : ( [ <React.Fragment> <Template - contrast={contrast} length={learningObjects.length} titleText={learningObjects.length === 1 ? `Recurso publicado de ${username}` : `Recursos publicados ${username}`} noContentText={`${username} ainda não publicou nenhum Recurso!`} diff --git a/src/Components/TabPanels/PublicUserPageTabs/TabRede.js b/src/Components/TabPanels/PublicUserPageTabs/TabRede.js index 15492323f74174e8358e1875ea1248937151c023..81334d46c6edc88b10c8df88fa0df5366edec587 100644 --- a/src/Components/TabPanels/PublicUserPageTabs/TabRede.js +++ b/src/Components/TabPanels/PublicUserPageTabs/TabRede.js @@ -16,162 +16,160 @@ 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} from 'react' import PanelTemplateRede from '../PanelComponents/TemplateRede.js' import { fetchAllRequest, getRequest } from '../../HelperFunctions/getAxiosConfig' import LoadingSpinner from '../../LoadingSpinner.js' -export default function TabRede({ id, username, contrast }) { - const [loading, handleLoading] = useState(true) - - const [errorInFollowing, setErrorInFollowing] = useState(false) - const [errorInFollowers, setErrorInFollowers] = useState(false) - - const [followingList, setFollowing] = useState([]) - const [currFollowingLimit, setCurrFollowingLimit] = useState(12) - const [loadingMoreFollowing, setLoadingFollowing] = useState(false) - const [endOfFollowing, setEndOfFollowing] = useState(false) +export default function TabRede ({id, username}) { + const [loading, handleLoading] = useState(true) + + const [errorInFollowing, setErrorInFollowing] = useState(false) + const [errorInFollowers, setErrorInFollowers] = useState(false) + + const [followingList, setFollowing] = useState([]) + const [currFollowingLimit, setCurrFollowingLimit] = useState(12) + const [loadingMoreFollowing, setLoadingFollowing] = useState(false) + const [endOfFollowing, setEndOfFollowing] = useState(false) + + const [followersList, setFollowers] = useState([]) + const [currFollowerLimit, setFollowersLimit] = useState(12) + const [loadingMoreFollowers, setLoadingMoreFollowers] = useState(false) + const [endOfFollowers, setEndOfFollowers] = useState(false) + + const showMoreFollowing = (limite) => { + setLoadingFollowing(true); + const limit = limite; + setCurrFollowingLimit(currFollowingLimit + limit) + const url = `/users/${id}/following/User?offset=${currFollowingLimit}&limit=${limit}`; + getRequest(url, + (data) => { + if (data.errors) { + setLoadingFollowing(false); + setEndOfFollowing(true); + setErrorInFollowing(true); + } + else if (data.length >= 1) { + let currData = [...followingList]; + currData = [...currData.concat(data)]; + setLoadingFollowing(false); + setFollowing(currData); + } + else { + setLoadingFollowing(false); + setEndOfFollowing(true); + } + }, + (error) => { + setLoadingFollowing(false); + setEndOfFollowing(true); + setErrorInFollowing(true); + } + ) + } + + const showMoreFollowers = (limite) => { + setLoadingMoreFollowers(true); + const limit = limite; + setFollowersLimit(currFollowerLimit + limit) + const url = `/users/${id}/followers?offset=${currFollowerLimit}&limit=${limit}`; + getRequest(url, + (data) => { + if (data.errors) { + setLoadingMoreFollowers(false); + setEndOfFollowers(true); + setErrorInFollowers(true); + } + else { + if (data.length >= 1) { + let currData = [...followersList]; + currData = [...currData.concat(data)]; + setLoadingMoreFollowers(false); + setFollowers(currData); + } + else { + setLoadingMoreFollowers(false); + setEndOfFollowers(true) + } + } + }, + (error) => { + setLoadingMoreFollowers(false); + setEndOfFollowers(true); + setErrorInFollowers(true); + } + ) + } - const [followersList, setFollowers] = useState([]) - const [currFollowerLimit, setFollowersLimit] = useState(12) - const [loadingMoreFollowers, setLoadingMoreFollowers] = useState(false) - const [endOfFollowers, setEndOfFollowers] = useState(false) + async function handleSuccess (responseArr, headersArr) { + setErrorInFollowing(responseArr[0].errors ? true : false) // prevent of crashing the portal, do not remove it + setErrorInFollowers(responseArr[1].errors ? true : false) // prevent of crashing the portal, do not remove it + setFollowers(responseArr[0]) + setFollowing(responseArr[1]) - const showMoreFollowing = (limite) => { - setLoadingFollowing(true); - const limit = limite; - setCurrFollowingLimit(currFollowingLimit + limit) - const url = `/users/${id}/following/User?offset=${currFollowingLimit}&limit=${limit}`; - getRequest(url, - (data) => { - if (data.errors) { - setLoadingFollowing(false); - setEndOfFollowing(true); - setErrorInFollowing(true); - } - else if (data.length >= 1) { - let currData = [...followingList]; - currData = [...currData.concat(data)]; - setLoadingFollowing(false); - setFollowing(currData); + if (headersArr[1].has('X-Total-Count')) { + setEndOfFollowing(headersArr[1].get('X-Total-Count')); } - else { - setLoadingFollowing(false); - setEndOfFollowing(true); + if (headersArr[0].has('X-Total-Count')) { + setEndOfFollowers(headersArr[0].get('X-Total-Count')); } - }, - (error) => { - setLoadingFollowing(false); - setEndOfFollowing(true); - setErrorInFollowing(true); - } - ) - } + handleLoading(false) + } - const showMoreFollowers = (limite) => { - setLoadingMoreFollowers(true); - const limit = limite; - setFollowersLimit(currFollowerLimit + limit) - const url = `/users/${id}/followers?offset=${currFollowerLimit}&limit=${limit}`; - getRequest(url, - (data) => { - if (data.errors) { - setLoadingMoreFollowers(false); - setEndOfFollowers(true); - setErrorInFollowers(true); - } - else { - if (data.length >= 1) { - let currData = [...followersList]; - currData = [...currData.concat(data)]; - setLoadingMoreFollowers(false); - setFollowers(currData); - } - else { - setLoadingMoreFollowers(false); - setEndOfFollowers(true) - } - } - }, - (error) => { + function handleErrors() { setLoadingMoreFollowers(false); setEndOfFollowers(true); setErrorInFollowers(true); - } - ) - } - - async function handleSuccess(responseArr, headersArr) { - setErrorInFollowing(responseArr[0].errors ? true : false) // prevent of crashing the portal, do not remove it - setErrorInFollowers(responseArr[1].errors ? true : false) // prevent of crashing the portal, do not remove it - setFollowers(responseArr[0]) - setFollowing(responseArr[1]) - - if (headersArr[1].has('X-Total-Count')) { - setEndOfFollowing(headersArr[1].get('X-Total-Count')); - } - if (headersArr[0].has('X-Total-Count')) { - setEndOfFollowers(headersArr[0].get('X-Total-Count')); } - handleLoading(false) - } - function handleErrors() { - setLoadingMoreFollowers(false); - setEndOfFollowers(true); - setErrorInFollowers(true); - } - - useEffect(() => { - handleLoading(true) - - const urls = [`/users/${id}/followers`, `/users/${id}/following/User`] - - fetchAllRequest(urls, handleSuccess, handleErrors) - }, []) - - return ( - <> - { - loading ? - ( - [ - <LoadingSpinner contrast={contrast} text={`Carregando dados de ${username}`} /> - ] - ) - : - ( - [ - <React.Fragment> - <PanelTemplateRede - contrast={contrast} - title={`Seguidores de ${username}`} - length={followersList.length} - sliceArr={followersList} - showMore={showMoreFollowers} - follower={true} - end={endOfFollowers} - loadingMore={loadingMoreFollowers} - error={errorInFollowers} - noContentText={username + ' não possui nenhum seguidor'} - /> - - <PanelTemplateRede - contrast={contrast} - title={`${username} está seguindo`} - length={followingList.length} - sliceArr={followingList} - showMore={showMoreFollowing} - follower={false} - end={endOfFollowing} - loadingMore={loadingMoreFollowing} - error={errorInFollowing} - noContentText={username + ' não segue nenhum usuário'} - /> - </React.Fragment> - ] - ) - } - </> - ) + useEffect( () => { + handleLoading(true) + + const urls = [`/users/${id}/followers`, `/users/${id}/following/User`] + + fetchAllRequest(urls, handleSuccess, handleErrors) + }, []) + + return ( + <> + { + loading ? + ( + [ + <LoadingSpinner text={`Carregando dados de ${username}`} /> + ] + ) + : + ( + [ + <React.Fragment> + <PanelTemplateRede + title={`Seguidores de ${username}`} + length={followersList.length} + sliceArr={followersList} + showMore={showMoreFollowers} + follower={true} + end={endOfFollowers} + loadingMore={loadingMoreFollowers} + error={errorInFollowers} + noContentText={username + ' não possui nenhum seguidor'} + /> + + <PanelTemplateRede + title={`${username} está seguindo`} + length={followingList.length} + sliceArr={followingList} + showMore={showMoreFollowing} + follower={false} + end={endOfFollowing} + loadingMore={loadingMoreFollowing} + error={errorInFollowing} + noContentText={username + ' não segue nenhum usuário'} + /> + </React.Fragment> + ] + ) + } + </> + ) } diff --git a/src/Components/TabPanels/PublicUserPageTabs/UserDescription.js b/src/Components/TabPanels/PublicUserPageTabs/UserDescription.js index df5fcde96513967e1983154bf666301698ee49ed..4fcc273f0a0b3e8ed984f1d831488d8002a978dd 100644 --- a/src/Components/TabPanels/PublicUserPageTabs/UserDescription.js +++ b/src/Components/TabPanels/PublicUserPageTabs/UserDescription.js @@ -19,15 +19,15 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React from 'react' import styled from 'styled-components' -export default function UserDescription(props) { +export default function UserDescription (props) { return ( - <NoPadBox contrast={props.contrast}> - <ContainerDiv> - <DivSobre contrast={props.contrast}> - <h3>Sobre</h3> - <p>{props.text}</p> - </DivSobre> - </ContainerDiv> + <NoPadBox> + <ContainerDiv> + <DivSobre> + <h3>Sobre</h3> + <p>{props.text}</p> + </DivSobre> + </ContainerDiv> </NoPadBox> ) } @@ -49,13 +49,11 @@ const DivSobre = styled.div` font-family : inherit; font-weight: 500; line-height: 1.1; - color: ${(props) => (props.contrast === "" ? "#666" : "white")}; - + color: inherit; } p { margin : 0 0 10px; - color: ${(props) => (props.contrast === "" ? "#666" : "white")}; } ` @@ -78,10 +76,9 @@ const NoPadBox = styled.div` margin-right : auto; margin-left : auto; padding : 0; - background-color: ${(props) => (props.contrast === "" ? "#f4f4f4" : "black")}; + background-color : #fff; box-shadow : 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); margin-bottom : 30px; - border: ${(props) => (props.contrast === "" ? "0" : "1px solid white")}; @media screen and (min-width: 768px) { width : max-content; diff --git a/src/Components/TabPanels/StyledComponents.js b/src/Components/TabPanels/StyledComponents.js index 88b121132437f546b0f832c56fea8af55faffdee..182fd013462a57191b7482f708e4379537c4255c 100644 --- a/src/Components/TabPanels/StyledComponents.js +++ b/src/Components/TabPanels/StyledComponents.js @@ -61,8 +61,7 @@ export const WhiteContainer = styled.div` flex-direction : column; margin-left : auto; margin-right : auto; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; + background-color : #fff; box-shadow : 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); margin-bottom : 30px; @@ -79,16 +78,6 @@ export const WhiteContainer = styled.div` @media screen and (max-width: 768px) { width : auto; } - - .errorText{ - font-size: 15px; - color: ${props => props.contrast === "" ? "" : "white"} - font-weight: lighter; - margin: 0 0 10px; - display: flex; - justify-content: center; - text-align: center; - } ` export const StyledGrid = styled(Grid)` @@ -104,11 +93,6 @@ export const Carregados = styled.div` position : relative; margin-right : -15px; margin-left : -15px; - .total{ - margin: 0 0 10px; - font-size: 14px; - color: ${props => props.contrast === "" ? "" : "white"}; - } ` export const HeaderGrid = styled(Grid)` @@ -162,8 +146,7 @@ export const ContainerStyled = styled.div` /*User page and Public User page components: */ export const HeaderContainer = styled.div` - background-color: ${props => props.contrast === "" ? "#afeeee" : "black"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; + background-color : #afeeee; position : relative; ` @@ -185,42 +168,22 @@ export const UserProfileContainer = styled.div` @media screen and (min-width: 768px) and (max-width : 991px) { width : 750px; } - @media screen and (max-width: 600px) { - width : 100%; - } ` export const CoverContainer = styled.div` - position : relative; - - @media screen and (min-width: 1200px) { - height : 234px; - } - @media screen and (min-width: 992px) and (max-width : 1199px){ - height : 194px; - } - @media screen and (min-width: 768px) and (max-width : 991px) { - height : 150px; - } - @media screen and (max-width: 600px) { - height : 128px - } + height : 230px; + position : relative; + @media screen and (max-width: 600px) { + height : 128px + } ` export const UserProfileInfoDiv = styled.div` - position : absolute; - bottom : 0; - left : 260px; - overflow : hidden; - margin-bottom : 20px; - p { - font-size: 28px; - color: #fff; - padding: 5px 10px; - font-weight: 500; - border-radius: 5px; - text-shadow: 0 1px 2px rgba(0,0,0,.45); - } + position : absolute; + bottom : 0; + left : 260px; + overflow : hidden; + margin-bottom : 20px; ` export const CheckTeacherDiv = styled.div` @@ -228,9 +191,6 @@ export const CheckTeacherDiv = styled.div` padding-left : 250px; margin-bottom : -10px; display : absolute; - background-color: ${props => props.contrast === "" ? "" : "black"}; - border-left: ${props => props.contrast === "" ? 0 : "1px solid white"}; - border-right: ${props => props.contrast === "" ? 0 : "1px solid white"}; p { margin : 0 0 10px; @@ -238,7 +198,6 @@ export const CheckTeacherDiv = styled.div` font-size: 15px; line-height: 22px; text-align: left; - color: ${props => props.contrast === "" ? "" : "white"}; span { padding-right : 5px; @@ -253,20 +212,11 @@ export const CheckTeacherDiv = styled.div` ` export const StyledTabs = styled(Tabs)` - .MuiTab-textColorPrimary{ - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: 400; - } .MuiTab-textColorPrimary.Mui-selected { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: none; - font-weight: 500; + color : #00bcd4; } - .MuiTab-textColorPrimary.Mui-disabled { - color: ${props => props.contrast === "" ? "#bdbdbd" : "white"}; - text-decoration: none; - font-weight: 400; + .PrivateTabIndicator-colorPrimary-4 { + background-color : #00bcd4 !important; } ` @@ -275,10 +225,6 @@ export const RodapeDiv = styled.div` flex-direction : row; justify-content : flex-end; padding-right : 15px; - background-color: ${props => props.contrast === "" ? "transparent" : "black"}; - border-left: ${props => props.contrast === "" ? 0 : "1px solid white"}; - border-right: ${props => props.contrast === "" ? 0 : "1px solid white"}; - border-bottom: ${props => props.contrast === "" ? 0 : "1px solid white"}; .report-button { @media screen and (max-width: 768px) { @@ -289,7 +235,7 @@ export const RodapeDiv = styled.div` ` export const NavBarContentContainer = styled(Container)` - background-color: ${props => props.contrast === "" ? "transparent" : "black"}; + background-color : transparent; padding-bottom : 0; overflow-x : hidden !important; overflow-y : hiddden !important; @@ -297,10 +243,10 @@ export const NavBarContentContainer = styled(Container)` ` export const BackgroundDiv = styled.div` - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; font-family : 'Roboto', sans serif; font-size : 14px; padding-bottom : 50px; line-height : 20px; - background-color: ${props => props.contrast === "" ? " #f4f4f4" : "black"}; + background : #f4f4f4; ` diff --git a/src/Components/TabPanels/UserPageTabs/ContainerRedeVazia.js b/src/Components/TabPanels/UserPageTabs/ContainerRedeVazia.js index 9243b0fb8c41722e27308a8d3ec922d7050c1ac1..7a1451b29c5becca86e59a94c36a08fbc54359ef 100644 --- a/src/Components/TabPanels/UserPageTabs/ContainerRedeVazia.js +++ b/src/Components/TabPanels/UserPageTabs/ContainerRedeVazia.js @@ -19,7 +19,7 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React from 'react' import styled from 'styled-components' import TabRedeImgDiv from './TabRedeImgDiv.js' -import { WhiteContainer } from '../StyledComponents.js' +import {WhiteContainer} from '../StyledComponents.js' import Grid from '@material-ui/core/Grid'; //Image Import @@ -30,27 +30,26 @@ import { NoRede3 } from "ImportImages.js"; export default function ContainerRedeVazia (props) { return ( <React.Fragment> - <WhiteContainer contrast={props.contrast}> - <RedeVaziaBoxContainer contrast={props.contrast}> - <StyledSpan contrast={props.contrast}> - Você ainda não tem uma rede. - <br /> - Veja como começar: + <WhiteContainer> + <RedeVaziaBoxContainer> + <StyledSpan>Você ainda não tem uma rede. + <br/> + Veja como começar: </StyledSpan> - <StyledSpan contrast={props.contrast}> - <StyledHr /> - <Grid container style={{ paddingLeft: "30px", paddingRight: "15px" }}> - <Grid item md={4} xs={12}> - <TabRedeImgDiv img={NoRede1} text={"Para encontrar um usuário específico, você pode utilizar a barra de busca e selecionar a busca por \"pessoas\""} /> - </Grid> + <StyledSpan> + <StyledHr/> + <Grid container style={{paddingLeft : "30px", paddingRight : "15px"}}> + <Grid item md={4} xs={12}> + <TabRedeImgDiv img={NoRede1} text={"Para encontrar um usuário específico, você pode utilizar a barra de busca e selecionar a busca por \"pessoas\""}/> + </Grid> - <Grid item md={4} xs={12}> - <TabRedeImgDiv img={NoRede2} text={"Você pode começar a seguir uma pessoa clicando no botão \"seguir\" no card (A) ou na página dela (B)"} /> - </Grid> + <Grid item md={4} xs={12}> + <TabRedeImgDiv img={NoRede2} text={"Você pode começar a seguir uma pessoa clicando no botão \"seguir\" no card (A) ou na página dela (B)"}/> + </Grid> - <Grid item md={4} xs={12}> - <TabRedeImgDiv img={NoRede3} text={"Pronto! Agora você poderá acompanhar os novos recursos e coleções dessa pessoas na sua página, na aba \"Perfil e Atividades\""} /> - </Grid> + <Grid item md={4} xs={12}> + <TabRedeImgDiv img={NoRede3} text={"Pronto! Agora você poderá acompanhar os novos recursos e coleções dessa pessoas na sua página, na aba \"Perfil e Atividades\""}/> + </Grid> </Grid> </StyledSpan> </RedeVaziaBoxContainer> @@ -67,7 +66,7 @@ const StyledHr = styled.hr` ` const RedeVaziaBoxContainer = styled.div` - background: ${props => props.contrast === "" ? "#fff" : "black"}; + background-color : #fff; padding: 30px; padding-right: 30px; padding-left: 30px; @@ -77,16 +76,14 @@ const RedeVaziaBoxContainer = styled.div` padding-left: 0 !important; padding-right: 0 !important; margin-top: 20px; -`; - +} +` const StyledSpan = styled.span` - color: ${props => props.contrast === "" ? "" : "white"}; font-weight : lighter; margin-top: 0; font-family: Roboto; font-size: 24px; p { - color: ${props => props.contrast === "" ? "" : "white"}; font-weight : normal; } ` diff --git a/src/Components/TabPanels/UserPageTabs/ModalExcluirConta.js b/src/Components/TabPanels/UserPageTabs/ModalExcluirConta.js index 19f4c6e4485d3e674e1d5ba01a43ffd15932cf35..f8cf40d05116502b80295679b815932d28405f61 100644 --- a/src/Components/TabPanels/UserPageTabs/ModalExcluirConta.js +++ b/src/Components/TabPanels/UserPageTabs/ModalExcluirConta.js @@ -36,7 +36,7 @@ import { ExcluirAvatar } from "ImportImages.js"; function CloseModalButton (props) { return ( <StyledCloseModalButton onClick={props.handleClose}> - <CloseIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }}/> + <CloseIcon/> </StyledCloseModalButton> ) } @@ -46,8 +46,8 @@ export default function ModalExcluirConta (props) { const [formEmail, setEmail] = useState( { - key : true, - value : "", + key : false, + value : "", } ) const handleChange = (e) => { @@ -92,19 +92,19 @@ export default function ModalExcluirConta (props) { }} > <Fade in={props.open}> - <Container contrast={props.contrast}> + <Container> <Header> <span style={{width:"32px"}}/> <h2>Excluir a Conta Definitivamente</h2> <CloseModalButton handleClose={props.handleClose}/> </Header> <Content> - <div style={{display : "flex", flexDirection : "column", textAlign : "left"}}> + <div style={{display : "flex", flexDirection : "column", color : "#666", textAlign : "left"}}> <div style={{display : "flex", flexDirection : "row", margin : "0 30px", justifyContent : "center", alignContent : "center"}}> <div style={{height : "90px", position : "relative"}}> <img src={ExcluirAvatar} alt="excluir-avatar" style={{height : "inherit", objectFit : "contain", verticalAlign : "middle"}}/> </div> - <p style={{paddingLeft : "10px"}}>Você é muito importante para a rede, ficaríamos felizes se você ficasse. Quer contar o que aconteceu? Talvez possamos ajudar. <StyledLink to="/contato" className={`${props.contrast}LinkColor`}>Entre em contato.</StyledLink></p> + <p style={{paddingLeft : "10px"}}>Você é muito importante para a rede, ficaríamos felizes se você ficasse. Quer contar o que aconteceu? Talvez possamos ajudar. <StyledLink to="/contato">Entre em contato.</StyledLink></p> </div> <p style={{marginTop : "20px"}}> Saiba que a exclusão da conta removerá o seu perfil permanentemente. Se você publicou algum recurso, ele ainda ficará disponível para os usuários da plataforma. @@ -113,7 +113,6 @@ export default function ModalExcluirConta (props) { É necessário que você digite seu e-mail para confirmar a exclusão: </p> <FormInput - contrast={props.contrast} inputType={"text"} name={"email"} value={formEmail.value} @@ -123,9 +122,9 @@ export default function ModalExcluirConta (props) { error = {formEmail.key} help = {formEmail.key ? ( formEmail.value.length === 0 ? "Faltou preencher seu e-mail." : "O e-mail deve ser o mesmo no qual você cadastrou esta conta") : ""} /> - <div style={{display : "flex", flexDirection : "row", justifyContent : "space-evenly", paddingTop : "15px"}}> - <GreyButton contrast={props.contrast} callback={props.handleClose} text={"Cancelar"}/> - <RedButton contrast={props.contrast} disabled={formEmail.key} onClick = {() => {deleteAccount()}}>EXCLUIR PERMANENTEMENTE</RedButton> + <div style={{display : "flex", flexDirection : "row", justifyContent : "space-evenly", paddingTop : "15px"}}> + <GreyButton callback={props.handleClose} text={"Cancelar"}/> + <RedButton disabled={formEmail.key} onClick = {() => {deleteAccount()}}>EXCLUIR PERMANENTEMENTE</RedButton> </div> </div> </Content> @@ -137,17 +136,10 @@ export default function ModalExcluirConta (props) { } const RedButton = styled(Button)` - color: ${props => props.contrast === "" ? "white" : "yellow"} !important; - text-decoration : ${props => props.contrast === "" ? "none" : "underline yellow"} !important; - background-color : ${props => props.contrast === "" ? "rgb(230,60,60)" : "black"} !important; + background-color : rgb(230,60,60) !important; + color : #fff !important; font-weight : bolder; box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; - - :disabled { - color: ${props => props.contrast === "" ? "white" : "white"} !important; - text-decoration : none !important; - background-color : ${props => props.contrast === "" ? "#666" : "black"} !important; - } ` const Content = styled.div` @@ -166,6 +158,7 @@ const Header = styled.div` h2 { font-size : 26px; font-weight : lighter; + color : #666 } ` @@ -193,12 +186,9 @@ const StyledModal = styled(Modal)` ` const Container = styled.div` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; - box-sizing : border-box; box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12); + background-color : white; align : center; display : flex; flex-direction : column; @@ -220,6 +210,6 @@ const Container = styled.div` } ` const StyledLink = styled(Link)` - text-decoration : none; - color : #00bcd4; + text-decoration : none !important; + color : #00bcd4 !important; ` diff --git a/src/Components/TabPanels/UserPageTabs/PanelAtividades.js b/src/Components/TabPanels/UserPageTabs/PanelAtividades.js index 7e771677edfb0f430622128cf013c49077ef6099..ff2126a3a850ea9e949656f35edec15719c65008 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelAtividades.js +++ b/src/Components/TabPanels/UserPageTabs/PanelAtividades.js @@ -122,7 +122,6 @@ export default function TabPanelAtividades(props) { } } } - useEffect(() => { const url = `/feed?offset=0&limit=30` @@ -130,7 +129,7 @@ export default function TabPanelAtividades(props) { }, []) return ( - <MainContainerDesktop contrast={props.contrast}> + <MainContainerDesktop> <SnackBar snackbarOpen={snackInfo.open} handleClose={handleCloseSnackBar} @@ -139,133 +138,110 @@ export default function TabPanelAtividades(props) { text={snackInfo.text} /> <Paper elevation={3}> - <div style={props.contrast === "" ? {} : { backgroundColor: "black" }}> + <div> <DivTitulo> <InnerDivTitulo> - <TituloContent contrast={props.contrast}> + <TituloContent> <p style={{ margin: "0 0 10px", marginBottom: "40px" }}>Todas Notificações</p> </TituloContent> </InnerDivTitulo> </DivTitulo> { loading ? - ( - <LoadingSpinner text={'Carregando Atividades'} contrast={props.contrast} /> - ) - : - ( - [ - <div> - { - error ? - <ErrorP - contrast={props.contrast} - > - Erro ao tentar obter as notificações - </ErrorP> - : - notificatonsLength === 0 ? - ( + ( + <LoadingSpinner text={'Carregando Atividades'} /> + ) + : + ( + [ + <div> + { + error ? + <p + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} + > + Erro ao tentar obter as notificações + </p> + : + notificatonsLength === 0 ? + ( - <NoNotificationsDiv> - <div> - <div> - <img src={Bolo} alt='bolo' style={{ width: "23px", display: "block", marginLeft: "auto", marginRight: "auto" }} /> - <H3Styled contrast={props.contrast}>Você se cadastrou na Plataforma</H3Styled> - </div> - <InfoP - contrast={props.contrast} - >Construa conosco a plataforma e amplie sua rede de conhecimento interagindo - <br />com pessoas envolvidas com experiências que ocorrem em todo o Brasil! - </InfoP> - </div> - </NoNotificationsDiv> + <NoNotificationsDiv> + <div> + <div> + <img src={Bolo} alt='bolo' style={{ width: "23px", display: "block", marginLeft: "auto", marginRight: "auto" }} /> + <H3Styled>Você se cadastrou na Plataforma</H3Styled> + </div> + <p + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} + >Construa conosco a plataforma e amplie sua rede de conhecimento interagindo + <br /> + com pessoas envolvidas com experiências que ocorrem em todo o Brasil! + </p> + </div> + </NoNotificationsDiv> - ) - : - ( - <> - <List height={400} width={300}> - { - notifications.map((notification, id) => - (notification.recipient_type !== "NilClass") && - <ActivityListItem - contrast={props.contrast} - key={id} - onMenuBar={false} - avatar={notification.owner.avatar ? apiDomain + notification.owner.avatar : noAvatar} - activity={notification.activity} - actionType={notification.trackable_type} - objectType={notification.recipient_type} - createdAt={notification.created_at} - ownerName={notification.owner.name} - ownerHref={'/usuario-publico/' + notification.owner.id} - recipientName={notification.recipient.name} - recipientHref={"/recurso/" + notification.recipient.id} - /> - ) - } - </List> - { - loadingMore ? - <LoadingSpinner contrast={props.contrast} text="Carregando mais atividades..." /> - : - <Grid container direction="row" alignItems="center" spacing={1}> - <Grid xs={12} md={12} item style={{ fontSize: "14px", color: "#666" }}> - <ShowData disabled={true} contrast={props.contrast}> - Mostrando {notificatonsLength} {notificatonsLength === 1 ? "Atividade " : "Atividades "}de {totalResults} - </ShowData> - </Grid> - <StyledGrid item xs={12} md={12}> - <LoadMoreButton contrast={props.contrast} onClick={() => { showMore(4) }}>CARREGAR MAIS 4</LoadMoreButton> - <LoadMoreButton contrast={props.contrast} onClick={() => { showMore(20) }}>CARREGAR MAIS 20</LoadMoreButton> - </StyledGrid> - </Grid> + ) + : + ( + <> + <List height={400} width={300}> + { + notifications.map((notification, id) => + (notification.recipient !== null) && + <ActivityListItem + key={id} + onMenuBar={false} + avatar={notification.owner.avatar ? apiDomain + notification.owner.avatar : noAvatar} + activity={notification.activity} + actionType={notification.trackable_type} + objectType={notification.recipient_type} + createdAt={notification.created_at} + ownerName={notification.owner.name} + ownerHref={'/usuario-publico/' + notification.owner.id} + recipientName={notification.recipient.name} + recipientHref={"/recurso/" + notification.recipient.id} + /> + ) + } + </List> + { + loadingMore ? + <LoadingSpinner text="Carregando mais atividades..." /> + : + <Grid container direction="row" alignItems="center" justify="flex-start"> + <Grid item xs={12} md={4}> + <LoadMoreButton onClick={() => { showMore(4) }}>CARREGAR MAIS 4</LoadMoreButton> + </Grid> + <Grid item xs={12} md={4}> + <LoadMoreButton onClick={() => { showMore(20) }}>CARREGAR MAIS 20</LoadMoreButton> + </Grid> + <Grid xs={12} md={4} item style={{ fontSize: "14px", color: "#666" }}> + <ShowData disabled={true}> + Mostrando {notificatonsLength} {notificatonsLength === 1 ? "Atividade " : "Atividades "} + de {totalResults} + </ShowData> + </Grid> + </Grid> + } + </> + ) } - </> - ) - } - </div> - ] - ) + </div> + + ] + ) } </div> </Paper> </MainContainerDesktop> ) } -const StyledGrid = styled(Grid)` - display: flex; - align-items: center; - justify-content: center; -` - -const InfoP = styled.p` - font-size: "15px"; - font-weight: "lighter"; - margin: "0 0 10px"; - display: "flex"; - justify-content: "center"; - text-align: "center"; - color: ${props => props.contrast === "" ? "" : "white"}; -` - -const ErrorP = styled.p` - font-size: "15px"; - font-weight: "lighter"; - margin: "0 0 10px"; - display: "flex"; - justify-content: "center"; - text-align: "center"; - color: ${props => props.contrast === "" ? "" : "white"}; -` const MainContainerDesktop = styled.div` padding : 10px 0 8px 0; margin-left : auto; margin-right : auto; - background-color: ${props => props.contrast === "" ? "" : "black"}; - border: ${props => props.contrast === "" ? "" : "1px solid white"}; @media screen and (min-width: 1200px) { width : 1170px; @@ -281,7 +257,7 @@ const MainContainerDesktop = styled.div` const H3Styled = styled.h3` font-size: 24px; font-weight : lighter; - color: ${props => props.contrast === "" ? "#00bcd4" : "white"}; + color : #00bcd4; margin-top : 20px; margin-bottom : 10px; display : flex; @@ -298,34 +274,35 @@ const NoNotificationsDiv = styled.div` ` const LoadMoreButton = styled(Button)` - margin-left: 6px !important; - margin-right: 6px !important; outline : none !important; - cursor : pointer !important; - max-height : 36px !important; - min-width : 88px !important; + display : block !important; + cusor : pointer !important; + min-height : 36px !important; + min-widht : 88px !important; + line-height: 36px !important; vertical-align: middle !important; - border: ${props => props.contrast === "" ? "" : "1px solid white !important"}; + border : 0 !important; padding : 0 px !important; - - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; + margin : auto !important; + text-decoration : none !important; font-weight : 500 !important; overflow : hidden !important; text-transform : uppercase !important; font-size : 14px !important; - background : transparent !important; - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; + background : transparent !important; + color : #666 !important &:hover { - background-color: ${props => props.contrast === "" ? "rgba(158,158,158,0.2) !important" : "rgba(255,255,0,0.24) !important"}; + background : rgba(158,158,158,0.2) !important } ` const ShowData = styled(Button)` outline : none !important; display : block !important; - cursor : pointer !important; - max-height : 36px !important; - min-width : 88px !important; + cusor : pointer !important; + min-height : 36px !important; + min-widht : 88px !important; + line-height: 36px !important; vertical-align: middle !important; border : 0 !important; padding : 0 px !important; @@ -336,7 +313,7 @@ const ShowData = styled(Button)` text-transform : none !important; font-size : 14px !important; background : transparent !important; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; + color : #666 !important &:hover { background : rgba(158,158,158,0.2) !important } @@ -348,7 +325,6 @@ const TituloContent = styled.div` position : relative; font-family: Roboto, sans-serif; font-weight : ligther; - color: ${props => props.contrast === "" ? "" : "white"}; ` const InnerDivTitulo = styled.div` diff --git a/src/Components/TabPanels/UserPageTabs/PanelColecoes.js b/src/Components/TabPanels/UserPageTabs/PanelColecoes.js index 3adaa32cc24270170e7b80c85aa3f80f1b309b67..427a7d5c13857e1ea40608128e61b85c8ce8d9e5 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelColecoes.js +++ b/src/Components/TabPanels/UserPageTabs/PanelColecoes.js @@ -153,34 +153,33 @@ export default function TabPanelColecoes(props) { { loading ? ( - <LoadingSpinner contrast={props.contrast} text={'CARREGANDO COLEÇÕES'} /> + <LoadingSpinner text={'CARREGANDO COLEÇÕES'} /> ) : ( [ <React.Fragment> <Tentativa - contrast={props.contrast} title={"Minhas Coleções"} length={userCollections.length} noContentText={ - <StyledNewGrid contrast={props.contrast} direction='column' justify='center' alignItems='center'> + <Grid direction='column' justify='center' alignItems='center'> <Grid item> <img src={ColecaoVazia} alt="ColecaoVazia" style={{ height: "150px", width: "150px", verticalAlign: "middle", border: "0" }} /> </Grid> <Grid> - <span className="title"> - Crie a sua primeira Coleção! + <span style={{ fontFamily: "Roboto", fontWeight: "lighter", fontSize: "24px", textAlign: 'center' }}> + Criamos a sua primeira Coleção! </span> </Grid> <Grid> - <p className="explication"> + <p style={{ fontFamily: "Roboto", fontSize: "16px", margin: "10px 0 0", fontWeight: "normal" }}> Adicione nela recursos que você queira acessar mais tarde. <br /> Crie novas coleções clicando no cartão roxo "Criar Colecão". </p> </Grid> - </StyledNewGrid> + </Grid> } sliceArr={userCollections} showMore={showMoreUserCollections} @@ -192,7 +191,6 @@ export default function TabPanelColecoes(props) { /> <PanelTemplateColecao - contrast={props.contrast} title={"Coleções que você segue"} length={followedCollections.length} noContentText={"Você ainda não segue nenhuma coleção."} @@ -217,36 +215,34 @@ function Tentativa(props) { if (props.error) return ( - <WhiteContainer contrast={props.contrast}> + <WhiteContainer> <Title - contrast={props.contrast} title={props.title} length={props.length} /> <p - className="errorText" + style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} > Erro ao tentar obter os dados - </p> + </p> </WhiteContainer> ) else return ( - <WhiteContainer contrast={props.contrast}> - <CriarColecaoModal contrast={props.contrast} open={modalOpen} handleClose={() => { handleModal(); props.callback() }} /> + <WhiteContainer> + <CriarColecaoModal open={modalOpen} handleClose={() => { handleModal(); props.callback() }} /> <Title - contrast={props.contrast} title={props.title} length={props.end} /> <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> <Grid item xs={12} sm={6} md={'auto'} lg={3}> - <CardDiv contrast={props.contrast} onClick={() => { handleModal() }}> - <div className="background"> + <CardDiv onClick={() => { handleModal() }}> + <div style={{ backgroundColor: "#673ab7", display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center", cursor: "pointer" }}> <CreateNewFolderIcon style={{ color: "#fff", fontSize: "70px" }} /> - <p className="action"> + <p style={{ fontSize: "16px", margin: "0 0 10px", color: "#fff" }}> CRIAR COLEÇÃO </p> </div> @@ -272,7 +268,6 @@ function Tentativa(props) { props.sliceArr.map((card) => <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> <CollectionCardFunction - contrast={props.contrast} name={card.name} tags={card.tags} rating={card.review_average} @@ -298,10 +293,9 @@ function Tentativa(props) { </StyledGrid> { props.loadingMore ? - <LoadingSpinner contrast={props.contrast} text={'Carregando Recursos...'} /> + <LoadingSpinner text={'Carregando Recursos...'} /> : <ButtonsAreaColecao - contrast={props.contrast} sliceLength={props.sliceArr.length} length={props.length} showMore={props.showMore} @@ -313,45 +307,10 @@ function Tentativa(props) { ) } -const StyledNewGrid = styled(Grid)` - - .title{ - font-family: Roboto; - font-weight: lighter; - font-size: 24px; - text-align: center; - color: ${props => props.contrast === "" ? "" : "white"}; - } - .explication{ - font-family: Roboto; - font-size: 16px; - margin: 10px 0 0; - color: ${props => props.contrast === "" ? "" : "white"}; - font-weight: normal; - } - -` - const CardDiv = styled(Card)` margin-top : 10px; margin-bottom : 10px; height : 381px; width : 272.5px; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; - - .background{ - background-color: ${props => props.contrast === "" ? "#673ab7" : "black"}; - display: flex; - height: 100%; - width: 100%; - justify-content: center; - align-items: center; - cursor: pointer; - } - .action{ - font-size: 16px; - margin: 0 0 10px; - color: ${props => props.contrast === "" ? "#fff" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } + ${'' /* float : left; */} ` diff --git a/src/Components/TabPanels/UserPageTabs/PanelCuradoria.js b/src/Components/TabPanels/UserPageTabs/PanelCuradoria.js index d2196091f056f506a7f8239ca7c6498eb3587490..084f865b9077e0752df8b34d221debade2a35492 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelCuradoria.js +++ b/src/Components/TabPanels/UserPageTabs/PanelCuradoria.js @@ -90,14 +90,13 @@ export default function TabPanelCuradoria(props) { { loading ? ( - <LoadingSpinner contrast={props.contrast} text={"Carregando Recursos"} /> + <LoadingSpinner text={"Carregando Recursos"} /> ) : ( [ <React.Fragment> <TemplateCuradoria - contrast={props.contrast} length={curating.length} titleText={curating.length === 1 ? "Recurso sendo avaliado pela curadoria" : "Recursos sendo avaliados pela curadoria"} noContentText={"Você não tem nenhum recurso sendo avaliado pelos curadores."} diff --git a/src/Components/TabPanels/UserPageTabs/PanelEditarPerfil.js b/src/Components/TabPanels/UserPageTabs/PanelEditarPerfil.js index cd49d1a70082a26cd2ff3e01314b25a13285fd52..3857508b93610e27d08654e486e43561d52610d2 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelEditarPerfil.js +++ b/src/Components/TabPanels/UserPageTabs/PanelEditarPerfil.js @@ -117,24 +117,22 @@ export default function TabPanelEditarPerfil(props) { return ( <React.Fragment> <ModalAlterarCover - contrast={state.contrast} open={open} handleClose={controlModal} cover={tempCover} id={state.currentUser.id} /> <ModalAlterarAvatar - contrast={state.contrast} open={alterarAvatatarOpen} handleClose={controlModalAvatar} userAvatar={state.currentUser.avatar} id={state.currentUser.id} /> <div className="card-config"> - <h1 className="title">Editar Perfil </h1> + <h1 style={{ fontWeight: "300" }}>Editar Perfil </h1> <div className='content-div'> <div style={{ padding: "0", display: "flex", flexDirection: "column" }}> - <HeaderContainer contrast={state.contrast}> + <HeaderContainer> <div style={{ position: "relative", height: "100%" }}> <img src={state.currentUser.cover ? `${apiDomain}` + state.currentUser.cover : null} alt={state.currentUser.cover ? "user cover avatar" : ""} style={{ width: "100%", height: "100%", objectFit: "cover" }} /> <input accept="image/*" style={{ display: "none" }} id="icon-button-file" type="file" onChange={(e) => updateCover(e.target.files)} /> @@ -160,7 +158,6 @@ export default function TabPanelEditarPerfil(props) { <div style={{ display: "flex", flexDirection: "row", justifyContent: "center" }}> <form onSubmit={e => handleSubmit(e)}> <FormInput - contrast={state.contrast} inputType={"text"} name={"Nome Completo"} value={formNome.value} @@ -170,7 +167,6 @@ export default function TabPanelEditarPerfil(props) { error={formNome.key} /> <FormInput - contrast={state.contrast} inputType={"text"} name={"Sobre Mim"} value={formAboutMe.value} @@ -186,8 +182,8 @@ export default function TabPanelEditarPerfil(props) { </form> </div> <ButtonsDiv> - <Link to="perfil" ><ButtonCancelar contrast={state.contrast} >CANCELAR</ButtonCancelar></Link> - <ButtonConfirmar contrast={state.contrast} onClick={e => handleSubmit(e)}>SALVAR ALTERAÇÕES</ButtonConfirmar> + <Link to="perfil" ><ButtonCancelar ><span>CANCELAR</span></ButtonCancelar></Link> + <ButtonConfirmar onClick={e => handleSubmit(e)}><span>SALVAR ALTERAÇÕES</span></ButtonConfirmar> </ButtonsDiv> </div> </div > @@ -197,8 +193,10 @@ export default function TabPanelEditarPerfil(props) { } const ButtonConfirmar = styled(Button)` - background-color: ${props => props.contrast === "" ? "#00bcd4 !important" : "black !important"}; + background-color : #00bcd4 !important; + color : #fff !important; font-family : 'Roboto',sans-serif !important; + font-size : 14px !important; font-weight : 500 !important; padding-left : 16px !important; padding-right : 16px !important; @@ -211,7 +209,7 @@ const ButtonConfirmar = styled(Button)` font-style : inherit !important; font-variant : inherit !important; font-family : inherit !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; + text-decoration : none !important; overflow : hidden !important; display : inline-block !important; position : relative !important; @@ -224,11 +222,7 @@ const ButtonConfirmar = styled(Button)` text-align : center !important; border-radius : 3px !important; box-sizing : border-box !important; - color: ${props => props.contrast === "" ? "white !important" : "yellow !important"}; - border: ${props => props.contrast === "" ? "0 !important" : "1px solid white !important"}; - :hover{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } + border : 0 !important; ` export const ButtonCancelar = styled(Button)` @@ -244,7 +238,7 @@ export const ButtonCancelar = styled(Button)` font-style : inherit !important; font-variant : inherit !important; font-family : inherit !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; + text-decoration : none !important; overflow : hidden !important; display : inline-block !important; position : relative !important; @@ -258,17 +252,18 @@ export const ButtonCancelar = styled(Button)` border-radius : 3px !important; box-sizing : border-box !important; user-select : none !important; - color: ${props => props.contrast === "" ? "#666" : "yellow !important"}; - background-color: ${props => props.contrast === "" ? "" : "transparent !important"}; + border : 0 !important; padding : 0 6px !important; margin : 6px 8px !important; + :hover{ + background-color : #f1f1f1 !important; + } ` const ButtonsDiv = styled.div` text-align : right; margin-top : 80px; - text-decoration: underline; ` const ChangeAvatarDiv = styled.div` @@ -318,8 +313,7 @@ const ProfileAvatarDiv = styled.div` ` const HeaderContainer = styled.div` - background: ${props => props.contrast === "" ? "#afeeee" : "black"}; - border: ${props => props.contrast === "" ? "1px solid #afeeee" : "1px solid white"}; + background-color : #afeeee; position : relative; height : 150px; border-radius : 8px; diff --git a/src/Components/TabPanels/UserPageTabs/PanelFavoritos.js b/src/Components/TabPanels/UserPageTabs/PanelFavoritos.js index 4ac34bc7514659b330cbabd49cf785d3ab83573c..9cf489886054275662595ce75d29302caf0ab2a0 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelFavoritos.js +++ b/src/Components/TabPanels/UserPageTabs/PanelFavoritos.js @@ -134,14 +134,13 @@ export default function TabPanelFavoritos(props) { { loading ? ( - <LoadingSpinner contrast={props.contrast} text={'CARREGANDO...'} /> + <LoadingSpinner text={'CARREGANDO...'} /> ) : ( [ <React.Fragment> <Template - contrast={props.contrast} length={likedLearnObjs.length} titleText={likedLearnObjs.length === 1 ? "Recurso favoritado" : "Recursos favoritados"} noContentText={"Você não favoritou nenhum recurso ainda"} @@ -153,7 +152,6 @@ export default function TabPanelFavoritos(props) { /> <PanelTemplateColecao - contrast={props.contrast} title={"Coleções favoritadas"} length={likedCollections.length} noContentText={"Você ainda não curtiu nenhuma coleção."} diff --git a/src/Components/TabPanels/UserPageTabs/PanelGerenciarConta.js b/src/Components/TabPanels/UserPageTabs/PanelGerenciarConta.js index 502a5e043125bae13ef62b7111455103868aa55d..29edb847bc0aed30c5bef936117d0f95370d5958 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelGerenciarConta.js +++ b/src/Components/TabPanels/UserPageTabs/PanelGerenciarConta.js @@ -16,64 +16,59 @@ 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 Paper from '@material-ui/core/Paper'; import FormInput from "../../FormInput.js" -import { CompletarCadastroButton } from './PanelSolicitarContaProfessor.js' -import { ButtonCancelar } from './PanelEditarPerfil.js' +import {CompletarCadastroButton} from './PanelSolicitarContaProfessor.js' +import {ButtonCancelar} from './PanelEditarPerfil.js' import ValidateUserInput from '../../HelperFunctions/FormValidationFunction.js' import ModalExcluirConta from './ModalExcluirConta.js' -import { Store } from '../../../Store' -export default function TabPanelGerenciarConta(props) { - const { state } = useContext(Store) +export default function TabPanelGerenciarConta (props) { const [senhaAtual, setSenhaAtual] = useState( { - key: false, - value: localStorage.getItem("@portalmec/senha") || "" - }) + key : false, + value : localStorage.getItem("@portalmec/senha") || "" + }) const [novaSenha, setNovaSenha] = useState( { - key: false, - value: "" - }) + key : false, + value : "" + }) const [novaSenhaConfirmacao, setNovaSenhaConfirmacao] = useState( { - key: false, - value: "" - }) + key : false, + value : "" + }) const [novoEmail, setNovoEmail] = useState( { - key: false, - value: "" - }) + key : false, + value : "" + }) const handleChangeSenha = (e, type) => { const userInput = e.target.value const flag = (type === 'confirmacao' ? ValidateUserInput('confirmation', userInput, novaSenha.value) : ValidateUserInput('password', userInput)) - if (type === 'senhaAtual') { - setSenhaAtual({ - ...senhaAtual, - key: flag, - value: userInput + if(type === 'senhaAtual') { + setSenhaAtual({...senhaAtual, + key : flag, + value : userInput }) } - else if (type === 'novaSenha') { - setNovaSenha({ - ...novaSenha, - key: flag, - value: userInput + else if(type === 'novaSenha') { + setNovaSenha({...novaSenha, + key : flag, + value : userInput }) } - else if (type === 'confirmacao') { - setNovaSenhaConfirmacao({ - ...novaSenhaConfirmacao, - key: flag, - value: userInput + else if (type === 'confirmacao'){ + setNovaSenhaConfirmacao({...novaSenhaConfirmacao, + key : flag, + value : userInput }) } } @@ -82,47 +77,43 @@ export default function TabPanelGerenciarConta(props) { const userInput = e.target.value const flag = ValidateUserInput('email', userInput) - setNovoEmail({ - ...novoEmail, - key: flag, - value: userInput + setNovoEmail({...novoEmail, + key : flag, + value : userInput }) } const limpaCamposForm = () => { - setSenhaAtual({ - ...senhaAtual, - key: false, - value: '' + setSenhaAtual({...senhaAtual, + key : false, + value : '' }) - setNovaSenha({ - ...novaSenha, - key: false, - value: '' + setNovaSenha({...novaSenha, + key : false, + value : '' }) - setNovaSenhaConfirmacao({ - ...novaSenhaConfirmacao, - key: false, - value: '' + setNovaSenhaConfirmacao({...novaSenhaConfirmacao, + key : false, + value : '' }) } const onSubmit = (e, type) => { e.preventDefault() - if (type === 'senha') { + if (type === 'senha'){ if (!(senhaAtual.key || novaSenha.key || novaSenhaConfirmacao.key)) { - const info = { user: { password: novaSenha.value } } + const info = {user : {password : novaSenha.value}} props.updateUserPassword(info) limpaCamposForm() } } else { - const info = { user: { email: novoEmail.value } } + const info = {user : {email : novoEmail.value}} props.updateUserEmail(info) @@ -134,96 +125,92 @@ export default function TabPanelGerenciarConta(props) { return ( <> - <Paper elevation={3} style={{ width: "100%" }}> - <div className='card-config'> - <div className='content-div'> - <h1 className="title">Gerenciar Conta</h1> - <div style={{ display: "flex", flexDirection: "column" }}> - <form style={{ margin: "0 0 20px 0" }} onSubmit={e => onSubmit(e, 'senha')}> - <h4 className="subtitle">Alterar Senha</h4> - <FormInput - contrast={state.contrast} - inputType={"password"} - name={"Senha Atual"} - value={senhaAtual.value} - placeholder={"Senha atual"} - handleChange={e => handleChangeSenha(e, 'senhaAtual')} - required={true} - error={senhaAtual.key} - help={senhaAtual.key ? "Faltou inserir sua senha atual" : ""} - /> - <FormInput - contrast={state.contrast} - inputType={"password"} - name={"Nova senha"} - value={novaSenha.value} - placeholder={"Nova senha"} - handleChange={e => handleChangeSenha(e, 'novaSenha')} - required={true} - error={novaSenha.key} - help={novaSenha.key ? (novaSenha.value.length === 0 ? "Faltou definir uma nova senha" : "A senha precisa ter no mínimo 8 caracteres.") : ""} - /> - <FormInput - contrast={state.contrast} - inputType={"password"} - name={"Digite novamente a nova senha"} - value={novaSenhaConfirmacao.value} - placeholder={"Digite novamente a nova senha"} - handleChange={e => handleChangeSenha(e, 'confirmacao')} - required={true} - error={novaSenhaConfirmacao.key} - help={novaSenhaConfirmacao.key ? "As senhas devem ser iguais" : ""} - /> - <div style={{ display: "flex", flexDirection: "row", justifyContent: "space-evenly" }}> - <span style={{ paddingTop: "0.7em" }}><a href="recuperar-senha" className="link">Esqueceu a senha?</a></span> - <div style={{ margin: "0" }}> - <ButtonCancelar contrast={state.contrast} onClick={limpaCamposForm}>Limpar Campos</ButtonCancelar> - <CompletarCadastroButton contrast={state.contrast} type="submit">Alterar Senha</CompletarCadastroButton> - </div> - </div> - </form> + <Paper elevation={3} style= {{width:"100%"}}> + <div className='card-config'> + <div className='content-div'> + <h1>Gerenciar Conta</h1> + <div style={{display : "flex", flexDirection : "column"}}> + <form style={{margin : "0 0 20px 0"}} onSubmit={e => onSubmit(e, 'senha')}> + <h4 style={{display:"flex", justifyContent:"flex-start", fontSize:"18px"}}>Alterar Senha</h4> + <FormInput + inputType={"password"} + name={"Senha Atual"} + value={senhaAtual.value} + placeholder={"Senha atual"} + handleChange={e => handleChangeSenha(e, 'senhaAtual')} + required={true} + error={senhaAtual.key} + help={ senhaAtual.key ? "Faltou inserir sua senha atual" : ""} + /> + <FormInput + inputType={"password"} + name={"Nova senha"} + value={novaSenha.value} + placeholder={"Nova senha"} + handleChange={e => handleChangeSenha(e, 'novaSenha')} + required={true} + error={novaSenha.key} + help={ novaSenha.key ? (novaSenha.value.length === 0 ? "Faltou definir uma nova senha" : "A senha precisa ter no mínimo 8 caracteres.") : ""} + /> + <FormInput + inputType={"password"} + name={"Digite novamente a nova senha"} + value={novaSenhaConfirmacao.value} + placeholder={"Digite novamente a nova senha"} + handleChange={e => handleChangeSenha(e, 'confirmacao')} + required={true} + error={novaSenhaConfirmacao.key} + help={ novaSenhaConfirmacao.key ? "As senhas devem ser iguais" : ""} + /> + <div style={{display:"flex", flexDirection:"row", justifyContent:"space-evenly"}}> + <span style={{paddingTop:"0.7em"}}><a href="recuperar-senha" style={{textAlign: "flex-start", color:"#00bcd4"}}>Esqueceu a senha?</a></span> + <div style={{margin:"0"}}> + <ButtonCancelar onClick={limpaCamposForm}>Limpar Campos</ButtonCancelar> + <CompletarCadastroButton type="submit">Alterar Senha</CompletarCadastroButton> + </div> </div> - </div> + </form> </div> - </Paper> - <Paper elevation={3} style={{ width: "100%" }}> - <div className='card-config'> - <div className='content-div'> - <div style={{ display: "flex", flexDirection: "column" }}> - <form onSubmit={(e) => onSubmit(e, 'email')}> - <h4 className="subtitle">Alterar e-mail</h4> - <FormInput - contrast={state.contrast} - inputType={"text"} - name={"email"} - value={novoEmail.value} - placeholder={"E-mail"} - handleChange={e => handleChangeEmail(e)} - required={true} - error={novoEmail.key} - /> - <div style={{ margin: "0", display: "flex", justifyContent: "flex-start" }}> - <CompletarCadastroButton contrast={state.contrast} type="submit">SALVAR ALTERAÇÕES</CompletarCadastroButton> - </div> - </form> + </div> + </div> + </Paper> + <Paper elevation={3} style= {{width:"100%"}}> + <div className='card-config'> + <div className='content-div'> + <div style={{display : "flex", flexDirection : "column"}}> + <form onSubmit={(e) => onSubmit(e, 'email')}> + <h4 style={{display:"flex", justifyContent:"flex-start", fontSize:"18px"}}>Alterar e-mail</h4> + <FormInput + inputType={"text"} + name={"email"} + value={novoEmail.value} + placeholder={"E-mail"} + handleChange={e => handleChangeEmail(e)} + required={true} + error = {novoEmail.key} + /> + <div style={{margin:"0", display:"flex", justifyContent:"flex-start"}}> + <CompletarCadastroButton type="submit">SALVAR ALTERAÇÕES</CompletarCadastroButton> </div> - </div> + </form> </div> - </Paper> - <Paper elevation={3} style={{ width: "100%" }}> - <div className='card-config'> - <div className='content-div'> - <div> - <h4 className="subtitle">Conta</h4> - <span style={state.contrast === "" ? { margin: "0", display: "flex", justifyContent: "flex-start" } : { margin: "0", display: "flex", justifyContent: "flex-start", color: "white" }}>Antes de excluir a sua conta, saiba que ela será removida permanentemente.</span> - </div> - <div style={{ margin: "0", display: "flex", justifyContent: "flex-start" }}> - <ModalExcluirConta contrast={state.contrast} open={modalExcluir} handleClose={() => { setModalExcluir(false) }} /> - <ButtonCancelar contrast={state.contrast} style={{backgroundColor: "red", color: "white"}} onClick={() => { setModalExcluir(true) }}>EXCLUIR CONTA</ButtonCancelar> - </div> - </div> + </div> + </div> + </Paper> + <Paper elevation={3} style= {{width:"100%"}}> + <div className='card-config'> + <div className='content-div'> + <div> + <h4 style={{display:"flex", justifyContent:"flex-start", fontSize:"18px"}}>Conta</h4> + <span style={{margin:"0", display:"flex", justifyContent:"flex-start"}}>Antes de excluir a sua conta, saiba que ela será removida permanentemente.</span> + </div> + <div style={{margin:"0", display:"flex", justifyContent:"flex-start"}}> + <ModalExcluirConta open={modalExcluir} handleClose={() => {setModalExcluir(false)}}/> + <ButtonCancelar style={{color:'#eb4034'}} onClick={() => {setModalExcluir(true)}}>EXCLUIR CONTA</ButtonCancelar> </div> - </Paper> + </div> + </div> + </Paper> </> ) } diff --git a/src/Components/TabPanels/UserPageTabs/PanelMeusRecursos.js b/src/Components/TabPanels/UserPageTabs/PanelMeusRecursos.js index c4cabfeee28d66b98c3559b2f29bb89d98ab4fb6..46400fa191908298e8c373e83a5971b74da1dcf3 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelMeusRecursos.js +++ b/src/Components/TabPanels/UserPageTabs/PanelMeusRecursos.js @@ -45,7 +45,7 @@ export default function TabPanelAtividades(props) { const [drafts, setDrafts] = useState([]); const [curating, setCurating] = useState([]); - function handleSuccess(responseArr, headersArr) { + function handleSuccess(responseArr, headersArr) { setErrorInLearnObj(responseArr[0].errors ? true : false) setErrorInDrafts(responseArr[1].errors ? true : false) setErrorInCurating(responseArr[2].errors ? true : false) @@ -116,6 +116,7 @@ export default function TabPanelAtividades(props) { const showMoreDrafts = (limite) => { setLoadingMoreDrafts(true); + console.log(limite); const limit = limite; setcurrLimitDrafts(currLimitDrafts + limit) const url = `/users/${props.id}/drafts?offset=${currLimitDrafts}&limit=${limit}`; @@ -128,6 +129,7 @@ export default function TabPanelAtividades(props) { else if (data.length >= 1) { let currData = [...drafts]; currData = [...currData.concat(data)]; + console.log('drafs: ', currData); setLoadingMoreDrafts(false); setDrafts([...currData]); } @@ -176,14 +178,13 @@ export default function TabPanelAtividades(props) { { loading ? ( - <LoadingSpinner contrast={props.contrast} text={'Carregando Recursos'} /> + <LoadingSpinner text={'Carregando Recursos'} /> ) : ( [ <React.Fragment> - <Template - contrast={props.contrast} + <Template length={learningObjects.length} titleText={learningObjects.length === 1 ? "Recurso Publicado" : "Recursos Publicados"} noContentText={"Você ainda não publicou nenhum Recurso!"} @@ -195,7 +196,6 @@ export default function TabPanelAtividades(props) { /> <Template - contrast={props.contrast} length={drafts.length} titleText={drafts.length === 1 ? "Rascunho Publicado" : "Rascunhos Publicados"} noContentText={"Você não tem nenhum recurso sendo editado."} @@ -207,7 +207,6 @@ export default function TabPanelAtividades(props) { /> <TemplateCuradoria - contrast={props.contrast} length={curating.length} titleText={curating.length === 1 ? "Recurso sendo avaliado pela curadoria" : "Recursos sendo avaliados pela curadoria"} noContentText={"Você não tem nenhum recurso sendo avaliado pelos curadores."} diff --git a/src/Components/TabPanels/UserPageTabs/PanelRede.js b/src/Components/TabPanels/UserPageTabs/PanelRede.js index 5077f98c14f5add6eac3ff982265ec488d1611d5..ba5741a5044359462e57d866a74e946c4ae0d444 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelRede.js +++ b/src/Components/TabPanels/UserPageTabs/PanelRede.js @@ -131,7 +131,7 @@ export default function TabPanelRede(props) { loading ? ( [ - <LoadingSpinner contrast={props.contrast} text={'CARREGANDO...'} /> + <LoadingSpinner text={'CARREGANDO...'} /> ] ) : @@ -143,7 +143,7 @@ export default function TabPanelRede(props) { ( [ <> - <ContainerRedeVazia contrast={props.contrast} /> + <ContainerRedeVazia /> </> ] ) @@ -151,7 +151,6 @@ export default function TabPanelRede(props) { ( <React.Fragment> <PanelTemplateRede - contrast={props.contrast} title={followersList.length === 1 ? "Seguidor" : "Seguidores"} length={followersList.length} sliceArr={followersList} @@ -164,7 +163,6 @@ export default function TabPanelRede(props) { /> <PanelTemplateRede - contrast={props.contrast} title={"Seguindo"} length={followingList.length} sliceArr={followingList} diff --git a/src/Components/TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js b/src/Components/TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js index fd0e59f1fe43aff65ff0fb57ca6796a61d54f38d..6a7aa88863a342036fab9e1474437c857e3e1d37 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js +++ b/src/Components/TabPanels/UserPageTabs/PanelSolicitarContaProfessor.js @@ -16,33 +16,30 @@ 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, { useContext } from 'react' +import React, {useContext} from 'react' import { Store } from '../../../Store.js'; import styled from 'styled-components' import Button from '@material-ui/core/Button'; -import { Link } from 'react-router-dom'; - -//Image Import -import { Publicar } from "ImportImages.js"; +import {Link} from 'react-router-dom'; //3 casos -//Professor nao cadastrado (nao pediu OU submitter_request = rejected) -//Professor em análise (submitter_request = requested) -//Professor aceito (submitter_request = accepted) -export default function TabPanelSolicitarContaProfessor(props) { + //Professor nao cadastrado (nao pediu OU submitter_request = rejected) + //Professor em análise (submitter_request = requested) + //Professor aceito (submitter_request = accepted) +export default function TabPanelSolicitarContaProfessor (props) { // eslint-disable-next-line - const { state, dispatch } = useContext(Store) + const {state, dispatch} = useContext(Store) return ( <div className='card-config'> <div className='content-div'> { - !state.currentUser.roles.some(role => role.name === "teacher") && (state.currentUser.submitter_request === 'default') ? - ( + !state.currentUser.roles.some(role => role.name === "teacher") && ( state.currentUser.submitter_request === 'default' || state.currentUser.submitter_request === 'rejected' ) ? + ( <div> - <ImageDiv /> - <StyledH2 contrast={state.contrast}>Você é professor(a) da educação básica e gostaria de colaborar com a Plataforma?</StyledH2> - <StyledP contrast={state.contrast}>Ao ser identificado como professor(a), você poderá publicar e compartilhar recursos educacionais + <ImageDiv/> + <StyledH2>Você é professor(a) da educação básica e gostaria de colaborar com a Plataforma?</StyledH2> + <StyledP>Ao ser identificado como professor(a), você poderá publicar e compartilhar recursos educacionais digitais na plataforma com toda a comunidade escolar do país. </StyledP> <div> @@ -50,37 +47,28 @@ export default function TabPanelSolicitarContaProfessor(props) { pathname: '/termos-publicar-recurso', state: true }}> - <CompletarCadastroButton contrast={state.contrast}> + <CompletarCadastroButton > SIM, COMPLETAR CADASTRO </CompletarCadastroButton> </Link> </div> </div> - ) - : - ( + ) + : + ( <> - { - (() => { - switch (state.currentUser.submitter_request) { - case 'requested': - return ( - <h1 className="title">A sua conta de Professor foi solicitada</h1> - ) - case 'rejected': - return ( - <h1 className="title">Sua solicitação foi negada</h1> - ) - default: - return ( - <h1 className="title">Você já possui uma conta de Professor</h1> - ) - - } - })() - } + { + state.currentUser.submitter_request === 'requested' ? + ( + <h1>A sua conta de Professor foi solicitada</h1> + ) + : + ( + <h1>Você já possui uma conta de Professor</h1> + ) + } </> - ) + ) } </div> </div> @@ -88,8 +76,8 @@ export default function TabPanelSolicitarContaProfessor(props) { } export const CompletarCadastroButton = styled(Button)` - background-color: ${props => props.contrast === "" ? "#00bcd4 !important" : "black !important"}; - color: ${props => props.contrast === "" ? "#fff !important" : "yellow !important"}; + background-color : #00bcd4 !important; + color : #fff !important; font-family : 'Roboto',sans-serif !important; font-size : 14px !important; font-weight : bold !important; @@ -106,7 +94,7 @@ export const CompletarCadastroButton = styled(Button)` font-style : inherit !important; font-variant : inherit !important; font-family : inherit !important; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; + text-decoration : none !important; overflow : hidden !important; display : inline-block !important; position : relative !important; @@ -117,10 +105,7 @@ export const CompletarCadastroButton = styled(Button)` align-items : center !important; text-align : center !important; box-sizing : border-box !important; - border: ${props => props.contrast === "" ? "0 !important" : "1px solid white !important"}; - :hover{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } + border : 0 !important; ` const StyledP = styled.p` @@ -128,11 +113,9 @@ const StyledP = styled.p` line-height : 22px; text-align : left; padding-bottom : 20px; - color: ${props => props.contrast === "" ? "" : "white"}; ` const StyledH2 = styled.h2` - color: ${props => props.contrast === "" ? "" : "white"}; font-weight : 200; font-size : 26px; line-height : 36px; @@ -141,7 +124,7 @@ const StyledH2 = styled.h2` ` const ImageDiv = styled.div` - background-image : url(${Publicar}); + background-image : url(https://plataformaintegrada.mec.gov.br/img/Publicar.png); display : block; height : 114px; background-size : contain; diff --git a/src/Components/Table.js b/src/Components/Table.js index e9aca6ccc07690c0ae723878f3156970e7025017..773a5fffb85387a8a4571b6e80b087c85104c944 100644 --- a/src/Components/Table.js +++ b/src/Components/Table.js @@ -1,5 +1,5 @@ -import React, { useEffect, useState } from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import React from 'react'; +import { withStyles, makeStyles } from '@material-ui/core/styles'; import Table from '@material-ui/core/Table'; import TableBody from '@material-ui/core/TableBody'; import TableCell from '@material-ui/core/TableCell'; @@ -23,97 +23,59 @@ const StyledTableCell = withStyles(theme => ({ }, }))(TableCell); -const ContrastStyledTableCell = withStyles(theme => ({ - head: { - backgroundColor: 'black', - color: '#ffffff', - border: '1px solid white', - fontFamily: 'Roboto', - fontStyle: 'normal', - fontWeight: 500, - fontSize: 15, - letterSpacing: .01 +const StyledTableRow = withStyles(theme => ({ + root: { + '&:nth-of-type(odd)': { + backgroundColor: theme.palette.background.default, + }, }, - body: { - fontSize: 14, - }, -}))(TableCell); - -const ContrastStyledTableCellBody = withStyles(theme => ({ - body: { - fontSize: 14, - backgroundColor: 'black', - color: '#ffffff', - border: '1px solid white', - fontFamily: 'Roboto', - fontStyle: 'normal', - fontWeight: 500, - letterSpacing: .01 - }, -}))(TableCell); +}))(TableRow); +const useStyles = makeStyles({ + table: { + minWidth: 970, + }, +}); export default function CustomizedTables(props) { - const [columns, setColumns] = useState([]); + const classes = useStyles(); const onClick = (row) => { - const { city_name, id, name, state_name } = row - props.onClickTable(city_name, id, name, state_name) + const {city_name, id, name, state_name} = row + props.onClickTable(city_name, id, name, state_name) } - useEffect(() => { - const updatedColumns = [...props.columns]; - updatedColumns.splice(2, 2); - setColumns(updatedColumns); - }, []) - return ( - <> - <TableContainer component={Paper}> - <Table aria-label="customized table"> - <TableHead> - <TableRow> - { - columns.map((column) => - props.contrast === "" ? - <StyledTableCell align="left">{column}</StyledTableCell> - : - <ContrastStyledTableCell align="left">{column}</ContrastStyledTableCell> - ) - } - </TableRow> - </TableHead> - <TableBody> + <> + <TableContainer component={Paper}> + <Table className={classes.table} aria-label="customized table"> + <TableHead> + <TableRow> { - props.contrast === "" ? - props.rows.map((row) => { - return <TableRow onClick={() => onClick(row)} key={row.id}> - <StyledTableCell component="th" scope="row"> - {row.id} - </StyledTableCell> - <StyledTableCell align="left">{row.name}</StyledTableCell> - {/* <StyledTableCell align="left">{row.state_name}</StyledTableCell> - <StyledTableCell align="left">{row.city_name}</StyledTableCell> */} - </TableRow> - }) - : - props.rows.map((row) => { - return <TableRow onClick={() => onClick(row)} key={row.id}> - <ContrastStyledTableCellBody component="th" scope="row"> - {row.id} - </ContrastStyledTableCellBody> - <ContrastStyledTableCellBody align="left">{row.name}</ContrastStyledTableCellBody> - {/* <ContrastStyledTableCellBody align="left">{row.state_name}</ContrastStyledTableCellBody> - <ContrastStyledTableCellBody align="left">{row.city_name}</ContrastStyledTableCellBody> */} - </TableRow> - }) + props.columns.map( (column)=> + <StyledTableCell align="left">{column}</StyledTableCell> + ) } - </TableBody> - </Table> - </TableContainer> + </TableRow> + </TableHead> + <TableBody> + {props.rows.map(row => ( + <> + {console.log(row)} + <StyledTableRow onClick={() => onClick(row)} key={row.id}> + <StyledTableCell component="th" scope="row"> + {row.id} + </StyledTableCell> + <StyledTableCell align="left">{row.name}</StyledTableCell> + <StyledTableCell align="left">{row.state_name}</StyledTableCell> + <StyledTableCell align="left">{row.city_name}</StyledTableCell> + </StyledTableRow> + </> + ))} + </TableBody> + </Table> + </TableContainer> </> ); } - - diff --git a/src/Components/TermsPageContent.js b/src/Components/TermsPageContent.js index bcdcad410c05a67b7ed12659ab6afdbd245c4f29..918e040b626542c98ed6ecd83c739ac7d199ec0b 100644 --- a/src/Components/TermsPageContent.js +++ b/src/Components/TermsPageContent.js @@ -1,168 +1,169 @@ import React from 'react'; import Typography from '@material-ui/core/Typography'; +import CardContent from '@material-ui/core/CardContent'; -export default function TermsPageContent({ contrast }) { +export default function TermsPageContent () { return ( - <div style={contrast === "" ? { textAlign: "start", lineHeight: "21px", color: "rgb(102, 102, 102)", padding: "65px" } : { textAlign: "start", lineHeight: "21px", color: "white", padding: "65px", backgroundColor: "black" }}> - <Typography variant="h4" style={contrast === "" ? { textAlign: "center", color: "rgb(102, 102, 102)" } : { textAlign: "center", color: "white" }}> Antes de Prosseguir, é importante que você leia os <strong>Termos de Uso</strong></Typography> - <div> - <div> - <Typography variant="h3" style={{ textAlign: "center", fontSize: "23px", marginTop: "20px", marginBottom: "10px" }}> + <CardContent style={{textAlign: "start", marginBottom: "10px", lineHeight:"21px", color:"rgb(102, 102, 102)", padding:"65px"}}> + <Typography variant="h4" style={{textAlign:"center", color:"rgb(102, 102, 102)"}}> Antes de Prosseguir, é importante que você leia os <strong>Termos de Uso</strong></Typography> + <div classname="texto-termos"> + <div classname="title"> + <Typography variant = "h3" style={{textAlign:"center", fontSize:"23px", marginTop:"20px", marginBottom:"10px"}}> <strong>TERMOS DE USO </strong> </Typography> - <Typography variant="body2" style={contrast === "" ? { textAlign: "center", color: "rgb(102, 102, 102)" } : { textAlign: "center", color: "white" }}>Início da vigência: agosto de 2017</Typography> + <Typography variant="body2" style={{fontSize:"15px",textAlign:"center", color:"rgb(102, 102, 102)"}}>Início da vigência: agosto de 2017</Typography> </div> <p>Aqui estão os “Termos de Uso” da <strong>Plataforma Integrada de RED do MEC</strong>, isto é, as regras de funcionamento da Plataforma e seus serviços, - e o que se espera de seus usuários. Por “usuário”, entende-se qualquer pessoa que acesse o domínio portal.mec.gov.br, tanto para pesquisa - (acesso) como para a inclusão de dados e informações (participação) mediante cadastro</p> + e o que se espera de seus usuários. Por “usuário”, entende-se qualquer pessoa que acesse o domínio portal.mec.gov.br, tanto para pesquisa + (acesso) como para a inclusão de dados e informações (participação) mediante cadastro</p> <p>Fazem parte dos Termos de Uso as políticas de responsabilidade, de privacidade e confidencialidade, a licença de uso do conteúdo e as - informações sobre como reportar violações.</p> + informações sobre como reportar violações.</p> <p>Ao utilizar a <strong>Plataforma Integrada de RED do MEC</strong>, o usuário aceita todas as condições aqui estabelecidas. O uso da Plataforma Integrada de - RED do MEC implica aceite das condições aqui elencadas.</p> + RED do MEC implica aceite das condições aqui elencadas.</p> <p>Por “serviço”, entende-se qualquer funcionalidade ou ferramenta que permita a interatividade com o usuário, como, por exemplo, usuário subir - um recurso, postar um comentário, criar uma coleção ou enviar uma mensagem.</p> + um recurso, postar um comentário, criar uma coleção ou enviar uma mensagem.</p> <p>A aceitação destes "Termos de Uso" é indispensável à utilização da <strong>Plataforma Integrada de RED do MEC</strong>. Todos os usuários deverão ler, - certificar-se de tê-los entendido e aceitar todas as condições neles estabelecidas. Dessa forma, deve ficar claro que a utilização desta - "<strong>Plataforma Integrada de RED do MEC</strong>" implica aceitação completa deste documento intitulado Termos de Uso. Caso tenha dúvidas sobre os termos, - utilize o formulário disponível em “Contato” para saná-las.</p> - <Typography variant="h4" style={contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 1.Características da <strong>Plataforma Integrada de RED do MEC</strong> + certificar-se de tê-los entendido e aceitar todas as condições neles estabelecidas. Dessa forma, deve ficar claro que a utilização desta + "<strong>Plataforma Integrada de RED do MEC</strong>" implica aceitação completa deste documento intitulado Termos de Uso. Caso tenha dúvidas sobre os termos, + utilize o formulário disponível em “Contato” para saná-las.</p> + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 1.Características da <strong>Plataforma Integrada de RED do MEC</strong> </Typography> <p>A <strong>Plataforma Integrada de RED do MEC</strong> é um é sítio (website) em formato de plataforma interativa colaborativa para propiciar a formação de uma - rede de pessoas interessadas em usar, criar e compartilhar recursos e materiais educacionais. Seu objetivo é reunir e disponibilizar conteúdos do - acervo do MEC, antes distribuídos em diferentes portais (Portal do Professor, Banco Internacional de Objetos Educacionais, Domínio Público e TV Escola), - conteúdo de organizações parceiras, bem como fomentar espaços de participação, criação e compartilhamento de conhecimento entre usuários para temas - relacionados à educação básica brasileira.</p> + rede de pessoas interessadas em usar, criar e compartilhar recursos e materiais educacionais. Seu objetivo é reunir e disponibilizar conteúdos do + acervo do MEC, antes distribuídos em diferentes portais (Portal do Professor, Banco Internacional de Objetos Educacionais, Domínio Público e TV Escola), + conteúdo de organizações parceiras, bem como fomentar espaços de participação, criação e compartilhamento de conhecimento entre usuários para temas + relacionados à educação básica brasileira.</p> <p>A <strong>Plataforma Integrada de RED do MEC</strong> foi criada em software livre, cujas informações para desenvolvedores estão disponíveis em gitlab.c3sl.ufpr.br/portalmec/portalmec. - A <strong>Plataforma Integrada de RED do MEC</strong> funciona ao mesmo tempo como repositório e referatório:</p> + A <strong>Plataforma Integrada de RED do MEC</strong> funciona ao mesmo tempo como repositório e referatório:</p> <ul> - <li style={{ listStyleType: "disc" }}>Repositório: sítio na web que armazena conteúdos diversos (texto, áudio, vídeo, multimídia, etc.). Ou seja, um repositório efetivamente guarda uma cópia do recurso - educacional. Todos os conteúdos depositados na <strong>Plataforma Integrada de RED do MEC</strong> têm uma licença livre e são considerados Recursos Educacionais Abertos. - (Veja a seção 4 “Licença de uso do conteúdo”). + <li style={{listStyleType:"disc"}}>Repositório: sítio na web que armazena conteúdos diversos (texto, áudio, vídeo, multimídia, etc.). Ou seja, um repositório efetivamente guarda uma cópia do recurso + educacional. Todos os conteúdos depositados na <strong>Plataforma Integrada de RED do MEC</strong> têm uma licença livre e são considerados Recursos Educacionais Abertos. + (Veja a seção 4 “Licença de uso do conteúdo”). </li> - <li style={{ listStyleType: "disc" }}>Referatório: sítio na web que indica ou aponta para conteúdos diversos em sites externos, sem armazená-los. - Nesse caso, o conteúdo não está armazenado na <strong>Plataforma Integrada de RED do MEC</strong>, que somente indica a localização do recurso através de um link. - Os conteúdos referenciados podem ser fechados ou abertos. (Veja a seção 4, “Licença de uso do conteúdo”). + <li style={{listStyleType:"disc"}}>Referatório: sítio na web que indica ou aponta para conteúdos diversos em sites externos, sem armazená-los. + Nesse caso, o conteúdo não está armazenado na <strong>Plataforma Integrada de RED do MEC</strong>, que somente indica a localização do recurso através de um link. + Os conteúdos referenciados podem ser fechados ou abertos. (Veja a seção 4, “Licença de uso do conteúdo”). </li> </ul> <p>No que se refere ao Repositório, a <strong>Plataforma Integrada de RED do MEC</strong> disponibiliza recursos educacionais digitais e materiais de formação de seu acervo e - também permite que usuários (pessoas físicas) depositem (publiquem, façam upload) seus recursos e materiais para serem armazenados, desde que façam seu cadastro, - disponibilizem as informações necessárias no momento da publicação e respeitem as regras estabelecidas neste Termo.</p> + também permite que usuários (pessoas físicas) depositem (publiquem, façam upload) seus recursos e materiais para serem armazenados, desde que façam seu cadastro, + disponibilizem as informações necessárias no momento da publicação e respeitem as regras estabelecidas neste Termo.</p> <p>Os usuários terão acesso a uma variedade de recursos on-line. Para além, mediante cadastro, terão a sua disposição um maior número de funcionalidades, incluindo - ferramentas de comunicação e interação, mecanismos de consulta, poderão fazer upload e download de recursos educacionais digitais. Poderão utilizar serviços relacionados - à criação, à consulta e ao acompanhamento de coleções de recursos educacionais digitais de outros usuários, dentre outras funcionalidades. Professores cadastrados e - identificados poderão ainda fazer upload de RED.</p> + ferramentas de comunicação e interação, mecanismos de consulta, poderão fazer upload e download de recursos educacionais digitais. Poderão utilizar serviços relacionados + à criação, à consulta e ao acompanhamento de coleções de recursos educacionais digitais de outros usuários, dentre outras funcionalidades. Professores cadastrados e + identificados poderão ainda fazer upload de RED.</p> <p>No que se refere ao Referatório, a <strong>Plataforma Integrada de RED do MEC</strong> indica e organiza links externos para recursos e materiais de terceiros. Os recursos serão - disponibilizados mediante a adesão aos critérios específicos levantados pelo MEC. Para mais informações, utilize a página de Contato da plataforma.</p> - <Typography variant="h4" style={contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 2. Cadastro e segurança + disponibilizados mediante a adesão aos critérios específicos levantados pelo MEC. Para mais informações, utilize a página de Contato da plataforma.</p> + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 2. Cadastro e segurança </Typography> <p>A realização de cadastro pode ser exigida como condição para a utilização de determinados ambientes, recursos ou ferramentas. - O cadastramento de um usuário só será finalizado ao serem preenchidos todos os campos indicados como obrigatórios. Para o registro de sua conta, - o usuário deverá indicar uma senha e uma identificação, tornando-se responsável por mantê-las em sigilo, assumindo a total responsabilidade pelas atividades - que se realizam por meio dela. O usuário compromete-se igualmente em sair ("deslogar") de sua conta ao final de cada sessão.</p> + O cadastramento de um usuário só será finalizado ao serem preenchidos todos os campos indicados como obrigatórios. Para o registro de sua conta, + o usuário deverá indicar uma senha e uma identificação, tornando-se responsável por mantê-las em sigilo, assumindo a total responsabilidade pelas atividades + que se realizam por meio dela. O usuário compromete-se igualmente em sair ("deslogar") de sua conta ao final de cada sessão.</p> <p>Além das informações básicas, aos professores que quiserem ter a sua identidade verificada - o que o permitirá depositar recursos na plataforma (fazer upload) - - será necessário identificar a escola da rede em que atua. A mesma informação será verificada a partir dos dados do Censo Escolar.</p> + será necessário identificar a escola da rede em que atua. A mesma informação será verificada a partir dos dados do Censo Escolar.</p> <p>A <strong>Plataforma Integrada de RED do MEC</strong> não se responsabiliza pelas informações inseridas por seus usuários. Os usuários garantem e respondem, - em qualquer caso, pela veracidade, exatidão e autenticidade dos dados pessoais cadastrados. A <strong>Plataforma Integrada de RED do MEC</strong> se reserva o direito de conferir a - identificação de seus usuários, bem como de solicitar dados adicionais e documentos que julgue pertinentes, a fim de verificar os dados pessoais informados caso julgue necessário.</p> + em qualquer caso, pela veracidade, exatidão e autenticidade dos dados pessoais cadastrados. A <strong>Plataforma Integrada de RED do MEC</strong> se reserva o direito de conferir a + identificação de seus usuários, bem como de solicitar dados adicionais e documentos que julgue pertinentes, a fim de verificar os dados pessoais informados caso julgue necessário.</p> <p>Para acessar sua conta, o usuário deverá identificar-se por meio de e-mail e senha. O usuário compromete-se a não informar a terceiros sua senha, responsabilizando-se integral e - exclusivamente pelo uso que dela seja feito e pelas operações efetuadas em sua conta.</p> + exclusivamente pelo uso que dela seja feito e pelas operações efetuadas em sua conta.</p> <p>O usuário compromete-se a notificar a <strong>Plataforma Integrada de RED do MEC</strong>, por meio da funcionalidade “Contato”, sobre qualquer uso não autorizado de sua conta, assim como sobre o seu - acesso por terceiros não autorizados.</p> + acesso por terceiros não autorizados.</p> <p>Contas de usuários com informações consideradas inadequadas pela <strong>Plataforma Integrada de RED do MEC</strong>, conforme as cláusulas destes Termos de Uso, poderão ser desativadas, removidas ou - ter seu conteúdo bloqueado por decisão do Ministério da Educação. O usuário será notificado através do seu e-mail de cadastro.</p> + ter seu conteúdo bloqueado por decisão do Ministério da Educação. O usuário será notificado através do seu e-mail de cadastro.</p> <p>A criação de conta ou a disponibilização de conteúdo na <strong>Plataforma Integrada de RED do MEC</strong> não geram nenhum direito de suporte técnico ou de indenização por dificuldades - técnicas ou falhas nos sistemas. O cancelamento, a suspensão, a perda de dados armazenados, a indisponibilidade ou outra situação adversa que afete o acesso, os dados ou o conteúdo do usuário não ensejarão qualquer tipo de reparação, compensação ou outra obrigação.</p> + técnicas ou falhas nos sistemas. O cancelamento, a suspensão, a perda de dados armazenados, a indisponibilidade ou outra situação adversa que afete o acesso, os dados ou o conteúdo do usuário não ensejarão qualquer tipo de reparação, compensação ou outra obrigação.</p> <p>A <strong>Plataforma Integrada de RED do MEC</strong> não se responsabiliza por qualquer dano, prejuízo ou perda no equipamento do usuário causado por falhas no sistema, no servidor ou na - internet decorrentes de condutas de terceiros, de vírus por acesso, da utilização ou navegação na internet ou da transferência de dados.</p> - <Typography variant="h4" style={contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 3. Publicações de usuários - </Typography> + internet decorrentes de condutas de terceiros, de vírus por acesso, da utilização ou navegação na internet ou da transferência de dados.</p> + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 3. Publicações de usuários + </Typography> <p>O conteúdo disponibilizado pelo usuário é de inteira responsabilidade do usuário, não sendo a <strong>Plataforma Integrada de RED do MEC</strong> responsável por quaisquer fatos decorrentes de sua utilização.</p> <p>Os recursos publicados devem ter cunho educacional, mantendo-se dentro do assunto em que estão inseridos, em conformidade com estes Termos de Uso.</p> <p>Todas as informações publicadas na <strong>Plataforma Integrada de RED do MEC</strong>, como os metadados (descritivos dos recursos), comentários e discussões inseridas são consideradas públicas, visíveis por qualquer pessoa, sem nenhum tipo de confidencialidade. Não serão aceitos materiais que contenham vocabulário ofensivo ou desrespeitoso a terceiros, incluindo ofensas, calúnias, injúrias e difamações. Também não serão permitidos materiais que invadam a privacidade de terceiros, que sejam ameaçadoras, preconceituosas ou racistas.</p> <p>Caso o usuário entenda que alguma postagem, material, notícia, comentário ou outro conteúdo disponibilizado na <strong>Plataforma Integrada de RED do MEC</strong> violem algum direito seu, a legislação aplicável ou as cláusulas deste Termos de Uso, deverá notificar a <strong>Plataforma Integrada de RED do MEC</strong> por meio da funcionalidade “Reportar” ou, quando não houver, através do formulário de Contato.</p> <p>O spam (mensagens não solicitadas) ou o abuso em comentários poderão ser ativamente prevenidos através do bloqueio de palavras e expressões predeterminadas, ou excluídos posteriormente, sendo cabível a remoção da conta do usuário, no caso de tentativas de violação sistemática e repetitiva destes Termos de Uso, incluindo a reintrodução de material que já tenha sido previamente bloqueado ou excluído.</p> <p>Conteúdos com informações consideradas inadequadas pela <strong>Plataforma Integrada de RED do MEC</strong>, conforme as cláusulas destes Termos de Uso, poderão ser removidos por decisão do Ministério da Educação e o usuário será notificado através do seu e-mail de cadastro.</p> - <Typography variant="h5" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 3.1 É permitido ao usuário: + <Typography variant="h5" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 3.1 É permitido ao usuário: </Typography> <ul> - <li style={{ listStyleType: "disc" }}>Depositar (publicar) recurso ou material de sua autoria ou de autoria coletiva, com anuência dos demais autores, que esteja em domínio público, ou para o qual há anuência dos autores originais, desde que os dados sejam corretamente preenchidos nos campos descritivos (metadados) indicados para preenchimento das informações sobre os recursos;</li> - <li style={{ listStyleType: "disc" }}>Nos comentários, contatos e comunicações, é fundamental ser cortês e tratar os demais usuários com respeito;</li> - <li style={{ listStyleType: "disc" }}>O usuário poderá sugerir links para outros sites, desde que tenham relação direta com o assunto abordado.</li> + <li style={{listStyleType:"disc"}}>Depositar (publicar) recurso ou material de sua autoria ou de autoria coletiva, com anuência dos demais autores, que esteja em domínio público, ou para o qual há anuência dos autores originais, desde que os dados sejam corretamente preenchidos nos campos descritivos (metadados) indicados para preenchimento das informações sobre os recursos;</li> + <li style={{listStyleType:"disc"}}>Nos comentários, contatos e comunicações, é fundamental ser cortês e tratar os demais usuários com respeito;</li> + <li style={{listStyleType:"disc"}}>O usuário poderá sugerir links para outros sites, desde que tenham relação direta com o assunto abordado.</li> </ul> - <Typography variant="h5" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 3.2 É vedado ao usuário: + <Typography variant="h5" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 3.2 É vedado ao usuário: </Typography> <ul> - <li style={{ listStyleType: "disc" }}>Transmitir, exibir, enviar, ou de qualquer outra forma, disponibilizar conteúdo que contenha material pornográfico e/ou atividades ilegais relativas a menores de 18 anos (consoante o Estatuto da Criança e do Adolescente), que invada a privacidade de terceiros, que tenha cunho comercial, viole os Direitos Humanos ou seja ilegal, ofensivo, ameaçador, que incite a violência, seja vulgar, preconceituoso ou racista (como descrito nos artigos 138-140 do Código Penal Brasileiro), ou de qualquer forma seja contrário às cláusulas destes Termos de Uso;</li> - <li style={{ listStyleType: "disc" }}>Assumir a identidade de outra pessoa, física ou jurídica; forjar cabeçalhos, ou de qualquer outra forma manipular identificadores, a fim de disfarçar a origem de qualquer material contido na plataforma, com sentido de desmoralizar, desprestigiar ou se fazer passar pela <strong>Plataforma Integrada de RED do MEC</strong>;</li> - <li style={{ listStyleType: "disc" }}>Disponibilizar conteúdo em desconformidade com a legislação de Direito Autoral, incluindo conteúdo que viole marca registrada, patente, segredo de negócio, direito autoral ou qualquer outro direito de terceiro; disponibilizar conteúdo com qualquer tipo de propaganda, material promocional, spam (mensagens não solicitadas), correntes ou esquemas de pirâmide;</li> - <li style={{ listStyleType: "disc" }}>Disponibilizar conteúdo que contenha vírus ou qualquer outro código, arquivo ou programa de computador, com o propósito de interromper, destruir ou limitar a funcionalidade de qualquer software, hardware ou equipamento de telecomunicações;</li> - <li style={{ listStyleType: "disc" }}>Interferir ou interromper os serviços, as redes ou os servidores conectados à plataforma de modo a dificultar a utilização e o aproveitamento dos serviços por outros usuários, bem como obter ou tentar obter acesso não autorizado à plataforma;</li> - <li style={{ listStyleType: "disc" }}>Pedir votos, mencionar número de candidato ou expressar qualquer outra manifestação que se caracterize como propaganda política ou que viole as normas eleitorais.</li> + <li style={{listStyleType:"disc"}}>Transmitir, exibir, enviar, ou de qualquer outra forma, disponibilizar conteúdo que contenha material pornográfico e/ou atividades ilegais relativas a menores de 18 anos (consoante o Estatuto da Criança e do Adolescente), que invada a privacidade de terceiros, que tenha cunho comercial, viole os Direitos Humanos ou seja ilegal, ofensivo, ameaçador, que incite a violência, seja vulgar, preconceituoso ou racista (como descrito nos artigos 138-140 do Código Penal Brasileiro), ou de qualquer forma seja contrário às cláusulas destes Termos de Uso;</li> + <li style={{listStyleType:"disc"}}>Assumir a identidade de outra pessoa, física ou jurídica; forjar cabeçalhos, ou de qualquer outra forma manipular identificadores, a fim de disfarçar a origem de qualquer material contido na plataforma, com sentido de desmoralizar, desprestigiar ou se fazer passar pela <strong>Plataforma Integrada de RED do MEC</strong>;</li> + <li style={{listStyleType:"disc"}}>Disponibilizar conteúdo em desconformidade com a legislação de Direito Autoral, incluindo conteúdo que viole marca registrada, patente, segredo de negócio, direito autoral ou qualquer outro direito de terceiro; disponibilizar conteúdo com qualquer tipo de propaganda, material promocional, spam (mensagens não solicitadas), correntes ou esquemas de pirâmide;</li> + <li style={{listStyleType:"disc"}}>Disponibilizar conteúdo que contenha vírus ou qualquer outro código, arquivo ou programa de computador, com o propósito de interromper, destruir ou limitar a funcionalidade de qualquer software, hardware ou equipamento de telecomunicações;</li> + <li style={{listStyleType:"disc"}}>Interferir ou interromper os serviços, as redes ou os servidores conectados à plataforma de modo a dificultar a utilização e o aproveitamento dos serviços por outros usuários, bem como obter ou tentar obter acesso não autorizado à plataforma;</li> + <li style={{listStyleType:"disc"}}>Pedir votos, mencionar número de candidato ou expressar qualquer outra manifestação que se caracterize como propaganda política ou que viole as normas eleitorais.</li> </ul> - <Typography variant="h4" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 4. Licença de uso do conteúdo + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 4. Licença de uso do conteúdo </Typography> <p>A <strong>Plataforma Integrada de RED do MEC</strong>, entendida como obra intelectual em seu conjunto, é de titularidade do Ministério da Educação. Sua disponibilização ocorrerá de acordo com os termos da Licença Pública Creative Commons do tipo CC BY-SA, exceto nos casos em que for indicado de outra forma.</p> <p>A licença CC BY SA é uma licença aberta e permite que seja feita cópia, redistribuição, adaptação e criação de obras derivadas, inclusive uso comercial, desde que o autor seja referenciado e que a licença da obra derivada seja também CC BY SA, garantindo o constante caráter aberto das produções.</p> <p>Aplica-se aos códigos de software desenvolvidos pela <strong>Plataforma Integrada de RED do MEC</strong> a Licença Pública Geral Affero GNU GPL (veja a tradução livre aqui), que visa garantir a liberdade de compartilhar e de modificar softwares livres.</p> <p>O usuário que utilizar a <strong>Plataforma Integrada de RED do MEC</strong> como repositório, ou seja, para armazenamento de conteúdo, garante que detém todos os direitos e autorizações para a publicação do conteúdo e deverá escolher uma das licenças Creative Commons elencadas no formulário no momento de cadastro do material. As licenças Creative Commons relacionadas abaixo serão aceitas na <strong>Plataforma Integrada de RED do MEC</strong>, pois garantem o devido crédito pela criação original do usuário e permitem as seguintes ações de uso:</p> <ul> - <li style={{ listStyleType: "disc" }}>CC-BY: esta licença permite que outros distribuam, remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito pela criação original.</li> - <li style={{ listStyleType: "disc" }}>CC-BY-SA: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito e que licenciem as novas criações sob termos idênticos</li> - <li style={{ listStyleType: "disc" }}>CC-BY-NC: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais e, embora os novos trabalhos tenham de lhe atribuir o devido crédito e não possam ser usados para fins comerciais, os usuários não têm de licenciar esses trabalhos derivados sob os mesmos termos.</li> - <li style={{ listStyleType: "disc" }}>CC-BY-NC-SA: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais, desde que atribuam o devido crédito e que licenciem as novas criações sob termos idênticos.</li> + <li style={{listStyleType:"disc"}}>CC-BY: esta licença permite que outros distribuam, remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito pela criação original.</li> + <li style={{listStyleType:"disc"}}>CC-BY-SA: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito e que licenciem as novas criações sob termos idênticos</li> + <li style={{listStyleType:"disc"}}>CC-BY-NC: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais e, embora os novos trabalhos tenham de lhe atribuir o devido crédito e não possam ser usados para fins comerciais, os usuários não têm de licenciar esses trabalhos derivados sob os mesmos termos.</li> + <li style={{listStyleType:"disc"}}>CC-BY-NC-SA: esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais, desde que atribuam o devido crédito e que licenciem as novas criações sob termos idênticos.</li> </ul> <p>Cabe ao Usuário verificar a compatibilidade da licença do material obtido na <strong>Plataforma Integrada de RED do MEC</strong> para utilizar em outras produções. Para consultar a compatibilidade das licenças Creative Commons, há uma ferramenta disponível no site Iniciativa Educação Aberta</p> <p>O usuário da <strong>Plataforma Integrada de RED do MEC</strong> responde por todo o conteúdo publicado por meio de seu perfil, inclusive no que diz respeito à violação dos direitos autorais relacionados a tais postagens. Ao inserir um conteúdo de sua autoria para armazenamento, o usuário concorda e autoriza o licenciamento ao escolher uma das licenças abertas descritas no formulário de publicação, de forma a permitir não só o seu reconhecimento pleno de autoria, como também a possibilidade de replicação, reedição e reformulação de suas postagens por terceiros, com o objetivo de possibilitar o compartilhamento e a reutilização de conteúdo educacional.</p> <p>A <strong>Plataforma Integrada de RED do MEC</strong> poderá disponibilizar endereços eletrônicos de outros sítios externos, por meio de links, o que não significa que estes sejam de sua propriedade ou por ele operados. A presença de links para outros sites não implica relação de sociedade ou de supervisão da <strong>Plataforma Integrada de RED do MEC</strong> com esses sites e seus conteúdos. Os campos descritivos de cada recurso conterão informações específicas sobre as licenças dos mesmos. Cabe ao usuário verificar a licença de cada recurso.</p> <p>É vedado o uso não autorizado da obra ou seu uso em desconformidade com a legislação autoral e com os termos da licença mencionada.</p> - <Typography variant="h4" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 5. Práticas de uso e armazenamento + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 5. Práticas de uso e armazenamento </Typography> <p>A depender da capacidade de espaço no servidor, a <strong>Plataforma Integrada de RED do MEC</strong> poderá retirar conteúdos armazenados na plataforma, observados os critérios de antiguidade e do tamanho dos arquivos disponibilizados, mediante notificação e justificativa ao usuário.</p> - <Typography variant="h4" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 6. Privacidade da informação + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 6. Privacidade da informação </Typography> <p>A <strong>Plataforma Integrada de RED do MEC</strong> tomará todas as medidas possíveis para manter a confidencialidade e a segurança de suas informações. No entanto, a <strong>Plataforma Integrada de RED do MEC</strong> não responderá por prejuízos que possam ser derivados da violação dessas medidas por parte de terceiros que subvertam os sistemas de segurança para acessar as informações de Usuários. A <strong>Plataforma Integrada de RED do MEC</strong> solicitará alguns dados pessoais para seu cadastro. Além disso, dados sobre a interação dos usuários e seu comportamento na plataforma são coletados de maneira automática. Esses dados nunca serão vendidos, alugados, trocados ou fornecidos para fins comerciais. No entanto, o MEC poderá colaborar com instituições públicas parceiras, como universidades, para análise desses dados bem como de qualquer conteúdo da plataforma para para fins de pesquisa, divulgação e melhoria dos serviços. Dados pessoais que possam identificá-lo nunca serão compartilhados. Dados que não identificam o usuário serão armazenados indefinidamente para fins de pesquisa.</p> - <Typography variant="h4" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 7. Violação no sistema ou na base de dados + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 7. Violação no sistema ou na base de dados </Typography> <p>O responsável por qualquer intromissão, ou tentativa de intromissão, na <strong>Plataforma Integrada de RED do MEC</strong> ou por atividade que viole ou contrarie as disposições legais aplicáveis ou as cláusulas destes Termos de Uso estará sujeito à aplicação das sanções previstas neste instrumento, das ações legais pertinentes e de indenizações por eventuais danos causados.</p> - <Typography variant="h4" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}>8. Sanções</Typography> + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}>8. Sanções</Typography> <p>Sem prejuízo de outras medidas, a <strong>Plataforma Integrada de RED do MEC</strong> poderá advertir, bloquear, desativar ou remover, temporária ou definitivamente, a conta e conteúdos disponibilizados por um usuário, em qualquer momento, e iniciar as ações legais cabíveis caso:</p> <ul> - <li style={{ listStyleType: "disc" }}>o usuário não cumprir qualquer dispositivo destes Termos de Uso;</li> - <li style={{ listStyleType: "disc" }}>o usuário praticar atos fraudulentos ou dolosos;</li> - <li style={{ listStyleType: "disc" }}>o MEC entender que as postagens, o conteúdo disponibilizado ou qualquer atitude do usuário tenham causado algum dano a terceiros ou à própria Plataforma, ou tenham a potencialidade de assim o fazer.</li> + <li style={{listStyleType:"disc"}}>o usuário não cumprir qualquer dispositivo destes Termos de Uso;</li> + <li style={{listStyleType:"disc"}}>o usuário praticar atos fraudulentos ou dolosos;</li> + <li style={{listStyleType:"disc"}}>o MEC entender que as postagens, o conteúdo disponibilizado ou qualquer atitude do usuário tenham causado algum dano a terceiros ou à própria Plataforma, ou tenham a potencialidade de assim o fazer.</li> </ul> - <Typography variant="h4" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}>9. Limitação de responsabilidade</Typography> + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}>9. Limitação de responsabilidade</Typography> <p>Em nenhuma situação a <strong>Plataforma Integrada de RED do MEC</strong> e o Ministério da Educação serão responsáveis por quaisquer danos, prejuízos ou outro efeito, direto ou indireto, relacionados ao uso, por parte de seus usuários, leitores ou de qualquer outra pessoa, deste sítio, de seu conteúdo ou de qualquer outro website mencionado.</p> <p>O usuário reconhece que será integralmente responsável pelos materiais enviados à <strong>Plataforma Integrada de RED do MEC</strong> e se compromete a responder por quaisquer reivindicações, demandas, penalidades e todos os danos, perdas e despesas, causados à <strong>Plataforma Integrada de RED do MEC</strong>.</p> <p>Todo autor de conteúdo exibido na <strong>Plataforma Integrada de RED do MEC</strong> retém os seus direitos e responsabilidades autorais, nos termos da Lei n. 9.610/1998, sem prejuízo dos termos de licenciamento de livre uso, conforme exposto nestes Termos de Uso, no item “Licença de uso do conteúdo”.</p> <p>Se o usuário verificar que qualquer comentário ou participação na <strong>Plataforma Integrada de RED do MEC</strong> infringem um direito de sua titularidade ou de um terceiro, deverá entrar em contato imediatamente na forma indicada neste mesmo documento, no item “Como reportar violações”.</p> - <Typography variant="h4" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 10. Inexistência de vínculo + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 10. Inexistência de vínculo </Typography> <p>A adesão a estes Termos de Uso pelo usuário não gera nenhum contrato, mandato, franquia ou vínculo de tipo trabalhista, societário, de parceria ou associativo entre a <strong>Plataforma Integrada de RED do MEC</strong> e o usuário.</p> - <Typography variant="h4" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}>11. Como reportar violações</Typography> + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}>11. Como reportar violações</Typography> <p>Nem todo o conteúdo disponibilizado pelo usuário nas áreas de comentário e debates é lido pela administração da <strong>Plataforma Integrada de RED do MEC</strong>.</p> <p>Se algum artigo, notícia, comentário ou outro conteúdo da <strong>Plataforma Integrada de RED do MEC</strong> violar qualquer direito do usuário, de terceiros ou a legislação aplicável, o usuário poderá usar a funcionalidade "Reportar" nas páginas que houver essa opção ou, quando não houver, entrar em contato com a administração da <strong>Plataforma Integrada de RED do MEC</strong> pelo formulário de “Contato”, mencionando de forma específica e detalhada a violação.</p> <p>De posse das informações, a <strong>Plataforma Integrada de RED do MEC</strong> poderá analisar e resolver a questão tão breve quanto possível. Caso a informação esteja incompleta, ou com detalhamento insuficiente, a <strong>Plataforma Integrada de RED do MEC</strong> poderá entrar em contato para solicitar a complementação, possivelmente atrasando a providência desejada.</p> - <Typography variant="h4" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 12. Modificações nos Termos de Uso + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 12. Modificações nos Termos de Uso </Typography> <p>A <strong>Plataforma Integrada de RED do MEC</strong> poderá alterar, a qualquer tempo, estes Termos de Uso, mediante declaração pública no site, visando seu aprimoramento e melhoria dos serviços prestados. Os novos Termos de Uso entrarão em vigor a partir de sua publicação na plataforma. Usuários cadastrados receberão notificação dessa alteração no e-mail de cadastro e haverá divulgação/chamada na página principal do Sistema. No prazo de 72 (setenta e duas) horas, - contadas a partir da publicação das modificações, o usuário poderá comunicar-se com a <strong>Plataforma Integrada de RED do MEC</strong>, caso não concorde com os novos Termos de Uso. Nesse caso, a conta do usuário será desativada. Não havendo manifestações no prazo estipulado, entender-se-á que o Usuário aceitou tacitamente os novos Termos de Uso.</p> - <Typography variant="h4" style = { contrast === "" ? { color: "rgb(102, 102, 102)", fontWeight: "300" } : { color: "white", fontWeight: "300" }}> - 13. Foro + contadas a partir da publicação das modificações, o usuário poderá comunicar-se com a <strong>Plataforma Integrada de RED do MEC</strong>, caso não concorde com os novos Termos de Uso. Nesse caso, a conta do usuário será desativada. Não havendo manifestações no prazo estipulado, entender-se-á que o Usuário aceitou tacitamente os novos Termos de Uso.</p> + <Typography variant="h4" style={{fontWeight:"300", color:"rgb(102, 102, 102)"}}> + 13. Foro </Typography> <p>Para dirimir dúvidas ou litígios referentes à interpretação e ao cumprimento destes Termos de Uso, as partes se submeterão ao Foro da Justiça Federal, Seção Judiciária do Distrito Federal.</p> </div> - </div > + </CardContent> ) } diff --git a/src/Components/TopicCard.js b/src/Components/TopicCard.js index 0ec3baf94df27d92af2e5d5d8e6783a3e44bdeca..1f3bb10faef2737441cea49be8b331a26edf8a21 100644 --- a/src/Components/TopicCard.js +++ b/src/Components/TopicCard.js @@ -26,22 +26,24 @@ import Button from '@material-ui/core/Button'; import { Link } from 'react-router-dom'; export default function MaterialCard(props) { + console.log(props); const thumb = require(`../../public/${props.topic.img}`) return ( - <Card className={`${props.contrast}BackColor ${props.contrast}Border`} style={{ maxHeight: "100%", maxWidth: "300px" }}> + <Card style={{ maxHeight: "100%", maxWidth: "300px" }}> <img style={{ maxHeight: "100%", maxWidth: "100%" }} src={thumb} alt="thumbnail do recurso" /> - <CardContent className={`${props.contrast}Text`} style={{ height: "50px" }}> + <CardContent style={{ height: "50px" }}> <Title> - {props.topic.pre_title} + <BoldTitle> + {props.topic.pre_title} + </BoldTitle> {props.topic.title} </Title> </CardContent> - <CardActions style={{ justifyContent: "center" }}> - <StyledLink className={`${props.contrast}LinkColor`} to={"topico?colecao=" + props.colecao_id + "&topico=" + props.topic.id}> + <CardActions style={{ borderTop: "1px solid #e5e5e5", justifyContent: "center" }}> + <StyledLink to={"topico?colecao=" + props.colecao_id + "&topico=" + props.topic.id}> <Button - className={`${props.contrast}LinkColor`} - style={props.contrast === "" ? {color: "#e8224f"} : {color: "white"}} + color="secondary" > Ver módulo </Button> @@ -53,6 +55,7 @@ export default function MaterialCard(props) { const Title = styled(Typography)` font-weight: 500; + color: rgb(102, 102, 102); font-size: 0.9em; margin-left: 10px; margin-right: 10px; @@ -62,6 +65,10 @@ const Title = styled(Typography)` -webkit-box-orient: vertical; overflow: hidden; ` +const BoldTitle = styled.span` + font-weight: bold; +` const StyledLink = styled(Link)` + text-decoration: none !important; color: inherit !important; ` \ No newline at end of file diff --git a/src/Components/TopicFooter.js b/src/Components/TopicFooter.js index d6e33341361a023add43ada4b4ff4319ba598a63..c6ce8ea42ddf97ec278bc6cd63e779b4cd28ec5e 100644 --- a/src/Components/TopicFooter.js +++ b/src/Components/TopicFooter.js @@ -4,7 +4,7 @@ import Grid from '@material-ui/core/Grid'; export default function TopicFooter(props) { return ( - <Container contrast={props.contrast}> + <Container> <Wrapper> <Grid container @@ -30,8 +30,7 @@ export default function TopicFooter(props) { const Container=styled.div` margin-top: 15px; - background: ${props => props.contrast === "" ? "#e81f4f" : "black"}; - border-top: ${props => props.contrast === "" ? "0" : "1px solid white"}; + background-color: #e81f4f; height: auto; padding: 0; ` diff --git a/src/Components/TopicList.js b/src/Components/TopicList.js index ba5d8eedb56627943633e6bef5076c7b3a747976..e965adad1b530fbf96d090fa028b1fc83ebad01a 100644 --- a/src/Components/TopicList.js +++ b/src/Components/TopicList.js @@ -15,7 +15,7 @@ export default function TopicList(props) { return ( <Wrapper> - <Title contrast={props.contrast}>Módulos</Title> + <Title>Módulos</Title> <Grid container spacing={3} @@ -25,7 +25,7 @@ export default function TopicList(props) { {props.topicos.slice(0, (expanded ? -1 : 5)).map((t, index) => { return ( <Grid item key={index} md={3}> - <TopicCard contrast={props.contrast} topic={t} colecao_id={props.colecao_id} /> + <TopicCard topic={t} colecao_id={props.colecao_id} /> </Grid> ); }) @@ -38,12 +38,12 @@ export default function TopicList(props) { alignItems="center" > <Grid item> - <Fab size="medium" color="secondary" aria-label="edit" onClick={handleFabClick} style={props.contrast === "" ? { marginTop: "1em" } : { backgroundColor: "black", border: "1px solid yellow", marginTop: "1em" }}> - {expanded ? <ExpandLessIcon style={props.contrast === "" ? {color: "white"} : {color: "yellow"}} /> : <ExpandMoreIcon style={props.contrast === "" ? {color: "white"} : {color: "yellow"}}/>} + <Fab size="medium" color="secondary" aria-label="edit" onClick={handleFabClick}> + {expanded ? <ExpandLessIcon /> : <ExpandMoreIcon />} </Fab> </Grid> <Grid item> - <FabText contrast={props.contrast}> + <FabText> {expanded ? "VER MENOS" : "VER TODOS OS MÓDULOS"} </FabText> </Grid> @@ -55,14 +55,14 @@ export default function TopicList(props) { } const FabText = styled.span` - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; font-weight: 900; line-height: 2em; ` const Title = styled.h1` font-weight: 100; margin-left: 30px; - color: ${props => props.contrast === "" ? "rgb(102, 102, 102)" : "white"}; + color: rgb(102, 102, 102); ` const Wrapper = styled.div` margin-right : auto; diff --git a/src/Components/UploadPageComponents/ButtonsDiv.js b/src/Components/UploadPageComponents/ButtonsDiv.js index a1ac74f01571780556c2f81803d224c62fa5ae90..8e4d194578dc53db54ff9934e9aef996e4582026 100644 --- a/src/Components/UploadPageComponents/ButtonsDiv.js +++ b/src/Components/UploadPageComponents/ButtonsDiv.js @@ -28,7 +28,6 @@ export default function ButtonsDiv(props) { return ( <> <ModalCancelar - contrast={props.contrast} open={modalCancelar} handleClose={() => { toggleModalCancelar(false) }} draftID={props.draftID} @@ -42,34 +41,34 @@ export default function ButtonsDiv(props) { {/*botao excluir na pagina de editar*/} <Grid item> - <GreyButton contrast={props.contrast} onClick={() => { toggleModalCancelar(true) }}> + <GreyButton onClick={() => { toggleModalCancelar(true) }}> <span className="button-text"> CANCELAR - </span> + </span> </GreyButton> </Grid> { props.onPartTwo && <Grid item> - <GreyButton contrast={props.contrast} onClick={() => { props.stepperControl(-1) }}> + <GreyButton onClick={() => { props.stepperControl(-1) }}> <span className="button-text"> VOLTAR - </span> + </span> </GreyButton> </Grid> } <Grid item> - <GreyButton contrast={props.contrast} onClick={() => { if (window.confirm('O seu recurso em edição foi salvo.')) toggleRedirect(true) }}> + <GreyButton onClick={() => { if (window.confirm('O seu recurso em edição foi salvo.')) toggleRedirect(true) }}> <span className="button-text"> CONTINUAR MAIS TARDE - </span> + </span> </GreyButton> </Grid> <Grid item> - <OrangeButton contrast={props.contrast} type="submit"> + <OrangeButton type="submit"> SALVAR E AVANÇAR </OrangeButton> </Grid> diff --git a/src/Components/UploadPageComponents/ChooseLinkSection.js b/src/Components/UploadPageComponents/ChooseLinkSection.js index 19186952a25f13c2c33f04d04a8542b03a7c1308..52a14ae21b18fb4c190effa4ba4d9ecfaca6d1f0 100644 --- a/src/Components/UploadPageComponents/ChooseLinkSection.js +++ b/src/Components/UploadPageComponents/ChooseLinkSection.js @@ -16,107 +16,81 @@ 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} from 'react' import UndoIcon from '@material-ui/icons/Undo'; -import { WrapperBox, StyledTextField, BlueButton, GrayButton } from './StyledComponents.js' -import { makeStyles } from "@material-ui/styles"; +import {WrapperBox, StyledTextField, BlueButton, GrayButton} from './StyledComponents.js' -const useStyles = makeStyles(theme => ({ - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "white", - width: "100%" - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "black", - width: "100%" - } -})); - -export default function ChooseLink(props) { - const classes = useStyles(); - const [linkSent, setLinkSent] = useState(false) - const [link, setLink] = useState({ flag: false, value: "" }) - const handleLink = (e) => { - let userInput = e.target.value - const urlRegex = new RegExp( - // eslint-disable-next-line - "(?:(?:(?:https?|ftp):\/\/))(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})*(?:[/?#]\S*)?", "i" - ) - let flag = !(urlRegex.test(userInput)) - setLink({ - ...link, - flag: flag, - value: userInput +export default function ChooseLink (props) { + const [linkSent, setLinkSent] = useState(false) + const [link, setLink] = useState({flag : false, value : ""}) + const handleLink = (e) => { + let userInput = e.target.value + const urlRegex = new RegExp( + // eslint-disable-next-line + "(?:(?:(?:https?|ftp):\/\/))(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})*(?:[/?#]\S*)?", "i" + ) + let flag = !(urlRegex.test(userInput)) + setLink({...link, + flag : flag, + value : userInput} + ) } - ) - } - const handleSubmit = (e) => { - e.preventDefault() - if (!link.flag) { - props.submit(link.value) - setLinkSent(true) + const handleSubmit = (e) => { + e.preventDefault() + console.log(link.flag) + if (!link.flag) { + props.submit(link.value) + setLinkSent(true) + } } - } - return ( - <WrapperBox contrast={props.contrast}> - <div className="inner"> - <div className="upload-title"> Enviar Link</div> + return ( + <WrapperBox> + <div className="inner"> + <div className="upload-title"> Enviar Link</div> - <div className="flex-column"> - <p>Insira o link da página do recurso abaixo:</p> - { - !linkSent ? - <form onSubmit={(e) => { handleSubmit(e) }}> - <StyledTextField - contrast={props.contrast} - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} - id={"choose-link-form"} - label={"Exemplo: http://google.com"} - type={"text"} - variant="outlined" - value={link.value} - onChange={e => { handleLink(e) }} - helperText={link.flag ? "Faltou inserir um endereço eletrônico" : ""} - multiline={true} - rowsMax={"10"} - rows={1} - error={link.flag} - required={true} - /> + <div className="flex-column"> + <p>Insira o link da página do recurso abaixo:</p> + <form onSubmit={(e) => {handleSubmit(e)}}> + <StyledTextField + id = {"choose-link-form"} + label={"Exemplo: http://google.com"} + type = {"text"} + value = {link.value} + onChange = {e => {handleLink(e)}} + helperText = {link.flag ? "Faltou inserir um endereço eletrônico" : ""} + multiline={true} + rowsMax = {"10"} + rows={1} + error = {link.flag} + required = {true} + disabled={linkSent} + /> - <div className="buttons-div"> - <> - <GrayButton contrast={props.contrast} onClick={() => { props.handleNextStage("default") }}> - <span className="button-text"> - <UndoIcon className="icon" />Voltar - </span> - </GrayButton> - <BlueButton contrast={props.contrast} type="submit">SALVAR</BlueButton> - </> + <div className="buttons-div"> + { + linkSent ? + ( + <BlueButton onClick={() => {setLinkSent(false)}}>Editar</BlueButton> + ) + : + ( + <> + <GrayButton onClick={() => {props.handleNextStage("default")}}> + <span className="button-text"> + <UndoIcon className="icon"/>Voltar + </span> + </GrayButton> + <BlueButton type="submit">SALVAR</BlueButton> + </> + ) + } + </div> + </form> </div> - </form> - : - <> - <p> - O link salvado foi: <a style={props.contrast === "" ? {} : { color: "yellow", textDecoration: "underline" }} href={link.value}>{link.value}</a> - </p> - <div className="buttons-div"> - <BlueButton contrast={props.contrast} onClick={() => { setLinkSent(false) }}>Editar</BlueButton> - </div> - </> - - } - </div> - </div> - </WrapperBox > - ) + </div> + </WrapperBox> + ) } diff --git a/src/Components/UploadPageComponents/Forms/Autor.js b/src/Components/UploadPageComponents/Forms/Autor.js index 5dec5827e420e25360400f09dedcf363c5cb8b55..4ab8bde9e9db318c225064eecd79aab7f3dda421 100644 --- a/src/Components/UploadPageComponents/Forms/Autor.js +++ b/src/Components/UploadPageComponents/Forms/Autor.js @@ -16,56 +16,28 @@ 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, memo, useContext } from 'react' -import { Store } from '../../../Store.js' +import React, {useState, memo, useContext} from 'react' +import {Store} from '../../../Store.js' import { withStyles } from '@material-ui/core/styles'; -import { yellow, blue } from "@material-ui/core/colors"; + import FormControl from '@material-ui/core/FormControl'; -import { StyledFormLabel, OutroAutorTextField } from '../StyledComponents.js' +import { StyledFormLabel, OutroAutorTextField} from '../StyledComponents.js' import RadioGroup from '@material-ui/core/RadioGroup'; import Radio from '@material-ui/core/Radio'; import FormControlLabel from '@material-ui/core/FormControlLabel'; -import { makeStyles } from "@material-ui/styles"; - -const useStyles = makeStyles(theme => ({ - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "white", - width: "100%", - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "black", - width: "100%", - } -})); const BlueRadio = withStyles({ - root: { - color: blue[400], - '&$checked': { - color: blue[600], - }, - }, -})((props) => <Radio color="default" {...props} />); - -const ContrastRadio = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, + root: { + color: '#666', + '&$checked': { + color: '#00bcd4', }, - checked: {}, + }, + checked: {}, })((props) => <Radio color="default" {...props} />); -function Autor(props) { - const classes = useStyles(); - const { state } = useContext(Store) +function Autor (props) { + const {state} = useContext(Store) const [authorValue, setAuthorValue] = useState(props.initialValue ? props.initialValue : -1) const [outroAutor, setOutroAutor] = useState(props.initialOutroAutor ? props.initialOutroAutor : '') @@ -74,29 +46,26 @@ function Autor(props) { } return ( - <FormControl required={true} style={{ width: "100%" }} onBlur={() => { props.onBlurCallback("author", getAuthor(), props.draftID) }}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> + <FormControl required={true} style={{width : "100%"}} onBlur={() => {props.onBlurCallback("author", getAuthor(), props.draftID)}}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> <b>Autor do recurso</b> </StyledFormLabel> - <RadioGroup ara-label="Autor do Recurso" name="Autor do Recurso" value={authorValue} onChange={(e) => { setAuthorValue(e.target.value) }}> - <FormControlLabel value="0" control={props.contrast === "" ? <BlueRadio /> : <ContrastRadio />} label="Sou o(a) autor(a) deste recurso" /> - <FormControlLabel value="1" control={props.contrast === "" ? <BlueRadio /> : <ContrastRadio />} + <RadioGroup ara-label="Autor do Recurso" name="Autor do Recurso" value={authorValue} onChange={(e) => {setAuthorValue(e.target.value)}}> + <FormControlLabel value="0" control={<BlueRadio />} label="Sou o(a) autor(a) deste recurso"/> + <FormControlLabel value="1" control={<BlueRadio/>} label={ - <div style={{ display: "flex", alignItems: "center" }}> + <div style={{display : "flex", alignItems : "center"}}> Outro: <OutroAutorTextField - variant="outlined" - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} - contrast={props.contrast} - id={"outro-autor-form"} - label={"Nome dos autores"} - type={"text"} - value={outroAutor} - onChange={e => { setOutroAutor(e.target.value) }} + id = {"outro-autor-form"} + placeholder={"Nome dos autores"} + type = {"text"} + value = {outroAutor} + onChange = {e => {setOutroAutor(e.target.value)}} fullWidth multiline - disabled={authorValue === "0"} - style={{ paddingLeft: "5px", width: "100%" }} + disabled = {authorValue === "0"} + style={{paddingLeft : "5px", width : "100%"}} /> </div>} /> diff --git a/src/Components/UploadPageComponents/Forms/Idioma.js b/src/Components/UploadPageComponents/Forms/Idioma.js index bf8b875f23f1d69969dad439abe2c892749c975d..79de2d04f8be2e66ca72f772679999af94e06b78 100644 --- a/src/Components/UploadPageComponents/Forms/Idioma.js +++ b/src/Components/UploadPageComponents/Forms/Idioma.js @@ -16,105 +16,56 @@ 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} from 'react' import FormControl from '@material-ui/core/FormControl'; -import { StyledFormLabel } from '../StyledComponents.js' +import {StyledFormLabel} from '../StyledComponents.js' +import ListItemText from '@material-ui/core/ListItemText'; import Checkbox from '@material-ui/core/Checkbox'; -import { withStyles } from '@material-ui/core/styles'; -import { yellow, blue } from "@material-ui/core/colors"; -import FormControlLabel from '@material-ui/core/FormControlLabel'; -import FormGroup from '@material-ui/core/FormGroup'; +import MenuItem from '@material-ui/core/MenuItem'; +import Select from '@material-ui/core/Select'; -const BlueCheckBox = withStyles({ - root: { - color: blue[400], - '&$checked': { - color: blue[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -const ContrastCheckBox = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -export default function Idioma(props) { +export default function Idioma (props) { const [chosenLanguage, setChosenLanguage] = useState(props.initialValue ? props.initialValue : []) const [ids, setIds] = useState(props.initialIDValue ? props.initialIDValue : []) - const handleChangeLanguage = (language) => { - const languageIndex = chosenLanguage.indexOf(language.name); - const copyChosenLanguages = [...chosenLanguage]; - const copyIds = [...ids] - - if (languageIndex > -1) { - copyChosenLanguages.splice(languageIndex, 1); - copyIds.splice(languageIndex, 1); + const handleChangeLanguage = (event) => { + let newLanguage = event.target.value.pop() + if (!chosenLanguage.some(language => language === newLanguage.name)) { + setChosenLanguage(chosenLanguage => [...chosenLanguage, newLanguage.name]); + setIds(ids => [...ids, newLanguage.id]) } - else { - copyChosenLanguages.push(language.name); - copyIds.push(language.id); + else + { + if (chosenLanguage.length > 0) { + setChosenLanguage(chosenLanguage.filter((language) => {return language !== newLanguage.name})); + setIds(ids.filter((id) => {return id !== newLanguage.id})) + } } - - setChosenLanguage(copyChosenLanguages); - setIds(copyIds); - - // if (!chosenLanguage.some(language => language === newLanguage.name)) { - // setChosenLanguage(chosenLanguage => [...chosenLanguage, newLanguage.name]); - // setIds(ids => [...ids, newLanguage.id]) - // } - // else { - // if (chosenLanguage.length > 0) { - // setChosenLanguage(chosenLanguage.filter((language) => { return language !== newLanguage.name })); - // setIds(ids.filter((id) => { return id !== newLanguage.id })) - // } - // } }; return ( - <FormControl style={{ minWidth: "30%" }}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> + <FormControl style={{minWidth : "30%"}}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> <b>Idioma</b><span>*</span> </StyledFormLabel> - - <FormGroup row onBlur={() => { props.onBlurCallback("language_ids", ids, props.draftID) }}> - { - props.languages.map((language) => { - return <FormControlLabel - value={language} - key={language.name} - control={props.contrast === "" ? <BlueCheckBox checked={chosenLanguage.indexOf(language.name) > -1} onChange={() => handleChangeLanguage(language)} /> : <ContrastCheckBox checked={chosenLanguage.indexOf(language.name) > -1} onChange={() => handleChangeLanguage(language)} />} - label={<span style={props.contrast === "" ? {} : { color: "yellow", textDecoration: "underline" }}>{language.name}</span>} - /> - }) - } - </FormGroup> - - {/* <Select + <Select value={chosenLanguage} multiple renderValue={(selected) => selected.join(', ')} name="Idioma" onChange={handleChangeLanguage} - onBlur={() => { props.onBlurCallback("language_ids", ids, props.draftID) }} + onBlur={() => {props.onBlurCallback("language_ids", ids, props.draftID)}} > { - props.languages.map(language => + props.languages.map( language => <MenuItem key={language.name} value={language}> <Checkbox checked={chosenLanguage.indexOf(language.name) > -1} /> <ListItemText primary={language.name} /> </MenuItem> ) } - </Select> */} + </Select> </FormControl> ) } diff --git a/src/Components/UploadPageComponents/Forms/Keywords.js b/src/Components/UploadPageComponents/Forms/Keywords.js index 428047106c25ecbb2685973d3369ddfe7de01e2d..fa2418b706dc96f56f88f60f7ef1014fd66b40dd 100644 --- a/src/Components/UploadPageComponents/Forms/Keywords.js +++ b/src/Components/UploadPageComponents/Forms/Keywords.js @@ -16,36 +16,16 @@ 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, memo, useEffect, useRef } from 'react' +import React, {useState, memo, useEffect, useRef} from 'react' import FormControl from '@material-ui/core/FormControl'; -import { StyledTextField, StyledFormLabel } from '../StyledComponents.js' -import styled from 'styled-components'; -import DeleteIcon from '@material-ui/icons/Delete'; +import {StyledTextField, StyledFormLabel} from '../StyledComponents.js' +import FormHelperText from '@material-ui/core/FormHelperText'; +import Chip from '@material-ui/core/Chip'; -import { makeStyles } from "@material-ui/styles"; -import { Chip } from '@material-ui/core'; +function Keywords (props) { -const useStyles = makeStyles(theme => ({ - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "white", - width: "100%", - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "black", - width: "100%", - } -})); - -function Keywords(props) { - const classes = useStyles(); const [keywords, setKeywords] = useState(props.initialValue ? props.initialValue : []) - const handleSetKeywords = (newKeyword) => { setKeywords(newKeyword) } + const handleSetKeywords = (newKeyword) => {setKeywords(newKeyword)} const deleteKeyword = (keywordToDelete) => { handleSetKeywords(keywords.filter((keyword) => keyword !== keywordToDelete)) } @@ -53,19 +33,19 @@ function Keywords(props) { const resettingRef = useRef(false); useEffect(() => { - if (resettingRef.current) { //used to ensure that keywords are updated before sending (after a delete) - resettingRef.current = false; - props.onBlurCallback("tags", keywords, props.draftID); + if(resettingRef.current){ //used to ensure that keywords are updated before sending (after a delete) + resettingRef.current = false; + props.onBlurCallback("tags", keywords, props.draftID); } - }, [keywords]) + },[keywords]) const [keywordsBuffer, setKeywordsBuffer] = useState('') const handleKeywords = (event) => { let userInput = event.target.value; - if (userInput.indexOf(',') !== -1) { - if (userInput.length > 1) { + if(userInput.indexOf(',') !== -1 ) { + if(userInput.length > 1) { handleSetKeywords([...keywords, userInput.split(',')[0]]) } setKeywordsBuffer('') @@ -78,45 +58,40 @@ function Keywords(props) { return ( <React.Fragment> - <FormControl required={true} style={{ width: "100%" }}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> + <FormControl required={true} style={{width : "100%"}}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> <b>Palavras-chave para buscar o Recurso</b> - <span style={props.contrast === "" ? { color: "#a5a5a5", paddingLeft: "10px" } : { color: "white", paddingLeft: "10px" }}> - (Use vírgula ou enter para separar as palavras-chave)</span> + <span style={{color : "#a5a5a5", paddingLeft : "10px"}}> + (Use vírgula ou enter para separar as palavras-chave)</span> </StyledFormLabel> <StyledTextField - contrast={props.contrast} - variant='outlined' - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} - id={"text-form"} + id = {"text-form"} placeholder={"Ex: Biomas, Geografia, ..."} - type={"text"} + type = {"text"} value={keywordsBuffer} onChange={handleKeywords} onKeyDown={(event) => { - if (event.keyCode === 13) { + if(event.keyCode === 13){ handleSetKeywords([...keywords, keywordsBuffer]) setKeywordsBuffer('') - } - } + }} } fullWidth - onBlur={() => { props.onBlurCallback("tags", keywords, props.draftID) }} + onBlur={() => {props.onBlurCallback("tags", keywords, props.draftID)}} /> </FormControl> - <SizedBox /> { keywords.length !== 0 && - keywords.map((keyword) => - <Chip style={props.contrast === "" ? { margin: "0.3em 0.5em" } : { border: "1px solid white", backgroundColor: "black", margin: "0.3em 0.5em", color: "white" }} label={keyword} key={keyword} onDelete={() => deleteKeyword(keyword)} deleteIcon={<DeleteIcon style={props.contrast === "" ? {} : { color: "white" }} />} /> - ) + <FormHelperText> + { + keywords.map( (keyword) => + <Chip label={keyword} key={keyword} onDelete={() => {resettingRef.current = true; deleteKeyword(keyword);}} /> + ) + } + </FormHelperText> } </React.Fragment> ) } -const SizedBox = styled.div` - height: 2em; -` - export default memo(Keywords) diff --git a/src/Components/UploadPageComponents/Forms/NewTitle.js b/src/Components/UploadPageComponents/Forms/NewTitle.js index c1e5f897f6249a59c2fa28935312e7b2a07ea7a9..b5d27708068df08fa2969420afde3342465873d2 100644 --- a/src/Components/UploadPageComponents/Forms/NewTitle.js +++ b/src/Components/UploadPageComponents/Forms/NewTitle.js @@ -16,65 +16,46 @@ 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, memo } from 'react' +import React, {useState, memo} from 'react' import FormControl from '@material-ui/core/FormControl'; -import { StyledTextField, StyledFormLabel } from '../StyledComponents.js' -import { makeStyles } from "@material-ui/styles"; +import {StyledTextField, StyledFormLabel} from '../StyledComponents.js' +import FormHelperText from '@material-ui/core/FormHelperText'; -const useStyles = makeStyles(theme => ({ - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "white", - width: "100%", - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "black", - width: "100%", - } -})); +function NewTitle (props) { -function NewTitle(props) { - const classes = useStyles(); const [objTitle, setFormValue] = useState({ - error: false, - value: props.initialValue ? props.initialValue : "" + error : false, + value : props.initialValue ? props.initialValue : "" }) const handleChangeTitle = (e) => { let userInput = e.target.value let flag = (userInput.length > 100 || userInput.length === 0 ? true : false) - setFormValue({ - ...objTitle, - error: flag, - value: userInput + setFormValue({...objTitle, + error : flag, + value : userInput }) } return ( - <FormControl required={true} style={{ width: "100%", height: "100px" }}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> + <FormControl required={true} style={{width : "100%", height : "100px"}}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> <b>Título do Recurso</b> </StyledFormLabel> <StyledTextField - contrast={props.contrast} - id={"title-form"} - placeholder="Ex: Jogo Virtual sobre os Biomas do Brasil" - type={"text"} - value={objTitle.value} - variant="outlined" - onChange={e => { handleChangeTitle(e) }} - helperText={objTitle.value.length + "/100"} - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} - error={objTitle.error} + id = {"title-form"} + placeholder={"Ex: Jogo Virtual sobre os Biomas do Brasil"} + type = {"text"} + value = {objTitle.value} + onChange = {e => {handleChangeTitle(e)}} + helperText = {objTitle.value.length + "/100"} + error = {objTitle.error} fullWidth multiline - onBlur={() => { props.onBlurCallback("name", objTitle.value, props.draftID) }} - /> + onBlur={() => {props.onBlurCallback("name", objTitle.value, props.draftID)}} + /> + {objTitle.value.length === 0 && objTitle.error && + <FormHelperText style={{fontSize : "14px", position : "relative", top : "-26px"}}>Faltou definir um título.</FormHelperText>} </FormControl> ) } diff --git a/src/Components/UploadPageComponents/Forms/SobreORecurso.js b/src/Components/UploadPageComponents/Forms/SobreORecurso.js index f0c43d9e6e007a3ac3681e5410c73f5eba8df2a4..ff82f818fac17ad111411b65ba4505dd3215fcc9 100644 --- a/src/Components/UploadPageComponents/Forms/SobreORecurso.js +++ b/src/Components/UploadPageComponents/Forms/SobreORecurso.js @@ -19,42 +19,20 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React, {useState, memo} from 'react' import FormControl from '@material-ui/core/FormControl'; import {StyledTextField, StyledFormLabel} from '../StyledComponents.js' -import { makeStyles } from "@material-ui/styles"; - -const useStyles = makeStyles(theme => ({ - darkTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "white", - width: "100%", - }, - lightTextField: { - maxWidth: "100%", - fontSize: "15px", - fontWeight: "lighter", - color: "black", - width: "100%", - } -})); function SobreORecurso (props) { - const classes = useStyles(); const [objDescription, setDescription] = useState(props.initialValue ? props.initialValue : '') const handleSetDescription = (event) => {setDescription(event.target.value)} return ( <FormControl style={{width : "100%"}}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> - <span><b>Descrição geral do Recurso</b> (Opcional)</span> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> + <b>Descrição geral do Recurso</b> (Opcional) </StyledFormLabel> <StyledTextField - InputProps={props.contrast === "" ? { className: classes.lightTextField } : { className: classes.darkTextField }} - contrast = {props.contrast} id = {"description-form"} placeholder={"Quais assuntos são contemplados neste Recurso? Para quais objetivos este Recurso pode ser destinado?"} - variant='outlined' type = {"text"} value={objDescription} onChange={handleSetDescription} diff --git a/src/Components/UploadPageComponents/Forms/TipoDeRecurso.js b/src/Components/UploadPageComponents/Forms/TipoDeRecurso.js index d55daaaebe8614e903cff812372ee4ce2326dd48..4e7a9f29ba8a55c6257cd1f03bb80e3821ab7aab 100644 --- a/src/Components/UploadPageComponents/Forms/TipoDeRecurso.js +++ b/src/Components/UploadPageComponents/Forms/TipoDeRecurso.js @@ -16,28 +16,28 @@ 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, memo } from 'react' +import React, {useState, memo} from 'react' import FormControl from '@material-ui/core/FormControl'; -import { StyledRadio, StyledFormLabel } from '../StyledComponents.js' +import {StyledRadio, StyledFormLabel} from '../StyledComponents.js' import RadioGroup from '@material-ui/core/RadioGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; + - -function TipoDeRecurso(props) { +function TipoDeRecurso (props) { const [objTypeValue, chooseObjType] = useState(props.initialValue ? props.initialValue : 0) - const handleChangeObjType = (event) => { chooseObjType(Number(event.target.value)) } + const handleChangeObjType = (event) => {chooseObjType(Number(event.target.value))} return ( - <FormControl required={true} style={{ width: "100%" }} onBlur={() => { props.onBlurCallback("object_type_id", objTypeValue, props.draftID) }}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> + <FormControl required={true} style={{width : "100%"}} onBlur={() => {props.onBlurCallback("object_type_id", objTypeValue, props.draftID)}}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> <b>Tipo de recurso</b> </StyledFormLabel> - <RadioGroup aria-label="Tipo de Recurso" name="Tipo de Recurso" row value={objTypeValue} onChange={handleChangeObjType} style={{ justifyContent: "center" }}> + <RadioGroup aria-label="Tipo de Recurso" name="Tipo de Recurso" row value={objTypeValue} onChange={handleChangeObjType} style={{justifyContent : "center"}}> { - props.objTypes.map((type) => - <FormControlLabel key={type.id} value={type.id} - control={<StyledRadio contrast={props.contrast} label={type.name} checked={objTypeValue === type.id} />} + props.objTypes.map( (type) => + <FormControlLabel key={type.id} value={type.id} + control={<StyledRadio label={type.name} checked={objTypeValue === type.id}/>} /> ) diff --git a/src/Components/UploadPageComponents/GetIconByName.js b/src/Components/UploadPageComponents/GetIconByName.js index b19857c0f9af5743e1045e949ee5c93892889cb4..d3c40d376b0032dea30ee2f22e423b4f189c5f38 100644 --- a/src/Components/UploadPageComponents/GetIconByName.js +++ b/src/Components/UploadPageComponents/GetIconByName.js @@ -14,6 +14,7 @@ import { ReactComponent as VideoIcon } from '../../img/object_type_icons/object- import { ReactComponent as AnimacaoIcon } from '../../img/object_type_icons/object-type_animacao.svg' import { ReactComponent as PlanoAulaIcon } from '../../img/object_type_icons/object-type_plano-de-aula.svg' + import { ReactComponent as Arte } from '../../img/subject_icons/subject_arte.svg' import { ReactComponent as Biologia } from '../../img/subject_icons/subject_biologia.svg' import { ReactComponent as CienciasNatureza } from '../../img/subject_icons/subject_ciencias-da-natureza.svg' @@ -124,7 +125,7 @@ export default function GetIconByName(objName) { case "vídeo": return <VideoIcon className="icon" />; case "animação": - return <AnimacaoIcon className="icon"/>; + return <AnimacaoIcon className="icon" />; default: return <OutrosIcon className="icon" />; } diff --git a/src/Components/UploadPageComponents/ModalCancelar.js b/src/Components/UploadPageComponents/ModalCancelar.js index b7569f160610f6ad6d69b2bd85abd880338909c9..fcfbc9b273cb75e79e05910aed2946eba4a39eb6 100644 --- a/src/Components/UploadPageComponents/ModalCancelar.js +++ b/src/Components/UploadPageComponents/ModalCancelar.js @@ -29,6 +29,7 @@ export default function ModalCancelar (props) { function handleSuccess (data) { props.handleClose() + console.log('ir pra home') } const handleDelete = () => { @@ -54,15 +55,15 @@ export default function ModalCancelar (props) { }} > <Fade in={props.open}> - <Container contrast={props.contrast}> + <Container> <Content> <h2>Tem certeza que deseja cancelar?</h2> <p>Ao clicar no botão "OK", o seu recurso NÃO será salvo.</p> </Content> <ButtonsArea> - <StyledButton contrast={props.contrast} onClick={props.handleClose}>VOLTAR</StyledButton> - <Link to="/"> - <StyledButton contrast={props.contrast} onClick={handleDelete}>OK</StyledButton> + <StyledButton onClick={props.handleClose}>VOLTAR</StyledButton> + <Link to="/" style={{textDecoration : "none !important"}}> + <StyledButton onClick={handleDelete}>OK</StyledButton> </Link> </ButtonsArea> </Container> @@ -88,12 +89,14 @@ const Content = styled.div` margin-top : 0; font-size : 20px; font-weight : bold; + color : #666; margin-bottom : 10px; } p { margin : 0 0 10px; font-size : 14px; + color : #666; } ` @@ -111,11 +114,8 @@ const StyledModal = styled(Modal)` ` const Container = styled.div` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; - box-sizing : border-box; + background-color : white; max-width : none; align : center; display : flex; @@ -132,12 +132,14 @@ const Container = styled.div` } ` const StyledButton = styled(Button)` - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - + &:hover { + background-color : rgba(158,158,158,0.2) !important; + } max-height : 36px !important; background-color : transparent !important; + color : #00bcd4 !important; + text-decoration : none !important; outline : none !important; text-align : center !important; diff --git a/src/Components/UploadPageComponents/PartOne.js b/src/Components/UploadPageComponents/PartOne.js index 66c18a516774994d570b3124d0b6fcde319ab77e..250428dbf319dd5488a5bcebb31743d787d6a73b 100644 --- a/src/Components/UploadPageComponents/PartOne.js +++ b/src/Components/UploadPageComponents/PartOne.js @@ -16,8 +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, useEffect, useContext, useRef } from 'react' -import { Store } from '../../Store.js' +import React, {useState, useEffect, useContext, useRef} from 'react' +import {Store} from '../../Store.js' import Grid from '@material-ui/core/Grid'; import ButtonsDiv from './ButtonsDiv.js' import SobreORecurso from './Forms/SobreORecurso.js' @@ -26,14 +26,14 @@ import Keywords from './Forms/Keywords.js' import Autor from './Forms/Autor.js' import TipoDeRecurso from './Forms/TipoDeRecurso.js' import Idioma from './Forms/Idioma.js' -import { SendInfo } from './SendInfo.js' -import { getRequest } from '../HelperFunctions/getAxiosConfig.js' +import {SendInfo} from './SendInfo.js' +import {getRequest} from '../HelperFunctions/getAxiosConfig.js' import SnackBar from '../../Components/SnackbarComponent'; import LoadingSpinner from '../../Components/LoadingSpinner' -export default function PartOne(props) { +export default function PartOne (props) { // {/*const [subjects, setSubjects] = useState([])*/} - const { state } = useContext(Store) + const {state} = useContext(Store) const didMountRef = useRef(false); const didMountRefObj = useRef(false); @@ -68,23 +68,23 @@ export default function PartOne(props) { }) } - function checkPartOne(data) { + function checkPartOne (data) { return ( - data.name !== null && - data.tags.length !== 0 && - data.author !== null && - data.object_type !== null && + data.name !== null && + data.tags.length !== 0 && + data.author !== null && + data.object_type !== null && data.language.length !== 0 && (data.attachments.length !== 0 || - data.link !== null) + data.link !== null) ) } - function handleSuccessGetObjTypes(data) { + function handleSuccessGetObjTypes (data) { setObjTypes(data.sort((a, b) => (a.name) > (b.name) ? 1 : -1)) } - function handleSuccessGetFormData(data) { + function handleSuccessGetFormData (data) { if (checkPartOne(data)) { props.stepperControl(1) } else { @@ -98,40 +98,40 @@ export default function PartOne(props) { } } - function handleSuccessfulGet(data) { + function handleSuccessfulGet (data) { setLearningObject(data) } - useEffect(() => { - getRequest(`/object_types/`, handleSuccessGetObjTypes, (error) => { console.log(error) }) - getRequest(`/languages/`, (data) => { setLanguages(data) }, (error) => { console.log(error) }) + useEffect( () => { + getRequest(`/object_types/`, handleSuccessGetObjTypes, (error) => {console.log(error)}) + getRequest(`/languages/`, (data) => {setLanguages(data)}, (error) => {console.log(error)}) const url = `/learning_objects/${props.draftID}` - getRequest(url, handleSuccessfulGet, (error) => { console.log(error) }) + getRequest(url, handleSuccessfulGet, (error) => {console.log(error)}) }, []) - useEffect(() => { + useEffect( () => { if (didMountRef.current) { - toggleLoading(false) + toggleLoading(false) } else { - didMountRef.current = true; + didMountRef.current = true; } }, [learningObject]) - useEffect(() => { + useEffect( () => { if (didMountRefObj.current) { - toggleLoadingObj(false) + toggleLoadingObj(false) } else { - didMountRefObj.current = true; + didMountRefObj.current = true; } }, [objTypes]) const handleSubmit = (e) => { e.preventDefault(); - getRequest(`/learning_objects/${props.draftID}`, - handleSuccessGetFormData, + getRequest(`/learning_objects/${props.draftID}`, + handleSuccessGetFormData, () => { const info = { open: true, @@ -140,7 +140,7 @@ export default function PartOne(props) { color: 'red', } handleSnackInfo(info) - } + } ) } @@ -157,65 +157,65 @@ export default function PartOne(props) { !loading && !loadingObj ? ( <form onSubmit={handleSubmit}> {/*------------------------------Titulo-----------------------------------------*/} - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <NewTitle contrast={props.contrast} draftID={props.draftID} onBlurCallback={SendInfo} initialValue={learningObject.name} /> + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <NewTitle draftID={props.draftID} onBlurCallback={SendInfo} initialValue={learningObject.name}/> </Grid> {/*------------------------------Sobre------------------------------------------*/} - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <SobreORecurso contrast={props.contrast} draftID={props.draftID} onBlurCallback={SendInfo} initialValue={learningObject.description} /> + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <SobreORecurso draftID={props.draftID} onBlurCallback={SendInfo} initialValue={learningObject.description}/> </Grid> {/*------------------------------Palavras-chave------------------------------------------*/} - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <Keywords contrast={props.contrast} draftID={props.draftID} onBlurCallback={SendInfo} initialValue={learningObject.tags !== undefined ? learningObject.tags.map((tag) => tag.name) : null} /> + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <Keywords draftID={props.draftID} onBlurCallback={SendInfo} initialValue={learningObject.tags !== undefined ? learningObject.tags.map((tag) => tag.name) : null}/> </Grid> {/*------------------------------Autor------------------------------------------*/} - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <Autor contrast={props.contrast} draftID={props.draftID} onBlurCallback={SendInfo} + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <Autor draftID={props.draftID} onBlurCallback={SendInfo} initialValue={ learningObject.author === state.currentUser.name ? - 0 : 1 + 0 : 1 } initialOutroAutor={ learningObject.author !== state.currentUser.name ? - learningObject.author : '' + learningObject.author : '' } /> </Grid> {/*------------------------------Tipo do Objeto------------------------------------------*/} - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <TipoDeRecurso contrast={props.contrast} objTypes={objTypes} draftID={props.draftID} onBlurCallback={SendInfo} + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <TipoDeRecurso objTypes={objTypes} draftID={props.draftID} onBlurCallback={SendInfo} initialValue={learningObject.object_type !== undefined && learningObject.object_type !== null ? objTypes.filter((type) => type.name === learningObject.object_type)[0].id : null} /> </Grid> {/*------------------------------Idioma------------------------------------------*/} - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <Idioma contrast={props.contrast} languages={languages} draftID={props.draftID} onBlurCallback={SendInfo} - initialValue={learningObject.language !== undefined ? learningObject.language.map((language) => language.name) : null} initialIDValues={learningObject.language !== undefined ? learningObject.language.map((language) => language.id) : null} - /> + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <Idioma languages={languages} draftID={props.draftID} onBlurCallback={SendInfo} + initialValue={learningObject.language !== undefined ? learningObject.language.map((language) => language.name) : null} initialIDValues={learningObject.language !== undefined ? learningObject.language.map((language) => language.id) : null} + /> </Grid> {/*------------------------------Botoes------------------------------------------*/} <Grid item xs={12}> - <ButtonsDiv contrast={props.contrast} draftID={props.draftID} stepperControl={props.stepperControl} /> + <ButtonsDiv draftID={props.draftID} stepperControl={props.stepperControl}/> </Grid> - <Grid item xs={12} style={{ marginTop: "20px" }}> - <span style={props.contrast === "" ? { marginTop: "20px", fontWeight: "200", color: "#a5a5a5", paddingLeft: "10px" } : { marginTop: "20px", fontWeight: "200", color: "white", paddingLeft: "10px" }}> + <Grid item xs={12} style={{marginTop : "20px"}}> + <span style={{marginTop : "20px", fontWeight : "200", color : "#a5a5a5", paddingLeft : "10px"}}> * Campos obrigatórios </span> </Grid> </form> ) - : - ( - <LoadingSpinner contrast={props.contrast} text={"CARREGANDO"} /> - ) + : + ( + <LoadingSpinner text={"CARREGANDO"}/> + ) } - </React.Fragment > + </React.Fragment> ) } diff --git a/src/Components/UploadPageComponents/PartThree.js b/src/Components/UploadPageComponents/PartThree.js index 19a4ac03bd3c70c1a8938dc1ab2555c8bd0585b1..5170659ca6f2e961a14e314a827656737def4000 100644 --- a/src/Components/UploadPageComponents/PartThree.js +++ b/src/Components/UploadPageComponents/PartThree.js @@ -22,6 +22,8 @@ import Grid from '@material-ui/core/Grid'; import styled from 'styled-components' import { apiDomain } from '../../env'; import Stepper from './Stepper.js' +import Rating from '@material-ui/lab/Rating'; +import StarBorderIcon from '@material-ui/icons/StarBorder'; import LoadingSpinner from '../LoadingSpinner.js' import MoreIcon from '@material-ui/icons/More'; import SdCardIcon from '@material-ui/icons/SdCard'; @@ -34,9 +36,6 @@ import ModalCancelar from './ModalCancelar.js' import { getDefaultThumbnail } from '../HelperFunctions/getDefaultThumbnail' import { getRequest } from '../HelperFunctions/getAxiosConfig.js' import ReCaptcha from 'react-recaptcha' -import Chip from '@material-ui/core/Chip' -import Rating from '@material-ui/lab/Rating'; -import StarBorderIcon from '@material-ui/icons/StarBorder'; export default function PartThree(props) { var moment = require('moment') @@ -50,10 +49,14 @@ export default function PartThree(props) { const [author, setAuthor] = useState('') function handleSuccess(data) { + console.log(data.tags) + console.log(data.language) + console.log(data.subjects) + // console.log(data.tags) setDraft(data) /*extract subjects*/ - setSubjects(data.subjects.map((subject) => (subject.name)).join(', ')) + setSubjects(data.subjects.map((subject)=>(subject.name)).join(', ')) // setTags(data.tags.map(tag => tag.name)) setDescription(data.description) setAuthor(data.author) @@ -70,6 +73,7 @@ export default function PartThree(props) { } }, [state.currentUser.id]) + let windowWidth = window.innerWidth const [modalCancelar, toggleModalCancelar] = useState(false) const checkAccessLevel = (levelToCheck) => { @@ -82,7 +86,7 @@ export default function PartThree(props) { return (state.currentUser.roles.filter((role) => role.name === userRole).length > 0) } - function captchaVerified(response) { + function captchaVerified (response) { if (response) { setButtonAvailability(false) } @@ -95,293 +99,416 @@ export default function PartThree(props) { ( <React.Fragment> <ModalCancelar - contrast={props.contrast} open={modalCancelar} handleClose={() => { toggleModalCancelar(false) }} draftID={draft.id} /> - <Grid container style={props.contrast === "" ? { backgroundColor: "#f4f4f4" } : { backgroundColor: "black" }}> + <Grid container style={{ backgroundColor: "#f4f4f4" }}> <Grid item xs={12}> - <StyledSessao1 contrast={props.contrast} className="page-content-preview"> - <div className='header'> - <Stepper activeStep={props.activeStep} contrast={props.contrast} /> - <h2>Quase lá, agora só falta publicar!</h2> - <span className="subtitle">Veja abaixo como o seu Recurso vai aparecer na Plataforma:</span> + <StyledSessao1 className="page-content-preview"> + <div className="cabecalho"> + <div className="feedback-upload"> + <Stepper activeStep={props.activeStep} /> + <h2>Quase lá, agora só falta publicar!</h2> + <span className="subtitle">Veja abaixo como o seu Recurso vai aparecer na Plataforma:</span> + </div> </div> </StyledSessao1> - <MainContent contrast={props.contrast} > - <CaixaContainer contrast={props.contrast} container spacing={2} className='draft-info'> - <Grid item xs={12} md={4}> - <img alt="" style={{ width: "100%", height: '100%' }} + <CaixaContainer> + <div> + <div className="cabecalho-objeto"> + <img alt="" className="img-objeto" src={draft.thumbnail === null ? getDefaultThumbnail(draft.object_type) : apiDomain + draft.thumbnail} /> - </Grid> - <Grid item xs={12} md={8}> - <Grid container justify='space-between'> - <Grid item xs={12}> - <h3>{draft.name}</h3> - </Grid> - <Grid item xs={12}> - <Grid container spacing={1}> - <Grid item xs={12}> - <Rating - readOnly - name="customized-empty" - value={draft.score} - precision={0.5} - style={props.contrast === "" ? { color: "#666" } : { color: "white" }} - emptyIcon={<StarBorderIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }} fontSize="inherit" />} - /> - </Grid> - <Grid item xs={12}> - Relacionado com: {subjects} - </Grid> - <Grid item xs={12}> - { - draft.tags && - draft.tags.map((tag) => { - return ( - <Chip className='tag' key={tag.name} label={tag.name} /> - ) - }) - } - </Grid> - </Grid> - </Grid> - </Grid> - </Grid> - </CaixaContainer> - </MainContent> - <MainContent contrast={props.contrast}> - <CaixaContainer contrast={props.contrast} container spacing={2}> - <Grid item xs={12}> - <h1 className='title'> - Sobre o recurso - </h1> - </Grid> - <Grid item xs={12}> - <hr /> - </Grid> - <Grid item xs={12} sm={6}> + <div className="texto-objeto"> + <h3>{draft.name}</h3> + <div className="rating-objeto"> + <Rating + name="customized-empty" + value={draft.score} + precision={0.5} + style={{ color: "#666" }} + emptyIcon={<StarBorderIcon fontSize="inherit" />} + /> + </div> + + <div className="relacionado"> + Relacionado com: {subjects} + </div> + + { + draft.tags && + <div className="tags-objeto"> + {draft.tags.map((tag) => { + return ( + <div className="tag" key={tag.name}>{tag.name}</div> + ) + })} + </div> + } + + </div> + </div> + + <div className="sobre-objeto"> <Grid container> - <Grid item xs={12}> - { - description !== '' && - <p> - <b>Descrição:</b> - <br /> - {description} - </p> - } - </Grid> - <Grid item xs={12}> - { - author !== '' && - <p> - <b>Autoria:</b> - <br /> - {author} - </p> - } - </Grid> - </Grid> - </Grid> - <Grid item xs={12} sm={6}> - <Grid container spacing={1}> - <Grid item xs={12}> - <Grid container direction='row' spacing={1} alignItems='center'> - <Grid item> - <MoreIcon /> - </Grid> - <Grid item> - <b>Tipo de mídia: </b>{draft.object_type} - </Grid> - </Grid> + <Grid item xs={windowWidth > 990 ? 7 : 12} className="left"> + <div className="titulo"> + Sobre o Recurso + </div> + <div className="sobre-conteudo"> + <p className="descricao">{description}</p> + { + author !== '' && + <p className="autor"> + <b>Autoria:</b> + <br /> + {author} + </p> + } + </div> </Grid> - <Grid item xs={12}> - <Grid container direction='row' spacing={1} alignItems='center'> - <Grid item> - <SdCardIcon /> - </Grid> - <Grid item> - <b>Tamanho: </b>{draft.attachments ? (draft.attachments[0].size / 1000000).toFixed(2) + ' Mb' : "Informação não disponível"} - </Grid> - </Grid> - </Grid> + <Grid item xs={windowWidth > 990 ? 4 : 12} className="right"> + <span className="meta-objeto"> + <MoreIcon /> <b>Tipo de mídia: </b>{draft.object_type} + </span> - <Grid item xs={12}> - <Grid container direction='row' spacing={1} alignItems='center'> - <Grid item> - <DateRangeIcon /> - </Grid> - <Grid item> - <b>Enviado: </b> - {moment(draft.created_at).format("DD/MM/YYYY")} - </Grid> - </Grid> - </Grid> + <span className="meta-objeto"> + <SdCardIcon /> <b>Tamanho: </b> + </span> - <Grid item xs={12}> - <Grid container direction='row' spacing={1} alignItems='center'> - <Grid item> - <UpdateIcon /> - </Grid> - <Grid item> - <b>Atualização: </b> - {moment(draft.updated_at).format("DD/MM/YYYY")} - </Grid> - </Grid> - </Grid> + <span className="meta-objeto"> + <DateRangeIcon /> <b>Enviado: </b> + {moment(draft.created_at).format("DD/MM/YYYY")} + </span> + + <span className="meta-objeto"> + <UpdateIcon /><b>Atualização: </b> + {moment(draft.updated_at).format("DD/MM/YYYY")} + </span> - <Grid item xs={12}> - {draft.language && + { draft.language && draft.language.map((language => - <Grid key={language.id} container direction='row' spacing={1} alignItems='center'> - <Grid item> - <TranslateIcon /> - </Grid> - <Grid item> - <b>Idioma: </b>{language.name} - </Grid> - </Grid> + <span className="meta-objeto" key={language.id}> + <TranslateIcon /><b>Idioma: </b>{language.name} + </span> )) } - </Grid> - - <Grid item xs={12}> - <Grid container direction='row' spacing={1} alignItems='center'> - <Grid item> - <AssignmentIcon /> - </Grid> - <Grid item> - <b>Licença: </b>{draft.license ? draft.license.name : "Informação não disponível"} - </Grid> - </Grid> + <span className="meta-objeto"> + <AssignmentIcon /><b>Licença: </b>{draft.license ? draft.license.name : ""} + </span> </Grid> </Grid> - </Grid> - </CaixaContainer> - </MainContent> - <MainContent contrast={props.contrast}> - <CaixaContainer contrast={props.contrast} container spacing={2} justify='center' alignItems='center'> - <Grid item xs={12} className='center'> - <Grid container direction='row' alignItems='center' justify='space-between' > - <Grid item> - <h4> - Para segurança da plataforma marque que você não é um robô - </h4> - </Grid> - <Grid item> - { - //<ReCaptcha sitekey={process.env.REACT_APP_SITE_KEY} verifyCallback={captchaVerified} /> //when key set in env - <ReCaptcha sitekey="6LfxuKUUAAAAAIzYpCzEtJyeE8QRjBYa44dvHlTX" verifyCallback={captchaVerified} /> //use this one on production - //<ReCaptcha sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI" verifyCallback={captchaVerified} /> //test key, from google, do not use this one on production - } - </Grid> + </div> + </div> + </CaixaContainer> + <Sessao3> + <form> + <Grid container> + <Grid item xs={windowWidth > 990 ? 6 : 12} style={{ paddingRight: "15px", paddingLeft: "15px", textAlign: windowWidth > 990 ? 'right' : 'center' }}> + <span style={{ fontSize: "14px" }}> + Para segurança da plataforma <br /> marque que você não é um robô + </span> </Grid> - </Grid> - <Grid item xs={12} className='center'> - <Grid container direction='row' spacing={1} alignItems='center' justify='center'> - <Grid item> - <GrayButton contrast={props.contrast} onClick={() => { props.stepperControl(-1) }}>VOLTAR</GrayButton> - </Grid> - <Grid item> - <GrayButton contrast={props.contrast} onClick={() => { toggleModalCancelar(true) }}>CANCELAR</GrayButton> - </Grid> - <Grid item> - { - checkAccessLevel("partner") ? - ( - unavailableButton ? ( - <GrayButton contrast={props.contrast} disabled={unavailableButton}>PUBLICAR RECURSO</GrayButton> - ) - : - ( - <OrangeButton contrast={props.contrast} onClick={props.handlePost}>PUBLICAR RECURSO</OrangeButton> - ) + <Grid item xs={windowWidth > 990 ? 6 : 12} style={{ paddingRight: "15px", paddingLeft: "15px"}}> + <div style={{margin:"0 auto", width: "304px"}}> + { + //<ReCaptcha sitekey={process.env.REACT_APP_SITE_KEY} verifyCallback={captchaVerified} /> //when key set in env + <ReCaptcha sitekey="6LfxuKUUAAAAAIzYpCzEtJyeE8QRjBYa44dvHlTX" verifyCallback={captchaVerified} /> //use this one on production + //<ReCaptcha sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI" verifyCallback={captchaVerified} /> //test key, from google, do not use this one on production + } + </div> + </Grid> + <Grid item xs={12} style={{ paddingRight: "15px", paddingLeft: "15px", marginTop: "30px", textAlign: 'center' }}> + <GrayButton onClick={() => { props.stepperControl(-1) }}>VOLTAR</GrayButton> + <GrayButton onClick={() => { toggleModalCancelar(true) }}>CANCELAR</GrayButton> + { + checkAccessLevel("partner") ? + ( + unavailableButton ? ( + <GrayButton disabled={unavailableButton}>PUBLICAR RECURSO</GrayButton> ) : ( - unavailableButton ? ( - <GrayButton contrast={props.contrast} disabled={unavailableButton}>SUBMETER RECURSO</GrayButton> - ) - : - ( - <OrangeButton contrast={props.contrast} onClick={props.handleSubmit}>SUBMETER RECURSO</OrangeButton> - ) + <OrangeButton onClick={props.handlePost}>PUBLICAR RECURSO</OrangeButton> ) + ) + : + ( + unavailableButton ? ( + <GrayButton disabled={unavailableButton}>SUBMETER RECURSO</GrayButton> + ) + : + ( + <OrangeButton onClick={props.handleSubmit}>SUBMETER RECURSO</OrangeButton> + ) + ) - } - </Grid> + } </Grid> </Grid> - </CaixaContainer> - </MainContent> + </form> + </Sessao3> </Grid> </Grid> </React.Fragment> ) : ( - <LoadingSpinner text="CARREGANDO" contrast={props.contrast} /> + <LoadingSpinner text="CARREGANDO" /> ) } - </React.Fragment > + </React.Fragment> ) } +const Sessao3 = styled.div` + position : relative; + top : -120px; + padding-right :15px; + padding-left :15px; + margin-right : auto; + margin-left : auto; + @media screen and (min-width: 768px) { + width : 750px; + } + @media screen and (min-width: 992px) { + width : 970px; + } + @media screen and (min-width: 1200px) { + width : 970px; + } + color : #666; + background-color : #f4f4f4; -const MainContent = styled.div` - color: ${props => props.contrast === "" ? "#666" : "white"}; - border-radius : 5px; - padding : 20px 10px; - width: 80%; - margin: 1.5em auto; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22); ` -const CaixaContainer = styled(Grid)` - width: 100%; - - .draft-info{ - padding : 10px 5px; +const CaixaContainer = styled.div` + background-color : rgba(238,238,238,.5); + border-radius : 5px; + position : relative; + top : -145px; + padding : 10px; + + margin-right : auto; + margin-left : auto; + @media screen and (min-width: 768px) { + width : 750px; } - - .tag{ - color: ${props => props.contrast === "" ? "black" : "white"}; - background: ${props => props.contrast === "" ? "#d4d4d4" : "black"}; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - margin: 0.2em; + @media screen and (min-width: 992px) { + width : 970px; + } + @media screen and (min-width: 1200px) { + width : 970px; } - .title{ - text-align: center; - font-weight: lighter; + + .cabecalho-objeto { + background-color:#fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + padding: 0; + margin-top: 30px; + margin-bottom: 30px; + position: relative; + min-height: 100px; + margin-top: 0; + margin-bottom: 10px; + color : #666; + + .img-objeto { + background-color:#e5e5e5; + height: 270px; + width: 400px; + float: left; + padding: 0; + } + + .texto-objeto { + padding: 20px 20px 0 20px; + height: content; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + -ms-flex-wrap: nowrap; + flex-wrap: nowrap; + -webkit-box-pack: start; + -ms-flex-pack: start; + justify-content: flex-start; + -ms-flex-line-pack: center; + align-content: center; + -webkit-box-align: start; + -ms-flex-align: start; + align-items: flex-start; + + h3 { + font-size: 26px; + font-weight: 400; + margin: 0; + padding-bottom: 15px; + } + + .rating-objeto { + margin : 0; + display : inline-flex; + padding-bottom : 10px; + } + + .relacionado { + font-weight : 500; + font-size : 13px; + } + + .tags-objeto { + max-height: 54px; + font-size: .8em; + overflow: hidden; + clear: both; + display: -webkit-inline-box; + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + + .tag { + display: -webkit-inline-box; + display: -ms-inline-flexbox; + display: inline-flex; + margin-right: 3px; + background-color: #e5e5e5; + padding: 3px 7px; + border-radius: 15px; + line-height: 18px; + color: #666; + margin-bottom: 3px; + } + } + } } - .center{ - text-align: center; + .sobre-objeto { + margin-top : 0; + margin-bottom : 0; + min-height : 275px; + display : flex; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + padding: 0; + position: relative; + min-height: 500px; + + .left { + @media screen and (min-width : 990px) { + margin-left : 4% !important; + margin-top : 4% !important; + } + + @media screen and (max-width : 989px) { + margin : 0; + padding : 20px; + padding-bottom : 0; + } + + .titulo { + margin-top: 2% !important; + margin-bottom: 10px; + font-family: 'Roboto Light','Roboto Regular',Roboto; + font-weight: 300; + font-style: normal; + color:#666; + font-size: 1.857em; + } + + .sobre-conteudo { + flex : 1; + color : #666; + font-size : 14px !important; + + .descricao { + text-align: justify; + margin-bottom: 20px; + margin-top: 20px; + } + + .autor { + margin : 0 0 10px !important; + } + } + } + + .right { + margin-top : 4% !important; + border-left: 1px solid #e5e5e5; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-pack: start; + -ms-flex-pack: start; + justify-content: flex-start; + padding: 20px; + position : relative; + margin-bottom : 20px; + + .meta-objeto { + position: relative; + width: 100%; + font-size: 14px; + color: #666; + margin-bottom: 20px; + display : inline-block; + } + + .MuiSvgIcon-root { + vertical-align : middle !important; + margin-right : 15px !important; + } + } } +} ` const StyledSessao1 = styled.div` color : #fff; - background: ${props => props.contrast === "" ? "#00bcd4" : "black"}; + background-color : #00bcd4; + float : none; height : 300px; + text-align : center; padding-top : 48px; padding-bottom : 48px; - flex-direction : column; - justify-content: center; - align-items: center; - display: flex; - - .header{ - width: 50%; - margin: 0 auto; - text-align: center; + margin-bottom : 30px; + + .cabecalho { + display : flex; + flex-direction : column; + align-items : center; + margin-bottom : 30px; + + .feedback-upload { + display : flex; + flex-direction : column; + justify-content : center; + text-align : center + margin-top : 20px; + width : 55%; + } + + h2 { + margint-top : 0; + font-size : 26px; + font-weight : lighter; + margin-bottom : 10px; + } + + .subtitle { + font-size : 16px; + + } } ` diff --git a/src/Components/UploadPageComponents/PartTwo.js b/src/Components/UploadPageComponents/PartTwo.js index 1c1cb116359f694f820ee9840c191d3cf9ff0dbb..cf65a4de9952a0450b5bfedf71bd671511bcecbe 100644 --- a/src/Components/UploadPageComponents/PartTwo.js +++ b/src/Components/UploadPageComponents/PartTwo.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, { useState, useEffect, useRef } from 'react' +import React, {useState, useEffect, useRef} from 'react' import Grid from '@material-ui/core/Grid'; import styled from 'styled-components' import DragAndDropThumbnail from './PartTwoComponents/DragAndDropThumbnail' @@ -25,49 +25,26 @@ import Licenca from './PartTwoComponents/Licenca' import Checkbox from '@material-ui/core/Checkbox'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import FormControl from '@material-ui/core/FormControl'; -import { StyledFormLabel } from './StyledComponents.js' +import {StyledFormLabel} from './StyledComponents.js' import ButtonsDiv from './ButtonsDiv.js' import SubjectsAndThemes from './PartTwoComponents/SubjectsAndThemes.js' -import { SendInfo } from './SendInfo.js' +import {SendInfo} from './SendInfo.js' import EditThumbnail from './PartTwoComponents/EditThumbnail.js' import DisplayThumbnail from './PartTwoComponents/DisplayThumbnail.js' import CustomCircularProgress from './PartTwoComponents/CustomCircularProgress'; -import { getRequest, putRequest } from '../HelperFunctions/getAxiosConfig.js' +import {getRequest, putRequest} from '../HelperFunctions/getAxiosConfig.js' import SnackBar from '../../Components/SnackbarComponent'; import LoadingSpinner from '../../Components/LoadingSpinner' -import { yellow, blue } from "@material-ui/core/colors"; -import { withStyles } from '@material-ui/core/styles'; - -const BlueCheckBox = withStyles({ - root: { - color: blue[400], - '&$checked': { - color: blue[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -const ContrastCheckBox = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -export function LoadingDiv(props) { +export function LoadingDiv () { return ( - <div style={props.contrast === "" ? { width: "100%", display: "flex", alignItems: "center", justifyContent: "center", color: "#666" } : { width: "100%", display: "flex", alignItems: "center", justifyContent: "center", color: "white" }}> - <CustomCircularProgress contrast={props.contrast} /> CARREGANDO IMAGEM + <div style={{width : "100%", display : "flex", alignItems : "center", justifyContent : "center", color : "#666"}}> + <CustomCircularProgress/> CARREGANDO IMAGEM </div> ) } -export default function PartTwo(props) { +export default function PartTwo (props) { const didMountRef = useRef(false); const [eduStages, setEduStages] = useState([]) @@ -101,12 +78,12 @@ export default function PartTwo(props) { }) } - function handleSuccess(data) { - setSubjects(data.filter(subject => subject.theme === false).sort((a, b) => a.name > b.name ? 1 : -1)) - setThemes(data.filter(subject => subject.theme === true).sort((a, b) => a.name > b.name ? 1 : -1)) + function handleSuccess (data) { + setSubjects(data.filter(subject => subject.theme === false).sort((a,b) => a.name > b.name ? 1 : -1)) + setThemes(data.filter(subject => subject.theme === true).sort((a,b) => a.name > b.name ? 1 : -1)) } - function checkPartTwo(data) { + function checkPartTwo (data) { return ( data.educational_stages.length !== 0 && data.subjects.length !== 0 && @@ -115,7 +92,7 @@ export default function PartTwo(props) { ) } - function handleSuccessGetFormData(data) { + function handleSuccessGetFormData (data) { if (checkPartTwo(data)) { props.stepperControl(1) } else { @@ -129,86 +106,82 @@ export default function PartTwo(props) { } } - function handleSuccessfulGet(data) { + function handleSuccessfulGet (data) { setLearningObject(data) } useEffect(() => { - getRequest(`/educational_stages/`, (data) => { setEduStages(data) }, (error) => { console.log(error) }) + getRequest(`/educational_stages/`, (data) => {setEduStages(data)}, (error) => {console.log(error)}) - getRequest(`/subjects/`, handleSuccess, (error) => { console.log(error) }) + getRequest(`/subjects/`, handleSuccess, (error) => {console.log(error)}) const url = `/learning_objects/${props.draftID}` - getRequest(url, handleSuccessfulGet, (error) => { console.log(error) }) + getRequest(url, handleSuccessfulGet, (error) => {console.log(error)}) }, []) - useEffect(() => { + useEffect( () => { if (didMountRef.current) { - toggleLoading(false) + console.log(learningObject); + toggleLoading(false) } else { - didMountRef.current = true; + didMountRef.current = true; } }, [learningObject]) - /*------------------------Licenca------------------------*/ - - const [termsCheckbox, setChecked] = useState(false) - const toggleCheckbox = () => { - setChecked(!termsCheckbox) - } + /*------------------------Licenca------------------------*/ - const [thumbnail, setThumbnail] = useState('') - const [tempUrl, setTempUrl] = useState('') + const [termsCheckbox, setChecked] = useState(false) + const toggleCheckbox = () => { + setChecked(!termsCheckbox) + } - const acceptFile = (file) => { - const objectURL = URL.createObjectURL(file) - setTempUrl(objectURL) - setThumbnailStage('editing') - } + const [thumbnail, setThumbnail] = useState('') + const [tempUrl, setTempUrl] = useState('') - const updateThumb = (newThumbnail) => { - setThumbnail(newThumbnail) - } + const acceptFile = (file) => { + const objectURL = URL.createObjectURL(file) + console.log(file) + setTempUrl(objectURL) + setThumbnailStage('editing') + } + const updateThumb = (newThumbnail) => { + setThumbnail(newThumbnail) + console.log(thumbnail) + } - const handleDeleteThumb = () => { - setThumbnail(''); - setTempUrl(''); - setThumbnailStage('default'); - } + const finalizeThumb = () => { + setThumbnailStage('uploading') - const finalizeThumb = () => { - setThumbnailStage('uploading') + const url = `/learning_objects/${props.draftID}` - const url = `/learning_objects/${props.draftID}` + let fdThumb = new FormData() + fdThumb.set('learning_object[thumbnail]', thumbnail) - let fdThumb = new FormData() - fdThumb.set('learning_object[thumbnail]', thumbnail) + putRequest(url, fdThumb, (data) => {setThumbnailStage('done')}, (error) => {console.log(error)}) + } - putRequest(url, fdThumb, (data) => { setThumbnailStage('done') }, (error) => { console.log(error) }) - } + const [thumbnailStage, setThumbnailStage] = useState('default') - const [thumbnailStage, setThumbnailStage] = useState('default') + const chooseRenderStageThumbnail = () => { + switch(thumbnailStage) { + case 'uploading': + return (<LoadingDiv/>) + case 'done': + return (<DisplayThumbnail acceptFile={acceptFile} thumbnail={thumbnail}/>) + case 'editing': + return (<EditThumbnail finalizeThumb={finalizeThumb} tempImgURL={tempUrl} updateThumb={updateThumb}/>) + default : + return (<DragAndDropThumbnail acceptFile={acceptFile}/>) - const chooseRenderStageThumbnail = (contrast) => { - switch (thumbnailStage) { - case 'uploading': - return (<LoadingDiv contrast={contrast} />) - case 'done': - return (<DisplayThumbnail handleDelete={handleDeleteThumb} acceptFile={acceptFile} contrast={contrast} thumbnail={thumbnail} />) - case 'editing': - return (<EditThumbnail contrast={contrast} finalizeThumb={finalizeThumb} tempImgURL={tempUrl} updateThumb={updateThumb} />) - default: - return (<DragAndDropThumbnail contrast={contrast} acceptFile={acceptFile} />) + } + } - } - } - - const handleSubmit = (e) => { + const handleSubmit = (e) => { e.preventDefault(); - getRequest(`/learning_objects/${props.draftID}`, - handleSuccessGetFormData, + getRequest(`/learning_objects/${props.draftID}`, + handleSuccessGetFormData, () => { const info = { open: true, @@ -217,11 +190,11 @@ export default function PartTwo(props) { color: 'red', } handleSnackInfo(info) - } + } ) } - return ( + return ( <React.Fragment> <SnackBar snackbarOpen={snackInfo.open} @@ -232,50 +205,50 @@ export default function PartTwo(props) { /> { !loading ? ( - <form style={{ width: "100%" }} onSubmit={handleSubmit}> - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - {chooseRenderStageThumbnail(props.contrast)} + <form style={{width : "100%"}} onSubmit={handleSubmit}> + <Grid item xs={12} style={{paddingBottom : "40px"}}> + {chooseRenderStageThumbnail()} </Grid> - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <EducationalStage contrast={props.contrast} draftID={props.draftID} eduStages={eduStages} onBlurCallback={SendInfo} + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <EducationalStage draftID={props.draftID} eduStages={eduStages} onBlurCallback={SendInfo} initialValue={learningObject.educational_stages !== null ? learningObject.educational_stages.map((stage) => String(stage.id)) : null} /> </Grid> - <SubjectsAndThemes contrast={props.contrast} draftID={props.draftID} subjects={subjects} themes={themes} onUploadPage={true} onBlurCallback={SendInfo} + <SubjectsAndThemes draftID={props.draftID} subjects={subjects} themes={themes} onUploadPage={true} onBlurCallback={SendInfo} initialValue={learningObject.subjects !== null ? learningObject.subjects.map(subject => String(subject.id)) : null} /> - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <Licenca contrast={props.contrast} draftID={props.draftID} onBlurCallback={SendInfo} initialValue={learningObject.license ? learningObject.license.id : null} /> - </Grid> + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <Licenca draftID={props.draftID} onBlurCallback={SendInfo} initialValue={learningObject.license ? learningObject.license.id : null}/> + </Grid> - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <StyledFormControl required contrast={props.contrast}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }} > - <b>Confirme se você concorda com os <strong onClick={() => window.open("/termos/", "_blank")} style={props.contrast === "" ? { color: "#ff7f00", cursor: "pointer" } : { color: "yellow", textDecoration: "underline", cursor: "pointer" }}>termos de uso e de propriedade intelectual</strong></b> + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <StyledFormControl required > + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}} onClick={() => window.open("/termos/", "_blank")}> + <b>Confirme se você concorda com os <strong style={{color : "#ff7f00"}}>termos de uso e de propriedade intelectual</strong></b> </StyledFormLabel> - <FormControlLabel label={<span className="label">Li e concordo com os termos de uso e de propriedade intelectual.</span>} control={props.contrast === "" ? <BlueCheckBox checked={termsCheckbox} onChange={toggleCheckbox} /> : <ContrastCheckBox checked={termsCheckbox} onChange={toggleCheckbox} />} - /> + <FormControlLabel label={<span className="label">Li e concordo com os termos de uso e de propriedade intelectual.</span>} control={<Checkbox checked={termsCheckbox} onChange={toggleCheckbox}/>} + /> </StyledFormControl> </Grid> <Grid item xs={12}> - <ButtonsDiv contrast={props.contrast} draftID={props.draftID} stepperControl={props.stepperControl} onPartTwo={true} /> + <ButtonsDiv draftID={props.draftID} stepperControl={props.stepperControl} onPartTwo={true}/> </Grid> - <Grid item xs={12} style={{ marginTop: "20px" }}> - <span style={props.contrast === "" ? { marginTop: "20px", fontWeight: "200", color: "#a5a5a5", paddingLeft: "10px" } : { marginTop: "20px", fontWeight: "200", color: "white", paddingLeft: "10px" }}> + <Grid item xs={12} style={{marginTop : "20px"}}> + <span style={{marginTop : "20px", fontWeight : "200", color : "#a5a5a5", paddingLeft : "10px"}}> * Campos obrigatórios </span> </Grid> </form> ) - : - ( - <LoadingSpinner contrast={props.contrast} text={"CARREGANDO"} /> - ) + : + ( + <LoadingSpinner text={"CARREGANDO"}/> + ) } </React.Fragment> ) @@ -288,8 +261,7 @@ const StyledFormControl = styled(FormControl)` .label { font-size : 14px !important; - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color : #666 !important; font-weight : 200 !important; } ` diff --git a/src/Components/UploadPageComponents/PartTwoComponents/CustomCircularProgress.js b/src/Components/UploadPageComponents/PartTwoComponents/CustomCircularProgress.js index 9de5008e66062efb18d8422783298c5c93a4af1a..2164091858560e3cb63f0c43099de40e2606b741 100644 --- a/src/Components/UploadPageComponents/PartTwoComponents/CustomCircularProgress.js +++ b/src/Components/UploadPageComponents/PartTwoComponents/CustomCircularProgress.js @@ -22,17 +22,14 @@ import CircularProgress from '@material-ui/core/CircularProgress'; const useStyles = makeStyles((theme) => ({ root: { - color: "#666", + color : "#666", }, - contrastRoot: { - color: "white", - } })); -export default function CustomCircularProgress(props) { +export default function CustomCircularProgress () { const classes = useStyles(); return ( - <CircularProgress className={props.contrast === "" ? classes.root : classes.contrastRoot} /> + <CircularProgress className={classes.root}/> ); } diff --git a/src/Components/UploadPageComponents/PartTwoComponents/DisplayThumbnail.js b/src/Components/UploadPageComponents/PartTwoComponents/DisplayThumbnail.js index 3cd8465dfb1331aabd77ef3f7b1f83801166658e..0c07e151670e4a256ed971abb978dad7b3107c5b 100644 --- a/src/Components/UploadPageComponents/PartTwoComponents/DisplayThumbnail.js +++ b/src/Components/UploadPageComponents/PartTwoComponents/DisplayThumbnail.js @@ -17,12 +17,12 @@ 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 { StyledFormLabel } from '../StyledComponents.js' +import {StyledFormLabel} from '../StyledComponents.js' import AddAPhotoIcon from '@material-ui/icons/AddAPhoto'; import Grid from '@material-ui/core/Grid'; import styled from 'styled-components' -export default function DisplayThumbnail(props) { +export default function DisplayThumbnail (props) { let windowWidth = window.innerWidth const handleUpload = (e, selectorFiles) => { @@ -32,42 +32,42 @@ export default function DisplayThumbnail(props) { return ( <React.Fragment> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> { props.onEditPage ? - ( - <b style={{ fontWeight: "ligther" }}>Imagem ilustrativa do recurso</b> - ) - : - ( - <> - <b>Editando Imagem</b> - <span style={props.contrast === "" ? { color: "#a5a5a5" } : { color: "white" }}>(Deixe seu recurso completo, para que todos o entendam melhor.)</span> - </> - ) + ( + <b style={{fontWeight : "ligther"}}>Imagem ilustrativa do recurso</b> + ) + : + ( + <> + <b>Editando Imagem</b> + <span style={{color : "#a5a5a5"}}>(Deixe seu recurso completo, para que todos o entendam melhor.)</span> + </> + ) } </StyledFormLabel> - <ImagemCarregada container contrast={props.contrast}> + <ImagemCarregada container> <Grid item xs={windowWidth > 990 ? 6 : 12}> <div className="img-preview"> - <img alt="" src={props.thumbnail} /> + <img alt="" src={props.thumbnail}/> <div className="alterar-imagem"> - <input type="file" onChange={(e) => handleUpload(e, e.target.files)} id="upload-file-thumbnail" style={{ display: "none" }} + <input type="file" onChange = {(e) => handleUpload(e, e.target.files)} id="upload-file-thumbnail" style={{display : "none"}} /> - <label htmlFor="upload-file-thumbnail" style={{ height: "100%", width: "inherit", cursor: "pointer" }}> + <label htmlFor="upload-file-thumbnail" style={{height : "100%", width : "inherit", cursor : "pointer"}}> <div className="interacoes"> - SUBSTITUIR <AddAPhotoIcon /> + SUBSTITUIR <AddAPhotoIcon/> </div> </label> - <div className="interacoes" onClick={() => { props.handleDelete() }}> - DELETAR <AddAPhotoIcon /> + <div className="interacoes" onClick={() => {props.handleDelete()}}> + DELETAR <AddAPhotoIcon/> </div> </div> </div> </Grid> <Grid item xs={windowWidth > 990 ? 6 : 12}> <div className="aviso-imagem-carregada"> - Sua imagem foi enviada, porém pode ser que demore alguns minutos até nosso servidor atualiza-la na página do recurso. + Sua imagem foi enviada, porém pode ser que demore alguns minutos até nosso servidor atualiza-la na página do recurso. </div> </Grid> </ImagemCarregada> @@ -77,7 +77,7 @@ export default function DisplayThumbnail(props) { const ImagemCarregada = styled(Grid)` .aviso-imagem-carregada { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; + color :#a5a5a5; font-size : 12px; font-weight : 500; text-align : justify; @@ -113,12 +113,10 @@ const ImagemCarregada = styled(Grid)` align-items : flex-end; height : 100%; padding : 10px; - color: ${props => props.contrast === "" ? "#fff" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color : #fff; font-size : 14px; .MuiSvgIcon-root { vertical-align : middle !important; - color: #fff; } } } diff --git a/src/Components/UploadPageComponents/PartTwoComponents/DragAndDropThumbnail.js b/src/Components/UploadPageComponents/PartTwoComponents/DragAndDropThumbnail.js index 56d532f8da83a78a4bae734ef294b12f20fd5ff9..59423e607f7d2395c498a12f7e2a2f6efc5e7e5a 100644 --- a/src/Components/UploadPageComponents/PartTwoComponents/DragAndDropThumbnail.js +++ b/src/Components/UploadPageComponents/PartTwoComponents/DragAndDropThumbnail.js @@ -16,13 +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 } from 'react' -import { DottedBox, BlueButton } from '../StyledComponents.js'; +import React, {useState} from 'react' +import {DottedBox, BlueButton} from '../StyledComponents.js'; import AddAPhotoIcon from '@material-ui/icons/AddAPhoto'; import FormControl from '@material-ui/core/FormControl'; -import { StyledFormLabel } from '../StyledComponents.js' +import {StyledFormLabel} from '../StyledComponents.js' -export default function DragAndDropThumbnail(props) { +export default function DragAndDropThumbnail (props) { const [dropDepth, setDropDepth] = useState(0) // eslint-disable-next-line const [inDropZone, toggleInDropZone] = useState(false) @@ -64,42 +64,41 @@ export default function DragAndDropThumbnail(props) { props.acceptFile(selectorFiles[0]) } return ( - <FormControl style={{ width: "100%" }}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> + <FormControl style={{width : "100%"}}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> { props.onEditPage ? - ( - <b style={props.contrast === "" ? { textAlign: "center", fontSize: "26px", fontWeight: "ligther" } : { textAlign: "center", fontSize: "26px", fontWeight: "ligther", color: "white" }}>Inserir Imagem Ilustrativa</b> - ) - : - ( - <> - <b>Imagem Ilustrativa do Recurso</b> <span style={props.contrast === "" ? { color: "#a5a5a5" } : { color: "white" }}>(Deixe seu recurso completo, para que todos o entendam melhor.)</span> - </> - ) + ( + <b style={{textAlign : "center", fontSize : "26px", fontWeight : "ligther"}}>Inserir Imagem Ilustrativa</b> + ) + : + ( + <> + <b>Imagem Ilustrativa do Recurso</b> <span style={{color : "#a5a5a5"}}>(Deixe seu recurso completo, para que todos o entendam melhor.)</span> + </> + ) } </StyledFormLabel> <DottedBox - contrast={props.contrast} onDrop={e => handleDrop(e)} onDragOver={e => handleDragOver(e)} onDragEnter={e => handleDragEnter(e)} onDragLeave={e => handleDragLeave(e)} thumbnail - > - <AddAPhotoIcon className="icon" /> + > + <AddAPhotoIcon className="icon"/> <input type="file" - onChange={(e) => handleUpload(e, e.target.files)} + onChange = {(e) => handleUpload(e, e.target.files)} id="upload-file-thumbnail" - style={{ display: "none" }} - /> - <BlueButton contrast={props.contrast}> - <label htmlFor="upload-file-thumbnail" style={{ width: "inherit", cursor: "pointer" }}> + style={{display : "none"}} + /> + <BlueButton> + <label htmlFor="upload-file-thumbnail" style={{width : "inherit", cursor : "pointer"}}> ESCOLHER IMAGEM </label> </BlueButton> - <span style={props.contrast === "" ? { marginTop: "6px" } : { color: "white" }}>Ou arrastar e soltar o arquivo aqui</span> + <span style={{marginTop : "6px"}}>Ou arrastar e soltar o arquivo aqui</span> </DottedBox> </FormControl> ) diff --git a/src/Components/UploadPageComponents/PartTwoComponents/EditThumbnail.js b/src/Components/UploadPageComponents/PartTwoComponents/EditThumbnail.js index 2ef43db3871a7334640802137a0032f96f5f2fee..7cce6bf2058f9c6512430053e27d6ed04f479800 100644 --- a/src/Components/UploadPageComponents/PartTwoComponents/EditThumbnail.js +++ b/src/Components/UploadPageComponents/PartTwoComponents/EditThumbnail.js @@ -16,28 +16,28 @@ 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 { StyledFormLabel } from '../StyledComponents.js' +import React, {useState} from 'react' +import {StyledFormLabel} from '../StyledComponents.js' import Cropper from '../../Cropper' import { Button } from '@material-ui/core'; import styled from 'styled-components' -export default function EditThumbnail(props) { +export default function EditThumbnail (props) { const [crop] = useState({ unit: "%" , - width : 200, - aspect: 9/6 + width : 100, + aspect: 9/3 }); return ( <> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> - <b>Editando Imagem</b> <span style={props.contrast === "" ? { color: "#a5a5a5" } : { color: "white" }}>(Deixe seu recurso completo, para que todos o entendam melhor.)</span> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> + <b>Editando Imagem</b> <span style={{color : "#a5a5a5"}}>(Deixe seu recurso completo, para que todos o entendam melhor.)</span> </StyledFormLabel> - <div style={{ display: "flex", alignItems: "center", flexDirection: "column" }}> - <div style={{ maxWidth: "500px", maxHeight: "300px", padding: "20px" }}> - <Cropper src={props.tempImgURL} crop={crop} circularCrop={false} update={props.updateThumb} /> + <div style={{display : "flex", alignItems : "center", flexDirection : "column"}}> + <div style={{maxWidth : "500px", maxHeight : "300px", padding : "20px"}}> + <Cropper src={props.tempImgURL} crop={crop} circularCrop={false} update={props.updateThumb}/> </div> - <StyledButton contrast={props.contrast} onClick={() => { props.finalizeThumb() }}>SELECIONAR IMAGEM</StyledButton> + <StyledButton onClick={() => {props.finalizeThumb()}}>SELECIONAR IMAGEM</StyledButton> </div> </> @@ -46,11 +46,10 @@ export default function EditThumbnail(props) { const StyledButton = styled(Button)` &:hover { - background: ${props => props.contrast === "" ? "rgba(158,158,158,0.2) !important" : "rgba(255,255,0,0.24) !important"}; + background-color : rgba(158,158,158,0.2) !important; } - background: ${props => props.contrast === "" ? "#fff !important" : "black !important"}; - border: ${props => props.contrast === "" ? "solid 1px #00bcd4 !important" : "solid 1px white !important"}; - color: ${props => props.contrast === "" ? "#00bcd4 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; + background-color : #fff !important; + border : solid 1px #00bcd4 !important; font-weight : 600 !important; + color : #00bcd4 !important; ` diff --git a/src/Components/UploadPageComponents/PartTwoComponents/EducationalStage.js b/src/Components/UploadPageComponents/PartTwoComponents/EducationalStage.js index f028b62b95636e60e4a048cb37394d27132b435a..96da308ae7eaf9c2eb942033bf707f567649e3ff 100644 --- a/src/Components/UploadPageComponents/PartTwoComponents/EducationalStage.js +++ b/src/Components/UploadPageComponents/PartTwoComponents/EducationalStage.js @@ -16,43 +16,21 @@ 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} from 'react' import FormControl from '@material-ui/core/FormControl'; -import { StyledFormLabel } from '../StyledComponents.js' +import {StyledFormLabel} from '../StyledComponents.js' import Checkbox from '@material-ui/core/Checkbox'; import FormGroup from '@material-ui/core/FormGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import styled from 'styled-components' -import { yellow, blue } from "@material-ui/core/colors"; -import { withStyles } from '@material-ui/core/styles'; -const BlueCheckBox = withStyles({ - root: { - color: blue[400], - '&$checked': { - color: blue[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -const ContrastCheckBox = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, - }, - checked: {}, -})((props) => <Checkbox color="default" {...props} />); - -export default function EducationalStage(props) { +export default function EducationalStage (props) { const [selected, setSelect] = useState(props.initialValue ? props.initialValue : []) const handleSet = (event) => { let newValue = event.target.value - if (selected.indexOf(newValue) > - 1) { + if(selected.indexOf(newValue) > - 1) { setSelect(selected.filter(item => item !== newValue)) } else { @@ -61,15 +39,15 @@ export default function EducationalStage(props) { } return ( - <FormControl required style={{ minWidth: "30%" }}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> - <b>Nível de ensino</b> <span style={props.contrast === "" ? { color: "#a5a5a5" } : { color: "white" }}>(Selecione uma ou mais opções)</span> + <FormControl required style={{minWidth : "30%"}}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> + <b>Nível de ensino</b> <span style={{color : "#a5a5a5"}}>(Selecione uma ou mais opções)</span> </StyledFormLabel> - <StyledFormGroup onBlur={() => { props.onBlurCallback("educational_stages", selected, props.draftID) }}> + <StyledFormGroup onBlur={() => {props.onBlurCallback("educational_stages", selected, props.draftID)}}> { props.eduStages.map(stage => <FormControlLabel key={stage.id} label={stage.name} - control={props.contrast === "" ? <BlueCheckBox checked={selected.indexOf(String(stage.id)) > - 1} value={stage.id} onChange={handleSet} /> : <ContrastCheckBox checked={selected.indexOf(String(stage.id)) > - 1} value={stage.id} onChange={handleSet} />} /> + control={<Checkbox checked={selected.indexOf(String(stage.id)) > - 1} value={stage.id} onChange={handleSet}/>}/> ) } </StyledFormGroup> diff --git a/src/Components/UploadPageComponents/PartTwoComponents/Licenca.js b/src/Components/UploadPageComponents/PartTwoComponents/Licenca.js index 30c2d581e91f344621195359b45dc493015ff36a..9e8e059aed392a5791d6e11ee8e1b492803585eb 100644 --- a/src/Components/UploadPageComponents/PartTwoComponents/Licenca.js +++ b/src/Components/UploadPageComponents/PartTwoComponents/Licenca.js @@ -16,67 +16,45 @@ 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, memo } from 'react' +import React, {useState, memo} from 'react' import styled from 'styled-components' import FormControl from '@material-ui/core/FormControl'; -import { StyledFormLabel } from '../StyledComponents.js' +import {StyledFormLabel} from '../StyledComponents.js' import RadioGroup from '@material-ui/core/RadioGroup'; import Radio from '@material-ui/core/Radio'; import FormControlLabel from '@material-ui/core/FormControlLabel'; -import { yellow, blue } from "@material-ui/core/colors"; -import { withStyles } from '@material-ui/core/styles'; - -const BlueRadio = withStyles({ - root: { - color: blue[400], - '&$checked': { - color: blue[600], - }, - }, - checked: {}, -})((props) => <Radio color="default" {...props} />); - -const ContrastRadio = withStyles({ - root: { - color: yellow[400], - '&$checked': { - color: yellow[600], - }, - }, - checked: {}, -})((props) => <Radio color="default" {...props} />); - -function Licenca(props) { + +function Licenca (props) { const options = [ - { name: "CC BY", description: "(Esta licença permite que outros distribuam, remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito pela criação original)", id: 1 }, + {name : "CC BY", description : "(Esta licença permite que outros distribuam, remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito pela criação original)", id : 1}, - { name: "CC BY-SA", description: "(Esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito e que licenciem as novas criações sob termos idênticos)", id: 2 }, + {name : "CC BY-SA", description : "(Esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho, mesmo para fins comerciais, desde que lhe atribuam o devido crédito e que licenciem as novas criações sob termos idênticos)", id : 2}, - { name: "CC BY-NC", description: "(Esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais e, embora os novos trabalhos tenham de lhe atribuir o devido crédito e não possam ser usados para fins comerciais, os usuários não têm de licenciar esses trabalhos derivados sob os mesmos termos)", id: 4 }, + {name : "CC BY-NC", description : "(Esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais e, embora os novos trabalhos tenham de lhe atribuir o devido crédito e não possam ser usados para fins comerciais, os usuários não têm de licenciar esses trabalhos derivados sob os mesmos termos)", id : 4}, - { name: "CC BY-NC SA", description: "(Esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais, desde que atribuam o devido crédito e que licenciem as novas criações sob termos idênticos)", id: 5 }, + {name : "CC BY-NC SA", description : "(Esta licença permite que outros remixem, adaptem e criem a partir do seu trabalho para fins não comerciais, desde que atribuam o devido crédito e que licenciem as novas criações sob termos idênticos)", id : 5}, - { name: "CC BY-NC-ND 3.0 BR", description: "(Atribuição-NãoComercial-SemDerivações 3.0 Brasil. Esta licença permite compartilhar, copiar e redistribuir o material em qualquer suporte ou formato)", id: 12 } + {name : "CC BY-NC-ND 3.0 BR", description : "(Atribuição-NãoComercial-SemDerivações 3.0 Brasil. Esta licença permite compartilhar, copiar e redistribuir o material em qualquer suporte ou formato)", id : 12} ] const [value, setValue] = useState(props.initialValue ? props.initialValue : -1) - const handleChange = (event) => { setValue(Number(event.target.value)) } + const handleChange = (event) => {setValue(Number(event.target.value))} return ( - <FormControl required="true" style={{ width: "100%" }}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> - <b>Licença do Uso do Conteúdo</b> <a href="https://br.creativecommons.org/licencas/" style={props.contrast === "" ? { color: "#ff7f00", textDecoration: "underline" } : { color: "yellow", textDecoration: "underline" }}>Saiba mais</a> + <FormControl required="true" style={{width : "100%"}}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> + <b>Licença do Uso do Conteúdo</b> <a href="https://br.creativecommons.org/licencas/" style={{color : "#ff7f00", textDecoration : "underline"}}>Saiba mais</a> </StyledFormLabel> - <StyledRadioGroup contrast={props.contrast} aria-label="Tipo de Recurso" name="Tipo de Recurso" row value={value} onChange={handleChange} style={{ justifyContent: "center" }} onBlur={() => { props.onBlurCallback("license_id", value, props.draftID) }}> + <StyledRadioGroup aria-label="Tipo de Recurso" name="Tipo de Recurso" row value={value} onChange={handleChange} style={{justifyContent : "center"}} onBlur={() => {props.onBlurCallback("license_id", value, props.draftID)}}> { - options.map((option) => - <FormControlLabel key={option.id} value={option.id} - control={props.contrast === "" ? <BlueRadio /> : <ContrastRadio />} - label={ - <span className="title">{option.name} - <span className="parentese"> {option.description}</span> - </span> + options.map( (option) => + <FormControlLabel key={option.id} value={option.id} + control={<Radio />} + label={ + <span className="title">{option.name} + <span className="parentese"> {option.description}</span> + </span> } /> ) @@ -98,12 +76,12 @@ const StyledRadioGroup = styled(RadioGroup)` .title { font-size: 14px; font-weight: 600; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color:#666; padding-left: 2px; } .parentese { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; font-weight: 200; + color:#a5a5a5; padding-left: 10px; } ` diff --git a/src/Components/UploadPageComponents/PartTwoComponents/SubjectsAndThemes.js b/src/Components/UploadPageComponents/PartTwoComponents/SubjectsAndThemes.js index 986081d86a4a2f642accb42616cd5174f88901c0..326dec2320b864be6820e9ec1182db9aa2066688 100644 --- a/src/Components/UploadPageComponents/PartTwoComponents/SubjectsAndThemes.js +++ b/src/Components/UploadPageComponents/PartTwoComponents/SubjectsAndThemes.js @@ -16,40 +16,39 @@ 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, memo } from 'react' +import React, {useState, memo} from 'react' import { makeStyles } from '@material-ui/core/styles'; import FormControl from '@material-ui/core/FormControl'; -import { ObjTypeBox, StyledFormLabel } from '../StyledComponents.js' +import {ObjTypeBox, StyledFormLabel} from '../StyledComponents.js' import FormGroup from '@material-ui/core/FormGroup'; -import { GetSubjectIconByName } from '../GetIconByName.js' +import {GetSubjectIconByName} from '../GetIconByName.js' import FormControlLabel from '@material-ui/core/FormControlLabel'; import Checkbox from '@material-ui/core/Checkbox'; import Grid from '@material-ui/core/Grid'; const useStyles = makeStyles({ - root: { - '&:hover': { - backgroundColor: 'transparent', - }, - } -}) - -function StyledCheckbox(props) { + root: { + '&:hover': { + backgroundColor: 'transparent', + }, +}}) + +function StyledCheckbox (props) { const classes = useStyles(); return ( <Checkbox className={classes.root} disableRipple - checkedIcon={ - <ObjTypeBox checked contrast={props.contrast}> + checkedIcon = { + <ObjTypeBox checked> <span> {GetSubjectIconByName(props.label)} <p>{props.label}</p> </span> </ObjTypeBox> } - icon={ - <ObjTypeBox contrast={props.contrast}> + icon = { + <ObjTypeBox> <span> {GetSubjectIconByName(props.label)} <p>{props.label}</p> @@ -62,77 +61,75 @@ function StyledCheckbox(props) { } -function SubjectsAndThemes(props) { +function SubjectsAndThemes (props) { const [value, setValue] = useState(props.initialValue ? props.initialValue : []) const handleChange = (event) => { const newValue = event.target.value - if ((value.indexOf(newValue) > -1)) { + if((value.indexOf(newValue) > -1)) { setValue(value.filter(item => item !== newValue)) } else { setValue(value => [...value, newValue]) } - } + } return ( <React.Fragment> - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <FormControl required style={{ width: "100%" }}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> - <b>Componente curricular</b> <span>(Selecione uma ou mais opções)</span> - </StyledFormLabel> - <FormGroup row style={{ justifyContent: "center" }} onBlur={() => { props.onBlurCallback("subjects", value, props.draftID) }}> - { - props.subjects.map((subject) => - <> - <FormControlLabel key={subject.id} value={subject.id} - control={ - <StyledCheckbox - contrast={props.contrast} - label={subject.name} - checked={value.indexOf(String(subject.id)) > -1} - onChange={handleChange} - />} - /> - </> - ) - - } - </FormGroup> - </FormControl> - </Grid> - - { - - props.onUploadPage && - <Grid item xs={12} style={{ paddingBottom: "40px" }}> - <FormControl style={{ width: "100%" }}> - <StyledFormLabel contrast={props.contrast} component="legend" style={{ fontSize: "14px", marginBottom: "10px" }}> - <b>Outras Temáticas</b> - </StyledFormLabel> - <FormGroup aria-label="Tipo de Recurso" name="Tipo de Recurso" row style={{ justifyContent: "center" }} onBlur={() => { props.onBlurCallback("subjects", value, props.draftID) }}> - { - props.themes.map((theme) => - <FormControlLabel key={theme.id} value={theme.id} - control={ - <StyledCheckbox - contrast={props.contrast} - label={theme.name} - checked={value.indexOf(String(theme.id)) > -1} - onChange={handleChange} - - /> - } - /> - ) + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <FormControl required style={{width : "100%"}}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> + <b>Componente curricular</b> <span>(Selecione uma ou mais opções)</span> + </StyledFormLabel> + <FormGroup row style={{justifyContent : "center"}} onBlur={() => {props.onBlurCallback("subjects", value, props.draftID)}}> + { + props.subjects.map( (subject) => + <> + <FormControlLabel key={subject.id} value={subject.id} + control={ + <StyledCheckbox + label={subject.name} + checked={value.indexOf(String(subject.id)) > -1} + onChange={handleChange} + />} + /> + </> + ) + + } + </FormGroup> + </FormControl> + </Grid> + + { + + props.onUploadPage && + <Grid item xs={12} style={{paddingBottom : "40px"}}> + <FormControl style={{width : "100%"}}> + <StyledFormLabel component="legend" style={{fontSize : "14px", marginBottom : "10px"}}> + <b>Outras Temáticas</b> + </StyledFormLabel> + <FormGroup aria-label="Tipo de Recurso" name="Tipo de Recurso" row style={{justifyContent : "center"}} onBlur={() => {props.onBlurCallback("subjects", value, props.draftID)}}> + { + props.themes.map( (theme) => + <FormControlLabel key={theme.id} value={theme.id} + control={ + <StyledCheckbox + label={theme.name} + checked={value.indexOf(String(theme.id)) > -1} + onChange={handleChange} + /> } - </FormGroup> - </FormControl> - </Grid> - } + /> + ) + + } + </FormGroup> + </FormControl> + </Grid> + } </React.Fragment> ) } diff --git a/src/Components/UploadPageComponents/Stepper.js b/src/Components/UploadPageComponents/Stepper.js index a4acce469786ff8af28648a0d4a31f4751a1a83e..c1f9d40f55c2e4aafba0c44282ed441077853bf0 100644 --- a/src/Components/UploadPageComponents/Stepper.js +++ b/src/Components/UploadPageComponents/Stepper.js @@ -18,90 +18,160 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React from 'react'; import styled from 'styled-components' +import PropTypes from 'prop-types'; +import { makeStyles } from '@material-ui/core/styles'; +import clsx from 'clsx'; +import Stepper from '@material-ui/core/Stepper'; +import Step from '@material-ui/core/Step'; +import StepLabel from '@material-ui/core/StepLabel'; import Check from '@material-ui/icons/Check'; -import Grid from '@material-ui/core/Grid'; -export default function CustomizedSteppers(props) { +const useColorlibStepIconStyles = makeStyles({ + root: { + backgroundColor: '#fff', + color: '#00bcd4', + width: 36, + height: 36, + display: 'flex', + border : 'solid 3px #00bcd4', + borderRadius: '50%', + justifyContent: 'center', + alignItems: 'center', + }, + active: { + backgroundColor : '#00bcd4', + color : '#fff', + }, + completed: { + backgroundColor : '#00bcd4', + color : '#fff', + }, +}); + +function ColorlibStepIcon(props) { + const classes = useColorlibStepIconStyles(); + const { active, completed } = props; - function isInFinalSTep(step) { - return step === 2; - } + const icons = { + 1: '1', + 2: '2', + 3: '3', + }; return ( - <MainGrid contrast={props.contrast} container direction='row' justify='space-between' alignItems='center'> - { - !isInFinalSTep(props.activeStep) ? - - [0, 1, 2].map((index) => { - return ( - <Grid item key={new Date().toISOString() + index}> - <div className={props.activeStep === index ? "currStep" : "step"}> - { - index < props.activeStep ? - <Check style={props.contrast === "" ? { color: "#00bcd4" } : { color: "white" }} /> : index - } - </div> - </Grid> - ) - }) - : - [0, 1, 2].map((index) => { - return ( - <Grid item key={new Date().toISOString() + index}> - <div className={props.activeStep === index ? "currStep" : "finalStep"}> - { - index < props.activeStep ? - <Check style={{ color: 'white' }} /> : - <span style={{ color: 'white' }}> - {index} - </span> - } - </div> - </Grid> - ) - }) - } - </MainGrid > + <div + className={clsx(classes.root, { + [classes.active]: active, + [classes.completed]: completed, + })} + > + {completed ? <Check className={classes.completed} /> : icons[String(props.icon)]} + </div> ); } -const MainGrid = styled(Grid)` - padding: 1em; - border-radius: 50px; - width: 90%; - margin: 0 auto; - border: ${props => props.contrast === "" ? "2px solid #d4d4d4" : "2px solid white"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - - .currStep{ - height: 30px; - width: 30px; - display: flex; - justify-content: center; - align-items: center; - border: 2px solid rgba(255, 255, 255, 0.6); - border-radius: 50%; - } - - .step{ - height: 30px; - width: 30px; - display: flex; - justify-content: center; - align-items: center; - border: ${props => props.contrast === "" ? "2px solid #00bcd4" : "2px solid white"}; - border-radius: 50%; - } - - .finalStep{ - height: 30px; - width: 30px; - display: flex; - justify-content: center; - align-items: center; - border: 2px solid white; - border-radius: 50%; - color: white; - } -` +ColorlibStepIcon.propTypes = { + /** + * Whether this step is active. + */ + active: PropTypes.bool, + /** + * Mark the step as completed. Is passed to child components. + */ + completed: PropTypes.bool, + /** + * The label displayed in the step icon. + */ + icon: PropTypes.node, +}; + +// const useStyles = makeStyles((theme) => ({ +// root: { +// width: '100%', +// }, +// button: { +// marginRight: theme.spacing(1), +// }, +// instructions: { +// marginTop: theme.spacing(1), +// marginBottom: theme.spacing(1), +// }, +// })); + +function getSteps() { + return ['Select campaign settings', 'Create an ad group', 'Create an ad']; +} + +// function getStepContent(step) { +// switch (step) { +// case 0: +// return 'Select campaign settings...'; +// case 1: +// return 'What is an ad group anyways?'; +// case 2: +// return 'This is the bit I really care about!'; +// default: +// return 'Unknown step'; +// } +// } + +export default function CustomizedSteppers(props) { + // const classes = useStyles(); + const steps = getSteps(); +// {/* const handleNext = () => { +// setActiveStep((prevActiveStep) => prevActiveStep + 1); +// }; + +// const handleBack = () => { +// setActiveStep((prevActiveStep) => prevActiveStep - 1); +// }; + +// const handleReset = () => { +// setActiveStep(0); +// };*/} + + return ( + + <> + <StyledStepper style={{backgroundColor : "#e5e5e5", borderRadius : "50px", justifyContent : "space-between"}} activeStep={props.activeStep} connector={<></>}> + {steps.map((label) => ( + <Step key={label}> + <StepLabel StepIconComponent={ColorlibStepIcon}/> + </Step> + ))} + </StyledStepper> + {/*<div> + {activeStep === steps.length ? ( + <div> + <Button onClick={handleReset} className={classes.button}> + Reset + </Button> + </div> + ) : ( + <div> + <Typography className={classes.instructions}>{getStepContent(activeStep)}</Typography> + <div> + <Button disabled={activeStep === 0} onClick={handleBack} className={classes.button}> + Back + </Button> + <Button + variant="contained" + color="primary" + onClick={handleNext} + className={classes.button} + > + {activeStep === steps.length - 1 ? 'Finish' : 'Next'} + </Button> + </div> + </div> + )} + </div>*/} + </> + ); +} + +const StyledStepper = styled(Stepper)` + padding : 7px !important; + +` diff --git a/src/Components/UploadPageComponents/StyledComponents.js b/src/Components/UploadPageComponents/StyledComponents.js index f09077acd3440bfc2f8453937b668f8ad3bd842e..3c157e6f38eceec0f2376bcba6a8328fb6b64abe 100644 --- a/src/Components/UploadPageComponents/StyledComponents.js +++ b/src/Components/UploadPageComponents/StyledComponents.js @@ -35,18 +35,18 @@ export const StyledFormHelperText = styled(FormHelperText)` export const DottedBox = styled.div` align-self : center; /* width : ${props => props.thumbnail ? "100%" : "320px"}; */ - background-color : ${props => props.contrast === "" ? props.thumbnail ? "transparent" : "#f4f4f4" : "black"}; - border : ${props => props.contrast === "" ? props.thumbnail ? "2px dashed #a5a5a5" : "2px dashed #00bcd4" : "2px dashed white"}; + background-color : ${props => props.thumbnail ? "transparent" : "#f4f4f4"}; + border : ${props => props.thumbnail ? "2px dashed #a5a5a5" : "2px dashed #00bcd4"}; align-items : center; border-radius : 10px; display : flex; flex-direction : column; padding : 20px 0; - color : ${props => props.contrast === "" ? props.thumbnail ? "#a5a5a5" : "$666" : "white"}; + color : ${props => props.thumbnail ? "#a5a5a5" : "$666"}; .icon { font-size : 40px !important; - color : ${props => props.contrast === "" ? "#00bcd4 !important" : "white !important"}; + color : #00bcd4 !important; margin-bottom : 10px !important; vertical-align : middle !important; font-weight : normal !important; @@ -64,30 +64,32 @@ export const DottedBox = styled.div` export const BlueButton = styled(Button)` &:hover { - background-color: ${props => props.contrast === "" ? "#00acc1 !important" : "rgba(255,255,0,0.24) !important"}; + background-color : #00acc1 !important; } - color : ${props => props.contrast === "" ? "#fff !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; - background-color : ${props => props.contrast === "" ? "#00bcd4 !important" : "black !important"}; - border : ${props => props.contrast === "" ? "none !important" : "1px solid white !important"}; + color : #fff !important; + background-color : #00bcd4 !important; + height : 36px !important; box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; font-weight : 600 !important; + min-width : 88px !important; + align-self : center !important; + padding : 16px !important; ` export const GrayButton = styled(Button)` &:hover { - background-color: ${props => props.contrast === "" ? "rgba(158,158,158,0.2) !important" : "rgba(255,255,0,0.24) !important"}; + background-color : rgba(158,158,158,0.2) !important; } - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline" } !important; - - background-color : ${props => props.contrast === "" ? "transparent !important" : "black !important"}; - border : ${props => props.contrast === "" ? "none !important" : "1px solid white !important"}; + height : 36px !important; font-weight : 600 !important; - + color : #666 !important; + background-color: transparent; + min-width : 88px !important; + height : 36px !important; + margin-left : 8px !important; + margin-right : 8px !important; .icon { vertical-align : middle !important; - color : ${props => props.contrast === "" ? "#666 !important" : "white !important"}; font-weight : normal !important; font-style : normal !important; font-size : 24px !important; @@ -114,9 +116,6 @@ export const GrayButton = styled(Button)` font-style : inherit; font-variant : inherit; } - - margin-left : 8px !important; - margin-right : 8px !important; ` export const WrapperBox = styled.div` @@ -125,14 +124,12 @@ export const WrapperBox = styled.div` display : block; border-radius : 3px; box-shadow : 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + background-color : #fff; font-size : 14px; - background: ${props => props.contrast === "" ? " #fff" : "black"}; - border: ${props => props.contrast === "" ? " " : "1px solid white"}; .inner { display : block; padding : 20px; - background: ${props => props.contrast === "" ? " #fff" : "black"}; } .upload-title { @@ -140,7 +137,6 @@ export const WrapperBox = styled.div` font-size : 26px; margin-bottom : 10px; font-weight : lighter; - color: ${props => props.contrast === "" ? "" : "white"}; } .flex-column { @@ -154,7 +150,6 @@ export const WrapperBox = styled.div` p { margin : 0 0 10px; - color: ${props => props.contrast === "" ? "" : "white"}; } .buttons-div { @@ -187,7 +182,7 @@ export const WrapperBox = styled.div` overflow : hidden; text-align : center; font-size : 14px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color : #666; padding : 0 5px; } } @@ -236,7 +231,7 @@ export const WrapperBox = styled.div` .file-status { .icon-margin { - color: ${props => props.contrast === "" ? "#00bcd4" : "white"}; + color : #00bcd4; margin-right : 5px; } .MuiLinearProgress-root { @@ -256,20 +251,17 @@ export const WrapperBox = styled.div` margin-top: 40px; border-top: solid 1px #f4f4f4; text-align: center; - color: ${props => props.contrast === "" ? "" : "white"}; span { font-size : 16px; font-weight : lighter; - color: ${props => props.contrast === "" ? "" : "white"}; } } } ` export const InfoBox = styled.div` - background: ${props => props.contrast === "" ? " #fff" : "black"}; - border: ${props => props.contrast === "" ? " " : "1px solid white"}; + background-color : #fff; padding : 30px; box-shadow : 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); margin-bottom : 30px; @@ -302,13 +294,8 @@ export const ObjTypeBox = styled.div` height : 100px; width : 100px; border-radius : 10px; - background-color : ${props => props.contrast === "" ? "#f4f4f4" : "black"}; - border : ${props => props.contrast === "Contrast" ? props.checked ? "1px solid white" : "0" : props.checked ? "1px solid #00bcd4" : "0"}; - font-weight : ${props => props.checked ? "bold" : "lighter"}; - - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; + background-color : ${props => props.checked ? "#00bcd4" : "#f4f4f4"}; + color : ${props => props.checked ? "#fff" : "#00bcd4"}; span { padding-top : 5%; @@ -317,20 +304,22 @@ export const ObjTypeBox = styled.div` justify-content : center; .icon { - color : #00bcd4; + color : inherit; align-self : center; height : 48px; width : 48px; } p { - color : ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration : ${props => props.contrast === "Contrast" ? props.checked ? "none" : "underline" : "none"}; height : 28px; font-size : 14px; text-align : center; line-height : 14px; } + + svg path { + fill : ${props => props.checked ? "#fff" : "#00bcd4"}; + } } ` @@ -338,173 +327,168 @@ export const OutroAutorTextField = styled(TextField)` font-size : 14px; width : 100% !important; - .MuiOutlinedInput-root { - &.Mui-focused fieldset { - border-color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - } - fieldset { - border-color: ${props => props.contrast === "" ? "#666" : "white"}; - } + .MuiFormControl-root { + margin : 18px 0 !important; } - label{ - color: ${props => props.contrast === "" ? "#666" : "white"}; + .MuiFormHelperText-root { + text-align : left; + font-size : 14px !important ; } label.Mui-focused { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; + color : #00bcd4; } label.Mui-focused.Mui-error { color : red; } + .MuiInput-underline::after { + border-bottom: 1px solid #00bcd4; + } .MuiFormHelperText-root { - text-align : left; - color: ${props => props.contrast === "" ? "#666" : "white"}; + font-size : 12px !important; + text-align : right !important; } ` export const StyledFormLabel = styled(FormLabel)` b { - color: ${props => props.contrast === "" ? "#666 !important" : "white !important"}; + color : #666 !important; } span { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; + color : #a5a5a5; } ` export const StyledTextField = styled(TextField)` font-size : 14px; width : 100% !important; + full-width : 100% !important; - .MuiOutlinedInput-root { - &.Mui-focused fieldset { - border-color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - } - fieldset { - border-color: ${props => props.contrast === "" ? "#666" : "white"}; - } + .MuiFormControl-root { + margin : 18px 0 !important; } - label{ - color: ${props => props.contrast === "" ? "#666" : "white"}; + + .MuiFormHelperText-root { + text-align : left; + font-size : 14px !important ; } label.Mui-focused { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; + color : #00bcd4; } label.Mui-focused.Mui-error { color : red; } + .MuiInput-underline::after { + border-bottom: 2px solid #00bcd4; + } .MuiFormHelperText-root { - text-align : left; - color: ${props => props.contrast === "" ? "#666" : "white"}; + font-size : 12px !important; + text-align : right !important; } ` -const useStyles = makeStyles({ - root: { - '&:hover': { - backgroundColor: 'transparent', - }, - } -}) - -export function StyledRadio(props) { - const classes = useStyles(); - return ( - <Radio - className={classes.root} - disableRipple - checkedIcon={ - <ObjTypeBox contrast={props.contrast} checked> - <span> - {GetIconByName(props.label)} - <p>{props.label}</p> - </span> - </ObjTypeBox> - } - icon={ - <ObjTypeBox contrast={props.contrast}> - <span> - {GetIconByName(props.label)} - <p>{props.label}</p> - </span> - </ObjTypeBox> - } - {...props} - /> - ) -} - -export const StyledDiv = styled.div` - display : flex; - margin-top : 30px; - justify-content : space-evenly; + const useStyles = makeStyles({ + root: { + '&:hover': { + backgroundColor: 'transparent', + }, + }}) + + export function StyledRadio (props) { + const classes = useStyles(); + return ( + <Radio + className={classes.root} + disableRipple + checkedIcon = { + <ObjTypeBox checked> + <span> + {GetIconByName(props.label)} + <p>{props.label}</p> + </span> + </ObjTypeBox> + } + icon = { + <ObjTypeBox> + <span> + {GetIconByName(props.label)} + <p>{props.label}</p> + </span> + </ObjTypeBox> + } + {...props} + /> + ) + } + + export const StyledDiv = styled.div` + display : flex; + margin-top : 30px; + justify-content : space-evenly; ` -export const OrangeButton = styled(Button)` + export const OrangeButton = styled(Button)` max-height : 36px !important; - box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; - font-weight : 600 !important; - background: ${props => props.contrast === "" ? " #ff7f00 !important" : "black !important"}; - color: ${props => props.contrast === "" ? "rgba(255,255,255,0.87) !important" : "yellow !important"}; - border: ${props => props.contrast === "" ? "" : "1px solid white !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; - margin-left : 8px !important; - margin-right : 8px !important; - &:hover { - background: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24) !important"}; - } + color : rgba(255,255,255,0.87) !important; + box-shadow : 0 2px 5px 0 rgba(0,0,0,.26) !important; + font-weight : 600 !important; + background-color : #ff7f00 !important; + margin-left : 8px !important; + margin-right : 8px !important; ` -export const GreyButton = styled(Button)` - background: ${props => props.contrast === "" ? "transparent !important" : "black !important"}; - color: ${props => props.contrast === "" ? "#666 !important" : "yellow !important"}; - border: ${props => props.contrast === "" ? "" : "1px solid white !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; - outline : none !important; - text-align : center !important; - - margin-left : 8px !important; - margin-right : 8px !important; - - .button-text { - cursor : pointer; - text-align : center; - color : currentColor; - white-space : nowrap; - text-transform : uppercase; - font-weight : 600 !important; - font-style : inherit; - font-variant : inherit; - } + export const GreyButton = styled(Button)` + &:hover { + background-color : rgba(158,158,158,0.2) !important; + } + max-height : 36px !important; + + background-color : transparent !important; + color : #666 !important; + text-decoration : none !important; + outline : none !important; + text-align : center !important; + + .button-text { + cursor : pointer; + line-height : 36px; + text-align : center; + color : currentColor; + white-space : nowrap; + text-transform : uppercase; + font-weight : 600 !important; + font-size : 14px; + font-style : inherit; + font-variant : inherit; + padding : 6px 16px !important; + } ` -export const Background = styled.div` - padding-top : 40px; - background: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - - .container { - padding : 0; - margin-right : auto; - margin-left : auto; - background: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - - - @media screen and (min-width: 768px) { - width : 750px; - } - @media screen and (min-width: 992px) { - width : 970px; - } - @media screen and (min-width: 1200px) { - width : 1170px; - } - } + export const Background = styled.div ` + padding-top : 40px; + background-color : #f4f4f4; + color : #666; + + .container { + padding : 0; + margin-right : auto; + margin-left : auto; + + @media screen and (min-width: 768px) { + width : 750px; + } + @media screen and (min-width: 992px) { + width : 970px; + } + @media screen and (min-width: 1200px) { + width : 1170px; + } + } ` diff --git a/src/Components/UploadPageComponents/UploadFileWrapper.js b/src/Components/UploadPageComponents/UploadFileWrapper.js index 866f02097561cf25a9075ff8b3bb208c08bec2d5..b8919a54a0de3a1872de7c5258d32fdecfedc656 100644 --- a/src/Components/UploadPageComponents/UploadFileWrapper.js +++ b/src/Components/UploadPageComponents/UploadFileWrapper.js @@ -16,21 +16,21 @@ 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} from 'react' import LinkIcon from '../../img/link_icon.svg' import ChooseLink from './ChooseLinkSection.js' -import { WrapperBox, BlueButton, GrayButton } from './StyledComponents.js'; -import { DottedBox } from './StyledComponents.js'; -import { getAxiosConfigFromJSON, updateHeaders, deleteRequest, putRequest } from '../HelperFunctions/getAxiosConfig.js' +import {WrapperBox, BlueButton, GrayButton} from './StyledComponents.js'; +import {DottedBox} from './StyledComponents.js'; +import {getAxiosConfigFromJSON, updateHeaders, deleteRequest, putRequest} from '../HelperFunctions/getAxiosConfig.js' import AttachFileIcon from '@material-ui/icons/AttachFile'; import axios from 'axios' -import { apiUrl } from '../../env'; +import {apiUrl} from '../../env'; import DoneIcon from '@material-ui/icons/Done'; import DeleteIcon from '@material-ui/icons/Delete'; import Alert from '../Alert.js'; import Snackbar from '@material-ui/core/Snackbar'; -export default function UploadFileWrapper(props) { +export default function UploadFileWrapper (props) { /*----------------------------------------------------------------- - Wrapper for file upload box - has three different stages: @@ -41,11 +41,10 @@ export default function UploadFileWrapper(props) { - Props used: - submit : called when the user clicks "ENVIAR" inside ChooseLinkSection; renders the alert snackbar to let them know the link was submitted - - contrast : used to display contrast colors or not - */ + */ const [stage, setStage] = useState(props.prevFile ? "fileSelected" : "default") - const handleNextStage = (newStage) => { setStage(newStage) } + const handleNextStage = (newStage) => {setStage(newStage)} // eslint-disable-next-line const [fileToUpload, setFileToUpload] = useState(null); @@ -56,15 +55,15 @@ export default function UploadFileWrapper(props) { const [uploadProgress, setProgress] = useState(0) const [attachmentID, setAttachmentID] = useState(props.prevFile ? props.prevFile.id : null) - async function onFileChange(file) { - if (!file) return; + async function onFileChange (file) { + if(!file) return; let newFile = file - //console.log(newFile) + console.log(newFile) setFileToUpload(newFile); setFileName(newFile.name) - let total = Math.ceil(newFile.size / chunkSize) + let total = Math.ceil(newFile.size/chunkSize) let currentChunkStartByte = 0; let currentChunkFinalByte = chunkSize > newFile.size ? newFile.size : chunkSize; let chunkIdentifier = props.draftID + '-' + newFile.name; @@ -85,11 +84,11 @@ export default function UploadFileWrapper(props) { try { const response = await axios.post(uploadUrl, formData, config); - //console.log(response) + console.log(response) if (response.headers['access-token']) { updateHeaders(response.headers) } - setProgress(Math.round((currentChunkFinalByte / newFile.size) * 100)) + setProgress(Math.round((currentChunkFinalByte/newFile.size) * 100)) remainingBytes = newFile.size - currentChunkFinalByte; if (currentChunkFinalByte === newFile.size) { setFileDoneUploading(true) @@ -104,6 +103,7 @@ export default function UploadFileWrapper(props) { currentChunkFinalByte = currentChunkStartByte + chunkSize; } } catch (error) { + console.log(error) handleNextStage("error") return; } @@ -114,12 +114,12 @@ export default function UploadFileWrapper(props) { if (attachmentID != null) { const url = `/learning_objects/${props.draftID}/attachment/${attachmentID}` - deleteRequest(url, (data) => { handleNextStage("default") }, (error) => { console.log(error) }) + deleteRequest(url, (data) => {handleNextStage("default")}, (error) => {console.log(error)}) } } const handleCancel = () => { - + console.log('cancelar request') } const handleDragOver = e => { @@ -133,6 +133,7 @@ export default function UploadFileWrapper(props) { e.stopPropagation(); let files = [...e.dataTransfer.files] + console.log('files: ', files) if (files && files.length > 0) { onFileChange(files[0]) } @@ -144,25 +145,25 @@ export default function UploadFileWrapper(props) { const url = `/learning_objects/${props.draftID}` let payload = { - "learning_object": { - "id": props.draftID, - "link": link + "learning_object" : { + "id" : props.draftID, + "link" : link } } - putRequest(url, payload, (data) => { toggleSnackbar(true) }, (error) => { console.log(error) }) + putRequest(url, payload, (data) => {toggleSnackbar(true)}, (error) => {console.log(error)}) } switch (stage) { case "error": - return ( - <WrapperBox contrast={props.contrast}> + return( + <WrapperBox> <div className="inner"> <div className="upload-title">Erro</div> - <span>Clique no botão para tentar novamente.</span> + <span>Clique no botão para tentar novamente.</span> <div className="flex-column"> <div className="buttons-div"> - <GrayButton contrast={props.contrast} onClick={() => { handleNextStage("default") }}> + <GrayButton onClick={() => {handleNextStage("default")}}> <span className="button-text"> Voltar </span> @@ -173,8 +174,8 @@ export default function UploadFileWrapper(props) { </WrapperBox> ) case "fileSelected": - return ( - <WrapperBox contrast={props.contrast}> + return( + <WrapperBox> <div className="inner"> <div className="upload-title"> {fileDoneUploading ? 'O arquivo foi carregado' : 'Carregando arquivo'} @@ -185,33 +186,33 @@ export default function UploadFileWrapper(props) { <div className="item-info"> { fileDoneUploading ? - ( - <React.Fragment> - <div className="file-status"> - <DoneIcon contrast={props.contrast} className="icon icon-margin" /> {fileName} + ( + <React.Fragment> + <div className="file-status"> + <DoneIcon className="icon icon-margin"/> {fileName} </div> - <GrayButton contrast={props.contrast} onClick={() => { handleDelete() }}> - Excluir <DeleteIcon className="icon icon-remove" /> + <GrayButton onClick={() => {handleDelete()}}> + Excluir <DeleteIcon className="icon icon-remove"/> </GrayButton> - </React.Fragment> - ) - : - ( - <React.Fragment> - <div className="file-status"> - {uploadProgress}% {fileName} - </div> - <GrayButton contrast={props.contrast} onClick={() => { handleCancel() }}> - Cancelar <DeleteIcon className="icon icon-remove" /> - </GrayButton> - </React.Fragment> - ) + </React.Fragment> + ) + : + ( + <React.Fragment> + <div className="file-status"> + {uploadProgress}% {fileName} + </div> + <GrayButton onClick={() => {handleCancel()}}> + Cancelar <DeleteIcon className="icon icon-remove"/> + </GrayButton> + </React.Fragment> + ) } </div> </div> <div className="warning"> <span>Não se esqueça de preencher as</span> - <br /> + <br/> <span>informações sobre o recurso ao lado.</span> </div> </div> @@ -221,19 +222,19 @@ export default function UploadFileWrapper(props) { case "choosingLink": return ( <React.Fragment> - <Snackbar open={snackbarOpen} autoHideDuration={1000} onClose={() => { toggleSnackbar(false) }} - anchorOrigin={{ vertical: 'top', horizontal: 'right' }} - > - <Alert severity="info" style={{ backgroundColor: "#00acc1" }}> + <Snackbar open={snackbarOpen} autoHideDuration={1000} onClose={() => {toggleSnackbar(false)}} + anchorOrigin = {{ vertical:'top', horizontal:'right' }} + > + <Alert severity="info" style={{backgroundColor:"#00acc1"}}> Link salvo com sucesso! </Alert> </Snackbar> - <ChooseLink contrast={props.contrast} handleNextStage={handleNextStage} submit={handleChooseLink} /> + <ChooseLink handleNextStage={handleNextStage} submit={handleChooseLink}/> </React.Fragment> ) default: - return ( - <WrapperBox contrast={props.contrast}> + return( + <WrapperBox> <div className="inner"> <div className="upload-title"> Enviar Recurso</div> <div className="flex-column"> @@ -242,39 +243,38 @@ export default function UploadFileWrapper(props) { <div className="upload-form"> <form id="file_upload"> <DottedBox - contrast={props.contrast} onDrop={e => handleDrop(e)} onDragOver={e => handleDragOver(e)} - > - <AttachFileIcon className="icon" /> + > + <AttachFileIcon className="icon"/> <input type="file" - onChange={(e) => { onFileChange(e.target.files[0]) }} + onChange = {(e) => {onFileChange(e.target.files[0])}} id="upload-file" - style={{ display: "none" }} - /> - <BlueButton contrast={props.contrast}> - <label htmlFor="upload-file" style={{ width: "inherit", cursor: "pointer" }}> + style={{display : "none"}} + /> + <BlueButton> + <label htmlFor="upload-file" style={{width : "inherit", cursor : "pointer"}}> ESCOLHER ARQUIVO </label> </BlueButton> - <span style={{ marginTop: "6px" }}>Ou arrastar e soltar o arquivo aqui</span> + <span style={{marginTop : "6px"}}>Ou arrastar e soltar o arquivo aqui</span> </DottedBox> </form> </div> </div> <div className="strike-box"> - <div className="strike" /><h3>ou</h3><div className="strike" /> + <div className="strike"/><h3>ou</h3><div className="strike"/> </div> <div className="enviar-link-texto"> - <img alt="" src={LinkIcon} /> - <br /> + <img alt="" src={LinkIcon}/> + <br/> <span>Enviar link de um recurso de outro site</span> </div> - <BlueButton contrast={props.contrast} onClick={() => { handleNextStage("choosingLink") }}>ENVIAR LINK</BlueButton> + <BlueButton onClick={ () => {handleNextStage("choosingLink")} }>ENVIAR LINK</BlueButton> </div> </div> </WrapperBox> diff --git a/src/Components/UserPageComponents/Avatar.js b/src/Components/UserPageComponents/Avatar.js index 03b3ae11d5423a23f40052bcb23afaff56c60d12..8f3c05b8ff5937ef8609e24ed3015dc136860a09 100644 --- a/src/Components/UserPageComponents/Avatar.js +++ b/src/Components/UserPageComponents/Avatar.js @@ -41,7 +41,6 @@ export default function ProfileAvatar (props) { return ( <> <ModalAlterarAvatar - contrast={props.contrast} open={open} handleClose={controlModal} userAvatar={currentAvatar} diff --git a/src/Components/UserPageComponents/Cover.js b/src/Components/UserPageComponents/Cover.js index 27aae3915cd04776cf808fab0be2de2579b3154b..339c36fd612cb3dc1a595c9a994a775af089c886 100644 --- a/src/Components/UserPageComponents/Cover.js +++ b/src/Components/UserPageComponents/Cover.js @@ -37,6 +37,7 @@ export default function Cover (props) { const updateCover = (selectorFiles) => { const objectURL = URL.createObjectURL(selectorFiles[0]) + console.log(objectURL) setTempCover(objectURL) controlModal() } @@ -44,11 +45,9 @@ export default function Cover (props) { useEffect( () => { setCoverImg(state.currentUser.cover) }, state.currentUser.cover) - return ( <> <ModalAlterarCover - contrast={props.contrast} open = {open} handleClose={controlModal} cover={tempCover} diff --git a/src/Components/UserPageComponents/EditProfileButton.js b/src/Components/UserPageComponents/EditProfileButton.js index b063638067a684d10a9b0137dbbea171da08590c..beaa7137501ba03fc9de6f46d14391c6e7072f13 100644 --- a/src/Components/UserPageComponents/EditProfileButton.js +++ b/src/Components/UserPageComponents/EditProfileButton.js @@ -18,25 +18,25 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React from 'react'; import { Store } from '../../Store.js'; import styled from 'styled-components' -import { Link } from 'react-router-dom'; +import {Link} from 'react-router-dom'; import EditIcon from '@material-ui/icons/Edit'; import Button from '@material-ui/core/Button'; -export default function EditProfileButton({ contrast }) { - const { state } = React.useContext(Store) +export default function EditProfileButton () { + const {state} = React.useContext(Store) return ( - <EditProfileAnchor to="/editarperfil" contrast={contrast}> + <EditProfileAnchor to="/editarperfil"> <Button> - {state.windowSize.width >= 900 ? + {state.windowSize.width >=900 ? ( <React.Fragment> - <EditIcon className="icon" /> <span>EDITAR PERFIL</span> + <EditIcon style={{marginRight:"5px", verticalAlign:"middle"}}/> <span>EDITAR PERFIL</span> </React.Fragment> ) : ( - <EditIcon className="icon" style={contrast === "" ? {color: "white"} : {color: "yellow"}}/> + <EditIcon style={{marginRight:"5px", verticalAlign:"middle"}}/> ) } </Button> @@ -45,32 +45,30 @@ export default function EditProfileButton({ contrast }) { } const EditProfileAnchor = styled(Link)` - Button { - box-shadow : 0 2px 5px 0 rgba(0,0,0,.26); - background-color: ${props => props.contrast === "" ? "#52BCD4" : "black"} !important; - position : absolute; - right : 10px; - top : 10px; - margin-bottom : 20px; - color: ${props => props.contrast === "" ? "white" : "yellow"}; - padding : 0 10px; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - border-radius : 3px; - @media screen and (min-width: 800px) { - min-height : 36px; - min-width : 88px; - } - line-height : 36px; - border: ${props => props.contrast === "" ? "0" : "1px solid white"}; - display: inline-block; - text-align : center; - @media screen and (max-width: 600px) { - max-width : 44px !important ; - } - } - .icon{ - margin-right: 5px; - vertical-align: middle; - color: white; - } + Button { + box-shadow : 0 2px 5px 0 rgba(0,0,0,.26); + background-color : #fafafa; + position : absolute; + right : 10px; + top : 10px; + margin-bottom : 20px; + color : #666; + padding : 0 10px; + text-decoration : none; + border-radius : 3px; + @media screen and (min-width: 800px) { + min-height : 36px; + min-width : 88px; + } + line-height : 36px; + border : 0; + display: inline-block; + text-align : center; + :hover{ + background-color : #fafafa; + } + @media screen and (max-width: 600px) { + max-width : 44px !important ; + } + } ` diff --git a/src/Components/UserPageComponents/SubmitterStatus.js b/src/Components/UserPageComponents/SubmitterStatus.js index d36f53dc7412e5c83e7c54bdeb3b46bc7558a74e..1cb29365644038f8a8a9a115675ddf8f0af1ccfd 100644 --- a/src/Components/UserPageComponents/SubmitterStatus.js +++ b/src/Components/UserPageComponents/SubmitterStatus.js @@ -15,13 +15,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, { useContext } from 'react'; +import React, {useContext} from 'react'; import { Store } from '../../Store.js'; import CheckDecagram from '../../img/check-decagram-gray.svg' -import { Link } from 'react-router-dom'; +import {Link} from 'react-router-dom'; -export default function SubmitterStatus(props) { - const { state } = useContext(Store) +export default function SubmitterStatus (props) { + const {state} = useContext(Store) let text; switch (state.currentUser.submitter_request) { @@ -37,21 +37,21 @@ export default function SubmitterStatus(props) { return ( <React.Fragment> - <p style={{ fontSize: "15px", lineHeight: "22px", textAlign: "left", margin: "0 0 10px" }}> - <span> - <span style={{ paddingRight: "5px" }}> - <img src={CheckDecagram} alt='check icon' /> - </span> - {text} - <Link to={{ - pathname: '/editarperfil', - tabValue: { - value: 1 - } - }}> - <span style={state.contrast === "" ? { color: "#00bcd4" } : { color: "yellow", textDecoration: "underline", cursor: "pointer" }}> SAIBA MAIS</span> - </Link> - + <p style={{fontSize:"15px", lineHeight:"22px", textAlign:"left", margin:"0 0 10px"}}> + <span style={{cursor:"pointer"}}> + <span style={{paddingRight:"5px"}}> + <img src={CheckDecagram} alt='check icon'/> + </span> + {text} + <Link to={{ + pathname: '/editarperfil', + tabValue: { + value: 1 + } + }}> + <span style={{color:"#00bcd4"}}> SAIBA MAIS</span> + </Link> + </span> </p> </React.Fragment> diff --git a/src/Components/UserPageComponents/UserInfo.js b/src/Components/UserPageComponents/UserInfo.js index b8dde202a47fa21b4e53baa725421b115c762230..4782759f8f2e4eb70a86b03e13d8be603c035f6e 100644 --- a/src/Components/UserPageComponents/UserInfo.js +++ b/src/Components/UserPageComponents/UserInfo.js @@ -25,8 +25,18 @@ export default function UserInfo(props) { const user = state.currentUser.name; return ( - <UserProfileInfoDiv contrast={state.contrast}> - <p> + <UserProfileInfoDiv> + <p + style={{ + fontSize: "28px", + color: "#fff", + paddingTop: "5px", + paddingBottom: "5px", + fontWeight: "500", + backgroundColor: "#77777796", + borderRadius: "5px", + }} + > {user} </p> </UserProfileInfoDiv> diff --git a/src/Components/Accessibility/ContrastBar.css b/src/Components/VerticalRuler.js similarity index 52% rename from src/Components/Accessibility/ContrastBar.css rename to src/Components/VerticalRuler.js index ce199caa8933bb659823c7827c9b1376511934db..a84dc1381675d222245eb7097263f385e15c1b10 100644 --- a/src/Components/Accessibility/ContrastBar.css +++ b/src/Components/VerticalRuler.js @@ -16,50 +16,16 @@ 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/>.*/ -.Constrasticon { - width: 1em; - height: 1em; - vertical-align: middle; -} -/* -.contrastButton{ - border: none; - padding: 0; - background: none; - background-color: white; -} -.contrastButton:active { - border: none; - padding: 0; - background: none; - background-color: white; -} -.bar{ - overflow: auto; - background-color: white; - width: 100%; - height: 1.3em; - border-bottom: 1px solid #666; -} +import React from 'react'; -.Contrastbar{ - overflow: auto; - background-color: black; - width: 100%; - border-bottom: 1px solid white; -}*/ -.Contrasttext{ - color: yellow; - text-decoration: underline; - cursor: pointer; - text-align: center; - vertical-align: middle; +export default function VerticalRuler(props) { + return ( + <div + style={{ + borderLeft: ''+props.width+'px solid '+props.color, + height:props.height + }}/> + ); } -.text{ - color: #666; - cursor: pointer; - text-align: center; - vertical-align: middle; -} \ No newline at end of file diff --git a/src/Components/carousel.css b/src/Components/carousel.css index 3a4c6336859565de33631450b35b9ed963a8dfdd..e1c5dc424e68875b47dc7a46017780516bf8f1a5 100644 --- a/src/Components/carousel.css +++ b/src/Components/carousel.css @@ -16,36 +16,34 @@ 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/>.*/ - - -.carousel .slide { - background-color: inherit !important; +.carousel .control-dots{ + position: inherit !important; } +.carousel .control-arrow { + background: orange !important; + /* position: relative !important; */ -.carousel .control-dots { - position: inherit !important; -} + -webkit-box-shadow: 0 8px 17px 2px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.2); + box-shadow: 0 8px 17px 2px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.2); -.carousel .control-arrow { - background: orange !important; - /* position: relative !important; */ +} - -webkit-box-shadow: 0 8px 17px 2px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.2); - box-shadow: 0 8px 17px 2px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.2); +.carousel .slide { + background-color: inherit !important; } .MuiPaper-elevation1-209{ - box-shadow: none !important; + box-shadow: none !important; } .carousel.carousel-slider .control-arrow { - top: 35%!important; - bottom: 50%!important; - border-radius: 100%!important; - opacity: 1!important; - text-align: center; - vertical-align: middle; - height: 50px; - width: 50px; + top: 35%!important; + bottom: 50%!important; + border-radius: 100%!important; + opacity: 1!important; + text-align: center; + vertical-align: middle; + height: 50px; + width: 50px; } diff --git a/src/Pages/AboutPage.js b/src/Pages/AboutPage.js index bf21ccee212d2033d6bf82039872d2093b881599..ab1b6bbbe3a74ce0f0d2ee7ad58b8b5b2e434956 100644 --- a/src/Pages/AboutPage.js +++ b/src/Pages/AboutPage.js @@ -16,13 +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, { useEffect, useContext } from 'react'; +import React, { useEffect } from 'react'; import Grid from '@material-ui/core/Grid'; import styled from 'styled-components'; import Modal from '../Components/ModalAbout'; import AboutCarousel from "../Components/AboutCarousel"; import AboutCarouselPartner from '../Components/AboutCarouselPartner'; -import { Store } from '../Store'; + /*Importação de imagens para o componente*/ import Agpl from "../img/sobre/agpl.svg"; @@ -47,7 +47,6 @@ const Secao2 = styled.div` text-align: center; font-size: 14px; line-height: 1.42857143; - background-color: ${props => props.contrast === '' ? "" : "black"}; .container { @@ -100,7 +99,6 @@ const Secao3 = styled.div` padding: 30px 0; background-color: #1ab9de; color: #fff; - background-color: ${props => props.contrast === '' ? "" : "black"}; .container { @@ -166,7 +164,6 @@ const Secao4 = styled.div` height: 720px; text-align: center; color: #666; - background-color: ${props => props.contrast === '' ? "" : "black"}; .container { @@ -226,7 +223,7 @@ const Secao4 = styled.div` text-align: center; border: 0; padding: 0 6px; - white-space: nowrap; + hite-space: nowrap; text-decoration: none; @@ -322,7 +319,7 @@ const Secao5 = styled.div` const Secao6 = styled.div` height: 500px; - background-color: ${props => props.contrast === '' ? "" : "black"}; + .container { @@ -377,7 +374,7 @@ const Secao6 = styled.div` const Secao7 = styled.div` height: 100%; - background-color: ${props => props.contrast === '' ? "#f4f4f4" : "black"}; + background-color: #f4f4f4; .container { @@ -419,8 +416,10 @@ const Secao7 = styled.div` } .card { + height: 80%; - background-color: ${props => props.contrast === '' ? "#fff" : "black"}; + + background-color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding: 40px 20px; text-align: center; @@ -442,7 +441,6 @@ const Secao7 = styled.div` img { width: 114px; - background-color: ${props => props.contrast === '' ? "#fff" : "black"}; } } @@ -457,7 +455,6 @@ const Secao7 = styled.div` const Secao8 = styled.div` height: 230px; - background-color: ${props => props.contrast === '' ? "" : "black"}; .container { @@ -502,7 +499,8 @@ const Secao8 = styled.div` } button { - background-color: ${props => props.contrast === '' ? "#ed6f00" : "black"}; + + background-color: #ed6f00; font-family: Roboto,sans-serif; font-size: 14px; font-weight: 500; @@ -520,7 +518,7 @@ const Secao8 = styled.div` text-align: center; border-radius: 3px; user-select: none; - border: ${props => props.contrast === '' ? "0" : "1px solid white"}; + border: 0; padding: 0 6px; padding-right: 6px; padding-left: 6px; @@ -528,24 +526,33 @@ const Secao8 = styled.div` font-weight: 500; font-size: 14px; overflow: hidden; - :hover{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; - } + + + a { - color: ${props => props.contrast === '' ? "#fff" : "yellow"}; - text-decoration: ${props => props.contrast === '' ? "" : "underline"};; + color: #fff; + text-decoration: none; } } + } } } + + + ` + + + + + + + export default function AboutPage(props) { var pageWidth = window.innerWidth - const { state } = useContext(Store); - const calculateMargin = ((pageWidth) => { if (pageWidth > 700 && pageWidth <= 850) { return "40%" @@ -577,14 +584,12 @@ export default function AboutPage(props) { </Secao1> - <Secao2 contrast={state.contrast} > + <Secao2> <div className="container"> <div className="container-secao"> <div className="conteudo-secao"> - <h2 className={`${state.contrast}TextColor`}> - Um Pouco da História - </h2> - <p className={`${state.contrast}TextColor`} style={{ marginLeft: 20, marginRight: 20, marginBottom: 40 }}> + <h2>Um Pouco da História</h2> + <p style={{ marginLeft: 20, marginRight: 20, marginBottom: 40 }}> A partir de uma iniciativa do Ministério da Educação, surge em outubro de 2015 a proposta de reunir e disponibilizar, em um único lugar, os Recursos Educacionais Digitais dos principais @@ -598,10 +603,10 @@ export default function AboutPage(props) { colaborativo você também! </p> <img src={Agpl} alt="agpl" /> - <p className={`${state.contrast}TextColor`}> + <p> Este programa é software livre, sob os termos da - <a className={`${state.contrast}LinkColor`} href="https://www.gnu.org/licenses/agpl-3.0.en.html" rel="noreferrer" target="_blank"> licença GNU/AGPL</a><br /> - Seu código fonte está disponível no <a className={`${state.contrast}LinkColor`} href="https://gitlab.c3sl.ufpr.br/portalmec/portalmec" rel="noreferrer" target="_blank">GitLab</a> + <a href="https://www.gnu.org/licenses/agpl-3.0.en.html" rel="noreferrer" target="_blank"> licença GNU/AGPL</a><br /> + Seu código fonte está disponível no <a href="https://gitlab.c3sl.ufpr.br/portalmec/portalmec" rel="noreferrer" target="_blank">GitLab</a> </p> @@ -610,7 +615,7 @@ export default function AboutPage(props) { </div> </Secao2> - <Secao3 contrast={state.contrast} > + <Secao3> <div className="container"> <div className="container-secao"> <div className="conteudo-secao"> @@ -655,18 +660,18 @@ export default function AboutPage(props) { - <Secao4 contrast={state.contrast}> + <Secao4> <div className="container"> <div className="container-secao" id="portaisparceiros"> <div className="conteudo-secao" > - <div className={`${state.contrast}TextColor`}> + <div> <h2>Portais Parceiros</h2> <p>Aqui na Plataforma você encontra os Recursos Digitais dos principais portais do MEC e de vários outros parceiros.</p> </div> <AboutCarouselPartner /> - <div className={`${state.contrast}TextColor`}> + <div> <h3>Você busca Recursos Educacionais Digitais em outros sites?</h3> <p> Você gostaria que a plataforma tivesse os recursos do site que @@ -675,7 +680,7 @@ export default function AboutPage(props) { </p> </div> <div style={{ marginTop: "30px" }}> - <Modal contrast={state.contrast} /> + <Modal /> </div> </div> @@ -698,15 +703,16 @@ export default function AboutPage(props) { </div> </Secao5> - <Secao6 contrast={state.contrast}> + <Secao6> <div className="container"> <div className="container-secao"> <div className="conteudo-secao"> - <div className={`${state.contrast}TextColor`}> + <div> <h2>Aqui você pode:</h2> + </div> <div> - <AboutCarousel contrast={state.contrast} /> + <AboutCarousel /> </div> </div> @@ -714,13 +720,13 @@ export default function AboutPage(props) { </div> </Secao6> - <Secao7 contrast={state.contrast}> + <Secao7> <div className="container"> <div className="container-secao"> <div className="conteudo-secao"> <div className="cabecalho"> - <h2 className={`${state.contrast}TextColor`}>A quem se destina?</h2> - <p className={`${state.contrast}TextColor`}>A plataforma é aberta e destina-se a todos e todas que se + <h2>A quem se destina?</h2> + <p>A plataforma é aberta e destina-se a todos e todas que se interessam<br />pela relação entre a escola e a Cultura Digital:</p> </div> <div> @@ -728,8 +734,8 @@ export default function AboutPage(props) { <Grid item xs> <div className="card"> <img src={Professores} alt="" /> - <h3 className={`${state.contrast}TextColor`}>Professores</h3> - <p className={`${state.contrast}TextColor`}> + <h3>Professores</h3> + <p> Encontre recursos digitais que se encaixem aos objetivos das suas aulas! Aproveite para seguir outros professores, coleções e conhecer experiências de uso! @@ -739,8 +745,8 @@ export default function AboutPage(props) { <Grid item xs> <div className="card"> <img src={Alunos} alt="" /> - <h3 className={`${state.contrast}TextColor`}>Alunos</h3> - <p className={`${state.contrast}TextColor`}> + <h3>Alunos</h3> + <p> Você pode complementar os seus estudos com recursos digitais que lhe interessem. Gostou de algum recurso? Recomende ao seu professor ou professora. @@ -750,8 +756,8 @@ export default function AboutPage(props) { <Grid item xs> <div className="card"> <img src={Gestores} alt="" /> - <h3 className={`${state.contrast}TextColor`}>Gestores</h3> - <p className={`${state.contrast}TextColor`}> + <h3>Gestores</h3> + <p> Desenvolva junto com o coletivo da escola ações e projetos pedagógicos com recursos digitais importantes para o seu contexto. </p> @@ -760,8 +766,8 @@ export default function AboutPage(props) { <Grid item xs> <div className="card"> <img src={Comunidade} alt="" /> - <h3 className={`${state.contrast}TextColor`}>Comunidade Escolar</h3> - <p className={`${state.contrast}TextColor`}> + <h3>Comunidade Escolar</h3> + <p> Encontre recursos digitais e materiais de formação que contribuam para a aprendizagem e práticas educativas na sua comunidade escolar. @@ -776,12 +782,12 @@ export default function AboutPage(props) { </div> </Secao7> - <Secao8 contrast={state.contrast}> + <Secao8> <div className="container"> <div className="container-secao"> <div className="conteudo-secao"> - <h2 className={`${state.contrast}TextColor`}>Ficou alguma dúvida? Gostaria de fazer alguma sugestão ou crítica? Construa conosco.</h2> + <h2>Ficou alguma dúvida? Gostaria de fazer alguma sugestão ou crítica? Construa conosco.</h2> <div> <button><a href="contato">ENTRAR EM CONTATO</a></button> </div> diff --git a/src/Pages/ChangePasswordPage.js b/src/Pages/ChangePasswordPage.js index a7f90c2203cdd680446f35977b71d97424d4b4f6..cf552c07180f6e589cb39e9c697c50f4df2641cc 100644 --- a/src/Pages/ChangePasswordPage.js +++ b/src/Pages/ChangePasswordPage.js @@ -1,4 +1,4 @@ -import React, { useState, useContext } from "react"; +import React, { useState } from "react"; import { BackgroundDiv } from '../Components/TabPanels/StyledComponents.js' import Paper from '@material-ui/core/Paper' import styled from 'styled-components' @@ -13,14 +13,12 @@ import Grid from '@material-ui/core/Grid' import IconButton from '@material-ui/core/IconButton' import VisibilityIcon from '@material-ui/icons/Visibility' import VisibilityOffIcon from '@material-ui/icons/VisibilityOff' -import { Store } from '../Store' function Alert(props) { return <MuiAlert elevation={6} variant="filled" {...props} />; } export default function ChangePasswordPage(props) { - const { state } = useContext(Store) const [error, setError] = useState(false) const [success, setSuccess] = useState(false) @@ -79,7 +77,9 @@ export default function ChangePasswordPage(props) { } handleSnackInfo(snackInfo) } else { + //console.log("senha bate"); if (!formPassword.key && !formPasswordConfirmation.key) { + console.log("senha bate"); const urlParams = new URLSearchParams(window.location.search); const clientId = urlParams.get("client_id"); @@ -175,7 +175,7 @@ export default function ChangePasswordPage(props) { if (error) return ( - <BackgroundDiv contrast={state.contrast}> + <BackgroundDiv> <Snackbar open={snackInfo.open} autoHideDuration={6000} @@ -187,13 +187,13 @@ export default function ChangePasswordPage(props) { </Alert> </Snackbar> <div> - <CustomizedBreadcrumbs contrast={state.contrast} + <CustomizedBreadcrumbs values={["Recuperar senha", "Alterar senha"]} /> </div> <div style={{ justifyContent: "center", textAlign: "center", maxWidth: "600px", margin: "auto" }}> <Paper elevation={3}> - <CardDiv contrast={state.contrast}> + <CardDiv> <div style={{ overflow: "hidden", display: "inline-block" }}> <h2 style={{ fontSize: "32px", fontWeight: "200", marginBottom: "20px", lineHeight: '35px' }}> Ocorreu um erro. Por favor, tente novamente mais tarde. Você será redirecionado para a home em... <StyledTimer>{time}</StyledTimer> @@ -206,7 +206,7 @@ export default function ChangePasswordPage(props) { ) else if (success) return ( - <BackgroundDiv contrast={state.contrast}> + <BackgroundDiv> <Snackbar open={snackInfo.open} autoHideDuration={6000} @@ -218,13 +218,13 @@ export default function ChangePasswordPage(props) { </Alert> </Snackbar> <div> - <CustomizedBreadcrumbs contrast={state.contrast} + <CustomizedBreadcrumbs values={["Recuperar senha", "Alterar senha"]} /> </div> <div style={{ justifyContent: "center", textAlign: "center", maxWidth: "600px", margin: "auto" }}> <Paper elevation={3}> - <CardDiv contrast={state.contrast}> + <CardDiv> <div style={{ overflow: "hidden", display: "inline-block" }}> <h2 style={{ fontSize: "32px", fontWeight: "200", marginBottom: "20px", lineHeight: '35px' }}> Sua senha foi alterada com sucesso. Você será redirecionado para a home em... <StyledTimer>{time}</StyledTimer> @@ -237,7 +237,7 @@ export default function ChangePasswordPage(props) { ) else return ( - <BackgroundDiv contrast={state.contrast}> + <BackgroundDiv> <Snackbar open={snackInfo.open} autoHideDuration={6000} @@ -249,20 +249,19 @@ export default function ChangePasswordPage(props) { </Alert> </Snackbar> <div> - <CustomizedBreadcrumbs contrast={state.contrast} + <CustomizedBreadcrumbs values={["Recuperar senha", "Alterar senha"]} /> </div> <div style={{ justifyContent: "center", textAlign: "center", maxWidth: "600px", margin: "auto" }}> <Paper elevation={3}> - <CardDiv contrast={state.contrast}> + <CardDiv> <div style={{ overflow: "hidden", display: "inline-block" }}> <h2 style={{ fontSize: "32px", fontWeight: "200", marginBottom: "20px" }}>Confirme a nova senha</h2> <form onSubmit={(e) => { e.preventDefault(); onSubmit(e); }}> <Grid container direction='row' alignItems='center' spacing={1}> <Grid item xs={10}> <FormInput - contrast={state.contrast} inputType={formPassword.hidePass ? "password" : ""} name={"senha"} value={formPassword.value} @@ -276,11 +275,11 @@ export default function ChangePasswordPage(props) { <Grid item xs={2}> { formPassword.hidePass ? - <IconButton className={`${state.contrast}LinkColor`} onClick={handleStateHideFormPass}> + <IconButton onClick={handleStateHideFormPass}> <VisibilityIcon /> </IconButton> : - <IconButton className={`${state.contrast}LinkColor`} onClick={handleStateHideFormPass}> + <IconButton onClick={handleStateHideFormPass}> <VisibilityOffIcon /> </IconButton> } @@ -290,7 +289,6 @@ export default function ChangePasswordPage(props) { <Grid container direction='row' alignItems='center' spacing={1}> <Grid item xs={10}> <FormInput - contrast={state.contrast} inputType={formPasswordConfirmation.hidePass ? "password" : ""} name={"confirme a senha"} value={formPasswordConfirmation.value} @@ -304,18 +302,18 @@ export default function ChangePasswordPage(props) { <Grid item xs={2}> { formPasswordConfirmation.hidePass ? - <IconButton className={`${state.contrast}LinkColor`} onClick={handleStateHideConfFormPass}> + <IconButton onClick={handleStateHideConfFormPass}> <VisibilityIcon /> </IconButton> : - <IconButton className={`${state.contrast}LinkColor`} onClick={handleStateHideConfFormPass}> + <IconButton onClick={handleStateHideConfFormPass}> <VisibilityOffIcon /> </IconButton> } </Grid> </Grid> <div style={{ display: "flex", justifyContent: "center" }}> - <CompletarCadastroButton contrast={state.contrast} type="submit" >ATUALIZAR SENHA</CompletarCadastroButton> + <CompletarCadastroButton type="submit" >ATUALIZAR SENHA</CompletarCadastroButton> </div> </form> </div> @@ -327,11 +325,7 @@ export default function ChangePasswordPage(props) { } const CardDiv = styled.div` - color: ${props => props.contrast === "" ? "#666" : "white"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - border: ${props => props.contrast === "" ? "" : "1px solid white"} !important; - + background-color : #fff; box-shadow : 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding : 20px 30px; margin : 50px 0; diff --git a/src/Pages/CollectionPage.js b/src/Pages/CollectionPage.js index b64c73ce67b73ea8226457aef9e4fb2fa2bd9996..3b06dd99ecead429793638aaff5fcb691fc2672b 100644 --- a/src/Pages/CollectionPage.js +++ b/src/Pages/CollectionPage.js @@ -18,6 +18,7 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React, { useRef, useState, useEffect, useContext } from 'react'; import { Grid } from '@material-ui/core'; import CollectionAuthor from '../Components/CollectionAuthor.js'; +import VerticalRuler from '../Components/VerticalRuler.js'; import CollectionDescription from '../Components/CollectionDescription.js'; import ResourceList from '../Components/ResourceList.js'; import CollectionCommentSection from '../Components/CollectionCommentSection.js'; @@ -57,7 +58,7 @@ export default function CollectionPage(props) { } if (error) - return <CollectionNotFound contrast={state.contrast}> + return <CollectionNotFound> <Grid container direction='column' justify='center' alignItems='center' spacing={1}> <Grid item> <p className="not-found"> @@ -68,24 +69,22 @@ export default function CollectionPage(props) { <Link className="link" to={`/busca?page=0&results_per_page=12&order=review_average&query=*&search_class=Collection`}> <Button - variant='contained' - className="back-button" - > - Voltar para a busca de coleções + variant='contained' + className="back-button" + > + Voltar para a busca de coleções. </Button> </Link> - </Grid> + </Grid> </Grid> </CollectionNotFound > if (loading) - return <LoadingDiv contrast={state.contrast}> - <LoadingSpinner contrast={state.contrast} text="Carregando coleção..." /> - </LoadingDiv> + return <LoadingSpinner text="Carregando coleção..." /> else return ( - <div style={state.contrast === "" ? { backgroundColor: "white" } : { backgroundColor: "black" }}> + <> <BreadCrumbsDiv> - <StyledBreadCrumbs contrast={state.contrast}> + <StyledBreadCrumbs> <Link to="/">Página Inicial</Link> <span>Coleções</span> </StyledBreadCrumbs> @@ -93,15 +92,14 @@ export default function CollectionPage(props) { <Grid container direction="row" justify="center" alignItems="center"> <Grid item md={3}> <CollectionAuthor - contrast={state.contrast} author_id={collection.owner.id ? collection.owner.id : 0} name={collection.owner.name ? collection.owner.name : ""} imgsrc={collection.owner.avatar ? apiDomain + collection.owner.avatar : noAvatar} /> </Grid> + <Grid item md={5}> <CollectionDescription - contrast={state.contrast} stars={collection.review_average} likes={collection.likes_count} liked={collection.liked} @@ -112,56 +110,53 @@ export default function CollectionPage(props) { <Grid item md={3}> <DowloadButton - contrast={state.contrast} id={collection_id} /> <div style={{ height: 12 }}></div> <FollowCollectionButton - contrast={state.contrast} followed={collection.followed} user_id={state.currentUser.id} collection_id={collection_id} /> </Grid> </Grid> - <Grid container justify="center" style={state.contrast === "" ? { backgroundColor: "#f4f4f4" } : { backgroundColor: "black" }}> + <VerticalRuler width={1} height={100} color="rgb(238, 238, 238)" /> + + <Grid container justify="center" style={{ backgroundColor: '#f4f4f4' }}> {/* <Grid item xs={1}/> */} <Grid item xs={10}> - <ResourceList - contrast={state.contrast} - resources={ - collection.collection_items ? - collection.collection_items.map(i => { - return { - type: i.collectionable.object_type, - author: i.collectionable.author, - title: i.collectionable.name, - rating: i.collectionable.review_average, - likeCount: i.collectionable.likes_count, - liked: i.collectionable.liked, - avatar: i.collectionable.publisher.avatar, - thumbnail: i.collectionable.thumbnail, - tags: i.collectionable.tags.map(t => t), - id: i.collectionable.id, - downloadableLink: i.collectionable.default_attachment_location, - publisher: i.collectionable.publisher.name, - published: i.collectionable.state - } - }) - : [] - } /> + <ResourceList resources={ + collection.collection_items ? + collection.collection_items.map(i => { + return { + type: i.collectionable.object_type, + author: i.collectionable.author, + title: i.collectionable.name, + rating: i.collectionable.review_average, + likeCount: i.collectionable.likes_count, + liked: i.collectionable.liked, + avatar: i.collectionable.publisher.avatar, + thumbnail: i.collectionable.thumbnail, + tags: i.collectionable.tags.map(t => t), + id: i.collectionable.id, + downloadableLink: i.collectionable.default_attachment_location, + publisher: i.collectionable.publisher.name, + published: i.collectionable.state + } + }) + : [] + } /> </Grid> <Grid container item xs={12} style={{ marginTop: 40, paddingBottom: 40 }} ref={comment_ref}> <CollectionCommentSection - contrast={state.contrast} id={collection_id} currentUserId={state.currentUser.id} avatar={state.currentUser.avatar ? apiDomain + state.currentUser.avatar : noAvatar} /> </Grid> </Grid> - </div> + </> ); } @@ -169,23 +164,16 @@ const StyledBreadCrumbs = styled(Breadcrumbs)` display: flex; justify-content: flex-start; span { - color: ${props => props.contrast === "" ? "#666 !important" : "white !important"}; + color: #a5a5a5; } a { - color: ${props => props.contrast === "" ? "#00bcd4 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; + color: #00bcd4; + text-decoration: none; } `; -const LoadingDiv = styled.div` - background-color: ${props => props.contrast === "" ? "" : "black"}; - -` - const CollectionNotFound = styled.div` - background-color: ${props => props.contrast === "" ? "" : "black !important"}; - color: ${props => props.contrast === "" ? "#666 !important" : "white !important"}; - padding: 2em; + margin: 1em; .not-found{ font-family: 'Roboto', sans-serif; @@ -196,10 +184,8 @@ const CollectionNotFound = styled.div` } .back-button{ - background-color: ${props => props.contrast === "" ? "#673ab7 !important" : "black !important"}; - border: ${props => props.contrast === "" ? "none" : "1px solid white !important"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline !important"}; - color: ${props => props.contrast === "" ? "whitesmoke" : "yellow !important"}; + background-color: #673ab7; + color: whitesmoke; } .link{ diff --git a/src/Pages/Contact.js b/src/Pages/Contact.js index 27abe1a9241386b94760d876a2b5c3510fec8c3b..211c9d8012c011391e6f4083a47f4ce2484cf870 100644 --- a/src/Pages/Contact.js +++ b/src/Pages/Contact.js @@ -16,168 +16,165 @@ 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, useContext } from "react"; +import React, { useEffect } from "react"; import styled from "styled-components"; import InputFormulario from "../Components/ContactForm.js"; -import { Store } from '../Store'; //Image Import import { Banner1 } from "ImportImages.js"; const Secao1 = styled.div` - width: 100%; - background-color: ${props => props.contrast === "" ? "" : "black"}; - background-image: ${props => props.contrast === "" ? `url(${Banner1})` : ""}; - background-size: cover; - background-position: bottom center; - height: 250px; + width: 100%; + background-image: url(${Banner1}); + background-size: cover; + background-position: bottom center; + height: 250px; + color: #fff; + line-height: 1.1; + text-align: center; + padding-top: 120px; + + h2 { + font-family: Pompiere, cursive; + font-size: 52px; color: #fff; - line-height: 1.1; - text-align: center; - padding-top: 120px; - - h2 { - font-family: Pompiere, cursive; - font-size: 52px; - color: #fff; - margin: 0; - padding-left: 0; - padding-right: 0; - font-weight: 500; - } - - h3 { - margin-top: 20px; - margin-bottom: 10px; - font-family: Roboto, sans-serif; - font-size: 30px; - font-weight: lighter; - } + margin: 0; + padding-left: 0; + padding-right: 0; + font-weight: 500; + } + + h3 { + margin-top: 20px; + margin-bottom: 10px; + font-family: Roboto, sans-serif; + font-size: 30px; + font-weight: lighter; + } `; const Secao2 = styled.div` - height: 708px; - background-color: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; - display: flex; - justify-content: center; - align-items: center; + height: 708px; + background-color: #f4f4f4; + display: flex; + justify-content: center; + align-items: center; `; const Secao3 = styled.div` - height: 127px; - background-color: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - line-height: 1.42857143; - font-size: 18px; - text-align: center; - padding-top: 70px; - - p { - margin: 0 0 10px 0; - } + height: 127px; + background-color: #f4f4f4; + color: #666; + line-height: 1.42857143; + font-size: 18px; + text-align: center; + padding-top: 70px; + + p { + margin: 0 0 10px 0; + } `; const Formulario = styled.div` - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(255,255,255,.12),0 1px 2px rgba(255,255,255,.24)"}; - padding: 40px; - height: 560px; - width: 480px; - color: ${props => props.contrast === "" ? "#666" : "white"}; - border: ${props => props.contrast === "" ? "" : "1px solid white"}; - - form .inputBlock { - margin-block: 22px; - - } - - form .inputBlock label { - font-size: 14px; - font-weight: bold; - display: block; - - } - - form .inputBlock input { - width: 100%; - height: 32px; - font-size: 14px; - border: 0; - border-bottom: 1px solid #eee; - - } - - form .inputBlock.Message input { - height: 131px; - } - - form buttom[type=submit] { - width: 100%; - border: 0; - margin-top: 30px; - background: #7d40e7 - border-radius: 2px; - padding: 15px 20px; - font-size: 16px; - font-weight: bold; - color: #fff; - cursor: pointer; - transition: background 0.5s; - - } - - form buttom[type=submit]:hover { - background: #6931ac - } - - - h2 { - font-size: 24px; - font-weight: lighter; - margin-bottom: 50px; - margin-top: 20px; - text-align: center; - - } + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + padding: 40px; + height: 560px; + width: 480px; + color: #666; + + form .inputBlock { + margin-block: 22px; + + } + + form .inputBlock label { + font-size: 14px; + font-weight: bold; + display: block; + + } + + form .inputBlock input { + width: 100%; + height: 32px; + font-size: 14px; + border: 0; + border-bottom: 1px solid #eee; + + } + + form .inputBlock.Message input { + height: 131px; + } + + form buttom[type=submit] { + width: 100%; + border: 0; + margin-top: 30px; + background: #7d40e7 + border-radius: 2px; + padding: 15px 20px; + font-size: 16px; + font-weight: bold; + color: #fff; + cursor: pointer; + transition: background 0.5s; + + } + + form buttom[type=submit]:hover { + background: #6931ac + } + + + h2 { + font-size: 24px; + font-weight: lighter; + margin-bottom: 50px; + margin-top: 20px; + text-align: center; + + } `; function Contact(props) { - const { state } = useContext(Store) - useEffect(() => { - window.scrollTo(0, 0) - }) - - return ( - <div> - <link - href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto:300,400&display=swap" - rel="stylesheet" - /> - <Secao1 contrast={state.contrast}> - <h2>CONTATO</h2> - <h3>Quer enviar uma mensagem?</h3> - </Secao1> - - <Secao2 contrast={state.contrast}> - <Formulario noValidate autoComplete="off" contrast={state.contrast}> - <h2> - Entre em contato para enviar dúvidas, - <br /> - sugestões ou críticas - </h2> - <InputFormulario contrast={state.contrast} /> - </Formulario> - </Secao2> - - <Secao3 contrast={state.contrast}> - <span>MEC - Ministério da Educação </span> - <p> - Endereço: Esplanada dos Ministérios Bloco L - Ed.Sede e Anexos. CEP: - 70.047-900 - Brasília/DF. Telefone: 0800 616161 - </p> - </Secao3> - </div> - ); + + useEffect(() => { + window.scrollTo(0, 0) + }) + + return ( + <> + <link + href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto:300,400&display=swap" + rel="stylesheet" + /> + <Secao1> + <h2>CONTATO</h2> + <h3>Quer enviar uma mensagem?</h3> + </Secao1> + + <Secao2> + <Formulario noValidate autoComplete="off"> + <h2> + Entre em contato para enviar dúvidas, + <br /> + sugestões ou críticas + </h2> + <InputFormulario /> + </Formulario> + </Secao2> + + <Secao3> + <span>MEC - Ministério da Educação </span> + <p> + Endereço: Esplanada dos Ministérios Bloco L - Ed.Sede e Anexos. CEP: + 70.047-900 - Brasília/DF. Telefone: 0800 616161 + </p> + </Secao3> + </> + ); } export default Contact; diff --git a/src/Pages/EditLearningObjectPage.js b/src/Pages/EditLearningObjectPage.js index e9b4da89fa5c10ce21e6cd2a33e53d1552284365..c785bf3564d672834c0ed00f964fcc139040a8c5 100644 --- a/src/Pages/EditLearningObjectPage.js +++ b/src/Pages/EditLearningObjectPage.js @@ -187,11 +187,13 @@ export default function EditLearningObjectPage (props) { const acceptFile = (file) => { const objectURL = URL.createObjectURL(file) + console.log('acceptFile: ', file) setTempUrl(objectURL) setThumbnailStage('editing') } const updateThumb = (newThumbnail) => { setThumbnail(newThumbnail) + console.log('updateThumb: ', thumbnail) } @@ -225,13 +227,13 @@ export default function EditLearningObjectPage (props) { const chooseRenderStageThumbnail = () => { switch(thumbnailStage) { case 'uploading': - return (<LoadingDiv contrast={state.contrast}/>) + return (<LoadingDiv/>) case 'done': - return (<DisplayThumbnail contrast={state.contrast} acceptFile={acceptFile} thumbnail={`${apiDomain}` + thumbnail} onEditPage={true} handleDelete={handleDeleteThumbnail}/>) + return (<DisplayThumbnail acceptFile={acceptFile} thumbnail={`${apiDomain}` + thumbnail} onEditPage={true} handleDelete={handleDeleteThumbnail}/>) case 'editing': - return (<EditThumbnail contrast={state.contrast} finalizeThumb={finalizeThumb} tempImgURL={tempUrl} updateThumb={updateThumb}/>) + return (<EditThumbnail finalizeThumb={finalizeThumb} tempImgURL={tempUrl} updateThumb={updateThumb}/>) default : - return (<DragAndDropThumbnail contrast={state.contrast} acceptFile={acceptFile} onEditPage={true}/>) + return (<DragAndDropThumbnail acceptFile={acceptFile} onEditPage={true}/>) } } @@ -256,14 +258,14 @@ export default function EditLearningObjectPage (props) { { !loading ? ( - <Background contrast={state.contrast}> + <Background> <div className="container"> <Grid container spacing={2}> <Grid item md={4} xs={12}> - <UploadFileWrapper contrast={state.contrast} draftID={recursoId} prevFile={learningObject.attachments ? learningObject.attachments[0] : null}/> + <UploadFileWrapper draftID={recursoId} prevFile={learningObject.attachments ? learningObject.attachments[0] : null}/> </Grid> <Grid item md={8} xs={12}> - <InfoBox contrast={state.contrast}> + <InfoBox> <form> <div className="cabecalho"> <h2>Editar Recurso</h2> @@ -275,22 +277,22 @@ export default function EditLearningObjectPage (props) { <Grid container style={{paddingLeft : "15px", paddingRight : "15px"}}> <Grid item xs={12} style={{paddingBottom : "40px"}}> - <NewTitle contrast={state.contrast} draftID={learningObject.id} initialValue={learningObject.name} + <NewTitle draftID={learningObject.id} initialValue={learningObject.name} onBlurCallback={onBlurCallback} /> </Grid> <Grid item xs={12} style={{paddingBottom : "40px"}}> - <SobreORecurso contrast={state.contrast} draftID={learningObject.id} initialValue={learningObject.description} onBlurCallback={onBlurCallback}/> + <SobreORecurso draftID={learningObject.id} initialValue={learningObject.description} onBlurCallback={onBlurCallback}/> </Grid> <Grid item xs={12} style={{paddingBottom : "40px"}}> - <Keywords contrast={state.contrast} draftID={learningObject.id} initialValue={learningObject.tags !== undefined ? learningObject.tags.map((tag) => tag.name) : null} + <Keywords draftID={learningObject.id} initialValue={learningObject.tags !== undefined ? learningObject.tags.map((tag) => tag.name) : null} onBlurCallback={onBlurCallback}/> </Grid> <Grid item xs={12} style={{paddingBottom : "40px"}}> - <Autor contrast={state.contrast} draftID={learningObject.id} + <Autor draftID={learningObject.id} initialValue={ learningObject.author === state.currentUser.name ? 0 : 1 @@ -304,44 +306,44 @@ export default function EditLearningObjectPage (props) { </Grid> <Grid item xs={12} style={{paddingBottom : "40px"}}> - <TipoDeRecurso contrast={state.contrast} objTypes={objTypes} draftID={learningObject.id} + <TipoDeRecurso objTypes={objTypes} draftID={learningObject.id} initialValue={learningObject.object_type !== undefined && learningObject.object_type !== null ? objTypes.filter((type) => type.name === learningObject.object_type)[0].id : null} onBlurCallback={onBlurCallback} /> </Grid> <Grid item xs={12} style={{paddingBottom : "40px"}}> - <Idioma contrast={state.contrast} languages={languages} draftID={learningObject.id} + <Idioma languages={languages} draftID={learningObject.id} initialValue={learningObject.language !== undefined ? learningObject.language.map((language) => language.name) : null} initialIDValues={learningObject.language !== undefined ? learningObject.language.map((language) => language.id) : null} onBlurCallback={onBlurCallback} /> </Grid> <Grid item xs={12} style={{paddingBottom : "40px"}}> - <EducationalStage contrast={state.contrast} draftID={learningObject.id} eduStages={eduStages} initialValue={learningObject.educational_stages !== null ? learningObject.educational_stages.map((stage) => String(stage.id)) : null} onBlurCallback={onBlurCallback} + <EducationalStage draftID={learningObject.id} eduStages={eduStages} initialValue={learningObject.educational_stages !== null ? learningObject.educational_stages.map((stage) => String(stage.id)) : null} onBlurCallback={onBlurCallback} /> </Grid> - <SubjectsAndThemes contrast={state.contrast} draftId={learningObject.id} subjects={subjects} initialValue={learningObject.subjects !== null ? learningObject.subjects.map(subject => String(subject.id)) : null} onBlurCallback={onBlurCallback}/> + <SubjectsAndThemes draftId={learningObject.id} subjects={subjects} initialValue={learningObject.subjects !== null ? learningObject.subjects.map(subject => String(subject.id)) : null} onBlurCallback={onBlurCallback}/> <Grid item xs={12} style={{paddingBottom : "40px"}}> - <Licenca contrast={state.contrast} draftID={learningObject.id} initialValue={learningObject.license ? learningObject.license.id : null} onBlurCallback={onBlurCallback}/> + <Licenca draftID={learningObject.id} initialValue={learningObject.license ? learningObject.license.id : null} onBlurCallback={onBlurCallback}/> </Grid> <Grid item xs={12}> <div style={{display : "flex", justifyContent : "center"}}> - <GreyButton contrast={state.contrast} onClick={handleDelete}> - <span className="button-text"> + <GreyButton onClick={handleDelete}> + <span className="button-text"> EXCLUIR - </span> - </GreyButton> + </span> + </GreyButton> - <GreyButton contrast={state.contrast} onClick={props.history.goBack}> - <span className="button-text"> + <GreyButton onClick={props.history.goBack}> + <span className="button-text"> CANCELAR - </span> - </GreyButton> + </span> + </GreyButton> - <OrangeButton contrast={state.contrast} onClick={() => {handleUpdateInfo()}}> + <OrangeButton onClick={() => {handleUpdateInfo()}}> SALVAR ALTERAÇÕES - </OrangeButton> + </OrangeButton> {/* learningObject.state === "draft" && @@ -352,11 +354,11 @@ export default function EditLearningObjectPage (props) { { checkAccessLevel("partner") ? ( - <OrangeButton contrast={state.contrast} onClick={() => {handleUpdateInfo(); handlePost()}}>PUBLICAR RECURSO</OrangeButton> + <OrangeButton onClick={() => {handleUpdateInfo(); handlePost()}}>PUBLICAR RECURSO</OrangeButton> ) : ( - <OrangeButton contrast={state.contrast} onClick={() => {handleUpdateInfo(); handleSubmit()}}>SUBMETER RECURSO</OrangeButton> + <OrangeButton onClick={() => {handleUpdateInfo(); handleSubmit()}}>SUBMETER RECURSO</OrangeButton> ) } @@ -379,7 +381,7 @@ export default function EditLearningObjectPage (props) { ) : ( - <LoadingSpinner contrast={state.contrast} text={"CARREGANDO"}/> + <LoadingSpinner text={"CARREGANDO"}/> ) } </React.Fragment> diff --git a/src/Pages/EditProfilePage.js b/src/Pages/EditProfilePage.js index 6ed58aec32a714348acef51edd0b8b49000743c8..f85c888d5bc7624c7988c6f76119554ba0c5da05 100644 --- a/src/Pages/EditProfilePage.js +++ b/src/Pages/EditProfilePage.js @@ -119,7 +119,7 @@ export default function EditProfilePage(props) { } return ( - <Main contrast={state.contrast}> + <div style={{ backgroundColor: "#f4f4f4", color: "#666" }}> <Snackbar open={snackbarOpened.open} autoHideDuration={1000} onClose={handleCloseSnackbar} anchorOrigin={{ vertical: 'top', horizontal: 'right' }} > @@ -127,34 +127,31 @@ export default function EditProfilePage(props) { </Snackbar> <CustomizedBreadcrumbs - contrast={state.contrast} values={["Minha área", "Configurações da Conta", tabs[tabValue]]} /> <MainContainerDiv container spacing={3} justify="center" align="center"> <Grid item xs={12} md={3} style={{ fontFamily: "Roboto" }} > <Paper elevation={3}> - <ConfiguracoesMenu contrast={state.contrast}> - <h4 className="title"> + <ConfiguracoesMenu> + <h4 style={{ marginTop: "10px", fontFamily: "inherit", display: "flex", justifyContent: "center" }}> Configurações da Conta </h4> <StyledTabs - contrast={state.contrast} orientation="vertical" variant="fullWidth" - textColor="primary" value={tabValue} onChange={handleChangeTab} TabIndicatorProps={{ style: { display: "none" } }} > - <StyledTab contrast={state.contrast} label={tabs[0]} /> - <StyledTab contrast={state.contrast} label={tabs[1]} /> - <StyledTab contrast={state.contrast} label={tabs[2]} /> + <StyledTab label={tabs[0]} /> + <StyledTab label={tabs[1]} /> + <StyledTab label={tabs[2]} /> </StyledTabs> </ConfiguracoesMenu> </Paper> </Grid> - <TabContentDiv contrast={state.contrast} item xs={12} md={9}> + <TabContentDiv item xs={12} md={9}> <Paper elevation={3} style={{ width: "100%" }}> {tabValue === 0 && <TabPanelEditarPerfil updateUserInfo={updateUserInfo} />} {tabValue === 1 && <TabPanelSolicitarContaProfessor />} @@ -164,36 +161,18 @@ export default function EditProfilePage(props) { />} </TabContentDiv> </MainContainerDiv> - </Main> + </div> ) } -const Main = styled.div` - background-color: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; -` - const TabContentDiv = styled(Grid)` - - .subtitle{ - display: flex; - justify-content: flex-start; - font-size: 18px; - color: ${props => props.contrast === "" ? "" : "white"}; - } - - .title{ - font-weight: 300; - color: ${props => props.contrast === "" ? "" : "white"}; - } .card-config { padding : 40px; margin : 20px 0 20px 10px; border-radius : 3px; box-shadow : 0 0 5px 0rgba(0,0,0,.25); - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; + background-color : #fff; text-align : start; margin-left : auto; margin-right : auto; @@ -237,32 +216,19 @@ const TabContentDiv = styled(Grid)` font-weight : 500; line-height : 1.1; } - - .link { - text-align: flex-start; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } ` const StyledTabs = styled(Tabs)` display : flex; justify-content : center; - .MuiTab-textColorPrimary{ - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: 400; - } - .MuiTab-textColorPrimary.Mui-selected { - color: ${props => props.contrast === "" ? "black" : "yellow"}; - text-decoration: none; - font-weight: 600; + .Mui-selected { + background-color : #f4f4f4; } ` const StyledTab = styled(Tab)` &:hover { - background-color: ${props => props.contrast === "" ? "#6666663d" : "rgba(255,255,0,0.24)"}; + background-color : #6666663d; } ` @@ -270,16 +236,7 @@ const ConfiguracoesMenu = styled.div` margin : 20px 0 20px 0; border-radius : 3px; padding : 20px 0; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; - - .title{ - margin-top: 10px; - font-family: inherit; - display: flex; - justify-content: center; - color: ${props => props.contrast === "" ? "" : "white"}; - } + background-color : #fff; ` const MainContainerDiv = styled(Grid)` diff --git a/src/Pages/FormationMaterialPage.js b/src/Pages/FormationMaterialPage.js index 7f6c27cd22c1c85a4174da1848c5d34481c58ad1..797074618d38f7d3282a57a2ed8d5641ae06e512 100644 --- a/src/Pages/FormationMaterialPage.js +++ b/src/Pages/FormationMaterialPage.js @@ -15,7 +15,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, { useRef, useContext } from 'react'; +import React, { useRef } from 'react'; import styled from 'styled-components'; import { Grid } from '@material-ui/core'; import FormationMaterialHeader from '../Components/FormationMaterialHeader.js'; @@ -24,20 +24,18 @@ import TopicList from '../Components/TopicList.js'; import TopicFooter from '../Components/TopicFooter.js'; import colecoes_obj from '../Components/FormationMaterialsResources/formationMaterials.js'; import Breadcrumbs from "@material-ui/core/Breadcrumbs"; -import { Link } from "react-router-dom"; -import { Store } from '../Store'; +import {Link} from "react-router-dom" export default function FormationMaterialPage(props) { - const colecao = window.location.pathname.split('?')[0] === "/colecao"; + const colecao = props.location.pathname === "/colecao"; const colecoes = colecoes_obj(); - const { state } = useContext(Store); const colecao_id = Number( colecao ? - window.location.search.split('=')[1] - : window.location.search.split('&')[0].split('=')[1] + props.location.search.split('=')[1] + : props.location.search.split('&')[0].split('=')[1] ); - const topico_id = Number(colecao ? 0 : window.location.search.split('&')[1].split('=')[1]); + const topico_id = Number(colecao ? 0 : props.location.search.split('&')[1].split('=')[1]); const colecao_obj = ((id) => { for (const c in colecoes) { @@ -60,10 +58,12 @@ export default function FormationMaterialPage(props) { window.scrollTo(0, topic_list_ref.current.offsetTop); } + console.log(colecao_obj); + return ( - <Background contrast={state.contrast}> + <Background> <BreadCrumbsDiv> - <StyledBreadCrumbs contrast={state.contrast}> + <StyledBreadCrumbs> <Link to="/">Página Inicial</Link> <span> { @@ -72,7 +72,7 @@ export default function FormationMaterialPage(props) { </span> </StyledBreadCrumbs> </BreadCrumbsDiv> - <MainContainer contrast={state.contrast}> + <MainContainer> <Grid container direction="row" justify="flex-start" @@ -80,7 +80,6 @@ export default function FormationMaterialPage(props) { > <Grid item xs={12}> <FormationMaterialHeader - contrast={state.contrast} colecao={colecao} colecao_obj={colecao_obj} topico_obj={topico_obj} @@ -89,7 +88,6 @@ export default function FormationMaterialPage(props) { </Grid> <Grid item xs={12}> <FormationMaterialDescription - contrast={state.contrast} colecao={colecao} colecao_obj={colecao_obj} topico_obj={topico_obj} @@ -99,7 +97,6 @@ export default function FormationMaterialPage(props) { { colecao ? <TopicList - contrast={state.contrast} topicos={colecao_obj.topics} colecao_id={colecao_id} /> @@ -113,7 +110,6 @@ export default function FormationMaterialPage(props) { <div></div> : <TopicFooter - contrast={state.contrast} topic_name={colecao_obj.topic_name} src={colecao_obj.img} colecao_name={colecao_obj.name} /> @@ -123,13 +119,12 @@ export default function FormationMaterialPage(props) { } const Background = styled.div` - background: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; + background-color: #f4f4f4; ` const MainContainer = styled.div` margin-left: auto; margin-right: auto; padding : 0; - background: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; @media screen and (min-width: 768px) { width : 750px; @@ -146,11 +141,11 @@ const StyledBreadCrumbs = styled(Breadcrumbs)` justify-content: flex-start; max-width: 1170px; span { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; + color: #a5a5a5; } a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color: #00bcd4; + text-decoration: none; } ` diff --git a/src/Pages/HelpCenter.js b/src/Pages/HelpCenter.js index f72b8c48fcab3d56bac9d27c6fcebf26b836c320..162dec27a45c6ae619739f1d6e22105429032fd4 100644 --- a/src/Pages/HelpCenter.js +++ b/src/Pages/HelpCenter.js @@ -16,11 +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, { useEffect, useContext } from 'react'; +import React, { useEffect } from 'react'; import styled from 'styled-components'; import Grid from '@material-ui/core/Grid'; import { Link } from 'react-router-dom'; -import { Store } from '../Store'; + import CardPublicando from '../Components/HelpCenter/Cards/CardPublicando'; import CardEncontrando from '../Components/HelpCenter/Cards/CardEncontrando'; import CardParticipando from '../Components/HelpCenter/Cards/CardParticipando'; @@ -31,7 +31,6 @@ import { Banner3 } from "ImportImages.js"; function HelpCenter(props) { - const { state } = useContext(Store) let windowWidth = window.innerWidth useEffect(() => { window.scrollTo(0, 0) }, []) @@ -40,7 +39,7 @@ function HelpCenter(props) { <div style={{ backgroundColor: "#f4f4f4" }}> <link href="https://fonts.googleapis.com/css?family=Pompiere|Roboto:300,400&display=swap" rel="stylesheet" /> - <Secao1 contrast={state.contrast}> + <Secao1> <div className="container"> { windowWidth > 420 ? @@ -56,7 +55,7 @@ function HelpCenter(props) { </div> </Secao1> - <Secao2 contrast={state.contrast}> + <Secao2> <div className="container"> <div className="container-secao"> <div className="conteudo"> @@ -66,26 +65,26 @@ function HelpCenter(props) { <div> <Grid container justify="center" style={{ margin: -8 }}> <Grid item xs={12} md={5} style={{ padding: 8 }}> - <CardPublicando contrast={state.contrast} /> + <CardPublicando /> </Grid> <Grid item xs={12} md={5} style={{ padding: 8 }}> - <CardEncontrando contrast={state.contrast} /> + <CardEncontrando /> </Grid> <Grid item xs={12} md={5} style={{ padding: 8 }}> - <CardParticipando contrast={state.contrast} /> + <CardParticipando /> </Grid> <Grid item xs={12} md={5} style={{ padding: 8 }}> - <CardGerenciando contrast={state.contrast} /> + <CardGerenciando /> </Grid> </Grid> </div> </div> </div> </div> - </Secao2> + </Secao2> <div style={{ width: "100%" }}> - <Secao3 contrast={state.contrast}> + <Secao3> <Grid style={{ height: "100%" }} container justify="center"> <Grid style={{ backgroundColor: "#333", paddingInline: "0" }} item xs={12} md={6}> <iframe title="Vídeo página ajuda" src="https://player.vimeo.com/video/231609051" width="100%" height="100%" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe> @@ -145,7 +144,7 @@ function HelpCenter(props) { </Secao3> </div> - <Secao4 contrast={state.contrast}> + <Secao4> <div className="container"> <div className="conteudo"> <h2>Não encontrou o que você precisa?</h2> @@ -165,7 +164,7 @@ export default HelpCenter; const Secao1 = styled.div` - background-color: ${props => props.contrast === "" ? "#00bcd4" : "black"}; + background-color:#00bcd4; text-align: center; width: 100%; .container { @@ -215,9 +214,10 @@ const Secao1 = styled.div` ` const Secao2 = styled.div` - background-color: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; + background-color:#f4f4f4; text-align: center; - padding-bottom: 50px; + margin-bottom: 20px; + padding-bottom: 50px width: 100%; .container { height: 100%; @@ -236,14 +236,14 @@ const Secao2 = styled.div` h2 { font-size: 30px; font-weight: lighter; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color:#666; margin: 0; } } .card-ajuda { height: 360px; - margin-bottom: 20px; + margin-bottom: 20px .card { @@ -321,9 +321,9 @@ const Secao2 = styled.div` const Secao3 = styled.div` padding: 0; text-align: center; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; + background-color: #fff; margin-inline: auto; - color: ${props => props.contrast === "" ? "rgba(0,0,0,0.87)" : "white"}; + color: rgba(0,0,0,0.87); width: 100%; .links { font-size: 15px; @@ -332,12 +332,10 @@ const Secao3 = styled.div` margin: 0 0 10px; line-height: 1.42857143; a { - color: ${props => props.contrast === "" ? "#666" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - font-weight: lighter; + color: #666; + text-decoration: none; :hover { - color: ${props => props.contrast === "" ? "#000" : "yellow"}; - font-weight: 500; + color: #000; } } } @@ -363,7 +361,7 @@ const Secao4 = styled.div` width: 100%; .container { height: 100%; - background-color: ${props => props.contrast === "" ? "" : "black"}; + color: #a5a5a5; margin-inline: auto; display: flex; flex-direction: column; @@ -375,7 +373,7 @@ const Secao4 = styled.div` h2 { font-size: 24px; font-weight: lighter; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color:#666; margin-top: 20px; margin-bottom: 10px; text-align: center; @@ -383,14 +381,15 @@ const Secao4 = styled.div` span { font-size: 15px; - color: ${props => props.contrast === "" ? "#777" : "white"}; + color:#777; text-align: center; + } button { margin-top: 25px; - color: ${props => props.contrast === "" ? "rgba(255,255,255,0.87)" : "yellow"}; - background-color: ${props => props.contrast === "" ? "rgb(255,127,0)" : "black"}; + color: rgba(255,255,255,0.87); + background-color: rgb(255,127,0); box-shadow: 0 2px 5px 0 rgba(0,0,0,.26); outline: none;display: inline-block; position: relative; @@ -405,7 +404,7 @@ const Secao4 = styled.div` border-radius: 3px; box-sizing: border-box; user-select: none; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; + border: 0; padding: 0 6px; margin: 6px 8px; white-space: nowrap; @@ -419,12 +418,9 @@ const Secao4 = styled.div` overflow: hidden; transition: box-shadow .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1); letter-spacing: .01em; - :hover{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; - } a { - color: ${props => props.contrast === "" ? "rgba(255,255,255,0.87)" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + text-decoration: none; + color: #fff; } } } diff --git a/src/Pages/MaterialPage.js b/src/Pages/MaterialPage.js index 4ec7369a89fea7e179737f57285df08ca54a397e..9b243b8b8da922a631f9e774d6143a0fa09fa36b 100644 --- a/src/Pages/MaterialPage.js +++ b/src/Pages/MaterialPage.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, { useState, useContext } from "react"; +import React, { useState } from "react"; import { Col, Row, Container } from "react-grid-system"; import { Carousel } from "react-responsive-carousel"; import MaterialCard from "../Components/MaterialCard"; @@ -25,84 +25,77 @@ import ExpandedMaterial from "../Components/ExpandedMaterials"; import styled from "styled-components"; import Breadcrumbs from "@material-ui/core/Breadcrumbs"; import { Link } from "react-router-dom"; -import { Store } from '../Store'; const MateriaPage = () => { - const materials = colecoes_obj(); - const { state } = useContext(Store); - const [currMaterial, setCurrMaterial] = useState({ - open: false, - material: {}, - }); + const materials = colecoes_obj(); - const HandleExpandMaterial = (id) => { - if (id !== currMaterial.material.id) - setCurrMaterial({ - open: true, - material: { ...materials[id] }, - }); - else - setCurrMaterial({ + const [currMaterial, setCurrMaterial] = useState({ open: false, material: {}, - }); - }; + }); - return ( - <MainPage contrast={state.contrast}> - <link href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap" rel="stylesheet" /> - <BreadCrumbsDiv> - <StyledBreadCrumbs contrast={state.contrast}> - <Link to="/">Página Inicial</Link> - <span>Materias de Formação</span> - </StyledBreadCrumbs> - </BreadCrumbsDiv> - <StyledBox contrast={state.contrast}> - <StyledTitle contrast={state.contrast}> - Materias de formação - </StyledTitle> - </StyledBox> - <MainContainer contrast={state.contrast}> - <Container style={{ padding: "20px" }}> - <Carousel - style={{ padding: "20px" }} - showThumbs={false} - showStatus={false} - > - <Row> - {materials.map((material, index) => { - return ( - <Col md={3} key={index}> - <MaterialCard - contrast={state.contrast} - name={material.name} - thumb={material.img} - score={material.score} - modules={material.topics} - handleExpand={HandleExpandMaterial} - id={index} - /> - </Col> - ); - })} - </Row> - </Carousel> - {currMaterial.open ? ( - <ExpandedMaterial contrast={state.contrast} material={currMaterial.material} /> - ) : null} - </Container> - </MainContainer> - </MainPage> - ); + const HandleExpandMaterial = (id) => { + if (id !== currMaterial.material.id) + setCurrMaterial({ + open: true, + material: { ...materials[id] }, + }); + else + setCurrMaterial({ + open: false, + material: {}, + }); + }; + + return ( + <> + <link href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap" rel="stylesheet" /> + <BreadCrumbsDiv> + <StyledBreadCrumbs> + <Link to="/">Página Inicial</Link> + <span>Materias de Formação</span> + </StyledBreadCrumbs> + </BreadCrumbsDiv> + <StyledBox> + <StyledTitle> + Materias de formação + </StyledTitle> + </StyledBox> + <MainContainer> + <Container style={{ padding: "20px" }}> + <Carousel + style={{ padding: "20px" }} + showThumbs={false} + showStatus={false} + > + <Row> + {materials.map((material, index) => { + return ( + <Col md={3} key={index}> + <MaterialCard + name={material.name} + thumb={material.img} + score={material.score} + modules={material.topics} + handleExpand={HandleExpandMaterial} + id={index} + /> + </Col> + ); + })} + </Row> + </Carousel> + {currMaterial.open ? ( + <ExpandedMaterial material={currMaterial.material} /> + ) : null} + </Container> + </MainContainer> + </> + ); }; export default MateriaPage; -const MainPage = styled.div` - background: ${props => props.contrast === "" ? "" : "black"}; -` - const MainContainer = styled.div` - background: ${props => props.contrast === "" ? "" : "black"}; margin-left: auto; margin-right: auto; padding: 0; @@ -123,11 +116,11 @@ const StyledBreadCrumbs = styled(Breadcrumbs)` justify-content: flex-start; max-width: 1170px; span { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; + color: #a5a5a5; } a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color: #00bcd4; + text-decoration: none; } ` @@ -137,17 +130,16 @@ const BreadCrumbsDiv = styled.div` ` const StyledBox = styled.div` - background: ${props => props.contrast === "" ? "#fff" : "black"}; + background-color: #fff; box-shadow: 1px 1px 3px rgba(0,0,0,.12), 1px 1px 2px rgba(0,0,0,.24); - border: ${props => props.contrast === "" ? "0" : "1px solid white"}; padding: 30px; margin-bottom: 30px; text-align: center; ` const StyledTitle = styled.span` text-align: center; - color: ${props => props.contrast === "" ? "#e81f4f" : "white"}; + color: #e81f4f; font-size: 26px; font-family: "Roboto", sans-serif; - font-weight: lighter; + font-weight: 100; ` \ No newline at end of file diff --git a/src/Pages/PageNotFound.js b/src/Pages/PageNotFound.js index 291db6617f7d060ff07bc09a86050a8240cd5cd1..7e9a5b0ca55aa05bc584bad105e8ebe0f3f306e5 100644 --- a/src/Pages/PageNotFound.js +++ b/src/Pages/PageNotFound.js @@ -16,46 +16,29 @@ 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, { useContext } from "react"; -import { Store } from '../Store' +import React from 'react'; import styled from "styled-components"; export default function PageNotFound (props) { - const { state } = useContext(Store); - return ( - <ContentDiv contrast={state.contrast} > + <div> <link href="https://fonts.googleapis.com/css?family=Roboto:100,400,500&display=swap" rel="stylesheet" /> - <StyledDiv> - <span style={{ fontSize: '50px' }}>Desculpe</span> - </StyledDiv> - <StyledDiv> - <span style={{ fontSize: '30px' }}>Não foi possível encontrar a página que você está procurando.</span> - </StyledDiv> - <StyledDiv> - <a href='/'><span style={{ fontSize: '20px' }}>Voltar para a página inicial</span></a> - </StyledDiv> - </ContentDiv> + <StyledDiv><span style={{ fontSize: '50px' }}>Desculpe</span></StyledDiv> + <StyledDiv><span style={{ fontSize: '30px' }}>Não foi possível encontrar a página que você está procurando.</span></StyledDiv> + <StyledDiv><a href='/'><span style={{ fontSize: '20px' }}>Voltar para a página inicial</span></a></StyledDiv> + </div> ) } -const ContentDiv = styled('div')` - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - color: ${props => props.contrast === "" ? "#666" : "white"} !important; - a { - color: ${props => props.contrast === "" ? "" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "underline yellow"} !important; - } -` - const StyledDiv = styled('div')` width: 100%; - padding-top: 70px; - padding-bottom: 70px; + margin-top: 70px; + margin-bottom: 70px; justify-content : space-evenly; display: flex; + color: #757575; text-align:center; ` \ No newline at end of file diff --git a/src/Pages/PageProfessor.js b/src/Pages/PageProfessor.js index c77fe1d5993729a6c7c6d2b0f5a3fe52a4a5da6c..96cd46bb141e537274c606200855b89428a8e54a 100644 --- a/src/Pages/PageProfessor.js +++ b/src/Pages/PageProfessor.js @@ -1,18 +1,18 @@ -import React, { useState, useContext } from 'react' -import { Store } from '../Store.js' +import React, {useState,useContext} from 'react' +import {Store} from '../Store.js' import Paper from '@material-ui/core/Paper'; import PartOne from '../Components/PageProfessorComponents/PartOne.js' import PartTwo from '../Components/PageProfessorComponents/PartTwo.js' import PartThree from '../Components/PageProfessorComponents/PartThree.js' import SuccessfulRequest from '../Components/PageProfessorComponents/SuccessfulRequest.js' import ModalConfirmarProfessor from '../Components/PageProfessorComponents/ModalConfirmarProfessor.js' -import { postRequest } from '../Components/HelperFunctions/getAxiosConfig' +import {postRequest} from '../Components/HelperFunctions/getAxiosConfig' -export default function PageProfessor(props) { - const { state } = useContext(Store) +export default function PageProfessor (props) { + const {state} = useContext(Store) const [modalOpen, toggleModal] = useState(false) const handleModal = () => { - toggleModal(!modalOpen); + toggleModal(!modalOpen) ; } const redirect = () => { @@ -24,36 +24,39 @@ export default function PageProfessor(props) { teacher_cpf: '', school_phone: '', school_name: '', - school_city: '', - school_uf: { - abbreviation: '', - name: '' + school_city : '', + school_uf : { + abbreviation : '', + name : '' }, inep_code: '' } ) - const [activeStep, setActiveStep] = useState(0); - - const incrementStep = () => { - setActiveStep((previous) => previous + 1); - } - - const decrementStep = () => { - setActiveStep((previous) => previous - 1); + const [stepper, handleStepper] = useState( + [ {value : '1', selected : true}, {value : '2', selected : false}, {value : '3', selected : false}, {value : '4', selected : false}] + ) + const toggleStepper = (selected1, selected2, selected3, selected4) => { + handleStepper( + [ + {value : '1', selected : selected1}, + {value : '2', selected : selected2}, + {value : '3', selected : selected3}, + {value : '4', selected : selected4} + ] + ) } const handleBuscarParteUm = (ufAbbreviation, ufName, nomeMunicipio, inep) => { - setRegisterInformation({ - ...registerInformation, - school_uf: { + setRegisterInformation({...registerInformation, + school_uf : { abbreviation: (ufAbbreviation ? ufAbbreviation : ''), - name: (ufName ? ufName : '') + name : (ufName ? ufName : '') }, - school_city: (nomeMunicipio ? nomeMunicipio : ''), - inep_code: (inep ? inep : '') + school_city : (nomeMunicipio ? nomeMunicipio : ''), + inep_code : (inep ? inep : '') }) - incrementStep() + toggleStepper(false, true, false, false) } const handleBuscarParteDois = (city_name, inep, school_name, state_name) => { @@ -61,22 +64,20 @@ export default function PageProfessor(props) { const prev_state_name = registerInformation.school_uf.name const prev_city_name = registerInformation.school_city.name - setRegisterInformation({ - ...registerInformation, - school_uf: { - abbreviation: uf_abbreviation, + setRegisterInformation({...registerInformation, + school_uf : { + abbreviation : uf_abbreviation, name: (state_name ? state_name : prev_state_name) }, - school_city: (city_name ? city_name : prev_city_name), + school_city :(city_name ? city_name : prev_city_name), school_name: (school_name ? school_name : ''), - inep_code: (inep ? inep : '') + inep_code : (inep ? inep : '') }) - incrementStep(); + toggleStepper(false, false, true, false) } const handleParteTres = (phone, cpf) => { - setRegisterInformation({ - ...registerInformation, + setRegisterInformation({...registerInformation, teacher_cpf: (cpf ? cpf : ''), school_phone: (phone ? phone : ''), }) @@ -87,74 +88,74 @@ export default function PageProfessor(props) { props.history.push('/perfil/atualizacoes') } - function handleSuccessfulSubmit(data) { + function handleSuccessfulSubmit (data) { toggleModal() - incrementStep(); + toggleStepper(false, false, false, true) } const handleFinalSubmit = () => { const url = `/users/teacher_request` const payload = { - city: registerInformation.school_city, - cpf: registerInformation.teacher_cpf.toString(), - inep_id: registerInformation.inep_code.toString(), - phone: registerInformation.school_phone.toString(), - school: registerInformation.school_name, - uf: registerInformation.school_uf.name, + city : registerInformation.school_city.name, + cpf : registerInformation.teacher_cpf, + inep_id : registerInformation.inep_code, + phone : registerInformation.school_phone, + school : registerInformation.school_name, + uf : registerInformation.school_uf.name } - postRequest(url, payload, handleSuccessfulSubmit, (error) => { console.log(error) }) + postRequest(url, payload, handleSuccessfulSubmit, (error) =>{console.log(error)}) } return ( <> - { - state.userAgreedToPublicationTerms ? - ( - <> - <ModalConfirmarProfessor contrast={state.contrast} open={modalOpen} handleClose={handleModal} - info={registerInformation} confirmar={() => { handleFinalSubmit() }} - cancelar={() => { toggleModal() }} - /> - <div style={state.contrast === "" ? { backgroundColor: "#f4f4f4", color: "#666" } : { backgroundColor: "black", color: "white" }}> - <div style={{ display: "flex", justifyContent: "center", paddingTop: "5vh", paddingBottom: "5vh" }}> - <Paper elevation={3} style={state.contrast === "" ? { width: "max-content" } : { width: "max-content", backgroundColor: "black", color: "white", border: '1px solid white' }}> - <div style={{ paddingRight: "15px", paddingLeft: "15px" }}> - {activeStep === 0 && - <PartOne contrast={state.contrast} activeStep={activeStep} handleBuscar={handleBuscarParteUm} - handleCancelar={handleCancelar} - /> - } - {activeStep === 1 && - <PartTwo activeStep={activeStep} contrast={state.contrast} - info={registerInformation} goBack={decrementStep} - handleCancelar={handleCancelar} handleBuscar={handleBuscarParteDois} - /> - } - {activeStep === 2 && - <PartThree activeStep={activeStep} goBack={decrementStep} contrast={state.contrast} - handleCancelar={handleCancelar} info={registerInformation} - handleSubmit={handleParteTres} - /> - } - { - activeStep === 3 && - <SuccessfulRequest email={state.currentUser.email} history={props.history} contrast={state.contrast} /> - } - </div> - </Paper> - </div> + { + state.userAgreedToPublicationTerms? + ( + <> + <ModalConfirmarProfessor open={modalOpen} handleClose={handleModal} + info={registerInformation} confirmar = {() => {handleFinalSubmit()}} + cancelar = {() => {toggleModal()}} + /> + <div style={{backgroundColor:"#f4f4f4", color:"#666"}}> + <div style={{display: "flex", justifyContent:"center", paddingTop:"5vh", paddingBottom:"5vh"}}> + <Paper elevation={3} style= {{width:"max-content"}}> + <div style={{paddingRight:"15px", paddingLeft:"15px"}}> + {stepper[0].selected && + <PartOne stepper={stepper} handleBuscar={handleBuscarParteUm} + handleCancelar={handleCancelar} + /> + } + {stepper[1].selected && + <PartTwo stepper={stepper} + info={registerInformation} goBack={toggleStepper} + handleCancelar={handleCancelar} handleBuscar={handleBuscarParteDois} + /> + } + {stepper[2].selected && + <PartThree stepper={stepper} goBack={toggleStepper} + handleCancelar={handleCancelar} info={registerInformation} + handleSubmit={handleParteTres} + /> + } + { + stepper[3].selected && + <SuccessfulRequest email={state.currentUser.email} history={props.history}/> + } + </div> + </Paper> </div> - </> - ) - : - ( - <> - {redirect()} - </> - ) - } + </div> + </> + ) + : + ( + <> + {redirect()} + </> + ) + } </> ) } diff --git a/src/Pages/PasswordRecoveryPage.js b/src/Pages/PasswordRecoveryPage.js index e1a42071bbd4cb429f9407ad73cb32d796b69080..1ed9b8ccc586b4e7ac96150bd434a27cd2f2815c 100644 --- a/src/Pages/PasswordRecoveryPage.js +++ b/src/Pages/PasswordRecoveryPage.js @@ -1,5 +1,5 @@ -import React, { useState, useContext } from 'react' -import { BackgroundDiv } from '../Components/TabPanels/StyledComponents.js' +import React, {useState} from 'react' +import {BackgroundDiv} from '../Components/TabPanels/StyledComponents.js' import Paper from '@material-ui/core/Paper'; import styled from 'styled-components' import ValidateUserInput from '../Components/HelperFunctions/FormValidationFunction.js' @@ -7,15 +7,14 @@ import Default from '../Components/PasswordRecoveryComponents/Default.js' import Success from '../Components/PasswordRecoveryComponents/Success.js' import CaseError from '../Components/PasswordRecoveryComponents/Error.js' import CustomizedBreadcrumbs from '../Components/TabPanels/Breadcrumbs.js' -import { postRequest } from '../Components/HelperFunctions/getAxiosConfig' -import { Store } from '../Store' +import {postRequest} from '../Components/HelperFunctions/getAxiosConfig' + +export default function PasswordRecoveryPage (props) { -export default function PasswordRecoveryPage(props) { - const { state } = useContext(Store) const [formEmail, setEmail] = useState( { - key: false, - value: "" + key : false, + value : "" } ) @@ -24,22 +23,22 @@ export default function PasswordRecoveryPage(props) { const userInput = e.target.value const flag = ValidateUserInput('email', userInput) - setEmail({ - ...formEmail, - key: flag, - value: userInput + setEmail({...formEmail, + key : flag, + value : userInput }) } const [aux, setCase] = useState('default') const handleChangeSwitch = (value) => { + console.log(value) if (value !== "success") { - setEmail({ key: false, value: "" }) + setEmail({key : false, value : ""}) } setCase(value) }; - function handleSuccessfulSubmit(data) { + function handleSuccessfulSubmit (data) { handleChangeSwitch((data.success ? "success" : "error")) } const onSubmit = (e) => { @@ -52,19 +51,19 @@ export default function PasswordRecoveryPage(props) { "redirect_url" : "https://plataformaintegrada.mec.gov.br/recuperar-senha/alterar-senha" //"http://localhost:4000/recuperar-senha/alterar-senha" } - postRequest(url, payload, handleSuccessfulSubmit, (error) => { console.log(error) }) + postRequest(url, payload, handleSuccessfulSubmit, (error) => {console.log(error)}) } const components = { - default: <Default contrast={state.contrast} handleChange={handleChange} onSubmit={onSubmit} value={formEmail.value} error={formEmail.key} />, - success: <Success contrast={state.contrast} email={formEmail.value} changeSwitch={handleChangeSwitch} />, - error: <CaseError contrast={state.contrast} handleChange={handleChange} onSubmit={onSubmit} value={formEmail.value} error={formEmail.key} /> + default : <Default handleChange={handleChange} onSubmit={onSubmit} value={formEmail.value} error={formEmail.key}/>, + success : <Success email={formEmail.value} changeSwitch={handleChangeSwitch}/>, + error : <CaseError handleChange={handleChange} onSubmit={onSubmit} value={formEmail.value} error={formEmail.key}/> } const switchFunction = (value) => { - switch (value) { + switch(value) { case 'success': return components.success; case 'error': @@ -72,25 +71,24 @@ export default function PasswordRecoveryPage(props) { default: return components.default - } + } } return ( <> - <BackgroundDiv contrast={state.contrast}> + <BackgroundDiv> <div> <CustomizedBreadcrumbs - contrast={state.contrast} values={["Recuperar senha"]} /> </div> - <div style={{ justifyContent: "center", textAlign: "center", maxWidth: "600px", margin: "auto" }}> - <Paper elevation={3}> - <CardDiv contrast={state.contrast}> + <div style={{justifyContent:"center", textAlign:"center", maxWidth:"600px", margin:"auto"}}> + <Paper elevation={3}> + <CardDiv> {switchFunction(aux)} - </CardDiv> - </Paper> + </CardDiv> + </Paper> </div> </BackgroundDiv> </> @@ -98,8 +96,7 @@ export default function PasswordRecoveryPage(props) { } const CardDiv = styled.div` - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - border: ${props => props.contrast === "" ? 0 : "1px solid white"}; + background-color : #fff; box-shadow : 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); padding : 30px 60px; margin : 50px 0; diff --git a/src/Pages/PublicUserPage.js b/src/Pages/PublicUserPage.js index 0b7638739ba092df4f866b5d998cd5d58f51a987..6cdb3ccb2b825f648570bc718e4215416cf9abba 100644 --- a/src/Pages/PublicUserPage.js +++ b/src/Pages/PublicUserPage.js @@ -16,430 +16,327 @@ 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, useContext } from "react"; -import { Store } from "../Store"; -import styled from "styled-components"; -import { apiDomain } from "../env"; -import CustomizedBreadcrumbs from "../Components/TabPanels/Breadcrumbs.js"; -import Grid from "@material-ui/core/Grid"; -import FollowButton from "../Components/ContactButtons/FollowButton.js"; -import FollowingButton from "../Components/ContactButtons/FollowingButton.js"; -import FollowersCountButton from "../Components/ContactButtons/FollowersCountButton.js"; -import Tab from "@material-ui/core/Tab"; -import TabInicio from "../Components/TabPanels/PublicUserPageTabs/TabInicio.js"; -import TabRecursos from "../Components/TabPanels/PublicUserPageTabs/TabRecursos.js"; -import TabColecoes from "../Components/TabPanels/PublicUserPageTabs/TabColecoes.js"; -import TabRede from "../Components/TabPanels/PublicUserPageTabs/TabRede.js"; -import CheckDecagram from "../img/check-decagram-blue.svg"; -import ReportButton from "../Components/ReportButton.js"; -import { - HeaderContainer, - UserProfileContainer, - CoverContainer, - UserProfileInfoDiv, - StyledTabs, - CheckTeacherDiv, - RodapeDiv, - NavBarContentContainer, - BackgroundDiv, -} from "../Components/TabPanels/StyledComponents.js"; -import { fetchAllRequest } from "../Components/HelperFunctions/getAxiosConfig"; -import Typography from "@material-ui/core/Typography"; -import CircularProgress from "@material-ui/core/CircularProgress"; -import LoadingSpinner from "../Components/LoadingSpinner"; -import Button from "@material-ui/core/Button"; -import { Link } from "react-router-dom"; +import React, { useEffect, useState, useContext } from 'react' +import { Store } from '../Store' +import styled from 'styled-components' +import { apiDomain } from '../env'; +import CustomizedBreadcrumbs from '../Components/TabPanels/Breadcrumbs.js' +import Grid from '@material-ui/core/Grid'; +import FollowButton from '../Components/ContactButtons/FollowButton.js' +import FollowingButton from '../Components/ContactButtons/FollowingButton.js' +import FollowersCountButton from '../Components/ContactButtons/FollowersCountButton.js' +import Tab from '@material-ui/core/Tab'; +import TabInicio from '../Components/TabPanels/PublicUserPageTabs/TabInicio.js' +import TabRecursos from '../Components/TabPanels/PublicUserPageTabs/TabRecursos.js' +import TabColecoes from '../Components/TabPanels/PublicUserPageTabs/TabColecoes.js' +import TabRede from '../Components/TabPanels/PublicUserPageTabs/TabRede.js' +import CheckDecagram from '../img/check-decagram-blue.svg' +import ReportButton from '../Components/ReportButton.js' +import { HeaderContainer, UserProfileContainer, CoverContainer, UserProfileInfoDiv, StyledTabs, CheckTeacherDiv, RodapeDiv, NavBarContentContainer, BackgroundDiv } from '../Components/TabPanels/StyledComponents.js' +import { fetchAllRequest } from '../Components/HelperFunctions/getAxiosConfig' +import Typography from '@material-ui/core/Typography'; +import CircularProgress from '@material-ui/core/CircularProgress'; +import LoadingSpinner from '../Components/LoadingSpinner'; +import Button from '@material-ui/core/Button' +import { Link } from 'react-router-dom' //Image Import import { noAvatar } from "ImportImages.js"; function RenderFollowContainer(props) { - const { state } = useContext(Store); - const [followed, setFollowed] = useState(props.followed); - const toggleFollowed = () => { - setFollowed(!followed); - }; + const { state } = useContext(Store) + const [followed, setFollowed] = useState(props.followed) + const toggleFollowed = () => { setFollowed(!followed) } - return ( - <FollowContainer> - <> - {props.id !== state.currentUser.id && followed ? ( - <FollowingButton - contrast={state.contrast} - followedID={props.id} - toggleFollowed={toggleFollowed} - /> - ) : ( - <FollowButton contrast={state.contrast} followerID={props.id} toggleFollowed={toggleFollowed} /> - )} - <FollowersCountButton contrast={state.contrast} followCount={props.followCount} /> - </> - </FollowContainer> - ); + return ( + <FollowContainer> + <> + { + (props.id !== state.currentUser.id) && + followed ? + ( + <FollowingButton followedID={props.id} toggleFollowed={toggleFollowed} /> + ) + : + ( + <FollowButton followerID={props.id} toggleFollowed={toggleFollowed} /> + ) + } + <FollowersCountButton followCount={props.followCount} /> + </> + </FollowContainer> + ) } const RenderProfileAvatar = (userAvatar) => { - return ( - <ProfileAvatarDiv> - <img - src={userAvatar ? apiDomain + userAvatar : noAvatar} - alt="user avatar" - style={{ - height: "inherit", - width: "inherit", - border: "0", - verticalAlign: "middle", - }} - /> - </ProfileAvatarDiv> - ); -}; + return ( + <ProfileAvatarDiv> + <img src={userAvatar ? apiDomain + userAvatar : noAvatar} alt="user avatar" style={{ height: "inherit", width: "inherit", border: "0", verticalAlign: "middle" }} /> + </ProfileAvatarDiv> + ) +} -const RenderUserProfileInfo = (userName, contrast) => { - return ( - <UserProfileInfoDiv contrast={contrast}> - <p> - {userName} - </p> - </UserProfileInfoDiv> - ); -}; +const RenderUserProfileInfo = (userName) => { + return ( + <UserProfileInfoDiv> + <p + style={{ fontSize: "28px", color: "#fff", marginBottom: "2px", fontWeight: "500", borderRadius: "5px", textShadow: "0 1px 2px rgba(0,0,0,.45)" }} + > + {userName} + </p> + </UserProfileInfoDiv> + ) +} const RenderCheckTeacher = (submitter_request) => { - if (submitter_request === "accepted") { - return ( - <CheckTeacherDiv> - <p> - <span> - <img alt="" src={CheckDecagram} /> - </span> + if (submitter_request === "accepted") { + return ( + <CheckTeacherDiv> + <p> + <span> + <img alt="" src={CheckDecagram} /> + </span> Professor(a) </p> - </CheckTeacherDiv> - ); - } -}; + </CheckTeacherDiv> + ) + } +} export default function PublicUserPage(props) { - /*currentUser info variables--------------------------------------*/ - const { state } = useContext(Store); - /*user info variables--------------------------------------*/ - const WIDTH = window.innerWidth; - const [id, setId] = useState(props.match.params.userId); + /*currentUser info variables--------------------------------------*/ + const { state } = useContext(Store) + /*user info variables--------------------------------------*/ + const WIDTH = window.innerWidth; + const [id, setId] = useState(props.match.params.userId) - const [loading, setLoading] = useState(false); - const [erro, setErro] = useState(false); + const [loading, setLoading] = useState(false); - const [userData, setUserData] = useState({}); - const fillUserInfo = (data) => { - setUserData(data); - }; - /*---------------------------------------------------------*/ - const [following, setFollowing] = useState(0); - const fillFollowing = (data) => { - if (data) - if (data.errors) - setFollowing("Você precisa logar para ver o que usuário está "); - else setFollowing(data.length); - }; + const [userData, setUserData] = useState({}) + const fillUserInfo = (data) => { + setUserData(data) + } + /*---------------------------------------------------------*/ + const [following, setFollowing] = useState(0); + const fillFollowing = (data) => { + if (data) + if (data.errors) + setFollowing('Você precisa logar para ver o que usuário está '); + else + setFollowing(data.length); + } - /*content control variables--------------------------------*/ - // eslint-disable-next-line - const [tabs, setTabs] = useState(["Início", "Recursos", "Coleções", "Rede"]); - const [tabValue, setTabValue] = useState(0); - const handleChangeTab = (event, newValue) => { - setTabValue(newValue); - }; - /*---------------------------------------------------------*/ + /*content control variables--------------------------------*/ + // eslint-disable-next-line + const [tabs, setTabs] = useState([ + 'Início', 'Recursos', 'Coleções', 'Rede' + ]) + const [tabValue, setTabValue] = useState(0); + const handleChangeTab = (event, newValue) => { + setTabValue(newValue) + } + /*---------------------------------------------------------*/ - /*content variables--------------------------------*/ - const [learningObjArr, setLearningObjects] = useState([]); - const handleLearningObjects = (data) => { - setLearningObjects(data); - }; - const [collectionsArr, setCollections] = useState([]); - const handleCollections = (data) => { - setCollections(data); - }; - /*---------------------------------------------------------*/ + /*content variables--------------------------------*/ + const [learningObjArr, setLearningObjects] = useState([]) + const handleLearningObjects = (data) => { setLearningObjects(data) } + const [collectionsArr, setCollections] = useState([]) + const handleCollections = (data) => { setCollections(data) } + /*---------------------------------------------------------*/ - function handleSuccess(responseArr) { - if (Object.keys(responseArr[0]).length === 0) setErro(true); - else { - fillUserInfo(responseArr[0]); + function handleSuccess(responseArr) { + fillUserInfo(responseArr[0]) - handleLearningObjects(responseArr[1]); - - handleCollections(responseArr[2]); - - fillFollowing(responseArr[3]); - setLoading(false); - } - } + handleLearningObjects(responseArr[1]) - /*Component Will Mount*/ - useEffect(() => { - const id = props.match.params.userId; - setId(id); - const urls = [ - `/users/${id}`, - `/users/${id}/learning_objects`, - `/users/${id}/collections`, - `/users/${id}/following/User`, - ]; - setLoading(true); - fetchAllRequest(urls, handleSuccess, () => { - setErro(true) - }); - }, [state.currentUser.id, props.match.params.userId]); - /*---------------------------------------------------------*/ + handleCollections(responseArr[2]) - if (erro) - return ( - <UserNotFoundDiv contrast={state.contrast}> - <Grid - container - direction="column" - justify="center" - alignItems="center" - spacing={1} - > - <Grid item> - <p className="not-found"> - O usuário não foi encontrado em nossa base de dados. - </p> - </Grid> - <Grid item> - <Link - className="link" - to={`/busca?page=0&results_per_page=12&query=*&search_class=User`} - > - <Button variant="contained" className="back-button"> - Voltar para a busca de usuários - </Button> - </Link> - </Grid> - </Grid> - </UserNotFoundDiv> - ); - else - if (loading) - return ( - <div style={state.contrast === "" ? {} : { backgroundColor: "black" }}> - <LoadingSpinner - contrast={state.contrast} - text="Carregando dados do usuário..." - /> - </div> - ); - else - return ( - <React.Fragment> - <link - href="https://fonts.googleapis.com/css?family=Roboto:100,400,500&display=swap" - rel="stylesheet" - /> - <BackgroundDiv contrast={state.contrast}> - <CustomizedBreadcrumbs contrast={state.contrast} values={["Usuário Público", tabs[tabValue]]} /> - <Grid container spacing={2}> - <Grid item xs={12}> - <div style={{ padding: "10px 0 8px 0" }}> - <UserProfileContainer> - <HeaderContainer contrast={state.contrast}> - <> - {!loading && ( - <RenderFollowContainer - followed={userData.followed} - id={id} - followCount={userData.follows_count} - /> - )} - {RenderProfileAvatar( - userData.avatar ? userData.avatar : undefined - )} - <CoverContainer contrast={state.contrast}> - {userData.cover && ( - <img - src={apiDomain + userData.cover} - alt="imagem de capa do usuário" - style={{ - width: "100%", - height: "100%", - objectFit: "cover", - }} - /> - )} - </CoverContainer> - {WIDTH <= 501 - ? null - : RenderUserProfileInfo(userData.name, state.contrast)} - </> - </HeaderContainer> - {WIDTH <= 501 ? ( - <Grid - style={state.contrast === "" ? { marginTop: "4em" } : { paddingTop: "4em", backgroundColor: "black", borderLeft: "1px solid white", borderRight: "1px solid white", }} - container - justify="center" - alignItems="center" - direction="column" - > - <Grid item> - <Typography - variant="h4" - gutterBottom - style={state.contrast === "" ? { textAlign: "center" } : { color: "white", textAlign: "center" }} - > - {userData.name} - </Typography> - </Grid> - <Grid - style={{ - marginTop: "0.5em", - marginBottom: "0.5em", - borderTop: "1px solid white", - borderBottom: "1px solid white", - }} - container - spacing={4} - justify="center" - alignItems="center" - direction="row" - > - <Grid item> - <Typography style={state.contrast === "" ? {} : { color: "white" }} variant="h6" onClick={(e) => { handleChangeTab(e, 4) }}> - {loading ? ( - <CircularProgress size={20} /> - ) : ( - `${userData.follows_count} seguidores` - )} - </Typography> - </Grid> - <Grid item> - <Typography style={state.contrast === "" ? {} : { color: "white" }} variant="h6" onClick={(e) => { handleChangeTab(e, 4) }}> - {loading ? ( - <CircularProgress size={20} /> - ) : ( - `${following} seguindo` - )} - </Typography> - </Grid> - </Grid> - </Grid> - ) : ( - RenderCheckTeacher(userData.submitter_request) - )} - <RodapeDiv contrast={state.contrast}> - <NavBarContentContainer contrast={state.contrast}> - <StyledTabs - contrast={state.contrast} - value={tabValue} - onChange={handleChangeTab} - indicatorColor="primary" - textColor="primary" - variant="scrollable" - scrollButtons="on" - TabIndicatorProps={{ style: state.contrast === "" ? { background: "#00bcd4" } : { background: "yellow" } }} - > - {tabs.map((tab) => ( - <Tab - label={tab} - key={tab} - disabled={ - (tab === "Recursos" && - learningObjArr.length === 0) || - (tab === "Coleções" && - collectionsArr.length === 0) || - (tab === "Rede" && state.currentUser.id === "") - } - /> - ))} - </StyledTabs> - </NavBarContentContainer> - <ReportButton - className="report-button" - complainableId={userData.id} - complainableType={"User"} - /> - </RodapeDiv> - </UserProfileContainer> - </div> - </Grid> + fillFollowing(responseArr[3]) + setLoading(false); + } + + /*Component Will Mount*/ + useEffect(() => { + const id = props.match.params.userId + setId(id) + const urls = [`/users/${id}`, `/users/${id}/learning_objects`, `/users/${id}/collections`, `/users/${id}/following/User`] + setLoading(true); + fetchAllRequest(urls, handleSuccess, (error) => { console.log(error) }) + }, [state.currentUser.id, props.match.params.userId]) + /*---------------------------------------------------------*/ - {!loading && ( - <Grid item xs={12}> - {tabValue === 0 && ( - <TabInicio - contrast={state.contrast} - id={id} - user={userData} - learningObjs={learningObjArr} - collections={collectionsArr} - /> - )} - {tabValue === 1 && <TabRecursos contrast={state.contrast} id={id} username={userData.name} />} - {tabValue === 2 && <TabColecoes contrast={state.contrast} id={id} username={userData.name} />} - {tabValue === 3 && <TabRede contrast={state.contrast} id={id} username={userData.name} />} - </Grid> - )} + if (loading) + return <LoadingSpinner text="Carregando dados do usuário..." /> + else if (!userData && !following && !learningObjArr && !collectionsArr) + return <UserNotFoundDiv> + <Grid container direction='column' justify='center' alignItems='center' spacing={1}> + <Grid item> + <p className="not-found"> + O usuário não foi encontrado em nossa base de dados. + </p> + </Grid> + <Grid item> + <Link className="link" to={`/busca?page=0&results_per_page=12&query=*&search_class=User`}> + <Button + variant='contained' + className="back-button" + > + Voltar para a busca de usuários. + </Button> + </Link> + </Grid> + </Grid> + </UserNotFoundDiv> + else + return <React.Fragment> + <link href="https://fonts.googleapis.com/css?family=Roboto:100,400,500&display=swap" rel="stylesheet" /> + <BackgroundDiv> + <CustomizedBreadcrumbs + values={["Usuário Público", tabs[tabValue]]} + /> + <Grid container spacing={2}> + <Grid item xs={12}> + <div style={{ padding: "10px 0 8px 0" }}> + <UserProfileContainer> + <HeaderContainer> + <> + {!loading && <RenderFollowContainer followed={userData.followed} id={id} followCount={userData.follows_count} />} + {RenderProfileAvatar(userData.avatar ? userData.avatar : undefined)} + <CoverContainer> + {userData.cover && <img src={apiDomain + userData.cover} alt='' style={{ width: "100%", height: "100%", objectFit: "cover" }} />} + </CoverContainer> + { + WIDTH <= 501 ? null : RenderUserProfileInfo(userData.name) + } + </> + </HeaderContainer> + { + WIDTH <= 501 ? + <Grid style={{ marginTop: '4em' }} container justify="center" alignItems="center" direction="column"> + <Grid item> + <Typography variant="h4" gutterBottom style={{ textAlign: "center" }}> + { + userData.name + } + </Typography> + </Grid> + <Grid style={{ marginTop: '0.5em', marginBottom: '0.5em', borderTop: "0.5px solid #DCDCDC", borderBottom: "0.5px solid #DCDCDC" }} container spacing={4} justify="center" alignItems="center" direction="row"> + <Grid item> + <Typography variant="h6" style={{ textAlign: 'center' }}> + { + loading ? + <CircularProgress size={20} /> : + `${userData.follows_count} seguidores` + } + </Typography> </Grid> - </BackgroundDiv> - </React.Fragment> - ); + <Grid item> + <Typography variant="h6" style={{ textAlign: 'center' }} > + { + loading ? + <CircularProgress size={20} /> : + `${following} seguindo` + } + </Typography> + </Grid> + </Grid> + </Grid> + : + RenderCheckTeacher(userData.submitter_request)} + <RodapeDiv> + <NavBarContentContainer> + <StyledTabs + value={tabValue} + onChange={handleChangeTab} + indicatorColor="primary" + textColor="primary" + variant="scrollable" + scrollButtons="desktop" + TabIndicatorProps={{ style: { background: "#00bcd4" } }} + > + { + tabs.map((tab) => + <Tab label={tab} key={tab} + disabled={(tab === "Recursos" && learningObjArr.length === 0) || (tab === "Coleções" && collectionsArr.length === 0) || (tab === "Rede" && state.currentUser.id === '')} + /> + ) + } + </StyledTabs> + </NavBarContentContainer> + <ReportButton className="report-button" complainableId={userData.id} complainableType={"User"} /> + </RodapeDiv> + </UserProfileContainer> + </div> + </Grid> + + { + !loading && + <Grid item xs={12}> + {tabValue === 0 && + <TabInicio id={id} user={userData} learningObjs={learningObjArr} collections={collectionsArr} />} + {tabValue === 1 && + <TabRecursos id={id} username={userData.name} />} + {tabValue === 2 && + <TabColecoes id={id} username={userData.name} />} + {tabValue === 3 && + <TabRede id={id} username={userData.name} />} + </Grid> + } + </Grid> + </BackgroundDiv> + </React.Fragment> } + const ProfileAvatarDiv = styled.div` - overflow: hidden; - border-radius: 100%; - bottom: -10px; - left: 20px; - z-index: 10; - box-sizing: content-box; - position: absolute; - width: 150px; - height: 150px; - border: 4px solid #fff; - outline: 0; - background-color: #fff; + overflow : hidden; + border-radius : 100%; + bottom : -10px; + left : 20px; + z-index : 10; + box-sizing : content-box; + position : absolute; + width : 150px; + height : 150px; + border : 4px solid #fff; + outline : 0; + background-color : #fff; @media screen and (max-width: 501px) { - height: 73px; - width: 73px; - position: absolute; - left: 0; - right: 0; - bottom: -40px; - margin-left: auto; - margin-right: auto; - } -`; + height : 73px; + width : 73px; + position:absolute; + left:0; + right:0; + bottom : -40px; + margin-left:auto; + margin-right:auto; + } +` const UserNotFoundDiv = styled.div` - padding: 1em; - background-color: ${(props) => (props.contrast === "" ? "#f4f4f4" : "black")}; + margin: 1em; + + .not-found{ + font-family: 'Roboto', sans-serif; + font-weight: 500; + text-align: left; + padding: 0; + margin: 0; + } - .not-found { - font-family: "Roboto", sans-serif; - color: ${(props) => props.contrast === "" ? "#666" : "white"}; - font-weight: 500; - text-align: left; - padding: 0; - margin: 0; - } + .back-button{ + background-color: #00bcd4; + color: whitesmoke; + } - .back-button { - background-color: ${(props) => props.contrast === "" ? "#00bcd4" : "black"}; - color: ${(props) => props.contrast === "" ? "whitesmoke" : "yellow"}; - border: ${(props) => props.contrast === "" ? "none" : "1px solid white"}; - text-decoration: ${(props) => props.contrast === "" ? "none" : "underline"}; - :hover { - background-color: ${(props) => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; - text-decoration: ${(props) => props.contrast === "" ? "none" : "underline"}; - } - } -`; + .link{ + text-decoration: none; + } +` const FollowContainer = styled.div` - padding: 4px 10px; - right: 0; - position: absolute; - z-index: 1; -`; + padding : 4px 10px; + right : 0; + position : absolute; + z-index : 1; +` \ No newline at end of file diff --git a/src/Pages/PublicationPermissionsPage.js b/src/Pages/PublicationPermissionsPage.js index a7a121b3d6e3a83a2a389060412099602ce0435e..52bdbd8a8caf5b3b2ff7cfb465b230ac120206bb 100644 --- a/src/Pages/PublicationPermissionsPage.js +++ b/src/Pages/PublicationPermissionsPage.js @@ -15,7 +15,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, { useState, useContext, useEffect } from "react"; +import React, { useState, useContext } from "react"; import Card from "@material-ui/core/Card"; import CardActions from "@material-ui/core/CardActions"; import { Button } from "@material-ui/core"; @@ -25,52 +25,30 @@ import { device } from "../Components/device.js"; import { Store } from "../Store.js"; import IllegalContentModal from "../Components/IllegalContentModal.js"; import PublicationPermissionsContent from "../Components/PublicationPermissionsContent.js"; -import { getRequest } from '../Components/HelperFunctions/getAxiosConfig'; -import LoadingSpinner from '../Components/LoadingSpinner'; const CardStyled = styled(Card)` - box-sizing: border-box; - background-color: white; - max-width: 1700px; - @media ${device.mobileM} { - width: 100%; - height: 100%; - } -`; - -const StyledContinuar = styled(Button)` - font-family: "Roboto", sans serif; - font-style: normal; - font-weight: 500; - line-height: 22px; - font-size: 15px; - letter-spacing: 0.01em; - padding: 7px; - border-radius: 5px; - color: ${props => props.disable === true ? props.contrast === "" ? "#666" : "white" : props.contrast === "" ? "white" : "yellow"} !important; - text-decoration: ${props => props.disable === true ? props.contrast === "" ? "none" : "none" : props.contrast === "" ? "none" : "yellow underline"} !important; - background-color: ${props => props.disable === true ? props.contrast === "" ? "#E9E9E9" : "black" : props.contrast === "" ? "#52BCD4" : "black"} !important; - border: ${props => props.disable === true ? props.contrast === "" ? "none" : "1px solid white" : props.contrast === "" ? "none" : "1px solid white"} !important; + box-sizing: border-box; + background-color: white; + max-width: 1700px; + padding-top: 52px; + @media ${device.mobileM} { + width: 100%; + height: 100%; + } `; -const StyledCancelar = styled(Button)` - font-family: "Roboto", sans serif; - font-style: normal; - font-weight: 500; - line-height: 22px; - font-size: 15px; - letter-spacing: 0.01em; - padding: 7px; - border-radius: 5px; - color: ${props => props.contrast === "" ? "#666" : "yellow"} !important; - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"} !important; - background-color: ${props => props.contrast === "" ? "white" : "black"} !important; - border: none; +const Styledspan = styled.span` + font-family: "Roboto", sans serif; + font-style: normal; + font-weight: 500; + line-height: 22px; + font-size: 15px; + letter-spacing: 0.01em; `; const Background = styled.div` padding-top : 40px; - background-color: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; + background-color : #f4f4f4; color : #666; padding-bottom : 40px; @@ -92,149 +70,134 @@ const Background = styled.div` ` export default function PermissionsContainer(props) { - const { state, dispatch } = useContext(Store); - const [loading, setLoading] = useState(true); - const [unavailableCheckbox, setCheckboxAvailability] = useState(true); - const [unavailableButton, setButtonAvailability] = useState(true); - - const [questionsArr, setQuestionsArr] = useState([]); - - const [radios, setRadioValues] = useState({}); - const [modalOpen, setModalOpen] = useState(false); - - const closeModal = () => { - setModalOpen(false); - props.history.push("/termos-publicar-recurso"); - window.scrollTo(0, 0); - }; - - const handleChecked = e => { - setButtonAvailability(!unavailableButton); - }; - - const handleRadios = e => { - let radioTmp2 = {id: parseInt(e.target.name), value: e.target.value}; - let temp = radios; - const index = temp.findIndex(x => x.id === parseInt(e.target.name)); - - temp[index] = radioTmp2; - - setRadioValues(temp); - setCheckboxAvailability(!(radios.every((radio) => radio.value === "Não"))); - }; - - const handleAgreement = () => { - if (radios.some((radio) => radio === "Sim")) { - setModalOpen(true); - } else { - dispatch({ - type: "USER_AGREED_TO_PUBLICATION_PERMISSIONS", - userAgreement: true - }); - - props.history.push("/upload"); - } - }; - - function handleSuccess(data) { - var radioTmp = []; - - data.forEach(element => { - var radioTmp2 = {id: element.id, value: ""}; - - if (element.status === "active" && element.id !== 4) { - radioTmp.push(radioTmp2); - } - }); - - setQuestionsArr(data); - setRadioValues(radioTmp); - - setLoading(false); + const { state, dispatch } = useContext(Store); + const [unavailableCheckbox, setCheckboxAvailability] = useState(true); + const [unavailableButton, setButtonAvailability] = useState(true); + const [radios, setRadioValues] = useState({ + radio1: "", + radio2: "", + radio3: "" + }); + const [modalOpen, setModalOpen] = useState(false); + + const closeModal = () => { + setModalOpen(false); + props.history.push("/termos-publicar-recurso"); + window.scrollTo(0, 0); + }; + + const handleChecked = e => { + setButtonAvailability(!unavailableButton); + }; + + const handleRadios = e => { + let temp = radios; + temp[e.target.name] = e.target.value; + + setRadioValues(temp); + setCheckboxAvailability(!(radios.radio1 === "Não" && radios.radio2 === "Não" && radios.radio3 === "Não")); + }; + + const handleAgreement = () => { + if ( + radios.radio1 === "Sim" || + radios.radio2 === "Sim" || + radios.radio3 === "Sim" + ) { + setModalOpen(true); + } else { + dispatch({ + type: "USER_AGREED_TO_PUBLICATION_PERMISSIONS", + userAgreement: true + }); + + props.history.push("/upload"); } - - useEffect(() => { - const url = `/questions/` - - getRequest(url, handleSuccess, (error) => { console.log(error) }) - - }, []) - - const redirect = () => { - props.history.push("/termos-publicar-recurso"); - }; - - const redirectToHome = () => { - props.history.push("/"); - }; - - return ( - <> - {!loading ? - ( - state.userAgreedToPublicationTerms ? ( - [ - <> - <IllegalContentModal - contrast={props.contrast} - open={modalOpen} - handleClose={closeModal} - disableBackdropClick={true} - /> - <Background contrast={state.contrast}> - <div className="container"> - <CardStyled variant="outlined"> - <PublicationPermissionsContent contrast={state.contrast} handleRadios={handleRadios} questionsArr={questionsArr}/> - <CardActions - style={state.contrast === "" ? { justifyContent: "center", padding: "25px", borderTop: "2px solide #dadada" } : { justifyContent: "center", padding: "25px", borderTop: "2px solide #dadada", backgroundColor: "black" }} - > - <div> - <div style={{ fontSize: "14px" }}> - <LabeledCheckbox - contrast={state.contrast} - disabled={unavailableCheckbox} - label={ - <span className={`${state.contrast}LinkColor`} style={{ fontSize: "15px" }}> - Li e permito a publicação do meu recurso na - Plataforma Integrada de RED do MEC, assim como - atesto que o meu recurso atende aos critérios - especificados acima. - </span> - } - handleChange={handleChecked} - /> - <div - style={{ justifyContent: "left", display: "flex", marginTop: "15px" }} - > - <StyledContinuar - disabled={unavailableButton || unavailableCheckbox} - disable={unavailableButton || unavailableCheckbox} - contrast={state.contrast} - onClick={handleAgreement} - > - Continuar - </StyledContinuar> - <StyledCancelar onClick={redirectToHome} contrast={state.contrast}> - Cancelar - </StyledCancelar> - </div> - </div> - </div> - </CardActions> - </CardStyled> + }; + + const redirect = () => { + props.history.push("/termos-publicar-recurso"); + }; + + const redirectToHome = () => { + props.history.push("/"); + }; + return ( + <> + {state.userAgreedToPublicationTerms ? ( + [ + <> + <IllegalContentModal + open={modalOpen} + handleClose={closeModal} + disableBackdropClick={true} + /> + <Background + > + <div className="container"> + <CardStyled variant="outlined"> + <PublicationPermissionsContent handleRadios={handleRadios} /> + <CardActions + style={{ justifyContent: "center", padding: "25px", borderTop : "2px solide #dadada" }} + > + <div> + <div style={{ fontSize: "14px" }}> + <LabeledCheckbox + disabled={unavailableCheckbox} + label={ + <Styledspan> + Li e permito a publicação do meu recurso na + Plataforma Integrada de RED do MEC, assim como + atesto que o meu recurso atende aos critérios + especificados acima. + </Styledspan> + } + handleChange={handleChecked} + /> + <div + style={{ justifyContent: "center", display: "flex" }} + > + <Button + disabled={unavailableButton || unavailableCheckbox} + style={ + unavailableButton || unavailableCheckbox + ? { backgroundColor: "#e9e9e9" } + : { backgroundColor: "#00bcd4" } + } + onClick={handleAgreement} + > + <Styledspan + style={ + unavailableButton || unavailableCheckbox + ? { color: "#666666", fontWeight : "600" } + : { color: "#ffffff", fontWeight : "600" } + } + > + Continuar{" "} + </Styledspan> + </Button> + <Button + style={{ + marginLeft: "45px", + backgroundColor: "#e9e9e9", + }} + > + <Styledspan style={{ color: "rgb(102, 102, 102)" , fontWeight : "600 !important"}} onClick={() => {redirectToHome()}}> + Cancelar + </Styledspan> + </Button> </div> - </Background> - </> - ] - ) : ( - <>{redirect()}</> - ) - ) - : - ( - <LoadingSpinner contrast={state.contrast} text="Carregando..." /> - ) - } - </> - ); + </div> + </div> + </CardActions> + </CardStyled> + </div> + </Background> + </> + ] + ) : ( + <>{redirect()}</> + )} + </> + ); } diff --git a/src/Pages/ResourcePage.js b/src/Pages/ResourcePage.js index 17cc07adf2121aface9b8140785ce21098d1da89..37d96115166a1ae2cb2ae97c9b83108c9427fbcc 100644 --- a/src/Pages/ResourcePage.js +++ b/src/Pages/ResourcePage.js @@ -42,316 +42,311 @@ import { Link } from 'react-router-dom'; import { noAvatar } from "ImportImages.js"; function urlVerify(url) { - return url - ? url.indexOf("youtu") !== -1 || url.indexOf("vimeo") !== -1 - : false; + return url + ? url.indexOf("youtu") !== -1 || url.indexOf("vimeo") !== -1 + : false; } export default function LearningObjectPage(props) { - const { state } = useContext(Store); - const id = props.match.params.recursoId; - const [carregando, toggle] = useState(true); - const [erro, setErro] = useState(false); - const [recurso, setRecurso] = useState({}); - const [modalConfirmarCuradoriaOpen, toggleModalConfirmarCuradoria] = useState( - false - ); - - function handleSuccessfulGet(data) { - setRecurso(data); + const { state } = useContext(Store); + const id = props.match.params.recursoId; + const [carregando, toggle] = useState(true); + const [erro, setErro] = useState(false); + const [recurso, setRecurso] = useState({}); + + function handleSuccessfulGet(data) { + setRecurso(data); + toggle(false); + } + useEffect(() => { + const url = `/learning_objects/${id}`; + + getRequest( + url, + handleSuccessfulGet, + (error) => { + setErro(true) toggle(false); + handleSnackbar(7) + } + ); + }, []); + + const [snackbarOpen, toggleSnackbar] = useState(false); + const handleSnackbar = (index) => { + setIndex(index); + toggleSnackbar(true); + }; + const snackbarText = [ + "Baixando o Recurso... Lembre-se de relatar sua experiência após o uso do Recurso!", + "Seu comentário foi publicado com sucesso!", + "Comentário editado com sucesso.", + "Comentário deletado com sucesso.", + "O Recurso foi guardado na coleção!", + "O recurso foi aprovado com sucesso!", + "Erro ao aprovar o recurso!", + "Erro ao carregar a página", + "Erro ao fazer o dowload do recurso", + ]; + const [snackbarIndex, setIndex] = useState(0); + const classes = useStyles(); + const [modalCuradoriaOpen, toggleModalCuradoria] = useState(false); + const handleModalCuradoria = (value) => { + toggleModalCuradoria(value); + }; + + const checkAccessLevel = (levelToCheck) => { + if (state.currentUser.id !== "") { + return checkUserRole(levelToCheck); + } else { + return false; } - useEffect(() => { - const url = `/learning_objects/${id}`; - - getRequest( - url, - handleSuccessfulGet, - (error) => { - setErro(true) - toggle(false); - handleSnackbar(7) - } - ); - }, []); - - const [snackbarOpen, toggleSnackbar] = useState(false); - const handleSnackbar = (index) => { - setIndex(index); - toggleSnackbar(true); - }; - const snackbarText = [ - "Baixando o Recurso... Lembre-se de relatar sua experiência após o uso do Recurso!", - "Seu comentário foi publicado com sucesso!", - "Comentário editado com sucesso.", - "Comentário deletado com sucesso.", - "O Recurso foi guardado na coleção!", - "O recurso foi aprovado com sucesso!", - "Erro ao aprovar o recurso!", - "Erro ao carregar a página", - "Erro ao fazer o dowload do recurso", - ]; - const [snackbarIndex, setIndex] = useState(0); - const classes = useStyles(); - const [modalCuradoriaOpen, toggleModalCuradoria] = useState(false); - const handleModalCuradoria = (value) => { - toggleModalCuradoria(value); - }; - - const checkAccessLevel = (levelToCheck) => { - if (state.currentUser.id !== "") { - return checkUserRole(levelToCheck); - } else { - return false; - } - }; - - const checkUserRole = (userRole) => { - return ( - state.currentUser.roles.filter((role) => role.name === userRole).length > - 0 - ); - }; - - const finalizeCuratorshipFlow = () => { - handleSnackbar(5); - handleModalConfirmarCuradoria(false); - const url = `/learning_objects/${id}`; - getRequest( - url, - (data) => { - setRecurso(data); - }, - (error) => { - handleSnackbar(7); - setErro(true); - }) - } + }; - const handleModalConfirmarCuradoria = (value) => { - toggleModalConfirmarCuradoria(value); - }; - const [reportCriteria, setReportCriteria] = useState([]); - const [justificativa, setJustificativa] = useState(""); - const [submissionAccepted, setSubmissionAccepted] = useState(""); - - const handleConfirm = (criteria, justification, accepted) => { - setReportCriteria(criteria); - setJustificativa(justification); - setSubmissionAccepted(accepted); - handleModalCuradoria(false); - handleModalConfirmarCuradoria(true); - }; - - if (erro) - return <LearnObjectNotFound contrast={state.contrast}> - <Grid container direction='column' justify='center' alignItems='center' spacing={1}> - <Grid item> - <p className="not-found"> - O recurso não foi encontrado em nossa base de dados. - </p> - </Grid> - <Grid item> - <Link to={`/busca?page=0&results_per_page=12&order=review_average&query=*&search_class=LearningObject`}> - <Button - variant='contained' - className="back-button" - > - Voltar para a busca de recursos - </Button> - </Link> - </Grid> - </Grid> - </LearnObjectNotFound> - else - return ( - <React.Fragment> - <Snackbar - open={snackbarOpen} - autoHideDuration={6000} - onClose={toggleSnackbar} - anchorOrigin={{ vertical: "top", horizontal: "right" }} - > - <Alert severity="info" - style={{ backgroundColor: "#00acc1" }}> - {snackbarText[snackbarIndex]} - </Alert> - </Snackbar> - - <ModalAvaliarRecurso - contrast={state.contrast} - open={modalCuradoriaOpen} - handleClose={() => { - handleModalCuradoria(false); - }} - title={recurso.name} - confirm={handleConfirm} - setCriteria={setReportCriteria} - /> - <ModalConfirmarCuradoria - contrast={state.contrast} - aceito={submissionAccepted} - reportCriteria={reportCriteria} - justificativa={justificativa} - open={modalConfirmarCuradoriaOpen} - handleClose={() => { - handleModalConfirmarCuradoria(false); - }} - cancel={() => { - handleModalCuradoria(true); - }} - recursoId={recurso.submission_id} - finalizeCuratorshipFlow={finalizeCuratorshipFlow} - handleErrorAprove={() => { - handleSnackbar(6) - }} - /> - <Background contrast={state.contrast}> - {carregando ? ( - <LoadingSpinner contrast={state.contrast} text={"Carregando Recurso"} /> - ) : ( - <> - <Grid container spacing={2}> - {recurso.object_type === "Vídeo" && !recurso.link ? ( - <Grid item xs={12}> - <Card contrast={state.contrast}> - <VideoPlayer - contrast={state.contrast} - link={recurso.link} - urlVerified={false} - videoUrl={recurso.default_attachment_location} - videoType={recurso.default_mime_type} - /> - </Card> - </Grid> - ) : ( - urlVerify(recurso.link) && ( - <Grid item xs={12}> - <Card contrast={state.contrast}> - <VideoPlayer contrast={state.contrast} link={recurso.link} urlVerified={true} /> - </Card> - </Grid> - ) + const checkUserRole = (userRole) => { + return ( + state.currentUser.roles.filter((role) => role.name === userRole).length > + 0 + ); + }; + + const [modalConfirmarCuradoriaOpen, toggleModalConfirmarCuradoria] = useState( + false + ); + const handleModalConfirmarCuradoria = (value) => { + toggleModalConfirmarCuradoria(value); + }; + const [reportCriteria, setReportCriteria] = useState([]); + const [justificativa, setJustificativa] = useState(""); + const [submissionAccepted, setSubmissionAccepted] = useState(""); + + const handleConfirm = (criteria, justification, accepted) => { + setReportCriteria(criteria); + setJustificativa(justification); + setSubmissionAccepted(accepted); + handleModalCuradoria(false); + handleModalConfirmarCuradoria(true); + }; + + const finalizeCuratorshipFlow = () => { + handleSnackbar(5); + handleModalConfirmarCuradoria(false); + const url = `/learning_objects/${id}`; + getRequest( + url, + (data) => { + setRecurso(data); + }, + (error) => { + handleSnackbar(7); + setErro(true); + } + ); + }; + + if (erro) + return <LearnObjectNotFound> + <Grid container direction='column' justify='center' alignItems='center' spacing={1}> + <Grid item> + <p className="not-found"> + O recurso não foi encontrado em nossa base de dados. + </p> + </Grid> + <Grid item> + <Link className="link" to={`/busca?page=0&results_per_page=12&order=review_average&query=*&search_class=LearningObject`}> + <Button + variant='contained' + className="back-button" + > + Voltar para a busca de recursos. + </Button> + </Link> + </Grid> + </Grid> + </LearnObjectNotFound> + else + return ( + <React.Fragment> + <Snackbar + open={snackbarOpen} + autoHideDuration={6000} + onClose={toggleSnackbar} + anchorOrigin={{ vertical: "top", horizontal: "right" }} + > + <Alert severity="info" + style={{ backgroundColor: "#00acc1" }}> + {snackbarText[snackbarIndex]} + </Alert> + </Snackbar> + <ModalAvaliarRecurso + open={modalCuradoriaOpen} + handleClose={() => { + handleModalCuradoria(false); + }} + title={recurso.name} + confirm={handleConfirm} + setCriteria={setReportCriteria} + /> + <ModalConfirmarCuradoria + aceito={submissionAccepted} + reportCriteria={reportCriteria} + justificativa={justificativa} + open={modalConfirmarCuradoriaOpen} + handleClose={() => { + handleModalConfirmarCuradoria(false); + }} + cancel={() => { + handleModalCuradoria(true); + }} + recursoId={recurso.submission_id} + finalizeCuratorshipFlow={finalizeCuratorshipFlow} + handleErrorAprove={() => { + handleSnackbar(6) + }} + /> + <Background> + {carregando ? ( + <LoadingSpinner text={"Carregando Recurso"} /> + ) : ( + <> + <Grid container spacing={2}> + {recurso.object_type === "Vídeo" && !recurso.link ? ( + <Grid item xs={12}> + <Card> + <VideoPlayer + link={recurso.link} + urlVerified={false} + videoUrl={recurso.default_attachment_location} + videoType={recurso.default_mime_type} + /> + </Card> + </Grid> + ) : ( + urlVerify(recurso.link) && ( + <Grid item xs={12}> + <Card> + <VideoPlayer link={recurso.link} urlVerified={true} /> + </Card> + </Grid> + ) + )} + + <Grid item xs={12}> + <Card> + <div> + {recurso.thumbnail && ( + <img alt="" src={apiDomain + recurso.thumbnail} /> )} - <Grid item xs={12}> - <Card contrast={state.contrast}> - <div> - {recurso.thumbnail && ( - <img alt="recurso" src={apiDomain + recurso.thumbnail} /> - )} - - <TextoObjeto - contrast={state.contrast} - name={recurso.name} - rating={recurso.review_average} - recursoId={id} - likesCount={recurso.likes_count} - likedBool={recurso.liked} - objType={recurso.object_type} - subjects={recurso.subjects} - educationalStages={recurso.educational_stages} - viewCount={recurso.views_count} - downloadCount={recurso.downloads_count} - id={recurso.publisher ? recurso.publisher.id : undefined} - stateRecurso={recurso.state} - attachments={recurso.attachments} - audioUrl={recurso.default_attachment_location} - /> - </div> - - <Footer - contrast={state.contrast} - recursoId={id} - downloadableLink={recurso.default_attachment_location} - handleSnackbar={handleSnackbar} - link={recurso.link} - title={recurso.name} - thumb={recurso.thumbnail} - currPageLink={window.location.href} - complained={recurso.complained} - /> - </Card> - </Grid> - - <Grid item xs={12}> - <Card contrast={state.contrast}> - {/*todo: change render method on additional item info*/} - <Sobre - avatar={ - recurso.publisher - ? recurso.publisher.avatar - ? apiDomain + recurso.publisher.avatar - : noAvatar - : noAvatar - } - publisher={ - recurso.publisher ? recurso.publisher.name : undefined - } - id={recurso.publisher ? recurso.publisher.id : undefined} - description={recurso.description} - author={recurso.author} - tags={recurso.tags} - attachments={recurso.attachments} - language={recurso.language} - mimeType={recurso.default_mime_type} - createdAt={recurso.created_at} - updatedAt={recurso.updated_at} - license={recurso.license} - followed={recurso.publisher ? recurso.publisher.followed : undefined} - /> - </Card> - </Grid> - - {recurso.state !== "submitted" && ( - <Grid item xs={12}> - <Card contrast={state.contrast}> - {/*adicionar funcionalidade ao botao de entrar*/} - <CommentsArea - recursoId={id} - handleSnackbar={handleSnackbar} - objType={recurso.object_type} - recurso={true} - /> - </Card> - </Grid> - )} - </Grid> + <TextoObjeto + name={recurso.name} + rating={recurso.review_average} + recursoId={id} + likesCount={recurso.likes_count} + likedBool={recurso.liked} + objType={recurso.object_type} + subjects={recurso.subjects} + educationalStages={recurso.educational_stages} + viewCount={recurso.views_count} + downloadCount={recurso.downloads_count} + id={recurso.publisher ? recurso.publisher.id : undefined} + stateRecurso={recurso.state} + attachments={recurso.attachments} + audioUrl={recurso.default_attachment_location} + /> + </div> + + <Footer + recursoId={id} + downloadableLink={recurso.default_attachment_location} + handleSnackbar={handleSnackbar} + link={recurso.link} + title={recurso.name} + thumb={recurso.thumbnail} + currPageLink={window.location.href} + complained={recurso.complained} + /> + </Card> + </Grid> + + <Grid item xs={12}> + <Card> + {/*todo: change render method on additional item info*/} + <Sobre + avatar={ + recurso.publisher + ? recurso.publisher.avatar + ? apiDomain + recurso.publisher.avatar + : noAvatar + : noAvatar + } + publisher={ + recurso.publisher ? recurso.publisher.name : undefined + } + id={recurso.publisher ? recurso.publisher.id : undefined} + description={recurso.description} + author={recurso.author} + tags={recurso.tags} + attachments={recurso.attachments} + language={recurso.language} + mimeType={recurso.default_mime_type} + createdAt={recurso.created_at} + updatedAt={recurso.updated_at} + license={recurso.license} + followed={recurso.publisher ? recurso.publisher.followed : undefined} + /> + </Card> + </Grid> + + {recurso.state !== "submitted" && ( + <Grid item xs={12}> + <Card> + {/*adicionar funcionalidade ao botao de entrar*/} + <CommentsArea + recursoId={id} + handleSnackbar={handleSnackbar} + objType={recurso.object_type} + recurso={true} + /> + </Card> + </Grid> + )} + </Grid> - {recurso.state === "submitted" && checkAccessLevel("curator") && ( - <AppBar - position="fixed" - className={classes.appBar} - style={state.contrast === "" ? { backgroundColor: "white" } : { backgroundColor: "black", borderTop: "1px solid white" }} - > - <StyledAppBarContainer contrast={state.contrast}> - <div className="container"> - <div className="botoes"> - <ButtonAvaliarRecurso - contrast={state.contrast} - callback={() => { - handleModalCuradoria(true); - }} - /> - </div> - </div> - </StyledAppBarContainer> - </AppBar> - )} - </> + {recurso.state === "submitted" && checkAccessLevel("curator") && ( + <AppBar + position="fixed" + color="primary" + className={classes.appBar} + > + <StyledAppBarContainer> + <div className="container"> + <div className="botoes"> + <ButtonAvaliarRecurso + callback={() => { + handleModalCuradoria(true); + }} + /> + </div> + </div> + </StyledAppBarContainer> + </AppBar> )} - </Background> - </React.Fragment> + </> + )} + </Background> + </React.Fragment> ); } const useStyles = makeStyles((theme) => ({ - appBar: { - top: "auto", - bottom: 0, - height: "100px", - boxShadow: "0 1px 3px rgba(0,0,0,.52),0 1px 2px rgba(0,0,0,.24)", - }, + appBar: { + top: "auto", + bottom: 0, + height: "100px", + backgroundColor: "#fff", + boxShadow: "0 1px 3px rgba(0,0,0,.52),0 1px 2px rgba(0,0,0,.24)", + }, })); const StyledAppBarContainer = styled.div` @@ -361,7 +356,6 @@ const StyledAppBarContainer = styled.div` justify-content : flex-start margin-right : auto; margin-left : auto; - padding: 10px; @media screen and (min-width: 1200px) { width : 1170px; } @@ -381,66 +375,61 @@ const StyledAppBarContainer = styled.div` `; const Background = styled.div` - background-color: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; - color: #666; - font-family: "Roboto", sans serif; - padding-top: 30px; + background-color: #f4f4f4; + color: #666; + font-family: "Roboto", sans serif; + padding-top: 30px; `; const LearnObjectNotFound = styled.div` - padding: 1em; - background-color: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; - - .not-found{ - font-family: 'Roboto', sans-serif; - color: ${props => props.contrast === "" ? "#666" : "white"}; - font-weight: 500; - text-align: left; - padding: 0; - margin: 0; - } - - .back-button{ - background-color: ${props => props.contrast === "" ? "#ff7f00" : "black"}; - color: ${props => props.contrast === "" ? "whitesmoke" : "yellow"}; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - :hover{ - background-color: ${props => props.contrast === "" ? "" : "rgba(255,255,0,0.24)"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } - } + margin: 1em; + + .not-found{ + font-family: 'Roboto', sans-serif; + font-weight: 500; + text-align: left; + padding: 0; + margin: 0; + } + + .back-button{ + background-color: #ff7f00; + color: whitesmoke; + } + + .link{ + text-decoration: none; + } ` const Card = styled.div` - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); - border: ${props => props.contrast === "" ? "0" : "1px solid white"}; - margin-bottom: 30px; - margin-right: auto; - margin-left: auto; - display: flex; - flex-direction: column; - @media screen and (min-width: 1200px) { - width: 1170px; - } - @media screen and (min-width: 992px) and (max-width: 1199px) { - width: 970px; - } - @media screen and (min-width: 768px) and (max-width: 991px) { - width: 750px; - } - - img { - background-color: #e5e5e5; - height: 270px; - width: 400px; - float: left; - padding: 0; - object-fit: cover; - @media screen and (max-width: 768px) { - height: auto; - width: 100%; - } + background-color: #fff; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); + margin-bottom: 30px; + margin-right: auto; + margin-left: auto; + display: flex; + flex-direction: column; + @media screen and (min-width: 1200px) { + width: 1170px; + } + @media screen and (min-width: 992px) and (max-width: 1199px) { + width: 970px; + } + @media screen and (min-width: 768px) and (max-width: 991px) { + width: 750px; + } + + img { + background-color: #e5e5e5; + height: 270px; + width: 400px; + float: left; + padding: 0; + object-fit: cover; + @media screen and (max-width: 768px) { + height: auto; + width: 100%; } + } `; diff --git a/src/Pages/Search.js b/src/Pages/Search.js index cedd26122f5acd816dd39c1912c79f21b1ea0774..15628592193b74b9363dd9d4e139a6858230bd85 100644 --- a/src/Pages/Search.js +++ b/src/Pages/Search.js @@ -31,533 +31,522 @@ import { useHistory } from 'react-router-dom'; import SearchExpansionPanel from '../Components/SearchExpansionPanel/SearchExpansionPanel'; import FilterSummary from '../Components/SearchPageComponents/FilterSummary'; import { - filtersCurriculum, - filtersTypes, - filtersStages, - filtersLanguages, + filtersCurriculum, + filtersTypes, + filtersStages, + filtersLanguages, } from '../Components/SearchPageComponents/filters'; import Snackbar from '@material-ui/core/Snackbar'; import MuiAlert from '@material-ui/lab/Alert'; import { Store } from '../Store' function Alert(props) { - return <MuiAlert elevation={6} variant="filled" {...props} />; + return <MuiAlert elevation={6} variant="filled" {...props} />; } export default function Search() { - const history = useHistory(); - const { state } = useContext(Store) - - const [currOption, setCurrOption] = useState(''); - const [currOrder, serCurrOrder] = useState('review_average'); - const [currQuery, setCurrQuery] = useState(''); - const [currPage, setCurrPage] = useState(0); - const [currCurriculumValues, setCurrCurriculumValues] = useState(''); - const [currTypeOfResValues, setCurrTypeOfResValues] = useState(''); - const [currTeachingStageValues, setCurrTeachingStageValues] = useState(''); - const [currLanguagesValues, setCurrLanguagesValues] = useState(''); - const [currTag, setCurrTag] = useState(''); - const [isLoading, setIsLoading] = useState(false); - const [error, setError] = useState(false); - const [snackInfo, setSnackInfo] = useState({ - open: false, - text: "", - severity: "", - }); - - const [curriculumComponents, setCurriculumComponents] = useState([]); - const [typeOfResources, setTypeOfResources] = useState([]); - const [teachingStage, setTeachingStage] = useState([]); - const [languages, setLanguages] = useState([]); - const [tag, setTag] = useState(''); - - const [resourcesArray, setResourcesArray] = useState([]); - const [totalResources, setTotalResources] = useState(0); - - const [collectionsArray, setCollectionsArray] = useState([]) - const [totalCollections, setTotalCollections] = useState(0); - - const [usersArray, setUsersArray] = useState([]) - const [totalUsers, setTotalUsers] = useState(0); - - const options = [ - { value: 'Recursos', name: 'LearningObject', color: state.contrast === "" ? '#ff7f00' : "yellow" }, - { value: 'Coleções', name: 'Collection', color: state.contrast === "" ? '#673ab7' : "yellow" }, - { value: 'Usuários', name: 'User', color: state.contrast === "" ? '#00bcd4' : "yellow" }, - ]; - - const orders = [ - { value: 'Mais Estrelas', name: 'review_average', color: state.contrast === "" ? '#ff7f00' : "yellow" }, - { value: 'Mais Relevante', name: 'score', color: state.contrast === "" ? '#ff7f00' : "yellow" }, - { value: 'Mais Baixados', name: 'downloads', color: state.contrast === "" ? '#ff7f00' : "yellow" }, - { value: 'Mais Favoritados', name: 'likes', color: state.contrast === "" ? '#ff7f00' : "yellow" }, - { value: 'Mais Recentes', name: 'publicationdesc', color: state.contrast === "" ? '#ff7f00' : "yellow" }, - { value: 'Ordem Alfabética', name: 'title', color: state.contrast === "" ? '#ff7f00' : "yellow" }, - ]; - - function handleSnackInfo(info) { - setSnackInfo({ ...info }) + const history = useHistory(); + const { state } = useContext(Store) + + const [currOption, setCurrOption] = useState(''); + const [currOrder, serCurrOrder] = useState('review_average'); + const [currQuery, setCurrQuery] = useState(''); + const [currPage, setCurrPage] = useState(0); + const [currCurriculumValues, setCurrCurriculumValues] = useState(''); + const [currTypeOfResValues, setCurrTypeOfResValues] = useState(''); + const [currTeachingStageValues, setCurrTeachingStageValues] = useState(''); + const [currLanguagesValues, setCurrLanguagesValues] = useState(''); + const [currTag, setCurrTag] = useState(''); + const [isLoading, setIsLoading] = useState(false); + const [error, setError] = useState(false); + const [snackInfo, setSnackInfo] = useState({ + open: false, + text: "", + severity: "", + }); + + const [curriculumComponents, setCurriculumComponents] = useState([]); + const [typeOfResources, setTypeOfResources] = useState([]); + const [teachingStage, setTeachingStage] = useState([]); + const [languages, setLanguages] = useState([]); + const [tag, setTag] = useState(''); + + const [resourcesArray, setResourcesArray] = useState([]); + const [totalResources, setTotalResources] = useState(0); + + const [collectionsArray, setCollectionsArray] = useState([]) + const [totalCollections, setTotalCollections] = useState(0); + + const [usersArray, setUsersArray] = useState([]) + const [totalUsers, setTotalUsers] = useState(0); + + const options = [ + { value: 'Recursos', name: 'LearningObject', color: '#ff7f00' }, + { value: 'Coleções', name: 'Collection', color: '#673ab7' }, + { value: 'Usuários', name: 'User', color: '#00bcd4' }, + ]; + + const orders = [ + { value: 'Mais Estrelas', name: 'review_average' }, + { value: 'Mais Relevante', name: 'score' }, + { value: 'Mais Baixados', name: 'downloads' }, + { value: 'Mais Favoritados', name: 'likes' }, + { value: 'Mais Recentes', name: 'publicationdesc' }, + { value: 'Ordem Alfabética', name: 'title' }, + ]; + + function handleSnackInfo(info) { + setSnackInfo({ ...info }) + } + + function handleCloseSnack() { + const snackInfo = { + open: false, + text: "", + severity: "", + } + handleSnackInfo(snackInfo) + } + + function onButtonClicked() { + const curriculumValues = []; + const typeOfResourcesValues = []; + const teachingStageValues = []; + const languagesValues = []; + + for (let index = 0; index < curriculumComponents.length; index++) { + const element = curriculumComponents[index]; + if (element.isChecked) + curriculumValues.push(element.value); } - function handleCloseSnack() { - const snackInfo = { - open: false, - text: "", - severity: "", - } - handleSnackInfo(snackInfo) + for (let index = 0; index < typeOfResources.length; index++) { + const element = typeOfResources[index]; + if (element.isChecked) + typeOfResourcesValues.push(element.value); } - function onButtonClicked() { - const curriculumValues = []; - const typeOfResourcesValues = []; - const teachingStageValues = []; - const languagesValues = []; + for (let index = 0; index < teachingStage.length; index++) { + const element = teachingStage[index]; + if (element.isChecked) + teachingStageValues.push(element.value); + } - for (let index = 0; index < curriculumComponents.length; index++) { - const element = curriculumComponents[index]; - if (element.isChecked) - curriculumValues.push(element.value); - } + for (let index = 0; index < languages.length; index++) { + const element = languages[index]; + if (element.isChecked) + languagesValues.push(element.value); + } - for (let index = 0; index < typeOfResources.length; index++) { - const element = typeOfResources[index]; - if (element.isChecked) - typeOfResourcesValues.push(element.value); - } + let url = `/busca?page=0&results_per_page=12&query=${currQuery}&search_class=${currOption}` - for (let index = 0; index < teachingStage.length; index++) { - const element = teachingStage[index]; - if (element.isChecked) - teachingStageValues.push(element.value); + if (currOption !== 'User') { + url = url + `&order=${currOrder}` + if (currOption === 'LearningObject') { + if (curriculumValues.length >= 1) { + url = url + `&subjects=${curriculumValues}` } - - for (let index = 0; index < languages.length; index++) { - const element = languages[index]; - if (element.isChecked) - languagesValues.push(element.value); + if (typeOfResourcesValues.length >= 1) { + url = url + `&object_types=${typeOfResourcesValues}` } - - let url = `/busca?page=0&results_per_page=12&query=${currQuery}&search_class=${currOption}` - - if (currOption !== 'User') { - url = url + `&order=${currOrder}` - if (currOption === 'LearningObject') { - if (curriculumValues.length >= 1) { - url = url + `&subjects=${curriculumValues}` - } - if (typeOfResourcesValues.length >= 1) { - url = url + `&object_types=${typeOfResourcesValues}` - } - if (teachingStageValues.length >= 1) { - url = url + `&educational_stages=${teachingStageValues}` - } - if (languagesValues.length >= 1) { - url = url + `&languages=${languagesValues}` - } - if (tag && tag.length >= 1) - url = url + `&tags=${tag}` - } + if (teachingStageValues.length >= 1) { + url = url + `&educational_stages=${teachingStageValues}` + } + if (languagesValues.length >= 1) { + url = url + `&languages=${languagesValues}` } + if (tag && tag.length >= 1) + url = url + `&tags=${tag}` + } + } + + history.push(url); + } - history.push(url); + function resetFilters() { + for (let index = 0; index < filtersCurriculum.length; index++) { + if (filtersCurriculum[index].isChecked) + filtersCurriculum[index].isChecked = false; + } + for (let index = 0; index < filtersLanguages.length; index++) { + if (filtersLanguages[index].isChecked) + filtersLanguages[index].isChecked = false; + } + for (let index = 0; index < filtersStages.length; index++) { + if (filtersStages[index].isChecked) + filtersStages[index].isChecked = false; + } + for (let index = 0; index < filtersTypes.length; index++) { + if (filtersTypes[index].isChecked) + filtersTypes[index].isChecked = false; } + setTag('') + } - function resetFilters() { - for (let index = 0; index < filtersCurriculum.length; index++) { - if (filtersCurriculum[index].isChecked) - filtersCurriculum[index].isChecked = false; + function handleChangeOption(e) { + const value = e.target.value; + let url; + + if (value !== 'User') + url = `/busca?page=0&results_per_page=12&order=review_average&query=*&search_class=${value}` + else + url = `/busca?page=0&results_per_page=12&query=*&search_class=${value}` + + resetFilters() + history.push(url); + } + + function handleChangeOrder(e) { + const value = e.target.value; + let url = `/busca?page=0&results_per_page=12&query=${currQuery}&search_class=${currOption}` + + if (currOption !== 'User') { + url = url + `&order=${value}` + if (currOption === 'LearningObject') { + if (currCurriculumValues) { + url = url + `&subjects=${currCurriculumValues}` } - for (let index = 0; index < filtersLanguages.length; index++) { - if (filtersLanguages[index].isChecked) - filtersLanguages[index].isChecked = false; + if (currTypeOfResValues) { + url = url + `&object_types=${currTypeOfResValues}` } - for (let index = 0; index < filtersStages.length; index++) { - if (filtersStages[index].isChecked) - filtersStages[index].isChecked = false; + if (currTeachingStageValues) { + url = url + `&educational_stages=${currTeachingStageValues}` } - for (let index = 0; index < filtersTypes.length; index++) { - if (filtersTypes[index].isChecked) - filtersTypes[index].isChecked = false; + if (currLanguagesValues) { + url = url + `&languages=${currLanguagesValues}` } - setTag('') + if (currTag) + url = url + `&tags=${currTag}` + } } - function handleChangeOption(e) { - const value = e.target.value; - let url; - - if (value !== 'User') - url = `/busca?page=0&results_per_page=12&order=review_average&query=${currQuery}&search_class=${value}` - else - url = `/busca?page=0&results_per_page=12&query=${currQuery}&search_class=${value}` + history.push(url); + } - resetFilters() - history.push(url); - } + function handleNextPage() { + const nextPage = currPage + 1; + let url = `/busca?page=${nextPage}&results_per_page=12&query=${currQuery}&search_class=${currOption}` - function handleChangeOrder(e) { - const value = e.target.value; - let url = `/busca?page=0&results_per_page=12&query=${currQuery}&search_class=${currOption}` - - if (currOption !== 'User') { - url = url + `&order=${value}` - if (currOption === 'LearningObject') { - if (currCurriculumValues) { - url = url + `&subjects=${currCurriculumValues}` - } - if (currTypeOfResValues) { - url = url + `&object_types=${currTypeOfResValues}` - } - if (currTeachingStageValues) { - url = url + `&educational_stages=${currTeachingStageValues}` - } - if (currLanguagesValues) { - url = url + `&languages=${currLanguagesValues}` - } - if (currTag) - url = url + `&tags=${currTag}` - } + if (currOption !== 'User') { + url = url + `&order=${currOrder}` + if (currOption === 'LearningObject') { + if (currCurriculumValues) { + url = url + `&subjects=${currCurriculumValues}` } - - history.push(url); - } - - function handleNextPage() { - const nextPage = currPage + 1; - let url = `/busca?page=${nextPage}&results_per_page=12&query=${currQuery}&search_class=${currOption}` - - if (currOption !== 'User') { - url = url + `&order=${currOrder}` - if (currOption === 'LearningObject') { - if (currCurriculumValues) { - url = url + `&subjects=${currCurriculumValues}` - } - if (currTypeOfResValues) { - url = url + `&object_types=${currTypeOfResValues}` - } - if (currTeachingStageValues) { - url = url + `&educational_stages=${currTeachingStageValues}` - } - if (currLanguagesValues) { - url = url + `&languages=${currLanguagesValues}` - } - if (currTag) - url = url + `&tags=${currTag}` - } + if (currTypeOfResValues) { + url = url + `&object_types=${currTypeOfResValues}` } - history.push(url); - } - - function handlePreviousPage() { - const previousPage = currPage - 1; - let url = `/busca?page=${previousPage}&results_per_page=12&query=${currQuery}&search_class=${currOption}` - - if (currOption !== 'User') { - url = url + `&order=${currOrder}` - if (currOption === 'LearningObject') { - if (currCurriculumValues) { - url = url + `&subjects=${currCurriculumValues}` - } - if (currTypeOfResValues) { - url = url + `&object_types=${currTypeOfResValues}` - } - if (currTeachingStageValues) { - url = url + `&educational_stages=${currTeachingStageValues}` - } - if (currLanguagesValues) { - url = url + `&languages=${currLanguagesValues}` - } - if (currTag) - url = url + `&tags=${currTag}` - } + if (currTeachingStageValues) { + url = url + `&educational_stages=${currTeachingStageValues}` } - history.push(url); + if (currLanguagesValues) { + url = url + `&languages=${currLanguagesValues}` + } + if (currTag) + url = url + `&tags=${currTag}` + } } - - function handleSuccess(data, headers, option) { - if (option === 'LearningObject') { - setResourcesArray(data) - if (headers.has('X-Total-Count')) { - setTotalResources(headers.get('X-Total-Count')); - } + history.push(url); + } + + function handlePreviousPage() { + const previousPage = currPage - 1; + let url = `/busca?page=${previousPage}&results_per_page=12&query=${currQuery}&search_class=${currOption}` + + if (currOption !== 'User') { + url = url + `&order=${currOrder}` + if (currOption === 'LearningObject') { + if (currCurriculumValues) { + url = url + `&subjects=${currCurriculumValues}` } - else if (option === 'Collection') { - setCollectionsArray(data) - if (headers.has('X-Total-Count')) { - setTotalCollections(headers.get('X-Total-Count')); - } + if (currTypeOfResValues) { + url = url + `&object_types=${currTypeOfResValues}` } - else { - setUsersArray(data); - if (headers.has('X-Total-Count')) { - setTotalUsers(headers.get('X-Total-Count')); - } + if (currTeachingStageValues) { + url = url + `&educational_stages=${currTeachingStageValues}` + } + if (currLanguagesValues) { + url = url + `&languages=${currLanguagesValues}` } - setIsLoading(false); + if (currTag) + url = url + `&tags=${currTag}` + } } - - function handleFail() { - const snackInfo = { - open: true, - text: "Houve um erro ao carregar os dados!", - severity: "warning", + history.push(url); + } + + function handleSuccess(data, headers, option) { + if (option === 'LearningObject') { + setResourcesArray(data) + if (headers.has('X-Total-Count')) { + setTotalResources(headers.get('X-Total-Count')); + } + } + else if (option === 'Collection') { + setCollectionsArray(data) + if (headers.has('X-Total-Count')) { + setTotalCollections(headers.get('X-Total-Count')); + } + } + else { + setUsersArray(data); + if (headers.has('X-Total-Count')) { + setTotalUsers(headers.get('X-Total-Count')); + } + } + setIsLoading(false); + } + + function handleFail() { + const snackInfo = { + open: true, + text: "Houve um erro ao carregar os dados!", + severity: "warning", + } + handleSnackInfo(snackInfo) + setError(true); + setIsLoading(false); + } + + function handleSubjects(subjectsString) { + if (subjectsString) { + const selectedSubjects = subjectsString.split(','); + for (let i = 0; i < selectedSubjects.length; i++) { + const elementOfSelectedSubs = selectedSubjects[i]; + for (let j = 0; j < filtersCurriculum.length; j++) { + if (elementOfSelectedSubs === filtersCurriculum[j].value) + filtersCurriculum[j].isChecked = true; } - handleSnackInfo(snackInfo) - setError(true); - setIsLoading(false); + } } - - function handleSubjects(subjectsString) { - if (subjectsString) { - const selectedSubjects = subjectsString.split(','); - for (let i = 0; i < selectedSubjects.length; i++) { - const elementOfSelectedSubs = selectedSubjects[i]; - for (let j = 0; j < filtersCurriculum.length; j++) { - if (elementOfSelectedSubs === filtersCurriculum[j].value) - filtersCurriculum[j].isChecked = true; - } - } + setCurriculumComponents(filtersCurriculum); + } + + function handleObjectTypes(objectTypesString) { + if (objectTypesString) { + const selectedObjectTypes = objectTypesString.split(','); + for (let i = 0; i < selectedObjectTypes.length; i++) { + const elementOfSelectedObjectTypes = selectedObjectTypes[i]; + for (let j = 0; j < filtersTypes.length; j++) { + if (elementOfSelectedObjectTypes === filtersTypes[j].value) + filtersTypes[j].isChecked = true; } - setCurriculumComponents(filtersCurriculum); + } } - - function handleObjectTypes(objectTypesString) { - if (objectTypesString) { - const selectedObjectTypes = objectTypesString.split(','); - for (let i = 0; i < selectedObjectTypes.length; i++) { - const elementOfSelectedObjectTypes = selectedObjectTypes[i]; - for (let j = 0; j < filtersTypes.length; j++) { - if (elementOfSelectedObjectTypes === filtersTypes[j].value) - filtersTypes[j].isChecked = true; - } - } + setTypeOfResources(filtersTypes); + } + + function handleLanguages(languagesString) { + if (languagesString) { + const selectedLanguages = languagesString.split(','); + + for (let i = 0; i < selectedLanguages.length; i++) { + const elementOfSelectedLanguages = selectedLanguages[i]; + for (let j = 0; j < filtersLanguages.length; j++) { + if (elementOfSelectedLanguages === filtersLanguages[j].value) + filtersLanguages[j].isChecked = true; } - setTypeOfResources(filtersTypes); + } } - - function handleLanguages(languagesString) { - if (languagesString) { - const selectedLanguages = languagesString.split(','); - - for (let i = 0; i < selectedLanguages.length; i++) { - const elementOfSelectedLanguages = selectedLanguages[i]; - for (let j = 0; j < filtersLanguages.length; j++) { - if (elementOfSelectedLanguages === filtersLanguages[j].value) - filtersLanguages[j].isChecked = true; - } - } + setLanguages(filtersLanguages); + } + + function handleStages(stagesString) { + if (stagesString) { + const selectedStages = stagesString.split(','); + + for (let i = 0; i < selectedStages.length; i++) { + const elementOfSelectedStages = selectedStages[i]; + for (let j = 0; j < filtersStages.length; j++) { + if (elementOfSelectedStages === filtersStages[j].value) + filtersStages[j].isChecked = true; } - setLanguages(filtersLanguages); + } } - - function handleStages(stagesString) { - if (stagesString) { - const selectedStages = stagesString.split(','); - - for (let i = 0; i < selectedStages.length; i++) { - const elementOfSelectedStages = selectedStages[i]; - for (let j = 0; j < filtersStages.length; j++) { - if (elementOfSelectedStages === filtersStages[j].value) - filtersStages[j].isChecked = true; - } - } + setTeachingStage(filtersStages); + } + + useEffect(() => { + setIsLoading(true) + + const urlParams = new URLSearchParams(window.location.search); + const query = urlParams.get("query"); + const searchClass = urlParams.get("search_class"); + const page = parseInt(urlParams.get("page")); + const order = urlParams.get("order"); + const subjects = urlParams.get("subjects"); + const objectTypes = urlParams.get("object_types"); + const educationalStages = urlParams.get("educational_stages"); + const languages = urlParams.get("languages"); + const tags = urlParams.get("tags"); + + setCurrOption(searchClass); + setCurrQuery(query); + setCurrPage(page); + serCurrOrder(order); + setCurrCurriculumValues(subjects); + setCurrLanguagesValues(languages); + setCurrTeachingStageValues(educationalStages); + setCurrTypeOfResValues(objectTypes); + setCurrTag(tags); + setTag(tags); + + handleSubjects(subjects); + handleObjectTypes(objectTypes); + handleStages(educationalStages); + handleLanguages(languages); + + let url = `/search?page=${page}&results_per_page=12&query=${query}&search_class=${searchClass}` + + if (searchClass !== 'User') { + url = url + `&order=${order}` + if (searchClass === 'LearningObject') { + if (subjects) { + url = url + `&subjects[]=${subjects}` + } + if (objectTypes) { + url = url + `&object_types[]=${objectTypes}` + } + if (educationalStages) { + url = url + `&educational_stages[]=${educationalStages}` } - setTeachingStage(filtersStages); + if (languages) { + url = url + `&languages[]=${languages}` + } + if (tags) + url = url + `&tags[]=${tags}` + } } - useEffect(() => { - setIsLoading(true) - - const urlParams = new URLSearchParams(window.location.search); - const query = urlParams.get("query"); - const searchClass = urlParams.get("search_class"); - const page = parseInt(urlParams.get("page")); - const order = urlParams.get("order"); - const subjects = urlParams.get("subjects"); - const objectTypes = urlParams.get("object_types"); - const educationalStages = urlParams.get("educational_stages"); - const languages = urlParams.get("languages"); - const tags = urlParams.get("tags"); - - setCurrOption(searchClass); - setCurrQuery(query); - setCurrPage(page); - serCurrOrder(order); - setCurrCurriculumValues(subjects); - setCurrLanguagesValues(languages); - setCurrTeachingStageValues(educationalStages); - setCurrTypeOfResValues(objectTypes); - setCurrTag(tags); - setTag(tags); - - handleSubjects(subjects); - handleObjectTypes(objectTypes); - handleStages(educationalStages); - handleLanguages(languages); - - let url = `/search?page=${page}&results_per_page=12&query=${query}&search_class=${searchClass}` - - if (searchClass !== 'User') { - url = url + `&order=${order}` - if (searchClass === 'LearningObject') { - if (subjects) { - url = url + `&subjects[]=${subjects}` - } - if (objectTypes) { - url = url + `&object_types[]=${objectTypes}` - } - if (educationalStages) { - url = url + `&educational_stages[]=${educationalStages}` - } - if (languages) { - url = url + `&languages[]=${languages}` - } - if (tags) - url = url + `&tags[]=${tags}` + getRequest( + url, + (data, headers) => { handleSuccess(data, headers, searchClass) }, + handleFail, + ); + + }, [window.history.state === null ? true : window.history.state.key, state.currentUser.id]) + + if (error) + return ( + <MainPageError> + <Snackbar + open={snackInfo.open} + autoHideDuration={6000} + onClose={handleCloseSnack} + anchorOrigin={{ vertical: 'top', horizontal: 'right' }} + > + <Alert onClose={handleCloseSnack} severity={snackInfo.severity}> + {snackInfo.text} + </Alert> + </Snackbar> + <Error /> + </MainPageError> + ) + else + return ( + <MainPage> + <Snackbar + open={snackInfo.open} + autoHideDuration={6000} + onClose={handleCloseSnack} + anchorOrigin={{ vertical: 'top', horizontal: 'right' }} + > + <Alert onClose={handleCloseSnack} severity={snackInfo.severity}> + {snackInfo.text} + </Alert> + </Snackbar> + <StyledBreadCrumbs> + <Link to='/'>Página Inicial</Link> + <span>Busca</span> + </StyledBreadCrumbs> + <HeaderFilters + options={options} + orders={orders} + currOption={currOption} + currOrder={currOrder} + handleChangeOption={handleChangeOption} + handleChangeOrder={handleChangeOrder} + /> + { + currOption === 'LearningObject' && + <Fragment> + <SearchExpansionPanel + setTag={(tag) => setTag(tag)} + curriculumComponents={curriculumComponents} + setCurriculum={(array) => { setCurriculumComponents(array) }} + typeOfResources={typeOfResources} + setTypeRes={(array) => { setTypeOfResources(array) }} + teachingStage={teachingStage} + setTeachingStage={(array) => { setTeachingStage(array) }} + languages={languages} + setLanguages={(array) => { setLanguages(array) }} + /> + { + <FilterSummary + curriculumComponents={curriculumComponents} + typeOfResources={typeOfResources} + languages={languages} + teachingStage={teachingStage} + tag={tag} + onButtonClicked={onButtonClicked} + /> } + <ResourceTemplate + handleNextPage={handleNextPage} + handlePreviousPage={handlePreviousPage} + isLoading={isLoading} + currPage={currPage} + resources={resourcesArray} + totalResources={totalResources} + /> + </Fragment> } - - getRequest( - url, - (data, headers) => { handleSuccess(data, headers, searchClass) }, - handleFail, - ); - - }, [window.history.state === null ? true : window.history.state.key, state.currentUser.id]) - - if (error) - return ( - <div style={state.contrast === "" ? {} : { backgroundColor: "black" }}> - <MainPageError> - <Snackbar - open={snackInfo.open} - autoHideDuration={6000} - onClose={handleCloseSnack} - anchorOrigin={{ vertical: 'top', horizontal: 'right' }} - > - <Alert onClose={handleCloseSnack} severity={snackInfo.severity}> - {snackInfo.text} - </Alert> - </Snackbar> - <Error contrast={state.contrast} /> - </MainPageError> - </div> - ) - else - return ( - <div style={state.contrast === "" ? {} : { backgroundColor: "black" }}> - <MainPage> - <Snackbar - open={snackInfo.open} - autoHideDuration={6000} - onClose={handleCloseSnack} - anchorOrigin={{ vertical: 'top', horizontal: 'right' }} - > - <Alert onClose={handleCloseSnack} severity={snackInfo.severity}> - {snackInfo.text} - </Alert> - </Snackbar> - <StyledBreadCrumbs contrast={state.contrast}> - <Link to='/'>Página Inicial</Link> - <span>Busca</span> - </StyledBreadCrumbs> - <HeaderFilters - contrast={state.contrast} - options={options} - orders={orders} - currOption={currOption} - currOrder={currOrder} - handleChangeOption={handleChangeOption} - handleChangeOrder={handleChangeOrder} - /> - { - currOption === 'LearningObject' && - <Fragment> - <SearchExpansionPanel - contrast={state.contrast} - setTag={(tag) => setTag(tag)} - curriculumComponents={curriculumComponents} - setCurriculum={(array) => { setCurriculumComponents(array) }} - typeOfResources={typeOfResources} - setTypeRes={(array) => { setTypeOfResources(array) }} - teachingStage={teachingStage} - setTeachingStage={(array) => { setTeachingStage(array) }} - languages={languages} - setLanguages={(array) => { setLanguages(array) }} - /> - { - <FilterSummary - contrast={state.contrast} - curriculumComponents={curriculumComponents} - typeOfResources={typeOfResources} - languages={languages} - teachingStage={teachingStage} - tag={tag} - onButtonClicked={onButtonClicked} - /> - } - <ResourceTemplate - contrast={state.contrast} - handleNextPage={handleNextPage} - handlePreviousPage={handlePreviousPage} - isLoading={isLoading} - currPage={currPage} - resources={resourcesArray} - totalResources={totalResources} - /> - </Fragment> - } - { - currOption === 'Collection' && - <CollectionTemplate - contrast={state.contrast} - handleNextPage={handleNextPage} - handlePreviousPage={handlePreviousPage} - isLoading={isLoading} - currPage={currPage} - resources={collectionsArray} - totalResources={totalCollections} - /> - } - { - currOption === 'User' && - <UserTemplate - contrast={state.contrast} - handleNextPage={handleNextPage} - handlePreviousPage={handlePreviousPage} - isLoading={isLoading} - currPage={currPage} - resources={usersArray} - totalResources={totalUsers} - /> - } - </MainPage> - </div> - ) + { + currOption === 'Collection' && + <CollectionTemplate + handleNextPage={handleNextPage} + handlePreviousPage={handlePreviousPage} + isLoading={isLoading} + currPage={currPage} + resources={collectionsArray} + totalResources={totalCollections} + /> + } + { + currOption === 'User' && + <UserTemplate + handleNextPage={handleNextPage} + handlePreviousPage={handlePreviousPage} + isLoading={isLoading} + currPage={currPage} + resources={usersArray} + totalResources={totalUsers} + /> + } + </MainPage> + ) } const MainPage = styled.div` - padding: 1em 0; - width: 90%; - margin: 0 auto; + width: 90%; + margin: 1em auto; ` -const MainPageError = styled.div` - width: 90%; - margin: 0 auto; - display: flex; - justify-content: center; - align-items: center; - padding: 1em; +const MainPageError = styled.div` + width: 90%; + margin: 1em auto; + display: flex; + justify-content: center; + align-items: center; + padding: 1em; ` const StyledBreadCrumbs = styled(Breadcrumbs)` - display: flex; - justify-content: flex-start; - span { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; - } - a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } + display: flex; + justify-content: flex-start; + span { + color: #a5a5a5; + } + a { + color: #00bcd4; + text-decoration: none; + } `; diff --git a/src/Pages/SummarizedUserTerms.js b/src/Pages/SummarizedUserTerms.js deleted file mode 100644 index 401530a44aa776c45537a9a59ad918b8dde6a562..0000000000000000000000000000000000000000 --- a/src/Pages/SummarizedUserTerms.js +++ /dev/null @@ -1,399 +0,0 @@ -/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre -Departamento de Informatica - Universidade Federal do Parana - -This file is part of Plataforma Integrada MEC. - -Plataforma Integrada MEC is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Plataforma Integrada MEC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -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, { useContext, useState } from 'react'; -import { Store } from '../Store' -import styled from 'styled-components'; -import Grid from '@material-ui/core/Grid'; -import Fab from '@material-ui/core/Fab'; -import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles'; - -import { StyledButton } from '../Components/ButtonAvaliarRecurso.js'; -import { BannerStyle } from './UserTerms'; - -/*Importação de imagens para o componente*/ -import Handshake from "../img/termos/handshake.svg" -import Pessoa from "../img/termos/Pessoa.svg" -import Email from "../img/termos/Email.svg" -import Seguranca from "../img/termos/Seguranca.svg" -import Like from "../img/termos/Like.svg"; -import Unlike from "../img/termos/Unlike.svg"; -import Line from "../img/termos/Line.svg"; - -import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward'; -import ArrowUpwardIcon from '@material-ui/icons/ArrowUpward'; -//Image Import -import { Aberto } from "ImportImages.js"; -import { Fechado } from "ImportImages.js"; - -const theme = createMuiTheme({ - palette: { - primary: { - light: 'orange', - main: 'orange', - dark: 'orange', - contrastText: '#fff', - }, - secondary: { - light: 'black', - main: 'black', - dark: 'black', - contrastText: 'yellow', - }, - }, - }); - - -export default function SummarizedUserTerms() { - const { state } = useContext(Store) - const [slide, updateSlide] = useState(0); - - const handleGoUp = () => { - if (slide > 1) { - var element = document.getElementById("slide" + (slide - 1).toString()); - if (element.offsetHeight < state.windowSize.height) element.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' }) - else element.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'center' }) - updateSlide(slide - 1); - } - } - - const handleGoDown = () => { - if (slide < 7) { - var element = document.getElementById("slide" + (slide + 1).toString()); - if (element.offsetHeight < state.windowSize.height) element.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' }) - else element.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'center' }) - updateSlide(slide + 1); - } - } - - return ( - <Content contrast={state.contrast}> - <link href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap" rel="stylesheet" /> - <BannerStyle contrast={state.contrast}> - <h2 style={{ width: "100%", textAlign: "center", marginTop: "0px", paddingTop: "6rem", marginBottom: "16px", fontSize: "52px", fontFamily: "'Pompiere', cursive", color: "#fff", fontWeight: "500" }}>RESUMO DOS TERMOS DE USO</h2> - <div style={{ display: "flex", justifyContent: "center" }}> - <StyledButton contrast={state.contrast} onClick={() => window.location.href='/termos'}> - Se preferir, veja a versão completa - </StyledButton> - </div> - </BannerStyle> - <FloatingButtons> - <ThemeProvider theme={theme}> - <Fab - color={state.contrast === "" ? "primary": "secondary"} - aria-label="slide superior" - onClick={handleGoUp} - style={state.contrast === "" ? {} : {border: "1px solid white"}} - > - <ArrowUpwardIcon/> - </Fab> - </ThemeProvider> - <ThemeProvider theme={theme}> - <Fab - color={state.contrast === "" ? "primary": "secondary"} - aria-label="slide inferior" - onClick={handleGoDown} - style={state.contrast === "" ? {} : {border: "1px solid white"}} - > - <ArrowDownwardIcon/> - </Fab> - </ThemeProvider> - </FloatingButtons> - <div className="slides"> - <div id="slide1" className="tmpl1"> - <div className="container"> - <Grid container> - <Grid item xs={12} md={8}> - <div className="box-text"> - <p>A Plataforma Integrada MEC RED é parte do Compromisso 6 do 3º Plano de Ação da Parceria para Governo Aberto (OGP-Brasil), que tem por objetivo “incorporar na política educacional o potencial da cultura digital, de modo a fomentar a autonomia para uso, reuso e adaptação de recursos educacionais digitais, valorizando a pluralidade e a diversidade da educação brasileira”.</p> - </div> - </Grid> - <Grid style={{ display: "flex", justifyContent: "center" }} item xs={12} md={4}> - <div className="box-image"> - <img src={Handshake} alt="handshake" /> - </div> - </Grid> - </Grid> - </div> - </div> - <div id="slide2" className="tmpl2"> - <div className="container"> - <div className="title"> - <p>O que é a Plataforma Integrada MEC RED e como ela está organizada?</p> - </div> - <Grid container> - <Grid className="box-text" item xs={12} md={6}> - <p>Uma plataforma interativa, colaborativa e criada em software livre, que disponibiliza conteúdos do acervo do MEC e indica conteúdos de parceiros com o objetivo de formar uma rede ativa de educadores interessados em usar, criar e compartilhar recursos educacionais digitais.</p> - </Grid> - <Grid className="box-text" item xs={12} md={6}> - <p><strong>Repositório</strong> de recursos educacionais digitais que permite aos usuários cadastrados a publicação de seus materiais e <strong>Referatório</strong> que aponta links para conteúdos em sites externos.</p> - </Grid> - </Grid> - </div> - </div> - <div id="slide3" className="tmpl3"> - <div className="container"> - <Grid className="title" container> - <Grid item xs={12}> - <p>Os recursos educacionais disponibilizados podem ser de dois tipos:</p> - </Grid> - </Grid> - <Grid container> - <Grid item xs={12} md={6}> - <div className="box-text"> - <img src={Aberto} alt="Aberto" /> - <p><strong>Abertos</strong>: recursos sem nenhuma restrição de acesso e<br /> com flexibilidade quanto ao uso ou reuso.</p> - </div> - <div className="box-text"> - <img src={Fechado} alt="Fechado" /> - <p><strong>Fechados</strong>: recursos com alguma restrição de acesso, uso<br /> ou reuso, como aqueles que, para acesso, há demanda de<br /> cadastro ou que têm licenças restritivas.</p> - </div> - </Grid> - <Grid item xs={12} md={6}> - <Grid item xs={12} md={12}> - <div className="box-text"> - <p>Como repositório, a Plataforma hospeda somente Recursos Educacionais Abertos (REA). Todo conteúdo inserido por usuários deve ser aberto.</p> - </div> - </Grid> - <Grid item xs={12} md={12}> - <div className="box-text"> - <p>Como referatório, a Plataforma aponta links para parceiros, e<br /> esses recursos podem ser abertos ou fechados.</p> - </div> - </Grid> - </Grid> - </Grid> - </div> - </div> - <div id="slide4" className="tmpl4"> - <div className="container"> - <Grid container> - <Grid item xs={12} md={6}> - <p className="title">Como se cadastrar?</p> - <div className="box-text"> - <p>Para criar uma conta, o usuário deverá clicar no botão “Cadastre-se” na página inicial da Plataforma e fazer um cadastro utilizando um endereço de e-mail e criando uma senha.</p> - </div> - </Grid> - <Grid item xs={4} md={2} style={{ alignSelf: "center" }}> <img style={{ width: "10vh", height: "10vh", verticalAlign: "middle", margin: "auto", display: "block" }} src={Pessoa} alt="Pessoa" /> </Grid> - <Grid item xs={4} md={2} style={{ alignSelf: "center" }}> <img style={{ width: "10vh", height: "10vh", verticalAlign: "middle", margin: "auto", display: "block" }} src={Email} alt="Email" /> </Grid> - <Grid item xs={4} md={2} style={{ alignSelf: "center" }}> <img style={{ width: "10vh", height: "10vh", verticalAlign: "middle", margin: "auto", display: "block" }} src={Seguranca} alt="Seguranca" /> </Grid> - </Grid> - </div> - </div> - <div id="slide5" className="tmpl5"> - <div className="container"> - <Grid container> - <Grid item xs={12} md={6}> - <div className="title"> - <img src={Like} alt="Like" /> - <p>O que publicar?</p> - </div> - <img src={Line} alt="Line" style={{margin: "auto", display: "block"}}/> - <div className="box-text"> - <p className="box-text">Conteúdos de cunho educacional e pertinentes ao assunto no qual estão inseridos, de autoria do usuário, de autoria coletiva (com consentimento dos demais autores) ou que estejam no domínio público. </p> - </div> - </Grid> - <Grid item xs={12} md={6}> - <div className="title"> - <img src={Unlike} alt="Unlike" /> - <p>O que não publicar?</p> - </div> - <img src={Line} alt="Line" style={{margin: "auto", display: "block"}}/> - <div className="box-text"> - <p className="box-text">Materiais ofensivos, pornográficos, relacionados a atividades ilegais, que invadam a privacidade de terceiros, que violem a legislação de Direito Autoral ou os Direitos Humanos. Propagandas, conteúdos com vírus, spam ou comentários abusivos.</p> - </div> - </Grid> - </Grid> - </div> - </div> - <div id="slide6" className="tmpl6"> - <div className="container"> - <Grid container> - <Grid item xs={12} md={7}> - <div className="title"> - <p>Direitos do autor e licenças de uso</p> - </div> - <div className="box-text"> - <p>Ao inserir um novo material de sua autoria no Repositório, o usuário deverá escolher um dos tipos de licença aberta disponíveis na Plataforma:</p> - </div> - <div className="box-text"> - <Grid container> - <Grid item xs={3} className="licenses"> - <p>CC-BY</p> - </Grid> - <Grid item xs={3} className="licenses"> - <p>CC-BY-SA</p> - </Grid> - <Grid item xs={3} className="licenses"> - <p>CC-BY-NC</p> - </Grid> - <Grid item xs={3} className="licenses"> - <p>CC-BY-NC-SA</p> - </Grid> - </Grid> - </div> - </Grid> - <Grid item xs={12} md={5}> - <Grid container> - <Grid item xs={12} md={2} className="licenses"> - <p>CC-BY</p> - </Grid> - <Grid item xs={12} md={10} className="box-text"> - <p> significa que o autor permite que distribuam, remixem, adaptem e criem a partir do seu trabalho, desde que lhe atribuam o devido crédito pela criação original</p> - </Grid> - </Grid> - <Grid container> - <Grid item xs={12} md={2} className="licenses"> - <p>NC</p> - </Grid> - <Grid item xs={12} md={10} className="box-text"> - <p> indica que as criações elaboradas a partir do trabalho do autor podem ser utilizadas somente para fins não comerciais (se não houver esta especificação, o novo recurso poderá ser utilizado para fins comerciais)</p> - </Grid> - </Grid> - <Grid container> - <Grid item xs={12} md={2} className="licenses"> - <p>SA</p> - </Grid> - <Grid item xs={12} md={10} className="box-text"> - <p> quer dizer que as novas criações devem ser licenciadas sob termos idênticos aos do trabalho original</p> - </Grid> - </Grid> - </Grid> - </Grid> - </div> - </div> - <div id="slide7" className="tmpl7"> - <div className="container"> - <Grid container xs={12}> - <Grid className="title" item xs={12} md={6}> - <p>Respeitamos a sua privacidade</p> - </Grid> - <Grid item xs={12} md={6}> - <Grid item xs={12} md={12} className="box-text"> - <p>Além de solicitar alguns dados pessoais para o cadastro, a Plataforma coleta, de forma automática, os dados não pessoais relativos à interação dos usuários no sistema. Esses dados nunca serão fornecidos para fins comerciais, assim como nunca serão compartilhados quaisquer dados pessoais que possam identificar o usuário.</p> - </Grid> - <Grid item xs={12} md={12} className="box-text"> - <p>Os dados anônimos poderão ser utilizados para fins de melhoria da plataforma, transparência e para o uso em pesquisas.</p> - </Grid> - </Grid> - </Grid> - <Grid container xs={12}> - <div className="title"> - <p>Dúvidas? Leia a <a href="/termos">versão completa dos termos de uso</a> ou fale conosco por meio do <a href="/contato">formulário de contato</a>.</p> - </div> - </Grid> - </div> - </div> - </div> - </Content> - ) -} - -const FloatingButtons = styled.div` - display: flex; - flex-direction: column; - position: fixed !important; - top: 50%; - -ms-transform: translateY(-50%); - transform: translateY(-50%); - right: 15px; - Fab { - margin: 15px; - } -` - -const Content = styled.div` - - color: white; - - text-align: left; - - p { - margin: 0; - } - - a { - text-decoration: ${props => props.contrast === "" ? "none" : "yellow underline"}; - color: ${props => props.contrast === "" ? "" : "yellow"}; - } - - .slides > div { - min-height: 500px; - display: flex; - align-items: center; - justify-content: center; - border: 1px solid ${props => props.contrast === "" ? "inherit" : "white"}; - border-radius: 20px; - margin: 25px; - } - - .box-text { - font-family: "Roboto", regular; - display: flex; - padding: 25px; - img { - width: 10vh; - height: 10vh; - vertical-align: middle; - } - font-size: 1.1em; - } - - .title { - font-family: "Pompiere", regular; - padding: 25px; - text-align: center; - font-size: 3em; - } - - .licenses { - text-align: center; - margin: auto; - } - - .box-image { - - } - - .tmpl1 { - background: ${props => props.contrast === "" ? "#00BCD4" : "black"}; - } - - .tmpl2 { - background: ${props => props.contrast === "" ? "#673AB7" : "black"}; - } - - .tmpl3 { - background: ${props => props.contrast === "" ? "#E81F4F" : "black"}; - } - - .tmpl4 { - background: ${props => props.contrast === "" ? "#FF7F00" : "black"}; - } - - .tmpl5 { - background: ${props => props.contrast === "" ? "#1AB9DE" : "black"}; - } - - .tmpl6 { - background: ${props => props.contrast === "" ? "#673AB7" : "black"}; - } - - .tmpl7 { - background: ${props => props.contrast === "" ? "#E81F4F" : "black"}; - } - -` \ No newline at end of file diff --git a/src/Pages/TabsHelp/TabManageAc.js b/src/Pages/TabsHelp/TabManageAc.js index dd9f12bcbc05dc219b1dde137c811b2b8d0f1318..6a2edde41fc01a942aae5f7b655a43ebd19ca420 100644 --- a/src/Pages/TabsHelp/TabManageAc.js +++ b/src/Pages/TabsHelp/TabManageAc.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, { useState, useEffect, useContext } from "react"; +import React, { useState, useEffect } from "react"; import styled from "styled-components"; import Tabs from "@material-ui/core/Tabs"; import Tab from "@material-ui/core/Tab"; @@ -31,242 +31,263 @@ import CardParticipando from "../../Components/HelpCenter/Cards/CardParticipando import CardEncontrando from "../../Components/HelpCenter/Cards/CardEncontrando"; import CardPublicando from "../../Components/HelpCenter/Cards/CardPublicando"; import { Link } from "react-router-dom"; -import { Store } from '../../Store'; //Image Import import { GerenciandoConta } from "ImportImages.js"; export default function TabManageAc(props) { - const { state } = useContext(Store); - const tabs = [ - "Por que me cadastrar?", - "Como fazer meu cadastro?", - "Como alterar minha senha?", - "Como acessar a conta?", - "Esqueci minha senha. O que fazer?", - "Gerenciando a Conta" - ]; - - const [tabValue, setTabValue] = useState(props.location.state === "undefined" ? 0 : props.location.state); - - const handleChangeTab = (e, newValue) => { - setTabValue(newValue); - }; - - useEffect(() => { window.scrollTo(0, 0) }, []) - - return ( - <div style={state.contrast === "" ? { backgroundColor: "#f4f4f4" } : { backgroundColor: "black" }}> - <link - href="https://fonts.googleapis.com/css?family=Pompiere|Roboto:500,400&display=swap" - rel="stylesheet" - /> - <Secao> - <BreadCrumbsDiv> - <StyledBreadCrumbs contrast={state.contrast}> - <Link to="/">Página Inicial</Link> - <Link to="ajuda">Ajuda</Link> - <span>{tabs[5]}</span> - </StyledBreadCrumbs> - </BreadCrumbsDiv> - <Grid container justify="center"> - <Grid item xs={12} md={10} > - <Principal contrast={state.contrast}> - <Menu contrast={state.contrast}> - <div className="fixo"> - <img src={GerenciandoConta} alt="Gerenciando a conta" /> - <span>{tabs[5]}</span> - </div> - <TabsStyled contrast={state.contrast} orientation="vertical" - variant="scrollable" - value={tabValue} - onChange={handleChangeTab} - TabIndicatorProps={{ style: { display: "none" } }} - > - <TabStyled contrast={state.contrast} label={tabs[0]}></TabStyled> - <TabStyled contrast={state.contrast} label={tabs[1]}></TabStyled> - <TabStyled contrast={state.contrast} label={tabs[2]}></TabStyled> - <TabStyled contrast={state.contrast} label={tabs[3]}></TabStyled> - <TabStyled contrast={state.contrast} label={tabs[4]}></TabStyled> - </TabsStyled> - <br/> - <div className="voltarInicio"> - <a href="ajuda">VOLTAR AO ÍNICIO</a> - </div> - </Menu> - {tabValue === 0 && <Why contrast={state.contrast} title={tabs[0]} />} - {tabValue === 1 && <HowToDo contrast={state.contrast} title={tabs[1]} />} - {tabValue === 2 && <HowToChange contrast={state.contrast} title={tabs[2]} />} - {tabValue === 3 && <HowToAccess contrast={state.contrast} title={tabs[3]} />} - {tabValue === 4 && <Forget contrast={state.contrast} title={tabs[4]} />} - <div className="resultadosProcura"> - <span>Não era bem o que você procurava?</span> - <div className="subtitulo"> - <span>Você pode navegar pelos tópicos de ajuda ou entrar em <a href="contato">Contato</a>.</span> - </div> - </div> - </Principal> - </Grid> - </Grid> - <Grid style={{ paddingBottom: "50px" }} container justify={"center"}> - <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardPublicando contrast={state.contrast} /> - </Grid> - <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardEncontrando contrast={state.contrast} /> - </Grid> - <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardParticipando contrast={state.contrast} /> - </Grid> - </Grid> - </Secao> - </div> - ); + const tabs = [ + "Por que me cadastrar?", + "Como fazer meu cadastro?", + "Como alterar minha senha?", + "Como acessar a conta?", + "Esqueci minha senha. O que fazer?", + "Gerenciando a Conta" + ]; + + const [tabValue, setTabValue] = useState(props.location.state === "undefined" ? 0 : props.location.state); + + const handleChangeTab = (e, newValue) => { + setTabValue(newValue); + }; + + useEffect(() => { window.scrollTo(0, 0) }, []) + + return ( + <div style={{ backgroundColor: "#f4f4f4" }}> + <link + href="https://fonts.googleapis.com/css?family=Pompiere|Roboto:500,400&display=swap" + rel="stylesheet" + /> + + <Secao> + <BreadCrumbsDiv> + <StyledBreadCrumbs> + <Link to="/">Página Inicial</Link> + <Link to="ajuda">Ajuda</Link> + + <span>{tabs[5]}</span> + </StyledBreadCrumbs> + </BreadCrumbsDiv> + <Grid container justify="center"> + <Grid item xs={12} md={10} > + <Principal> + <Menu> + <div className="fixo"> + <img src={GerenciandoConta} alt="Gerenciando a conta" /> + <span>{tabs[5]}</span> + </div> + <TabsStyled orientation="vertical" + variant="scrollable" + value={tabValue} + onChange={handleChangeTab} + TabIndicatorProps={{ style: { display: "none" } }} + > + <TabStyled label={tabs[0]}></TabStyled> + <TabStyled label={tabs[1]}></TabStyled> + <TabStyled label={tabs[2]}></TabStyled> + <TabStyled label={tabs[3]}></TabStyled> + <TabStyled label={tabs[4]}></TabStyled> + </TabsStyled> + <br /> + <div className="voltarInicio"> + <a href="ajuda">VOLTAR AO ÍNICIO</a> + </div> + </Menu> + + {tabValue === 0 && <Why title={tabs[0]} />} + {tabValue === 1 && <HowToDo title={tabs[1]} />} + {tabValue === 2 && <HowToChange title={tabs[2]} />} + {tabValue === 3 && <HowToAccess title={tabs[3]} />} + {tabValue === 4 && <Forget title={tabs[4]} />} + <div className="resultadosProcura"> + <span>Não era bem o que você procurava?</span> + <div className="subtitulo"> + <span>Você pode navegar pelos tópicos de ajuda ou entrar em <a href="contato">Contato</a>.</span> + </div> + </div> + + </Principal> + </Grid> + </Grid> + + + <Grid style={{ marginBottom: "50px" }} container justify={"center"}> + <Grid item xs={12} md={3} style={{ margin: 5 }}> + <CardPublicando /> + </Grid> + <Grid item xs={12} md={3} style={{ margin: 5 }}> + <CardEncontrando /> + </Grid> + <Grid item xs={12} md={3} style={{ margin: 5 }}> + <CardParticipando /> + </Grid> + </Grid> + </Secao> + </div> + ); } const StyledBreadCrumbs = styled(Breadcrumbs)` - display : flex; - justify-content : flex-start; - span { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; - } - a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } + display : flex; + justify-content : flex-start; + span { + color : #a5a5a5; + } + a { + color: #00bcd4; + text-decoration: none; + } + ` const BreadCrumbsDiv = styled.div` - padding : 10px; - display : flex; + + padding : 10px; + display : flex; ` const Principal = styled.div` - .fixo { - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - height: 40px; - text-align: center; - padding: 30px; - margin-bottom: 30px; - - img { - height: 50px; - width: 50px; - margin-right: 40px; - vertical-align: middle; - } - - span { - font-size: 20px; - color: ${props => props.contrast === "" ? "" : "white"}; - } + .fixo { + + height: 40px; + text-align: center; + background-color: #fff; + padding: 30px; + margin-bottom: 30px; + color: #666; + + + img { + height: 50px; + width: 50px; + margin-right: 40px; + vertical-align: middle; + } - .resultadosProcura { - text-align: center; - margin-block: 30px; - padding-inline: 15px; - color: ${props => props.contrast === "" ? "#666" : "white"}; - span { - font-size: 24px; - } - .subtitulo { - margin-top: 10px; - - span { - font-size: 15px - } - - a { - font-size: 15px; - padding: 0; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } - } + span { + font-size: 20px; + vertical-align: ; } -` -const TabsStyled = styled(Tabs)` - color: ${props => props.contrast === "" ? "" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - .Mui-selected { - background-color: ${props => props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)"}; + + + } + .resultadosProcura { + text-align: center; + margin-block: 30px; + padding-inline: 15px; + color: #666; + span { + font-size: 24px; } + .subtitulo { + margin-top: 10px; + + span { + font-size: 15px + } + + a { + font-size: 15px; + padding: 0; + color:#00bcd4; + text-decoration: none; + } - .MuiTab-root{ - text-transform: none !important; - max-width:100% } - text-align: center; - width:100%; + } + +` + +const TabsStyled = styled(Tabs)` + + .Mui-selected { + background-color: #e7e4e4; + } + + .MuiTab-root{ + text-transform: none !important; + max-width:100% + } + text-align: center; + width:100% + ` const TabStyled = styled(Tab)` - color: ${props => props.contrast === "" ? "" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - padding: 4px 15px !important; - font-weight: 500; - font-size: 14px !important; - border-radius: 4px !important; - text-align: center; + + padding: 4px 15px !important; + font-weight: 500; + font-size: 14px !important; + border-radius: 4px !important; + text-align: center; - &:hover { - background-color: ${props => props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)"}; - } + + + + + &:hover { + background-color: #e7e4e4; + } ` const Menu = styled.div` - width: auto; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - padding-block: 10px; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; - margin-bottom:30px - - h4 { - padding-inline: 15px; - font-size: 18px; - margin-block: 10px; - font-weight: 500; - line-height: 1.1; - } + width: auto; + background-color: #fff; + color: #666; + padding-block: 10px; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + margin-bottom:30px + + + h4 { + padding-inline: 15px; + font-size: 18px; + margin-block: 10px; + font-weight: 500; + line-height: 1.1; + } - .voltarInicio { - padding: 4px 15px; - font-size: 15px; - text-align: center; - a { - font-size: 15px; - padding: 0; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } + .voltarInicio { + padding: 4px 15px; + font-size: 15px; + text-align: center; + a { + font-size: 15px; + padding: 0; + color:#00bcd4; + text-decoration: none; } + } + + hr { + border: 0; + border-top: 1px solid #ccc; + margin-top: 20px; + margin-bottom: 20px; + } + + .procurava { + padding: 4px 15px; + font-size: 15px; + text-align: center; - hr { - border: 0; - border-top: 1px solid #ccc; - margin-top: 20px; - margin-bottom: 20px; + a { + font-size: 15px; + padding: 0; + color:#00bcd4; + text-decoration: none; } - .procurava { - padding: 4px 15px; - font-size: 15px; - text-align: center; - - a { - font-size: 15px; - padding: 0; - color:#00bcd4; - text-decoration: none; - } - } + } + ` const Secao = styled.div` - margin-inline: auto; + margin-inline: auto; + ` diff --git a/src/Pages/TabsHelp/TabNetPart.js b/src/Pages/TabsHelp/TabNetPart.js index 1eea7cfe8badecc23c43906016be5858f8c6c0d2..13c13d8c212b6057b92c2dc6181afb1853d68c7e 100644 --- a/src/Pages/TabsHelp/TabNetPart.js +++ b/src/Pages/TabsHelp/TabNetPart.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, { useState, useEffect, useContext } from 'react'; +import React, { useState, useEffect } from 'react'; import styled from 'styled-components'; import Tabs from '@material-ui/core/Tabs' import Tab from '@material-ui/core/Tab'; @@ -28,12 +28,10 @@ import CardEncontrando from '../../Components/HelpCenter/Cards/CardEncontrando'; import CardPublicando from '../../Components/HelpCenter/Cards/CardPublicando'; import CardGerenciando from '../../Components/HelpCenter/Cards/CardGerenciando'; import { Link } from 'react-router-dom'; -import { Store } from '../../Store'; //Image Import import { ParticipandoRede } from "ImportImages.js"; - export default function TabNetPart(props) { const tabs = [ 'Como comentar ou avaliar um recurso?', @@ -41,7 +39,6 @@ export default function TabNetPart(props) { 'Participando da Rede' ] - const { state } = useContext(Store); const [tabValue, setTabValue] = useState(props.location.state === "undefined" ? 0 : props.location.state); const handleChangeTab = (e, newValue) => { @@ -51,12 +48,12 @@ export default function TabNetPart(props) { useEffect(() => { window.scrollTo(0, 0) }, []) return ( - <div style={state.contrast === "" ? { backgroundColor: "#f4f4f4" } : { backgroundColor: "black" }}> + <div style={{ backgroundColor: "#f4f4f4" }}> <link href="https://fonts.googleapis.com/css?family=Pompiere|Roboto:500,400&display=swap" rel="stylesheet" /> <Secao> <BreadCrumbsDiv> - <StyledBreadCrumbs contrast={state.contrast}> + <StyledBreadCrumbs> <Link to="/" > Página Inicial </Link> @@ -74,22 +71,20 @@ export default function TabNetPart(props) { </BreadCrumbsDiv> <Grid container justify="center"> <Grid item xs={12} md={10} > - <Principal contrast={state.contrast}> - <Menu contrast={state.contrast}> + <Principal> + <Menu> <div className="fixo"> <img src={ParticipandoRede} alt="Participando da Rede" /> <span>{tabs[2]}</span> </div> - <TabsStyled - contrast={state.contrast} - orientation="vertical" + <TabsStyled orientation="vertical" variant="scrollable" value={tabValue} onChange={handleChangeTab} TabIndicatorProps={{ style: { display: "none" } }} > - <TabStyled contrast={state.contrast} label={tabs[0]}></TabStyled> - <TabStyled contrast={state.contrast} label={tabs[1]}></TabStyled> + <TabStyled label={tabs[0]}></TabStyled> + <TabStyled label={tabs[1]}></TabStyled> </TabsStyled> <br /> <div className="voltarInicio"> @@ -97,8 +92,8 @@ export default function TabNetPart(props) { </div> </Menu> - {tabValue === 0 && <How contrast={state.contrast} title={tabs[0]} />} - {tabValue === 1 && <What contrast={state.contrast} title={tabs[1]} />} + {tabValue === 0 && <How title={tabs[0]} />} + {tabValue === 1 && <What title={tabs[1]} />} <div className="resultadosProcura"> <span>Não era bem o que você procurava?</span> <div className="subtitulo"> @@ -113,13 +108,13 @@ export default function TabNetPart(props) { <Grid style={{ paddingBottom: "50px" }} container justify={"center"}> <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardPublicando contrast={state.contrast} /> + <CardPublicando /> </Grid> <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardEncontrando contrast={state.contrast} /> + <CardEncontrando /> </Grid> <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardGerenciando contrast={state.contrast} /> + <CardGerenciando /> </Grid> </Grid> @@ -128,18 +123,19 @@ export default function TabNetPart(props) { </div> ); } - const StyledBreadCrumbs = styled(Breadcrumbs)` display : flex; justify-content : flex-start; span { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; + color : #a5a5a5; } a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color: #00bcd4; + text-decoration: none; } + ` + const BreadCrumbsDiv = styled.div` padding : 10px; @@ -149,11 +145,14 @@ const BreadCrumbsDiv = styled.div` const Principal = styled.div` .fixo { - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; + height: 40px; text-align: center; + background-color: #fff; padding: 30px; margin-bottom: 30px; + color: #666; + img { height: 50px; @@ -165,7 +164,7 @@ const Principal = styled.div` span { font-size: 20px; - color: ${props => props.contrast === "" ? "" : "white"}; + vertical-align: ; } @@ -175,7 +174,7 @@ const Principal = styled.div` text-align: center; margin-block: 30px; padding-inline: 15px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 24px; } @@ -189,8 +188,8 @@ const Principal = styled.div` a { font-size: 15px; padding: 0; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color:#00bcd4; + text-decoration: none; } } @@ -199,10 +198,9 @@ const Principal = styled.div` ` const TabsStyled = styled(Tabs)` - color: ${props => props.contrast === "" ? "" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + .Mui-selected { - background-color: ${props => props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)"}; + background-color: #e7e4e4; } .MuiTab-root{ @@ -215,26 +213,29 @@ const TabsStyled = styled(Tabs)` ` const TabStyled = styled(Tab)` - color: ${props => props.contrast === "" ? "" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + padding: 4px 15px !important; font-weight: 500; font-size: 14px !important; border-radius: 4px !important; text-align: center; + + + + &:hover { - background-color: ${props => props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)"}; + background-color: #e7e4e4; } ` const Menu = styled.div` width: auto; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; + background-color: #fff; + color: #666; padding-block: 10px; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); margin-bottom:30px @@ -253,8 +254,8 @@ const Menu = styled.div` a { font-size: 15px; padding: 0; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color:#00bcd4; + text-decoration: none; } } @@ -281,8 +282,7 @@ const Menu = styled.div` ` - const Secao = styled.div` margin-inline: auto; -` \ No newline at end of file +` diff --git a/src/Pages/TabsHelp/TabPlataformaMEC.js b/src/Pages/TabsHelp/TabPlataformaMEC.js index ad0bb152b2cc0b480a06d09baf5cfd9a7176ce17..c704d98fed23e0a02df21be202f1233284067c9e 100644 --- a/src/Pages/TabsHelp/TabPlataformaMEC.js +++ b/src/Pages/TabsHelp/TabPlataformaMEC.js @@ -16,8 +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, useContext } from 'react'; +import React, { useState } from 'react'; import styled from 'styled-components'; +import Tabs from '@material-ui/core/Tabs' +import Tab from '@material-ui/core/Tab'; import Breadcrumbs from '@material-ui/core/Breadcrumbs'; import Grid from '@material-ui/core/Grid'; import CardEncontrando from '../../Components/HelpCenter/Cards/CardEncontrando'; @@ -29,213 +31,248 @@ import Which from '../../Components/HelpCenter/TabsPlataformaMEC/Which'; import Types from '../../Components/HelpCenter/TabsPlataformaMEC/Types'; import Software from '../../Components/HelpCenter/TabsPlataformaMEC/Software'; import How from '../../Components/HelpCenter/TabsPlataformaMEC/How'; -import { Link } from 'react-router-dom'; -import { Store } from '../../Store'; +import { Link } from 'react-router-dom'; -export default function TabPlataformaMEC(props) { - const { state } = useContext(Store); - const tabs = [ + + + + + +export default function TabPlataformaMEC (props) { + const tabs= [ 'O que é a plataforma MEC?', 'Como foi construída a Plataforma MEC?', 'Entendendo as 3 áreas da Plataforma', 'Quais são os Portais Parceiros?', 'Tipos de recursos', 'Softwares específicos', + 'Plataforma MEC' ] - + const [tabValue, setTabValue] = useState( Number(props.location.state.value) || 0); - const handleChangeTab = (event, index) => { - event.preventDefault(); - setTabValue(index); - } + const handleChangeTab = (e, newValue) => { + setTabValue(newValue) +} + - return ( - <MainPage contrast={state.contrast}> - <link href="https://fonts.googleapis.com/css?family=Pompiere|Roboto:300,400&display=swap" rel="stylesheet" /> + return( + <div style={{backgroundColor:"#f4f4f4"}}> + <link href="https://fonts.googleapis.com/css?family=Pompiere|Roboto:500,400&display=swap" rel="stylesheet"/> + <Secao> <BreadCrumbsDiv> - <StyledBreadCrumbs contrast={state.contrast}> + <StyledBreadCrumbs> <Link to="/" > - Página Inicial + Página Inicial </Link> <Link to="ajuda" > Ajuda </Link> - + <span> - Plataforma MEC + {tabs[6]} </span> </StyledBreadCrumbs> </BreadCrumbsDiv> - - <MainGrid container justify='center' spacing={4}> - <Grid xs={12} md={3} sm={4} item> - <Menu contrast={state.contrast}> - <p className="title"> - Plataforma MEC - </p> - <div className="sized-box" /> - - { - tabs.map((tab, index) => { - return ( - <TabStyled contrast={state.contrast} active={index === tabValue} name={index} onClick={(event) => handleChangeTab(event, index)} key={new Date().toISOString() + index}> - {tab} - </TabStyled> - ) - }) - } - - <div className="sized-box" /> - <Link to="ajuda"> - <p className="go-back"> - Voltar ao início - </p> - </Link> - - <div className="sized-box" /> - <p className="sub-title"> - Não encontrou o que procurava? Entre em - <Link to="contato"> - <span className="go-back"> contato</span> - </Link> - </p> + <Grid container spacing={4}> + <Grid item xs={3}> + <Menu> + <h4>{tabs[6]}</h4> + <TabsStyled orientation = "vertical" + variant = "scrollable" + value = {tabValue} + onChange = {handleChangeTab} + TabIndicatorProps = {{style:{display: "none"}}} + > + <TabStyled label={tabs[0]}></TabStyled> + <TabStyled label={tabs[1]}></TabStyled> + <TabStyled label={tabs[2]}></TabStyled> + <TabStyled label={tabs[3]}></TabStyled> + <TabStyled label={tabs[4]}></TabStyled> + <TabStyled label={tabs[5]}></TabStyled> + </TabsStyled> + <br/> + <div className="voltarInicio"> + <a href="ajuda">VOLTAR AO ÍNICIO</a> + </div> + <hr/> + <div className="procurava"> + Não encontrou o que procurava? Entre em + <a href="contato"> contato</a> + </div> </Menu> </Grid> - <Grid xs={12} md={9} sm={8} item> + <Grid item xs={9}> <Principal> - {tabValue === 0 && <What contrast={state.contrast} title={tabs[0]} />} - {tabValue === 1 && <How contrast={state.contrast} title={tabs[1]} />} - {tabValue === 2 && <Understand contrast={state.contrast} title={tabs[2]} />} - {tabValue === 3 && <Which contrast={state.contrast} title={tabs[3]} />} - {tabValue === 4 && <Types contrast={state.contrast} title={tabs[4]} />} - {tabValue === 5 && <Software contrast={state.contrast} title={tabs[5]} />} - </Principal> - </Grid> - </MainGrid> + {tabValue === 0 && <What title={tabs[0]}/>} + {tabValue === 1 && <How title={tabs[1]}/>} + {tabValue === 2 && <Understand title={tabs[2]}/>} + {tabValue === 3 && <Which title={tabs[3]}/>} + {tabValue === 4 && <Types title={tabs[4]}/>} + {tabValue === 5 && <Software title={tabs[5]}/>} + + <Grid style={{marginBlock:"50px"}} container spacing={2}> + <Grid item xs={4}> + <CardEncontrando/> + </Grid> + <Grid item xs={4}> + <CardParticipando/> + </Grid> + <Grid item xs={4}> + <CardGerenciando/> + </Grid> + + </Grid> - <MainGrid container spacing={4}> - <Grid xs={12} md={4} item> - <CardEncontrando contrast={state.contrast} /> - </Grid> + </Principal> + </Grid> + </Grid> - <Grid item xs={12} md={4} > - <CardParticipando contrast={state.contrast} /> - </Grid> - <Grid item xs={12} md={4} > - <CardGerenciando contrast={state.contrast} /> - </Grid> - </MainGrid> </Secao> - </MainPage> + </div> ); } const StyledBreadCrumbs = styled(Breadcrumbs)` display : flex; - justify-content : flex-start; - max-width : 1170px; - a{ - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } - span { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; - } -` + justify-content : flex-start; + max-width : 1170px; + span { + color : #a5a5a5; + } + a { + color: #00bcd4; + text-decoration: none; + } -const MainPage = styled.div` - background: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; ` const BreadCrumbsDiv = styled.div` + + padding : 10px; display : flex; ` -const MainGrid = styled(Grid)` - padding: 1.5em 0; +const Principal = styled.div` + .fixo { + + height: 40px; + text-align: center; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + padding: 30px; + margin-bottom: 30px; + color: #666; + + + img { + height: 50px; + width: 50px; + margin-right: 40px; + vertical-align: middle; + + } + + span { + font-size: 20px; + vertical-align: ; + } + + + + } + ` -const Principal = styled.div` +const TabsStyled = styled(Tabs)` + .Mui-selected { + background-color: #e7e4e4; + } + + .MuiTab-root{ + text-transform: none !important; + } + ` -const TabStyled = styled.div` - text-align: center; - font-family: 'Roboto', 'sans-serif'; - font-weight: ${props => props.active ? "500" : "lighter"}; - background: ${props => props.active ? props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)" : ""}; - padding: 0.5em; - color: ${props => props.contrast === "" ? "" : "yellow"}; - text-decoration: ${props => props.active ? "none" : props.contrast === "" ? "none" : "underline"}; - - :hover{ - background: ${props => props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)"}; - cursor: pointer; - font-weight: 500; +const TabStyled = styled(Tab)` + + padding: 4px 15px !important; + font-weight: 500; + font-size: 14px !important; + border-radius: 4px !important; + + + + + + &:hover { + background-color: #e7e4e4; } ` const Menu = styled.div` + width: auto; + background-color: #fff; + color: #666; + padding-block: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); - background: ${props => props.contrast === "" ? "#fff" : "black"}; - border: ${props => props.contrast === "" ? "none" : "1px solid white"}; - color: ${props => props.contrast === "" ? "" : "white"}; - width: 100%; - padding: 1em 0; - - .sized-box{ - border: 0.5px solid #d4d4d4; - margin: 1em 0; - } - .title{ - padding: 0; - margin: 0; + h4 { + padding-inline: 15px; + font-size: 18px; + margin-block: 10px; font-weight: 500; - text-align: center; - font-family: 'Roboto', 'sans-serif'; + line-height: 1.1; } - .sub-title{ - padding: 0; - margin: 0; - font-weight: lighter; + .voltarInicio { + padding: 4px 15px; + font-size: 15px; text-align: center; - font-family: 'Roboto', 'sans-serif'; + a { + font-size: 15px; + padding: 0; + color:#00bcd4; + text-decoration: none; + } + } + + hr { + border: 0; + border-top: 1px solid #ccc; + margin-top: 20px; + margin-bottom: 20px; } - .go-back{ - padding: 0; - margin: 0; - font-weight: lighter; + .procurava { + padding: 4px 15px; + font-size: 15px; text-align: center; - font-family: 'Roboto', 'sans-serif'; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - :hover{ - cursor: pointer; - font-weight: 500; + + a { + font-size: 15px; + padding: 0; + color:#00bcd4; + text-decoration: none; } + } - .active{ - background: ${props => props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)"}; - font-weight: 500; - } ` const Secao = styled.div` - width: 90%; - margin: 0 auto; - padding: 1em 0; + width: 1138px; + margin-inline: auto; + ` diff --git a/src/Pages/TabsHelp/TabResourseFind.js b/src/Pages/TabsHelp/TabResourseFind.js index 905650f8f3f0d5f37f393365dea4f56024798934..51765ca0d2b43c6f211122df59a00c0d5d7743b7 100644 --- a/src/Pages/TabsHelp/TabResourseFind.js +++ b/src/Pages/TabsHelp/TabResourseFind.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, { useState, useEffect, useContext } from 'react'; +import React, { useState, useEffect } from 'react'; import styled from 'styled-components'; import Tabs from '@material-ui/core/Tabs' import Tab from '@material-ui/core/Tab'; @@ -29,244 +29,263 @@ import CardPublicando from '../../Components/HelpCenter/Cards/CardPublicando'; import CardParticipando from '../../Components/HelpCenter/Cards/CardParticipando'; import CardGerenciando from '../../Components/HelpCenter/Cards/CardGerenciando'; import { Link } from 'react-router-dom'; -import { Store } from '../../Store'; //Image Import import { EncontrandoRecurso } from "ImportImages.js"; export default function TabResourseFind(props) { - const { state } = useContext(Store) - const tabs = [ - 'Como fazer uma busca?', - 'Como filtrar os resultados?', - 'Como os recursos são ranqueados?', - 'Encontrando Recursos' - ] - - const [tabValue, setTabValue] = useState(props.location.state === "undefined" ? 0 : props.location.state); - - const handleChangeTab = (e, newValue) => { - setTabValue(newValue) - } - - useEffect(() => { window.scrollTo(0, 0) }, []) - - return ( - <div style={state.contrast === "" ? { backgroundColor: "#f4f4f4" } : { backgroundColor: "black" }}> - <link href="https://fonts.googleapis.com/css?family=Pompiere|Roboto:500,400&display=swap" rel="stylesheet" /> - <Secao> - <BreadCrumbsDiv> - <StyledBreadCrumbs contrast={state.contrast}> - <Link to="/" > - Página Inicial - </Link> - <Link to="ajuda" > - Ajuda - </Link> - <span> - {tabs[3]} - </span> - </StyledBreadCrumbs> - </BreadCrumbsDiv> - <Grid container justify="center"> - <Grid item xs={12} md={10} > - <Principal contrast={state.contrast}> - <Menu contrast={state.contrast}> - <div className="fixo"> - <img src={EncontrandoRecurso} alt="Encontrando Recursos" /> - <span>{tabs[3]}</span> - </div> - <TabsStyled - contrast={state.contrast} - orientation="vertical" - variant="scrollable" - value={tabValue} - onChange={handleChangeTab} - TabIndicatorProps={{ style: { display: "none" } }} - > - <TabStyled contrast={state.contrast} label={tabs[0]}></TabStyled> - <TabStyled contrast={state.contrast} label={tabs[1]}></TabStyled> - <TabStyled contrast={state.contrast} label={tabs[2]}></TabStyled> - </TabsStyled> - <br/> - <div className="voltarInicio"> - <a href="ajuda">VOLTAR AO ÍNICIO</a> - </div> - </Menu> - {tabValue === 0 && <HowToDo contrast={state.contrast} title={tabs[0]} />} - {tabValue === 1 && <HowToFilter contrast={state.contrast} title={tabs[1]} />} - {tabValue === 2 && <HowToRank contrast={state.contrast} title={tabs[2]} />} - <div className="resultadosProcura"> - <span>Não era bem o que você procurava?</span> - <div className="subtitulo"> - <span>Você pode navegar pelos tópicos de ajuda ou entrar em <a href="contato">Contato</a>.</span> - </div> - </div> - </Principal> - </Grid> - </Grid> - <Grid style={{ paddingBottom: "50px" }} container justify={"center"}> - <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardPublicando contrast={state.contrast} /> - </Grid> - <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardParticipando contrast={state.contrast} /> - </Grid> - <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardGerenciando contrast={state.contrast} /> - </Grid> - </Grid> - </Secao> - </div> - ); + const tabs = [ + 'Como fazer uma busca?', + 'Como filtrar os resultados?', + 'Como os recursos são ranqueados?', + 'Encontrando Recursos' + ] + + const [tabValue, setTabValue] = useState(props.location.state === "undefined" ? 0 : props.location.state); + + const handleChangeTab = (e, newValue) => { + setTabValue(newValue) + } + + useEffect(() => { window.scrollTo(0, 0) }, []) + + return ( + <div style={{ backgroundColor: "#f4f4f4" }}> + <link href="https://fonts.googleapis.com/css?family=Pompiere|Roboto:500,400&display=swap" rel="stylesheet" /> + + <Secao> + <BreadCrumbsDiv> + <StyledBreadCrumbs> + <Link to="/" > + Página Inicial + </Link> + <Link to="ajuda" > + Ajuda + </Link> + + <span> + {tabs[3]} + </span> + + </StyledBreadCrumbs> + + </BreadCrumbsDiv> + <Grid container justify="center"> + <Grid item xs={12} md={10} > + <Principal> + <Menu> + <div className="fixo"> + <img src={EncontrandoRecurso} alt="Encontrando Recursos" /> + <span>{tabs[3]}</span> + </div> + <TabsStyled orientation="vertical" + variant="scrollable" + value={tabValue} + onChange={handleChangeTab} + TabIndicatorProps={{ style: { display: "none" } }} + > + <TabStyled label={tabs[0]}></TabStyled> + <TabStyled label={tabs[1]}></TabStyled> + <TabStyled label={tabs[2]}></TabStyled> + </TabsStyled> + <br /> + <div className="voltarInicio"> + <a href="ajuda">VOLTAR AO ÍNICIO</a> + </div> + </Menu> + + {tabValue === 0 && <HowToDo title={tabs[0]} />} + {tabValue === 1 && <HowToFilter title={tabs[1]} />} + {tabValue === 2 && <HowToRank title={tabs[2]} />} + <div className="resultadosProcura"> + <span>Não era bem o que você procurava?</span> + <div className="subtitulo"> + <span>Você pode navegar pelos tópicos de ajuda ou entrar em <a href="contato">Contato</a>.</span> + </div> + </div> + + + </Principal> + </Grid> + </Grid> + <Grid style={{ paddingBottom: "50px" }} container justify={"center"}> + <Grid item xs={12} md={3} style={{ margin: 5 }}> + <CardPublicando /> + </Grid> + <Grid item xs={12} md={3} style={{ margin: 5 }}> + <CardParticipando /> + </Grid> + <Grid item xs={12} md={3} style={{ margin: 5 }}> + <CardGerenciando /> + </Grid> + </Grid> + + + </Secao> + </div> + ); } const StyledBreadCrumbs = styled(Breadcrumbs)` - display : flex; - justify-content : flex-start; - span { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; - } - a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } + display : flex; + justify-content : flex-start; + span { + color : #a5a5a5; + } + a { + color: #00bcd4; + text-decoration: none; + } + ` + const BreadCrumbsDiv = styled.div` - padding : 10px; - display : flex; + + padding : 10px; + display : flex; ` const Principal = styled.div` - .fixo { - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - height: 40px; - text-align: center; - padding: 30px; - margin-bottom: 30px; - - img { - height: 50px; - width: 50px; - margin-right: 40px; - vertical-align: middle; - } - - span { - font-size: 20px; - color: ${props => props.contrast === "" ? "" : "white"}; - } + .fixo { + + height: 40px; + text-align: center; + background-color: #fff; + padding: 30px; + margin-bottom: 30px; + color: #666; + + + img { + height: 50px; + width: 50px; + margin-right: 40px; + vertical-align: middle; + } - .resultadosProcura { - text-align: center; - margin-block: 30px; - padding-inline: 15px; - color: ${props => props.contrast === "" ? "#666" : "white"}; - span { - font-size: 24px; - } - .subtitulo { - margin-top: 10px; - - span { - font-size: 15px - } - - a { - font-size: 15px; - padding: 0; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } - } + + span { + font-size: 20px; + vertical-align: ; } -` + -const TabsStyled = styled(Tabs)` - color: ${props => props.contrast === "" ? "" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - .Mui-selected { - background-color: ${props => props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)"}; + } + .resultadosProcura { + text-align: center; + margin-block: 30px; + padding-inline: 15px; + color: #666; + span { + font-size: 24px; } + .subtitulo { + margin-top: 10px; + + span { + font-size: 15px + } + + a { + font-size: 15px; + padding: 0; + color:#00bcd4; + text-decoration: none; + } - .MuiTab-root{ - text-transform: none !important; - max-width:100% } - text-align: center; - width:100% + } + +` + +const TabsStyled = styled(Tabs)` + + .Mui-selected { + background-color: #e7e4e4; + } + + .MuiTab-root{ + text-transform: none !important; + max-width:100% + } + text-align: center; + width:100% ` const TabStyled = styled(Tab)` - color: ${props => props.contrast === "" ? "" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - padding: 4px 15px !important; - font-weight: 500; - font-size: 14px !important; - border-radius: 4px !important; - text-align: center; + + padding: 4px 15px !important; + font-weight: 500; + font-size: 14px !important; + border-radius: 4px !important; + text-align: center; - &:hover { - background-color: ${props => props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)"}; - } + + + + + &:hover { + background-color: #e7e4e4; + } ` const Menu = styled.div` - width: auto; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; - padding-block: 10px; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; - margin-bottom:30px - - h4 { - padding-inline: 15px; - font-size: 18px; - margin-block: 10px; - font-weight: 500; - line-height: 1.1; - } + width: auto; + background-color: #fff; + color: #666; + padding-block: 10px; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); + margin-bottom:30px + + + h4 { + padding-inline: 15px; + font-size: 18px; + margin-block: 10px; + font-weight: 500; + line-height: 1.1; + } - .voltarInicio { - padding: 4px 15px; - font-size: 15px; - text-align: center; - a { - font-size: 15px; - padding: 0; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } + .voltarInicio { + padding: 4px 15px; + font-size: 15px; + text-align: center; + a { + font-size: 15px; + padding: 0; + color:#00bcd4; + text-decoration: none; } + } + + hr { + border: 0; + border-top: 1px solid #ccc; + margin-top: 20px; + margin-bottom: 20px; + } + + .procurava { + padding: 4px 15px; + font-size: 15px; + text-align: center; - hr { - border: 0; - border-top: 1px solid #ccc; - margin-top: 20px; - margin-bottom: 20px; + a { + font-size: 15px; + padding: 0; + color:#00bcd4; + text-decoration: none; } - .procurava { - padding: 4px 15px; - font-size: 15px; - text-align: center; - - a { - font-size: 15px; - padding: 0; - color:#00bcd4; - text-decoration: none; - } - - } + } ` - const Secao = styled.div` - margin-inline: auto; + margin-inline: auto; + ` diff --git a/src/Pages/TabsHelp/TabResoursePub.js b/src/Pages/TabsHelp/TabResoursePub.js index aa4f9dca45f01ba5fc53f0cbb9c6ede819692658..7ff00fa47e3afb43b53e748e970db42b8f43eb31 100644 --- a/src/Pages/TabsHelp/TabResoursePub.js +++ b/src/Pages/TabsHelp/TabResoursePub.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, { useState, useEffect, useContext } from 'react'; +import React, { useState, useEffect } from 'react'; import styled from 'styled-components'; import Tabs from '@material-ui/core/Tabs' import Tab from '@material-ui/core/Tab'; @@ -29,12 +29,14 @@ import CardEncontrando from '../../Components/HelpCenter/Cards/CardEncontrando'; import CardParticipando from '../../Components/HelpCenter/Cards/CardParticipando'; import CardGerenciando from '../../Components/HelpCenter/Cards/CardGerenciando'; import { Link } from 'react-router-dom'; -import { Store } from '../../Store'; //Image Import import { PublicandoRecursos } from "ImportImages.js"; export default function TabResoursePub(props) { + + console.log(props) + const tabs = [ 'Por que enviar um recurso?', 'Como publicar um recurso?', @@ -43,7 +45,6 @@ export default function TabResoursePub(props) { ] const [tabValue, setTabValue] = useState(props.location.state === "undefined" ? 0 : props.location.state); - const { state } = useContext(Store) const handleChangeTab = (e, newValue) => { setTabValue(newValue) @@ -52,12 +53,12 @@ export default function TabResoursePub(props) { useEffect(() => { window.scrollTo(0, 0) }, []) return ( - <div style={state.contrast === "" ? { backgroundColor: "#f4f4f4" } : { backgroundColor: "black" }}> + <div style={{ backgroundColor: "#f4f4f4" }}> <link href="https://fonts.googleapis.com/css?family=Pompiere|Roboto:500,400&display=swap" rel="stylesheet" /> <Secao> <BreadCrumbsDiv> - <StyledBreadCrumbs contrast={state.contrast}> + <StyledBreadCrumbs> <Link to="/" > Página Inicial </Link> @@ -72,21 +73,21 @@ export default function TabResoursePub(props) { </BreadCrumbsDiv> <Grid container justify="center"> <Grid item xs={12} md={10} > - <Principal contrast={state.contrast}> - <Menu contrast={state.contrast}> + <Principal> + <Menu> <div className="fixo"> <img src={PublicandoRecursos} alt="Publicando Recursos" /> <span>{tabs[3]}</span> </div> - <TabsStyled contrast={state.contrast} orientation="vertical" + <TabsStyled orientation="vertical" variant="scrollable" value={tabValue} onChange={handleChangeTab} TabIndicatorProps={{ style: { display: "none" } }} > - <TabStyled contrast={state.contrast} label={tabs[0]}></TabStyled> - <TabStyled contrast={state.contrast} label={tabs[1]}></TabStyled> - <TabStyled contrast={state.contrast} label={tabs[2]}></TabStyled> + <TabStyled label={tabs[0]}></TabStyled> + <TabStyled label={tabs[1]}></TabStyled> + <TabStyled label={tabs[2]}></TabStyled> </TabsStyled> <br /> <div className="voltarInicio"> @@ -94,9 +95,9 @@ export default function TabResoursePub(props) { </div> </Menu> - {tabValue === 0 && <Why contrast={state.contrast} title={tabs[0]} />} - {tabValue === 1 && <How contrast={state.contrast} title={tabs[1]} />} - {tabValue === 2 && <Which contrast={state.contrast} title={tabs[2]} />} + {tabValue === 0 && <Why title={tabs[0]} />} + {tabValue === 1 && <How title={tabs[1]} />} + {tabValue === 2 && <Which title={tabs[2]} />} <div className="resultadosProcura"> <span>Não era bem o que você procurava?</span> <div className="subtitulo"> @@ -109,14 +110,15 @@ export default function TabResoursePub(props) { </Grid> <Grid style={{ paddingBottom: "50px" }} container justify={"center"}> <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardEncontrando contrast={state.contrast} /> + <CardEncontrando /> </Grid> <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardParticipando contrast={state.contrast} /> + <CardParticipando /> </Grid> <Grid item xs={12} md={3} style={{ margin: 5 }}> - <CardGerenciando contrast={state.contrast} /> + <CardGerenciando /> </Grid> + </Grid> @@ -128,11 +130,11 @@ const StyledBreadCrumbs = styled(Breadcrumbs)` display : flex; justify-content : flex-start; span { - color: ${props => props.contrast === "" ? "#a5a5a5" : "white"}; + color : #a5a5a5; } a { - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color: #00bcd4; + text-decoration: none; } ` @@ -146,11 +148,14 @@ const BreadCrumbsDiv = styled.div` const Principal = styled.div` .fixo { - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; + height: 40px; text-align: center; + background-color: #fff; padding: 30px; margin-bottom: 30px; + color: #666; + img { height: 50px; @@ -162,7 +167,7 @@ const Principal = styled.div` span { font-size: 20px; - color: ${props => props.contrast === "" ? "" : "white"}; + vertical-align: ; } @@ -172,7 +177,7 @@ const Principal = styled.div` text-align: center; margin-block: 30px; padding-inline: 15px; - color: ${props => props.contrast === "" ? "#666" : "white"}; + color: #666; span { font-size: 24px; } @@ -186,8 +191,8 @@ const Principal = styled.div` a { font-size: 15px; padding: 0; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color:#00bcd4; + text-decoration: none; } } @@ -196,10 +201,9 @@ const Principal = styled.div` ` const TabsStyled = styled(Tabs)` - color: ${props => props.contrast === "" ? "" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + .Mui-selected { - background-color: ${props => props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)"}; + background-color: #e7e4e4; } .MuiTab-root{ @@ -212,26 +216,29 @@ const TabsStyled = styled(Tabs)` ` const TabStyled = styled(Tab)` - color: ${props => props.contrast === "" ? "" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + padding: 4px 15px !important; font-weight: 500; font-size: 14px !important; border-radius: 4px !important; text-align: center; + + + + &:hover { - background-color: ${props => props.contrast === "" ? "#e7e4e4" : "rgba(255,255,0,0.24)"}; + background-color: #e7e4e4; } ` const Menu = styled.div` width: auto; - background-color: ${props => props.contrast === "" ? "#fff" : "black"}; - color: ${props => props.contrast === "" ? "#666" : "white"}; + background-color: #fff; + color: #666; padding-block: 10px; - box-shadow: ${props => props.contrast === "" ? "0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)" : "0 1px 3px rgba(254,254,254,.48),0 1px 2px rgba(254,254,254,.48)"}; + box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); margin-bottom:30px @@ -250,8 +257,8 @@ const Menu = styled.div` a { font-size: 15px; padding: 0; - color: ${props => props.contrast === "" ? "#00bcd4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + color:#00bcd4; + text-decoration: none; } } diff --git a/src/Pages/TermsPage.js b/src/Pages/TermsPage.js index d2db18c4adf40b358b288bc7039bb87940330561..aaa58528781f305e067490c2ba119a5bd76dd9ce 100644 --- a/src/Pages/TermsPage.js +++ b/src/Pages/TermsPage.js @@ -15,9 +15,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, useContext } from 'react'; +import React, {useState, useContext} from 'react'; import styled from 'styled-components' -import { device } from '../Components/device.js' +import {device} from '../Components/device.js' import { Store } from '../Store.js'; import { Button } from '@material-ui/core'; import Card from '@material-ui/core/Card'; @@ -25,11 +25,12 @@ import LabeledCheckbox from "../Components/Checkbox.js" import TermsPageContent from '../Components/TermsPageContent.js' import AppBar from '@material-ui/core/AppBar'; import { makeStyles } from '@material-ui/core/styles'; -import { Link } from 'react-router-dom' +import {Link} from 'react-router-dom' const CardStyled = styled(Card)` box-sizing : border-box; background-color : white; max-width: 1700px; + padding-top: 52px; @media ${device.mobileM} { width : 100%; height : 100%; @@ -56,7 +57,7 @@ const StyledSpanContinuar = styled.span` const Background = styled.div` padding-top : 40px; - background-color: ${props => props.contrast === "" ? "#f4f4f4" : "black"}; + background-color : #f4f4f4; color : #666; padding-bottom : 40px; @@ -77,76 +78,76 @@ const Background = styled.div` } ` -export default function TermsContainer(props) { - // eslint-disable-next-line - const { state, dispatch } = useContext(Store) - // eslint-disable-next-line - const [checked, setChecked] = useState(false); - const [unavailableButton, setButtonAvailability] = useState(true); - const classes = useStyles() - - const handleChecked = e => { - setChecked(e.target.checked); - setButtonAvailability(!unavailableButton); - } +export default function TermsContainer (props) { + // eslint-disable-next-line + const {state, dispatch} = useContext(Store) + // eslint-disable-next-line + const [checked, setChecked] = useState(false); + const [unavailableButton, setButtonAvailability] = useState(true); + const classes = useStyles() + + const handleChecked = e => { + setChecked(e.target.checked); + setButtonAvailability(!unavailableButton); + } + + const handleAgreement = () => { + + dispatch( { + type: 'USER_AGREED_TO_PUBLICATION_TERMS', + userAgreement: true + }) - const handleAgreement = () => { - dispatch({ - type: 'USER_AGREED_TO_PUBLICATION_TERMS', - userAgreement: true - }) - - if (props.location.state) { - props.history.push('/professor') - } else { - props.history.push('/permission') - window.scrollTo(0, 0) + if (props.location.state) { + props.history.push('/professor') + }else { + props.history.push('/permission') + window.scrollTo(0, 0) + } } - } - return ( - <Background contrast={state.contrast}> - <div className="container"> - <CardStyled contrast={state.contrast} variant="outlined"> - <TermsPageContent contrast={state.contrast} /> - </CardStyled> - </div> - <AppBar position="fixed" color="primary" className={state.contrast === "" ? classes.lightAppBar : classes.darkAppBar}> - <StyledAppBarContainer> - <div className="container"> - <div style={{ fontSize: "14px" }}> - <LabeledCheckbox contrast={state.contrast} label={<Styledspan style={state.contrast === "" ? { color: "#666", fontWeight: "600" } : { color: "yellow", fontWeight: "600", textDecoration: "underline" }}>Li e concordo com os termos de uso da Plataforma Integrada de RED do MEC</Styledspan>} handleChange={handleChecked} /> - </div> - <div className="botoes"> - <Button disabled={unavailableButton} - style={unavailableButton ? state.contrast === "" ? { backgroundColor: "#e9e9e9" } : {border: "1px solid white"} : state.contrast === "" ? { backgroundColor: "#00bcd4" } : { backgroundColor: "black", border: "1px solid white" }} + return ( + <Background> + <div className="container"> + <CardStyled variant="outlined"> + <TermsPageContent/> + </CardStyled> + </div> + <AppBar position="fixed" color="primary" className={classes.appBar}> + <StyledAppBarContainer> + <div className="container"> + <div style={{fontSize:"14px"}}> + <LabeledCheckbox label={<Styledspan style={{color : "#666", fontWeight : "600"}}>Li e concordo com os termos de uso da Plataforma Integrada de RED do MEC</Styledspan>} handleChange={handleChecked}/> + </div> + <div className="botoes"> + <Button disabled = {unavailableButton} + style={ unavailableButton ? {backgroundColor:"#e9e9e9"} : {backgroundColor:"#00bcd4"}} onClick={handleAgreement} - > - <StyledSpanContinuar style={unavailableButton ? state.contrast === "" ? { color: "#666666" } : { color: "white" } : state.contrast === "" ? {} : { color: "yellow", textDecoration: "underline" }}> - Continuar - </StyledSpanContinuar> - </Button> - <Link to="/"> - <GrayButton contrast={state.contrast}> - Cancelar - </GrayButton> - </Link> + > + <StyledSpanContinuar style={unavailableButton ? {color:"#666666"} : {}}> + Continuar + </StyledSpanContinuar> + </Button> + <Link to="/"> + <GrayButton> + Cancelar + </GrayButton> + </Link> + </div> </div> - </div> - </StyledAppBarContainer> - </AppBar> - </Background> - ) + </StyledAppBarContainer> + </AppBar> + </Background> + ) } const GrayButton = styled(Button)` &:hover { - background-color: ${props => props.contrast === "" ? "rgba(158,158,158,0.2) !important" : "rgba(255,255,0,0.24) !important"}; + background-color : rgba(158,158,158,0.2) !important; } height : 36px !important; font-weight : 600 !important; - color: ${props => props.contrast === "" ? "#666 !important" : "yellow !important"}; - text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; + color : #666 !important; background-color: transparent; min-width : 88px !important; height : 36px !important; @@ -170,20 +171,13 @@ const GrayButton = styled(Button)` ` const useStyles = makeStyles((theme) => ({ - lightAppBar: { - top: 'auto', - bottom: 0, - height: '100px', - backgroundColor: '#fff', - boxShadow: '0 1px 3px rgba(0,0,0,.52),0 1px 2px rgba(0,0,0,.24)' - }, - darkAppBar: { - top: 'auto', - bottom: 0, - height: '100px', - backgroundColor: 'black', - boxShadow: '0 1px 3px rgba(0,0,0,.52),0 1px 2px rgba(0,0,0,.24)' - }, + appBar: { + top: 'auto', + bottom: 0, + height : '100px', + backgroundColor : '#fff', + boxShadow : '0 1px 3px rgba(0,0,0,.52),0 1px 2px rgba(0,0,0,.24)' + }, })); @@ -222,3 +216,26 @@ const StyledAppBarContainer = styled.div` } } ` + +// {/*<CardActions style={{justifyContent:"center", padding:"25px", borderTop : "2px solid #dadada"}}> +// <div> +// <div style={{fontSize:"14px"}}> +// <LabeledCheckbox label={<Styledspan>Li e concordo com os termos de uso da Plataforma Integrada de RED do MEC</Styledspan>} handleChange={handleChecked}/> +// <div style={{marginLeft:"1em", paddingLeft:"16px", color:"#a0a0a0", justifyContent:"center",display:"flex"}}> +// <Button disabled = {unavailableButton} +// style={ unavailableButton ? {backgroundColor:"#e9e9e9"} : {backgroundColor:"#00bcd4"}} +// onClick={handleAgreement} +// > +// <StyledSpanContinuar style={unavailableButton ? {color:"#666666"} : {}}> +// Continuar +// </StyledSpanContinuar> +// </Button> +// <Button style={{marginLeft:"45px", backgroundColor:"#e9e9e9"}}> +// <Styledspan style={{color:"rgb(102, 102, 102)"}}> +// Cancelar +// </Styledspan> +// </Button> +// </div> +// </div> +// </div> +// </CardActions>*/} diff --git a/src/Pages/UploadPage.js b/src/Pages/UploadPage.js index aa1f6d1b3f001b969630ac3de8f6c121880a762a..848b3b5b76edf5f975011b676dcfc021bbcd701e 100644 --- a/src/Pages/UploadPage.js +++ b/src/Pages/UploadPage.js @@ -16,23 +16,23 @@ 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, useContext } from 'react' +import React, {useState, useEffect, useContext} from 'react' import Grid from '@material-ui/core/Grid'; import UploadFileWrapper from '../Components/UploadPageComponents/UploadFileWrapper.js' -import { Store } from '../Store.js' -import { InfoBox } from '../Components/UploadPageComponents/StyledComponents.js' +import {Store} from '../Store.js' +import {InfoBox} from '../Components/UploadPageComponents/StyledComponents.js' import Stepper from '../Components/UploadPageComponents/Stepper.js' -import { postRequest } from '../Components/HelperFunctions/getAxiosConfig.js' +import {postRequest} from '../Components/HelperFunctions/getAxiosConfig.js' import PartOne from '../Components/UploadPageComponents/PartOne.js' import PartTwo from '../Components/UploadPageComponents/PartTwo.js' import PartThree from '../Components/UploadPageComponents/PartThree.js' import ModalLearningObjectPublished from '../Components/ModalLearningObjectPublished.js' -import { Background } from '../Components/UploadPageComponents/StyledComponents' +import {Background} from '../Components/UploadPageComponents/StyledComponents' import LoadingSpinner from '../Components/LoadingSpinner.js' -import { Redirect } from 'react-router-dom' +import {Redirect} from 'react-router-dom' -export default function UploadPage(props) { - const { state } = useContext(Store) +export default function UploadPage (props) { + const {state} = useContext(Store) // {/*Object : link or file uploaded*/} // eslint-disable-next-line @@ -40,27 +40,27 @@ export default function UploadPage(props) { const [loading, toggleLoading] = useState(true) const [draft, setDraft] = useState({}) - function handleSuccessfulGet(data) { + function handleSuccessfulGet (data) { setDraft(data) toggleLoading(false) } - useEffect(() => { + useEffect( () => { if (state.currentUser.id !== "") { - const url = `/learning_objects/` + const url = `/learning_objects/` - let payload = {} + let payload = {} - postRequest(url, payload, handleSuccessfulGet, (error) => { console.log(error) }) + postRequest(url, payload, handleSuccessfulGet, (error) => {console.log(error)}) } }, []) const [activeStep, setActiveStep] = React.useState(0); - const stepperControl = (increment) => { setActiveStep(activeStep + increment) } + const stepperControl=(increment)=>{setActiveStep(activeStep + increment)} const [objectSubmitted, toggleModal] = useState(false) - const handleModal = (value) => { toggleModal(value) } + const handleModal = (value) => {toggleModal(value)} const handlePost = () => { if (state.currentUser.id !== "") { @@ -69,8 +69,8 @@ export default function UploadPage(props) { let payload = {} postRequest(url, payload, - (data) => { handleModal(true) }, - (error) => { console.log(error) } + (data) => {handleModal(true)}, + (error) => {console.log(error)} ) } @@ -81,14 +81,14 @@ export default function UploadPage(props) { const url = `/submissions/` let payload = { - "submission": { - "learning_object_id": draft.id + "submission" : { + "learning_object_id" : draft.id } } postRequest(url, payload, - (data) => { handleModal(true) }, - (error) => { console.log(error) } + (data) => {handleModal(true)}, + (error) => {console.log(error)} ) } @@ -98,67 +98,64 @@ export default function UploadPage(props) { <React.Fragment> { state.currentUser.id === '' && - <Redirect to="/" /> + <Redirect to="/"/> } { loading === true ? ( - <div style={state.contrast === "" ? {} : { backgroundColor: "black" }}> - <LoadingSpinner contrast={state.contrast} text={"CARREGANDO..."} /> - </div> + <LoadingSpinner text={"CARREGANDO..."}/> ) : ( <> - <ModalLearningObjectPublished - contrast={state.contrast} - open={objectSubmitted} - handleClose={() => { toggleModal(false); props.history.push('/') }} - draftID={draft.id} + <ModalLearningObjectPublished + open={objectSubmitted} + handleClose={() => {toggleModal(false); props.history.push('/')}} + draftID={draft.id} /> - { - activeStep === 2 ? - ( - <PartThree contrast={state.contrast} draftID={draft.id} stepperControl={stepperControl} activeStep={activeStep} handlePost={handlePost} handleSubmit={handleSubmit} /> - ) - : - ( - <Background contrast={state.contrast}> - <div className="container"> - <Grid container spacing={2}> - <Grid item md={4} xs={12}> - <UploadFileWrapper contrast={state.contrast} draftID={draft.id} /> - </Grid> - <Grid item md={8} xs={12}> - <InfoBox contrast={state.contrast}> - <div className="cabecalho"> - <h2>Informações sobre o Recurso</h2> - <div className="feedback-upload"> - <Stepper contrast={state.contrast} activeStep={activeStep} /> - </div> + { + activeStep === 2 ? + ( + <PartThree draftID={draft.id} stepperControl={stepperControl} activeStep={activeStep} handlePost={handlePost} handleSubmit={handleSubmit}/> + ) + : + ( + <Background> + <div className="container"> + <Grid container spacing={2}> + <Grid item md={4} xs={12}> + <UploadFileWrapper draftID={draft.id}/> + </Grid> + <Grid item md={8} xs={12}> + <InfoBox> + <div className="cabecalho"> + <h2>Informações sobre o Recurso</h2> + <div className="feedback-upload"> + <Stepper activeStep={activeStep}/> </div> - { - activeStep === 0 && - <Grid container style={{ paddingLeft: "15px", paddingRight: "15px" }}> - <PartOne draftID={draft.id} stepperControl={stepperControl} contrast={state.contrast} /> - </Grid> - } - { - activeStep === 1 && - <Grid container style={{ paddingLeft: "15px", paddingRight: "15px" }}> - <PartTwo draftID={draft.id} stepperControl={stepperControl} contrast={state.contrast} /> - </Grid> - } - </InfoBox> - </Grid> + </div> + { + activeStep === 0 && + <Grid container style={{paddingLeft : "15px", paddingRight : "15px"}}> + <PartOne draftID={draft.id} stepperControl={stepperControl}/> + </Grid> + } + { + activeStep === 1 && + <Grid container style={{paddingLeft : "15px", paddingRight : "15px"}}> + <PartTwo draftID={draft.id} stepperControl={stepperControl}/> + </Grid> + } + </InfoBox> </Grid> - </div> - </Background> - ) - } + </Grid> + </div> + </Background> + ) + } </> ) - } - </React.Fragment> - ) + } + </React.Fragment> +) } diff --git a/src/Pages/UserPage.js b/src/Pages/UserPage.js index 21d4eb73ab91ab9b9f4e4d0b6e994d76667be5d5..2688500eeb48d71df1f3fc1469d744a41d4b71e6 100644 --- a/src/Pages/UserPage.js +++ b/src/Pages/UserPage.js @@ -17,6 +17,7 @@ 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, useEffect } from "react"; +import styled from "styled-components"; import CustomizedBreadcrumbs from "../Components/TabPanels/Breadcrumbs.js"; import { Store } from "../Store.js"; import Tab from "@material-ui/core/Tab"; @@ -29,14 +30,15 @@ import TabPanelRede from "../Components/TabPanels/UserPageTabs/PanelRede.js"; import TabPanelCuradoria from "../Components/TabPanels/UserPageTabs/PanelCuradoria.js"; import Grid from "@material-ui/core/Grid"; import { - HeaderContainer, - UserProfileContainer, - CheckTeacherDiv, - StyledTabs, - RodapeDiv, - NavBarContentContainer, - BackgroundDiv, + HeaderContainer, + UserProfileContainer, + CheckTeacherDiv, + StyledTabs, + RodapeDiv, + NavBarContentContainer, + BackgroundDiv, } from "../Components/TabPanels/StyledComponents.js"; +import CircularProgress from "@material-ui/core/CircularProgress"; import Cover from "../Components/UserPageComponents/Cover.js"; import ProfileAvatar from "../Components/UserPageComponents/Avatar.js"; import UserInfo from "../Components/UserPageComponents/UserInfo.js"; @@ -44,201 +46,213 @@ import EditProfileButton from "../Components/UserPageComponents/EditProfileButto import SubmitterStatus from "../Components/UserPageComponents/SubmitterStatus.js"; import { getRequest } from "../Components/HelperFunctions/getAxiosConfig.js"; import Typography from "@material-ui/core/Typography"; -import LoadingSpinner from '../Components/LoadingSpinner'; export default function UserPage(props) { - const { state, dispatch } = useContext(Store); - const id = state.currentUser.id; - - const [follows, setFollows] = useState(0); - const [following, setFollowing] = useState(0); - const [loading, setLoading] = useState(true); - const [tabValue, setTabValue] = useState(Number(props.location.state) || 0); - const [tabs, setTabs] = useState([ + const { state, dispatch } = useContext(Store); + const id = state.currentUser.id; + + const [follows, setFollows] = useState(0); + const [following, setFollowing] = useState(0); + const [loading, setLoading] = useState(false); + const [tabValue, setTabValue] = useState(Number(props.location.state) || 0); + const [tabs, setTabs] = useState([ + "Atividades", + "Meus Recursos", + "Favoritos", + "Coleções", + "Rede", + ]); + const handleChangeTab = (event, newValue) => { + setTabValue(newValue); + }; + + function handleSuccessfulGet(data) { + console.log(data); + dispatch({ + type: "GET_USER", + user: data, + }); + + setFollows(data.follows_count); + + if (data.role_ids.includes(4)) { + setTabs([ "Atividades", "Meus Recursos", "Favoritos", "Coleções", "Rede", - ]); - const handleChangeTab = (event, newValue) => { - setTabValue(newValue); - }; - - function handleSuccessfulGet(data) { - dispatch({ - type: "GET_USER", - user: data, - }); - - setFollows(data.follows_count); - - if (data.role_ids.includes(4)) { - setTabs([ - "Atividades", - "Meus Recursos", - "Favoritos", - "Coleções", - "Rede", - "Curadoria", - ]); - } + "Curadoria", + ]); } + } + + function handleSuccesGetFollowing(data) { + setFollowing(data.length); + setLoading(false); + } - function handleSuccesGetFollowing(data) { - setFollowing(data.length); + useEffect(() => { + if (id !== "") { + const url = `/users/${id}`; + const url2 = `/users/${id}/following/User`; + setLoading(true); + getRequest(url, handleSuccessfulGet, (error) => { + console.log(error); + }); + getRequest(url2, handleSuccesGetFollowing, (error) => { + console.log(error); + }); } + }, []); - useEffect(() => { - setLoading(true); - if (id !== "") { - const url = `/users/${id}`; - const url2 = `/users/${id}/following/User`; - getRequest(url, handleSuccessfulGet, (error) => { - console.log(error); - }); - getRequest(url2, handleSuccesGetFollowing, (error) => { - console.log(error); - }); - } - setLoading(false); - }, []); - - useEffect(() => { - setTabValue(Number(props.location.state) || 0) - }, [window.history.state.key]) - - const redirect = () => { - props.history.push("/"); - }; - - const [modalOpen, toggleModal] = useState(false); - const WIDTH = window.innerWidth; - - return ( - <div> - <link - href="https://fonts.googleapis.com/css?family=Roboto:100,400,500&display=swap" - rel="stylesheet" - /> - { - loading ? - ( - <LoadingSpinner contrast={state.contrast} text="Carregando..." /> - ) - : - ( - state.userIsLoggedIn ? - ( - <React.Fragment> - <ModalAlterarAvatar - contrast={state.contrast} - open={modalOpen} - handleClose={() => { - toggleModal(false); - }} - userAvatar={state.currentUser.avatar} - /> - <BackgroundDiv contrast={state.contrast}> - <CustomizedBreadcrumbs contrast={state.contrast} values={["Minha área", tabs[tabValue]]} /> - <Grid container spacing={2}> - <Grid item xs={12}> - <div style={{ padding: "10px 0 8px 0" }}> - <UserProfileContainer> - <HeaderContainer contrast={state.contrast}> - <Cover id={id} contrast={state.contrast}/> - <ProfileAvatar id={id} contrast={state.contrast}/> - {WIDTH <= 600 ? null : <UserInfo />} - <EditProfileButton contrast={state.contrast} /> - </HeaderContainer> - {WIDTH <= 600 ? ( - <Grid - style={state.contrast === "" ? { marginTop: "4em" } : { paddingTop: "4em", backgroundColor: "black", borderLeft: "1px solid white", borderRight: "1px solid white", }} - container - justify="center" - alignItems="center" - direction="column" - > - <Grid item> - <Typography - variant="h4" - gutterBottom - style={state.contrast === "" ? { textAlign: "center" } : { color: "white", textAlign: "center" }} - > - {state.currentUser.name} - </Typography> - </Grid> - <Grid - style={{ - marginTop: "0.5em", - marginBottom: "0.5em", - borderTop: "1px solid white", - borderBottom: "1px solid white", - }} - container - spacing={4} - justify="center" - alignItems="center" - direction="row" - > - <Grid item> - <Typography style={state.contrast === "" ? {} : { color: "white" }} variant="h6" onClick={(e) => { handleChangeTab(e, 4) }}> - {follows} seguidores - </Typography> - </Grid> - <Grid item> - <Typography style={state.contrast === "" ? {} : { color: "white" }} variant="h6" onClick={(e) => { handleChangeTab(e, 4) }}> - {following} seguindo - </Typography> - </Grid> - </Grid> - </Grid> - ) : ( - <CheckTeacherDiv contrast={state.contrast}> - <SubmitterStatus /> - </CheckTeacherDiv> - )} - <RodapeDiv contrast={state.contrast}> - <NavBarContentContainer contrast={state.contrast}> - <StyledTabs - contrast={state.contrast} - value={tabValue} - onChange={handleChangeTab} - indicatorColor="primary" - textColor="primary" - variant="scrollable" - scrollButtons="on" - TabIndicatorProps={{ style: state.contrast === "" ? { background: "#00bcd4" } : { background: "yellow" } }} - > - {tabs.map((tab) => ( - <Tab contrast={state.contrast} label={tab} key={tab} /> - ))} - </StyledTabs> - </NavBarContentContainer> - </RodapeDiv> - </UserProfileContainer> - </div> - </Grid> - <Grid item xs={12}> - {tabValue === 0 && <TabPanelAtividades id={id} contrast={state.contrast} />} - {tabValue === 1 && <TabPanelMeusRecursos id={id} contrast={state.contrast} />} - {tabValue === 2 && <TabPanelFavoritos id={id} contrast={state.contrast} />} - {tabValue === 3 && <TabPanelColecoes id={id} contrast={state.contrast} />} - {tabValue === 4 && <TabPanelRede id={id} contrast={state.contrast} />} - {tabValue === 5 && <TabPanelCuradoria id={id} contrast={state.contrast} />} - </Grid> - </Grid> - </BackgroundDiv> - </React.Fragment> - ) - : - ( - <> - {redirect()} - </> - ) - ) - } - </div> - ) + useEffect(() => { + setTabValue(Number(props.location.state) || 0) + }, [window.history.state.key]) + + const redirect = () => { + props.history.push("/"); + }; + + const [modalOpen, toggleModal] = useState(false); + const WIDTH = window.innerWidth; + + return ( + <div> + <link + href="https://fonts.googleapis.com/css?family=Roboto:100,400,500&display=swap" + rel="stylesheet" + /> + { + state.userIsLoggedIn ? ( + [ + <React.Fragment> + <ModalAlterarAvatar + open={modalOpen} + handleClose={() => { + toggleModal(false); + }} + userAvatar={state.currentUser.avatar} + /> + + <BackgroundDiv> + <CustomizedBreadcrumbs values={["Minha área", tabs[tabValue]]} /> + <Grid container spacing={2}> + <Grid item xs={12}> + <div style={{ padding: "10px 0 8px 0" }}> + <UserProfileContainer> + <HeaderContainer> + <Cover id={id} /> + <ProfileAvatar id={id} /> + {WIDTH <= 600 ? null : <UserInfo />} + <EditProfileButton /> + </HeaderContainer> + {WIDTH <= 600 ? ( + <Grid + style={{ marginTop: "4em" }} + container + justify="center" + alignItems="center" + direction="column" + > + <Grid item> + <Typography + variant="h4" + gutterBottom + style={{ textAlign: "center" }} + > + {state.currentUser.name} + </Typography> + </Grid> + <Grid + style={{ + marginTop: "0.5em", + marginBottom: "0.5em", + borderTop: "0.5px solid #eee", + borderBottom: "0.5px solid #eee", + }} + container + spacing={4} + justify="center" + alignItems="center" + direction="row" + > + <Grid item> + <Typography variant="h6" onClick={(e) => { handleChangeTab(e, 4) }}> + {loading ? ( + <CircularProgress size={20} /> + ) : ( + `${follows} seguidores` + )} + </Typography> + </Grid> + <Grid item> + <Typography variant="h6" onClick={(e) => { handleChangeTab(e, 4) }}> + {loading ? ( + <CircularProgress size={20} /> + ) : ( + `${following} seguindo` + )} + </Typography> + </Grid> + </Grid> + </Grid> + ) : ( + <CheckTeacherDiv> + <SubmitterStatus /> + </CheckTeacherDiv> + )} + <RodapeDiv> + <NavBarContentContainer> + <StyledTabs + value={tabValue} + onChange={handleChangeTab} + indicatorColor="primary" + textColor="primary" + variant="scrollable" + scrollButtons="on" + TabIndicatorProps={{ + style: { background: "#00bcd4" }, + }} + > + {tabs.map((tab) => ( + <StyledTab label={tab} key={tab} /> + ))} + </StyledTabs> + </NavBarContentContainer> + </RodapeDiv> + </UserProfileContainer> + </div> + </Grid> + <Grid item xs={12}> + {tabValue === 0 && <TabPanelAtividades id={id} />} + {tabValue === 1 && <TabPanelMeusRecursos id={id} />} + {tabValue === 2 && <TabPanelFavoritos id={id} />} + {tabValue === 3 && <TabPanelColecoes id={id} />} + {tabValue === 4 && <TabPanelRede id={id} />} + {tabValue === 5 && <TabPanelCuradoria id={id} />} + </Grid> + </Grid> + </BackgroundDiv> + </React.Fragment> + ] + ) + : + ( + <> + {redirect()} + </> + ) + } + </div> + ) } + +const StyledTab = styled(Tab)` + .Mui-selected { + border-bottom-color: #00bcd4 !important; + } + .MuiTab-wrapper { + border-bottom-color: #00bcd4 !important; + } +` diff --git a/src/Pages/UserTerms.js b/src/Pages/UserTerms.js index 2f6d9d9c798c8533f0b2831895dfaf60a4b096a6..d1df2973e336727e0517ecf7ba95716783865732 100644 --- a/src/Pages/UserTerms.js +++ b/src/Pages/UserTerms.js @@ -15,12 +15,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, { useEffect, useContext } from 'react'; +import React, { useEffect } from 'react'; import SimpleExpansionPanels from '../Components/ExpansionPanels' import Grid from '@material-ui/core/Grid'; -import { StyledButton } from '../Components/ButtonAvaliarRecurso.js' +import Modal from '../Components/Modal' import styled from 'styled-components' -import { Store } from '../Store' /*Importação de imagens para a página*/ import CadeadoAberto from "../img/termos/AbertoG.svg"; @@ -33,247 +32,252 @@ import { Banner } from "ImportImages.js"; import { Aberto } from "ImportImages.js"; import { Fechado } from "ImportImages.js"; -export const BannerStyle = styled.div` - background: ${props => props.contrast === "" ? "" : "black"}; - width: 100%; - background-image: ${props => props.contrast === "" ? `url(${Banner})` : ""}; - background-size: cover; - background-position: top center; - height: 370px; - vertical-align: "middle"; - border-bottom: ${props => props.contrast === "" ? "1px solid black" : "1px solid white"}; +const BannerStyle = styled.div` + width: 100%; + background-image: url(${Banner}); + background-size: cover; + background-position: top center; + height: 370px; + + verticalAlign: "middle" ` const AColorido = styled.a` - color: ${props => props.contrast === "" ? "#00BCD4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; + + color: #00BCD4; + text-decoration:none; + ` const ImagemSeçao2 = styled.div` - padding: 0 5%; - font-family: "Roboto", sans-serif; - background: ${props => props.contrast === "" ? "" : "black"}; - color: ${props => props.contrast === "" ? "rgba(0,0,0,0.87)" : "white"}; - - @media (min-width:750px) { - background-image: url(${BuscaTermos}); - background-position: right; - background-size: contain; - background-repeat: no-repeat; - } - - height: auto; - align-items: center; - padding-block: 30px; - h3 { - line-height: 1.1; - text-align: center; - @media (min-width: 1000px) { - font-size: 30px; - } - - @media (max-width: 1000px){ - font-size: 20px; - } - margin-top: 20px; - margin-bottom: 10px; - font-weight: 100; - padding-bottom: 20px; + font-family: Roboto, sans-serif; + + @media (min-width:1450px) { + background-image: url(${BuscaTermos}); + background-position: right; + background-size: contain; + background-repeat: no-repeat; + } + color: rgba(0,0,0,0.87); + height: auto; + align-items: center; + padding-block: 30px; + h3 { + line-height: 1.1; + text-align: center; + @media (min-width: 1000px) { + font-size: 30px; } - p { - line-height: 1.42857143; - padding-top: 20px; - font-size: 14px; - text-align: justify; - margin: 0 0 10px; + @media (max-width: 1000px){ + font-size: 20px; } + margin-top: 20px; + margin-bottom: 10px; + font-weight: 100; + padding-bottom: 20px; + + } + + p { + line-height: 1.42857143; + padding-top: 20px; + font-size: 14px; + text-align: justify; + margin: 0 0 10px; + } +} ` const Secao3 = styled.div` - padding: 20px 5%; - background: ${props => props.contrast === "" ? "#FF7F00" : "black"}; - @media (min-width: 1000px) { - background-image: url(${CadeadoAberto}), url(${CadeadoFechado}); - background-repeat: no-repeat; - background-position: bottom left, bottom right; - background-position-y: 120%, 120%; - height:340px; - padding-block:30px; + background-color: #FF7F00; + @media (min-width: 1000px) { + background-image: url(${CadeadoAberto}), url(${CadeadoFechado}); + background-repeat: no-repeat; + background-position: bottom left, bottom right; + background-position-y: 120%, 120%; + height:340px; + padding-block:30px; + } + + color: #fff; + + text-align: left; + + h3 { + font-family: 'Pompiere', cursive; + font-size: 46px; + padding-bottom: 20px; + margin-top: 20px; + margin-bottom: 10px; + width: 100%; + text-align: center !important; + font-weight: 500 ; + + } + + .aberto { + background-image: url(${Aberto}), url(${Linha}); + } + .fechado { + background-image: url(${Fechado}), url(${Linha}); + } + + .caixa { + background-repeat: no-repeat; + background-size: 70px 70px, auto auto; + background-position: top left; + background-position-x: 0, 35px; + padding-left: 90px; + .texto{ + background-image: url(${Linha}); + background-position: top left; + background-repeat: repeat-x; + background-size: auto auto; + span { + font-size: 26px; + } + p { + text-align: left; + font-size: 15px; + margin: 0 0 10px; + } } + } +` - color: #fff; +const Secao4 = styled.div` + font-size: 15px; + .texto { text-align: left; + padding-top: 20px; + padding-bottom: 20px; - h3 { - font-family: 'Pompiere', cursive; - font-size: 46px; - padding-bottom: 20px; - margin-top: 20px; - margin-bottom: 10px; - width: 100%; - text-align: center !important; - font-weight: 500 ; - - } - - .aberto { - background-image: url(${Aberto}), url(${Linha}); - } - .fechado { - background-image: url(${Fechado}), url(${Linha}); + a { + color:#00BCD4; } - .caixa { - background-repeat: no-repeat; - background-size: 70px 70px, auto auto; - background-position: top left; - background-position-x: 0, 35px; - padding-left: 90px; - .texto{ - background-image: url(${Linha}); - background-position: top left; - background-repeat: repeat-x; - background-size: auto auto; - span { - font-size: 26px; - } - p { - text-align: left; - font-size: 15px; - margin: 0 0 10px; - } - } + p { + font-family: 'Roboto', Bold; } -` - -const Secao4 = styled.div` - padding: 0 5%; - font-size: 15px; - background: ${props => props.contrast === "" ? "" : "black"}; - - .texto { - text-align: left; - padding-top: 20px; - padding-bottom: 20px; - color: ${props => props.contrast === "" ? "rgba(0,0,0,0.87)" : "white"}; - a { - color: ${props => props.contrast === "" ? "#00BCD4" : "yellow"}; - text-decoration: ${props => props.contrast === "" ? "none" : "underline"}; - } - - p { - font-family: 'Roboto', Bold; - color: ${props => props.contrast === "" ? "rgba(0,0,0,0.87)" : "white"}; - } + } + .titulo { + text-align: center; + color: #666666; + h3 { + font-size: 30px; + height: 22px; + padding-bottom: 20px; + margin-top: 20px; + margin-bottom: 10px; + font-weight: 500; + line-height: 1.1; + } + p { + height: 18px; + line-height: 1.42857143; + margin: 0 0 10px; } - - .titulo { - text-align: center; - color: ${props => props.contrast === "" ? "#666" : "white"}; - h3 { - font-size: 30px; - height: 22px; - padding-bottom: 20px; - margin-top: 20px; - margin-bottom: 10px; - font-weight: 500; - line-height: 1.1; - } - p { - height: 18px; - line-height: 1.42857143; - margin: 0 0 10px; - } ` + export default function UserTerms() { - const { state } = useContext(Store) - useEffect(() => { - window.scrollTo(0, 0) - }, []) - return ( - <div style={{ color: "rgba(0,0,0,0.87" }} > - <BannerStyle contrast={state.contrast}> - <h2 style={{ width: "100%", textAlign: "center", marginTop: "0px", paddingTop: "6rem", marginBottom: "16px", fontSize: "52px", fontFamily: "'Pompiere', cursive", color: "#fff", fontWeight: "500" }}>TERMOS DE USO</h2> - <div style={{ display: "flex", justifyContent: "center" }}> - <StyledButton contrast={state.contrast} onClick={() => window.location.href='/termos-resumido'}> - Se preferir, veja a versão resumida - </StyledButton> - </div> - </BannerStyle> - - <ImagemSeçao2 contrast={state.contrast}> - <Grid container> - <Grid item xs={12} md={12}> - <div> - <h3><strong style={{ fontWeight: "700" }}>Plataforma Integrada de Recursos Educacionais Digitais,</strong><br />uma iniciativa do Ministério da Educação!</h3> - - <p>A <strong>Plataforma Integrada de RED do MEC</strong> é parte do processo de implementação do Compromisso 6 do <AColorido contrast={state.contrast} href="http://www.governoaberto.cgu.gov.br/noticias/2017/3o-plano-de-acao-nacional-na-parceria-para-governo-aberto" target="_blank">3º Plano de Ação da Parceria Governo Aberto</AColorido> (OGP-Brasil), que tem por objetivo “incorporar na política educacional o potencial da cultura digital, de modo a fomentar a autonomia para uso, reuso e adaptação de recursos educacionais digitais, valorizando a pluralidade e a diversidade da educação brasileira”. - </p> - <p>Seguindo o compromisso, a <strong>Plataforma Integrada de RED do MEC</strong> visa fortalecer a distribuição de recursos educacionais digitais para o ensino básico brasileiro. Há preferência pela disponibilização de Recursos Educacionais Abertos (REA), ou seja, recursos que “se situem no domínio público ou que tenham sido divulgados sob licença aberta que permita acesso, uso, adaptação e redistribuição gratuita por terceiros, mediante nenhuma restrição ou poucas restrições.” <AColorido contrast={state.contrast} href="http://www.unesco.org/new/fileadmin/MULTIMEDIA/HQ/CI/CI/pdf/Events/Portuguese_Paris_OER_Declaration.pdf" target="_blank">(Declaração REA de Paris, 2012)</AColorido>. - </p> - </div> - </Grid> - </Grid> - </ImagemSeçao2> - - <Secao3 contrast={state.contrast}> - <Grid container > - <h3>Para melhor compreensão, podemos dividir os recursos em dois tipos:</h3> - <Grid item xs={12} md={6} > - <div class="caixa aberto"> - <div class="texto"> - <span>Abertos</span> - <p>De acordo com a Declaração de Paris, são recursos que, no mínimo, têm uma licença de uso mais flexível, que garante livre redistribuição. Adicionalmente, um recurso aberto deve utilizar um formato aberto, um formato de arquivo que permite a fácil edição por terceiros. Nenhum controle sobre o acesso (como cadastro e senha) deve existir para acesso a recursos abertos. Em sua maioria, são recursos gratuitos.</p> - </div> - </div> - </Grid> - <Grid item xs={12} md={6}> - <div class="caixa fechado"> - <div class="texto"> - <span>Fechados</span> - <p>São recursos que criam restrições no seu acesso, uso ou reuso. Como exemplo, podemos mencionar recursos que só são acessíveis mediante cadastro ou que têm licenças restritivas (como “todos os direitos reservados”, o símbolo ©). Podem ser gratuitos ou pagos.</p> - </div> - </div> - </Grid> - </Grid> - </Secao3> - - <Grid container style={state.contrast === "" ? {} : { backgroundColor: "black" }}> - <Grid item xs={12} md={12}> - <Secao4 contrast={state.contrast}> - <div class="texto" style={{ paddingTop: "70px" }}> - <p>O <a href="http://www.planalto.gov.br/ccivil_03/_ato2011-2014/2014/lei/l13005.htm" rel="noreferrer" target="_blank">Plano Nacional de Educação</a> (2014-2024) enfatiza nas metas 5 e 7 a importância dos recursos educacionais abertos para fomentar a qualidade da educação básica. A <a href="http://portal.mec.gov.br/index.php?option=com_docman&view=download&alias=35541-res-cne-ces-001-14032016-pdf&category_slug=marco-2016-pdf&Itemid=30192" rel="noreferrer" target="_blank">Resolução CNE/CES nº 1</a>, de 11 de março de 2016, também destaca a importância dos recursos educacionais abertos para as instituições de educação superior e para as atividades de educação a distância.</p> - </div> - <div class="titulo"> - <h3>TERMOS DE USO</h3> - <p>Início da vigência: agosto de 2017</p> - </div> - <div class="texto" style={{ paddingBottom: "40px" }}> - <p>Aqui estão os “Termos de Uso” da <strong>Plataforma Integrada de RED do MEC</strong>, isto é, as regras de funcionamento da Plataforma e seus serviços, e o que se espera de seus usuários. Por “usuário”, entende-se qualquer pessoa que acesse o domínio portal.mec.gov.br, tanto para pesquisa (acesso) como para a inclusão de dados e informações (participação) mediante cadastro.</p> - <p>Fazem parte dos Termos de Uso as políticas de responsabilidade, de privacidade e confidencialidade, a licença de uso do conteúdo e as informações sobre como reportar violações.</p> - <p>Ao utilizar a <strong>Plataforma Integrada de RED do MEC</strong>, o usuário aceita todas as condições aqui estabelecidas. O uso da <strong>Plataforma Integrada de RED do MEC</strong> implica aceite das condições aqui elencadas.</p> - <p>Por “serviço”, entende-se qualquer funcionalidade ou ferramenta que permita a interatividade com o usuário, como, por exemplo, usuário subir um recurso, postar um comentário, criar uma coleção ou enviar uma mensagem.</p> - <p>A aceitação destes "Termos de Uso" é indispensável à utilização da <strong>Plataforma Integrada de RED do MEC</strong>. Todos os usuários deverão ler, certificar-se de tê-los entendido e aceitar todas as condições neles estabelecidas. Dessa forma, deve ficar claro que a utilização desta "<strong>Plataforma Integrada de RED do MEC</strong>" implica aceitação completa deste documento intitulado Termos de Uso. Caso tenha dúvidas sobre os termos, utilize o formulário disponível em “Contato” para saná-las.</p> - </div> - </Secao4> - </Grid> - </Grid> - - <Grid container style={state.contrast === "" ? { padding: "0 5%" } : { backgroundColor: "black", padding: "0 5%" }}> - <Grid item xs={12} md={12}> - <div style={{ marginBottom: "50px", paddingTop: "20px" }}> - <SimpleExpansionPanels contrast={state.contrast} /> - </div> - </Grid> - </Grid> - </div> - ); + useEffect(() => { + window.scrollTo(0, 0) + }, []) + return ( + <div style={{ color: "rgba(0,0,0,0.87" }} > + + + <BannerStyle> + <h2 style={{ width: "100%", textAlign: "center", marginTop: "0px", paddingTop: "6rem", marginBottom: "16px", fontSize: "52px", fontFamily: "'Pompiere', cursive", color: "#fff", fontWeight: "500" }}>TERMOS DE USO</h2> + <Modal /> + </BannerStyle> + + <ImagemSeçao2> + <Grid container > + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={10}> + <div> + <h3><strong style={{ fontWeight: "700" }}>Plataforma Integrada de Recursos Educacionais Digitais,</strong><br />uma iniciativa do Ministério da Educação!</h3> + + <p>A <strong>Plataforma Integrada de RED do MEC</strong> é parte do processo de implementação do Compromisso 6 do <AColorido href="http://www.governoaberto.cgu.gov.br/noticias/2017/3o-plano-de-acao-nacional-na-parceria-para-governo-aberto" target="_blank">3º Plano de Ação da Parceria Governo Aberto</AColorido> (OGP-Brasil), que tem por objetivo “incorporar na política educacional o potencial da cultura digital, de modo a fomentar a autonomia para uso, reuso e adaptação de recursos educacionais digitais, valorizando a pluralidade e a diversidade da educação brasileira”. + </p> + <p>Seguindo o compromisso, a <strong>Plataforma Integrada de RED do MEC</strong> visa fortalecer a distribuição de recursos educacionais digitais para o ensino básico brasileiro. Há preferência pela disponibilização de Recursos Educacionais Abertos (REA), ou seja, recursos que “se situem no domínio público ou que tenham sido divulgados sob licença aberta que permita acesso, uso, adaptação e redistribuição gratuita por terceiros, mediante nenhuma restrição ou poucas restrições.” <AColorido href="http://www.unesco.org/new/fileadmin/MULTIMEDIA/HQ/CI/CI/pdf/Events/Portuguese_Paris_OER_Declaration.pdf" target="_blank">(Declaração REA de Paris, 2012)</AColorido>. + </p> + </div> + </Grid> + <Grid item xs={12} md={1}></Grid> + </Grid> + </ImagemSeçao2> + + <Secao3 > + <Grid container > + <h3>Para melhor compreensão, podemos dividir os recursos em dois tipos:</h3> + <Grid item xs={12} md={1} ></Grid> + <Grid item xs={12} md={5} > + <div class="caixa aberto"> + <div class="texto"> + <span>Abertos</span> + <p>De acordo com a Declaração de Paris, são recursos que, no mínimo, têm uma licença de uso mais flexível, que garante livre redistribuição. Adicionalmente, um recurso aberto deve utilizar um formato aberto, um formato de arquivo que permite a fácil edição por terceiros. Nenhum controle sobre o acesso (como cadastro e senha) deve existir para acesso a recursos abertos. Em sua maioria, são recursos gratuitos.</p> + </div> + </div> + </Grid> + + <Grid item xs={12} md={5}> + <div class="caixa fechado"> + <div class="texto"> + <span>Fechados</span> + <p>São recursos que criam restrições no seu acesso, uso ou reuso. Como exemplo, podemos mencionar recursos que só são acessíveis mediante cadastro ou que têm licenças restritivas (como “todos os direitos reservados”, o símbolo ©). Podem ser gratuitos ou pagos.</p> + </div> + </div> + </Grid> + <Grid item xs={12} md={1} ></Grid> + </Grid> + </Secao3> + + + + + <Grid container > + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={10}> + <Secao4> + <div class="texto" style={{ paddingTop: "70px" }}> + <p>O <a href="http://www.planalto.gov.br/ccivil_03/_ato2011-2014/2014/lei/l13005.htm" rel="noreferrer" target="_blank">Plano Nacional de Educação</a> (2014-2024) enfatiza nas metas 5 e 7 a importância dos recursos educacionais abertos para fomentar a qualidade da educação básica. A <a href="http://portal.mec.gov.br/index.php?option=com_docman&view=download&alias=35541-res-cne-ces-001-14032016-pdf&category_slug=marco-2016-pdf&Itemid=30192" rel="noreferrer" target="_blank">Resolução CNE/CES nº 1</a>, de 11 de março de 2016, também destaca a importância dos recursos educacionais abertos para as instituições de educação superior e para as atividades de educação a distância.</p> + </div> + <div class="titulo"> + <h3>TERMOS DE USO</h3> + <p>Início da vigência: agosto de 2017</p> + </div> + <div class="texto" style={{ paddingBottom: "40px" }}> + <p>Aqui estão os “Termos de Uso” da <strong>Plataforma Integrada de RED do MEC</strong>, isto é, as regras de funcionamento da Plataforma e seus serviços, e o que se espera de seus usuários. Por “usuário”, entende-se qualquer pessoa que acesse o domínio portal.mec.gov.br, tanto para pesquisa (acesso) como para a inclusão de dados e informações (participação) mediante cadastro.</p> + <p>Fazem parte dos Termos de Uso as políticas de responsabilidade, de privacidade e confidencialidade, a licença de uso do conteúdo e as informações sobre como reportar violações.</p> + <p>Ao utilizar a <strong>Plataforma Integrada de RED do MEC</strong>, o usuário aceita todas as condições aqui estabelecidas. O uso da <strong>Plataforma Integrada de RED do MEC</strong> implica aceite das condições aqui elencadas.</p> + <p>Por “serviço”, entende-se qualquer funcionalidade ou ferramenta que permita a interatividade com o usuário, como, por exemplo, usuário subir um recurso, postar um comentário, criar uma coleção ou enviar uma mensagem.</p> + <p>A aceitação destes "Termos de Uso" é indispensável à utilização da <strong>Plataforma Integrada de RED do MEC</strong>. Todos os usuários deverão ler, certificar-se de tê-los entendido e aceitar todas as condições neles estabelecidas. Dessa forma, deve ficar claro que a utilização desta "<strong>Plataforma Integrada de RED do MEC</strong>" implica aceitação completa deste documento intitulado Termos de Uso. Caso tenha dúvidas sobre os termos, utilize o formulário disponível em “Contato” para saná-las.</p> + </div> + </Secao4> + </Grid> + <Grid item xs={12} md={1}></Grid> + </Grid> + + + <Grid container > + <Grid item xs={12} md={1}></Grid> + <Grid item xs={12} md={10}> + <div style={{ marginBottom: "50px", paddingTop: "20px" }}> + <SimpleExpansionPanels /> + </div> + </Grid> + <Grid item xs={12} md={1}></Grid> + </Grid> + </div> + ); } diff --git a/src/Store.js b/src/Store.js index 6b8598b60a56213ce5f355eff17e67ede4370736..0cb5c0333ff49866a8125e8eb30e88582a815db9 100644 --- a/src/Store.js +++ b/src/Store.js @@ -21,170 +21,158 @@ import React from 'react' export const Store = React.createContext() const initialState = { - searchOpen: false, - userIsLoggedIn: false, - userAgreedToPublicationTerms: false, - userAgreedToPublicationPermissions: false, - modalColaborarPlataformaOpen: false, - search: { - query: '*', - class: 'LearningObject' - }, - windowSize: { - width: 0, - height: 0 - }, - currentUser: { - askTeacherQuestion: false, - id: '', - name: '', - email: '', - avatar: '', - cover: '', - uid: '', - follows_count: 0, - collections_count: 0, - submitter_request: 'default', - roles: [] - }, - contrast: '', - fontSize: 15, + searchOpen: false, + userIsLoggedIn : false, + userAgreedToPublicationTerms: false, + userAgreedToPublicationPermissions: false, + modalColaborarPlataformaOpen : false, + search: { + query: '*', + class: 'LearningObject' + }, + windowSize: { + width: 0, + height: 0 +}, + currentUser: { + askTeacherQuestion : false, + id : '', + name : '', + email : '', + avatar : '', + cover : '', + uid : '', + follows_count : 0, + collections_count : 0, + submitter_request : 'default', + roles : [] + } } function reducer(state, action) { - switch (action.type) { - case 'SET_CONTRAST': - return { - ...state, - contrast: action.payload - }; - case 'SET_FONT_SIZE': - return { - ...state, - fontSize: action.payload - }; - case 'SAVE_SEARCH': - return { - ...state, - search: action.newSearch - } - case 'HANDLE_SEARCH_BAR': - return { - ...state, - searchOpen: action.opened - } - case 'WINDOW_SIZE': - return { - ...state, - windowSize: action.innerWindow - } - case 'USER_LOGGED_IN': - if (action.login.avatar_file_name) { - Object.defineProperty(action.login, 'avatar', - Object.getOwnPropertyDescriptor(action.login, 'avatar_file_name')); - delete action.login['avatar_file_name']; - } - if (action.login.cover_file_name) { - Object.defineProperty(action.login, 'cover', - Object.getOwnPropertyDescriptor(action.login, 'cover_file_name')); - delete action.login['cover_file_name']; - } - return { - ...state, - userIsLoggedIn: action.userLoggedIn, - currentUser: action.login - } - case 'USER_SIGNED_UP': - return { - ...state, - userIsLoggedIn: action.userLoggedIn, - currentUser: action.user - } - case 'USER_LOGGED_OUT': - localStorage.clear() - return { - ...state, - userIsLoggedIn: action.userLoggedOut, - currentUser: { - askTeacherQuestion: false, - id: '', - name: '', - email: '', - avatar_file_name: '', - cover_file_name: '', - uid: '', - follows_count: 0, - collections_count: 0, - submitter_request: 'default', - roles: [] - }, - userAgreedToPublicationTerms: false, - userAgreedToPublicationPermissions: false - } - case 'USER_AGREED_TO_PUBLICATION_TERMS': - return { - ...state, - userAgreedToPublicationTerms: action.userAgreement - } - case 'USER_AGREED_TO_PUBLICATION_PERMISSIONS': - return { - ...state, - userAgreedToPublicationPermissions: action.userAgreement - } - case 'USER_ACCESSED_USER_PAGE': - return { - ...state, - currentUser: action.set - } - case 'USER_CHANGED_COVER': - return { - ...state, - currentUser: action.currUser - } - case 'USER_DELETED_ACCOUNT': - localStorage.clear() - return { - ...state, - userIsLoggedIn: false, - currentUser: { - askTeacherQuestion: false, - id: '', - name: '', - email: '', - avatar_file_name: '', - cover_file_name: '', - uid: '', - follows_count: 0, - collections_count: 0, - submitter_request: 'default', - roles: [] - }, - } - case 'TOGGLE_MODAL_COLABORAR_PLATAFORMA': - return { - ...state, - modalColaborarPlataformaOpen: action.modalColaborarPlataformaOpen - } - case 'GET_USER': - return { - ...state, - currentUser: action.user - } - case 'USER_UPDATED_EMAIL': - return { - ...state, - currentUser: action.currUser - } - default: - return state + switch (action.type){ + case 'SAVE_SEARCH': + return { + ...state, + search: action.newSearch + } + case 'HANDLE_SEARCH_BAR': + return { + ...state, + searchOpen: action.opened + } + case 'WINDOW_SIZE': + return { + ...state, + windowSize: action.innerWindow + } + case 'USER_LOGGED_IN': + if (action.login.avatar_file_name) { + Object.defineProperty(action.login, 'avatar', + Object.getOwnPropertyDescriptor(action.login, 'avatar_file_name')); + delete action.login['avatar_file_name']; + } + if (action.login.cover_file_name) { + Object.defineProperty(action.login, 'cover', + Object.getOwnPropertyDescriptor(action.login, 'cover_file_name')); + delete action.login['cover_file_name']; + } + return { + ...state, + userIsLoggedIn:action.userLoggedIn, + currentUser:action.login } + case 'USER_SIGNED_UP': + return { + ...state, + userIsLoggedIn:action.userLoggedIn, + currentUser:action.user + } + case 'USER_LOGGED_OUT': + localStorage.clear() + return { + ...state, + userIsLoggedIn:action.userLoggedOut, + currentUser:{ + askTeacherQuestion : false, + id : '', + name : '', + email : '', + avatar_file_name : '', + cover_file_name : '', + uid : '', + follows_count : 0, + collections_count : 0, + submitter_request : 'default', + roles : [] + }, + userAgreedToPublicationTerms: false, + userAgreedToPublicationPermissions: false + } + case 'USER_AGREED_TO_PUBLICATION_TERMS': + return { + ...state, + userAgreedToPublicationTerms: action.userAgreement + } + case 'USER_AGREED_TO_PUBLICATION_PERMISSIONS': + return { + ...state, + userAgreedToPublicationPermissions : action.userAgreement + } + case 'USER_ACCESSED_USER_PAGE': + return { + ...state, + currentUser : action.set + } + case 'USER_CHANGED_COVER': + return { + ...state, + currentUser : action.currUser + } + case 'USER_DELETED_ACCOUNT': + localStorage.clear() + return { + ...state, + userIsLoggedIn:false, + currentUser: { + askTeacherQuestion : false, + id : '', + name : '', + email : '', + avatar_file_name : '', + cover_file_name : '', + uid : '', + follows_count : 0, + collections_count : 0, + submitter_request : 'default', + roles : [] + }, + } + case 'TOGGLE_MODAL_COLABORAR_PLATAFORMA': + return { + ...state, + modalColaborarPlataformaOpen : action.modalColaborarPlataformaOpen + } + case 'GET_USER': + return { + ...state, + currentUser:action.user + } + case 'USER_UPDATED_EMAIL': + return { + ...state, + currentUser : action.currUser + } + default: + return state + } } export function StoreProvider(props) { const [state, dispatch] = React.useReducer(reducer, initialState); - const value = { state, dispatch }; + const value = { state, dispatch }; return ( <Store.Provider value={value}> {props.children} diff --git a/src/img/OffContrastIcon.png b/src/img/OffContrastIcon.png deleted file mode 100644 index f44e653f9499dec5cfc293de994c1081ff9c64ec..0000000000000000000000000000000000000000 Binary files a/src/img/OffContrastIcon.png and /dev/null differ diff --git a/src/img/OnContrastIcon.png b/src/img/OnContrastIcon.png deleted file mode 100644 index 3ae2fd847b997f007110cfb4d85930f639714ab5..0000000000000000000000000000000000000000 Binary files a/src/img/OnContrastIcon.png and /dev/null differ diff --git a/src/img/termos/handshake.svg b/src/img/termos/handshake.svg index 4ace30bff59d40ed3ba50c1f93951c18856e4dfd..7bde658e631f91995a5aed3591aa46b202295bb2 100644 --- a/src/img/termos/handshake.svg +++ b/src/img/termos/handshake.svg @@ -6,9 +6,9 @@ <path d="M117.537 114.957C117.537 114.957 156.706 141.311 156.616 149.654C156.515 159.107 146.919 163.575 139.855 158.654C132.79 153.732 106.434 132.572 106.434 132.572" stroke="white" stroke-width="2" stroke-miterlimit="10"/> <path d="M185.722 2.01043L162.527 16.4248L210.805 94.4066L233.999 79.9922L185.722 2.01043Z" stroke="white" stroke-width="2" stroke-miterlimit="10"/> <path d="M2.0007 79.9816L25.1953 94.396L73.4726 16.4142L50.278 1.99984L2.0007 79.9816Z" stroke="white" stroke-width="2" stroke-miterlimit="10"/> -<path d="M57.1547 103.426L57.1506 103.423C51.5036 98.8576 43.232 99.7433 38.6754 105.401L30.5923 115.438C26.0358 121.095 26.9198 129.383 32.5668 133.948L32.5709 133.951C38.2179 138.517 46.4895 137.631 51.0461 131.973L59.1291 121.937C63.6857 116.279 62.8017 107.991 57.1547 103.426Z" fill="none" stroke="white" stroke-width="2" stroke-miterlimit="10"/> -<path d="M76.2726 136.557C80.1935 131.688 79.4338 124.557 74.5757 120.63C69.7176 116.702 62.6008 117.465 58.6798 122.334L50.8611 132.042C46.9401 136.911 47.6999 144.041 52.558 147.969C57.4161 151.896 64.5329 151.134 68.4538 146.265L76.2726 136.557Z" fill="none" stroke="white" stroke-width="2" stroke-miterlimit="10"/> -<path d="M94.3195 153.237C98.2404 148.369 97.4807 141.238 92.6226 137.311C87.7645 133.383 80.6476 134.146 76.7267 139.014L68.9079 148.723C64.987 153.591 65.7468 160.722 70.6049 164.65C75.463 168.577 82.5798 167.814 86.5007 162.946L94.3195 153.237Z" fill="none" stroke="white" stroke-width="2" stroke-miterlimit="10"/> -<path d="M110.877 163.334C114.192 159.218 113.549 153.189 109.44 149.868C105.332 146.547 99.3147 147.191 95.9999 151.307L89.3855 159.52C86.0707 163.636 86.7138 169.665 90.8219 172.986C94.9301 176.308 100.948 175.663 104.262 171.547L110.877 163.334Z" fill="none" stroke="white" stroke-width="2" stroke-miterlimit="10"/> +<path d="M57.1547 103.426L57.1506 103.423C51.5036 98.8576 43.232 99.7433 38.6754 105.401L30.5923 115.438C26.0358 121.095 26.9198 129.383 32.5668 133.948L32.5709 133.951C38.2179 138.517 46.4895 137.631 51.0461 131.973L59.1291 121.937C63.6857 116.279 62.8017 107.991 57.1547 103.426Z" fill="#1AB9DE" stroke="white" stroke-width="2" stroke-miterlimit="10"/> +<path d="M76.2726 136.557C80.1935 131.688 79.4338 124.557 74.5757 120.63C69.7176 116.702 62.6008 117.465 58.6798 122.334L50.8611 132.042C46.9401 136.911 47.6999 144.041 52.558 147.969C57.4161 151.896 64.5329 151.134 68.4538 146.265L76.2726 136.557Z" fill="#1AB9DE" stroke="white" stroke-width="2" stroke-miterlimit="10"/> +<path d="M94.3195 153.237C98.2404 148.369 97.4807 141.238 92.6226 137.311C87.7645 133.383 80.6476 134.146 76.7267 139.014L68.9079 148.723C64.987 153.591 65.7468 160.722 70.6049 164.65C75.463 168.577 82.5798 167.814 86.5007 162.946L94.3195 153.237Z" fill="#1AB9DE" stroke="white" stroke-width="2" stroke-miterlimit="10"/> +<path d="M110.877 163.334C114.192 159.218 113.549 153.189 109.44 149.868C105.332 146.547 99.3147 147.191 95.9999 151.307L89.3855 159.52C86.0707 163.636 86.7138 169.665 90.8219 172.986C94.9301 176.308 100.948 175.663 104.262 171.547L110.877 163.334Z" fill="#1AB9DE" stroke="white" stroke-width="2" stroke-miterlimit="10"/> <path d="M71.6484 24.2119L81.606 28.3382" stroke="white" stroke-width="2" stroke-miterlimit="10"/> </svg>