From 238ab6f952b7d4e77744dbf71e554b26ac97978b Mon Sep 17 00:00:00 2001 From: Vinicius Gabriel Machado <vgm18@inf.ufpr.br> Date: Mon, 19 Jul 2021 22:30:43 -0300 Subject: [PATCH] Removed unimported files --- package-lock.json | 5 - package.json | 1 - src/Admin/Components/Components/DataCard.js | 140 ----------- src/Components/AchievementDescriptionCard.js | 39 --- src/Components/CardOptions.js | 77 ------ src/Components/CollectionCard.js | 147 ----------- .../HelperFunctions/checkAccessLevel.js | 14 -- src/Components/LevelDescriptionCard.js | 67 ----- src/Components/NotificationsInner.js | 70 ------ src/Components/ReportCollectionForm.js | 103 -------- src/Components/RequirementsDialog.js | 61 ----- src/Components/ResourceCard.js | 208 ---------------- .../SearchExpansionPanel/SearchEPKeyWord.js | 167 ------------- src/Components/SearchList.js | 70 ------ src/Components/SearchSection.js | 100 -------- src/Components/Select.js | 76 ------ src/Components/ShinyProgressBar.js | 55 ----- src/Components/Sidebar.js | 88 ------- src/Components/StatsBar.js | 99 -------- .../PublicUserPageTabs/LastCollections.js | 84 ------- .../PublicUserPageTabs/LastLearnObj.js | 84 ------- .../TabPanels/TabPanelStatusEConquistas.js | 112 --------- src/Components/Tags.js | 19 -- .../UploadPageComponents/FileToUpload.ts | 106 -------- .../UploadPageComponents/FileUploadStage.js | 65 ----- .../UploadPageComponents/ReactFileToUpload.js | 113 --------- src/Components/stars.js | 230 ------------------ src/index.js | 2 +- tsconfig.json | 26 -- 29 files changed, 1 insertion(+), 2427 deletions(-) delete mode 100644 src/Admin/Components/Components/DataCard.js delete mode 100644 src/Components/AchievementDescriptionCard.js delete mode 100644 src/Components/CardOptions.js delete mode 100644 src/Components/CollectionCard.js delete mode 100644 src/Components/HelperFunctions/checkAccessLevel.js delete mode 100644 src/Components/LevelDescriptionCard.js delete mode 100644 src/Components/NotificationsInner.js delete mode 100644 src/Components/ReportCollectionForm.js delete mode 100644 src/Components/RequirementsDialog.js delete mode 100644 src/Components/ResourceCard.js delete mode 100644 src/Components/SearchExpansionPanel/SearchEPKeyWord.js delete mode 100644 src/Components/SearchList.js delete mode 100644 src/Components/SearchSection.js delete mode 100644 src/Components/Select.js delete mode 100644 src/Components/ShinyProgressBar.js delete mode 100644 src/Components/Sidebar.js delete mode 100644 src/Components/StatsBar.js delete mode 100644 src/Components/TabPanels/PublicUserPageTabs/LastCollections.js delete mode 100644 src/Components/TabPanels/PublicUserPageTabs/LastLearnObj.js delete mode 100644 src/Components/TabPanels/TabPanelStatusEConquistas.js delete mode 100644 src/Components/Tags.js delete mode 100644 src/Components/UploadPageComponents/FileToUpload.ts delete mode 100644 src/Components/UploadPageComponents/FileUploadStage.js delete mode 100644 src/Components/UploadPageComponents/ReactFileToUpload.js delete mode 100644 src/Components/stars.js delete mode 100644 tsconfig.json diff --git a/package-lock.json b/package-lock.json index 0ee36f7c..e4fb1c54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17332,11 +17332,6 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, - "typescript": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", - "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==" - }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", diff --git a/package.json b/package.json index a1486968..3406c486 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "react-scripts": "^2.1.8", "react-swipeable-views": "^0.13.9", "styled-components": "^4.4.1", - "typescript": "^4.3.5", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/src/Admin/Components/Components/DataCard.js b/src/Admin/Components/Components/DataCard.js deleted file mode 100644 index 9f5c565d..00000000 --- a/src/Admin/Components/Components/DataCard.js +++ /dev/null @@ -1,140 +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, { useState } from "react"; -// Maerial ui components -import Card from "@material-ui/core/Card"; -import CardContent from "@material-ui/core/CardContent"; -import Typography from "@material-ui/core/Typography"; -import Button from "@material-ui/core/Button"; -import ListRoundedIcon from "@material-ui/icons/ListRounded"; -import ButtonGroup from "@material-ui/core/ButtonGroup"; -import { useStyles } from "../Styles/DataCard"; -// Icons -import EditRoundedIcon from "@material-ui/icons/EditRounded"; -import ArrowBackIosIcon from "@material-ui/icons/ArrowBackIos"; - -const DataCard = (params) => { - console.log(params) - return( - <div> - {params.data} - </div> - ) - // const classes = useStyles(); - // const [edit, setEdit] = useState(false); - - // const buttonArr = [ - // { - // label: "Listar", - // icon: <ListRoundedIcon />, - // }, - // edit - // ? { - // label: "Voltar", - // icon: <ArrowBackIosIcon />, - // } - // : { - // label: "Editar", - // icon: <EditRoundedIcon />, - // }, - // ]; - - // //Change state of the var edit - // const EditHandler = () => { - // setEdit(!edit); - // }; - - // // it stores an function that will be called when a button is clicked - // const functionArr = [props.viewData, EditHandler]; - - // return ( - // edit ? - // <Card className={classes.root} variant="outlined"> - // <CardContent> - // <div className={classes.displayRow}> - // <Typography - // className={classes.title} - // color="inherit" - // gutterBottom - // > - // {props.data[1].prop} - // </Typography> - // <ButtonGroup - // color="primary" - // aria-label="outlined primary button group" - // > - // {buttonArr.map((button, index) => ( - // <Button onClick={functionArr[index]}> - // <div className={classes.displayRow}> - // {button.icon} - // {button.label} - // </div> - // </Button> - // ))} - // </ButtonGroup> - // </div> - - // {/* Display the edit area */} - // {props.component} - - // </CardContent> - // </Card> - // : - // <Card className={classes.root} variant="outlined"> - // <CardContent> - // <div className={classes.displayRow}> - // <Typography - // className={classes.title} - // color="inherit" - // gutterBottom - // > - // {props.data[1].prop} - // </Typography> - // <ButtonGroup - // color="primary" - // aria-label="outlined primary button group" - // > - // {buttonArr.map((button, index) => ( - // <Button onClick={functionArr[index]}> - // <div className={classes.displayRow}> - // {button.icon} - // {button.label} - // </div> - // </Button> - // ))} - // </ButtonGroup> - // </div> - // {props.data.map((info , index) => ( - // <div className={classes.displayColumn} key={index}> - // <Typography color="initial" className={classes.subTitle}> - // {info.subTitle} - // </Typography> - // <Typography color='textSecondary'> - // { - // info.prop === null ? 'Sem dados' : info.prop - // } - // </Typography> - // </div> - // ))} - // </CardContent> - // </Card> - // ); -} - -export default DataCard; diff --git a/src/Components/AchievementDescriptionCard.js b/src/Components/AchievementDescriptionCard.js deleted file mode 100644 index ad01fc46..00000000 --- a/src/Components/AchievementDescriptionCard.js +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react' -import styled from 'styled-components' -import Paper from '@material-ui/core/Paper'; -import { Grid } from '@material-ui/core' -import RequirementDialog from './RequirementsDialog.js'; - -export default function AchievementDescriptionCard(props) { - return ( - <Paper elevation={3}> - <Grid container direction="row" justify="space-around" alignItems="center"> - <Grid item xs={3}> - <AchievementImg src={props.src}/> - </Grid> - <Grid item xs={7}> - <AchievementTitle>{props.title}</AchievementTitle> - <AchievementDescription>{props.description}</AchievementDescription> - <RequirementDialog - title={props.title} - description={props.description} - requirements={props.requirements} - /> - </Grid> - </Grid> - </Paper> - ); -} - -const AchievementImg = styled.img` - border-radius: 100px; - width: 100px; - height: 100px; - margin: 30px; -` - -const AchievementTitle = styled.h2` -` - -const AchievementDescription = styled.p` -` diff --git a/src/Components/CardOptions.js b/src/Components/CardOptions.js deleted file mode 100644 index 4c10b423..00000000 --- a/src/Components/CardOptions.js +++ /dev/null @@ -1,77 +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 from 'react'; -import Button from '@material-ui/core/Button'; -import Menu from '@material-ui/core/Menu'; -import ListItemIcon from '@material-ui/core/ListItemIcon'; -import MenuItem from '@material-ui/core/MenuItem'; -import MoreVertIcon from '@material-ui/icons/MoreVert'; -import OpenIcon from '@material-ui/icons/OpenInNew'; -import DownloadIcon from '@material-ui/icons/CloudDownload'; -import ShareIcon from '@material-ui/icons/Share'; -import AddIcon from '@material-ui/icons/CreateNewFolder'; -import ReportIcon from '@material-ui/icons/Error'; - -export default function SimpleMenu() { - const [anchorEl, setAnchorEl] = React.useState(null); - - function handleClick(event) { - setAnchorEl(event.currentTarget); - } - - function handleClose() { - setAnchorEl(null); - } - - return ( - <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} - > - <MenuItem onClick={handleClose}> - <ListItemIcon><OpenIcon /></ListItemIcon>Abrir - </MenuItem> - - <MenuItem onClick={handleClose}> - <ListItemIcon><DownloadIcon /></ListItemIcon>Baixar - </MenuItem> - - <MenuItem onClick={handleClose}> - <ListItemIcon><ShareIcon /></ListItemIcon>Compartilhar - </MenuItem> - - <MenuItem onClick={handleClose}> - <ListItemIcon><AddIcon /></ListItemIcon>Guardar - </MenuItem> - - <MenuItem onClick={handleClose}> - <ListItemIcon><ReportIcon /></ListItemIcon>Reportar - </MenuItem> - - </Menu> - </div> - ); -} diff --git a/src/Components/CollectionCard.js b/src/Components/CollectionCard.js deleted file mode 100644 index 4da688db..00000000 --- a/src/Components/CollectionCard.js +++ /dev/null @@ -1,147 +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, {Component} from 'react'; -import './CardsAnimation.css'; -import {apiDomain} from '../env'; -import {Col,Row, Container} from 'react-grid-system'; -import Card from '@material-ui/core/Card'; -import CardContent from '@material-ui/core/CardContent'; -import CardActions from '@material-ui/core/CardActions'; -import IconButton from '@material-ui/core/IconButton'; -import FolderIcon from '@material-ui/icons/Folder'; -import FavoriteIcon from '@material-ui/icons/Favorite'; -import Rating from '@material-ui/lab/Rating'; -import StarBorderIcon from '@material-ui/icons/StarBorder'; - -//Image Import -import { noAvatar } from "ImportImages.js"; - -var authorStyle={ - position: "absolute", - display: "flex", - backgroundColor: "white", - opacity: "0.6", - bottom:"0", - width: "100%", - paddingTop: "20px" -}; -var pictureStyle={ - position: "absolute", - display: "flex", - backgroundColor: "white", - borderRadius: "50%", - bottom:"7%", - left: "37%", - height: "70px", - width: "70px", -}; -const slideStyle={ - height: "50px", - width: "50px", - backgroundColor: "white", - borderRadius: "50%", -}; -const publisherStyle={ - color: "white", - paddinLeft: "20px", - fontSize: "15px" - -}; -class RenderThumbs extends Component { - render(){ - if (this.props.thumbs) { - var array = this.props.thumbs.slice(0,4); - if (array.length < 3) { - return( - <img height="160" src={apiDomain+array[0]} alt="Thumbnail dos Recursos"/>) - } - return( - <Row> - {array.map(thumb => <Col style={{padding: "0px"}} md={6}><img key={thumb.id} height="80" src={apiDomain+thumb} alt="Thumbnail dos Recursos"/> </Col>)} - </Row> - ); - } - return(null); - } -} -class CollectionCard extends Component { - constructor(props){ - super(props); - this.state={ - userStyle: "animatiOff", - userAvatar: null, - }; - } - onHover(){ - this.setState({userStyle: "animatiOn"}); - } - onIddle(){ - this.setState({userStyle: "animatiOff"}) - } - defAvatar(){ - if (!this.state.userAvatar && (!this.props.avatar.length)){ - this.setState({userAvatar: noAvatar}); - } - if (!this.state.userAvatar && (this.props.avatar.length) ) { - this.setState({userAvatar:apiDomain+this.props.avatar}); - } - } - render(){ - this.defAvatar(); - return ( - <Card onMouseOver={this.onHover.bind(this)} onMouseOut={this.onIddle.bind(this)} > - - - <Container style={{padding:"0px", backgroundColor: "#673ab7"}}> - <div className={this.state.userStyle}> - <img style={slideStyle} src={this.state.userAvatar} alt="Avatar do usuário"/> - <div style={publisherStyle}>Enviado por: <br/>{this.props.author}</div> - <div> tags </div> - </div> - <RenderThumbs thumbs={this.props.thumbnail}/> - <div style={authorStyle}> - <div style={{textAlign: "center"}}>{this.props.name}</div> - </div> - <img style={pictureStyle} src={this.state.userAvatar} alt="Avatar do usuário"/> - - - </Container> - <CardContent style={{height: "60%", textAlign: "left", paddingBottom: "0px"}}> - </CardContent> - <Container style={{textAlign: "left"}}> - <Rating - name="customized-empty" - value={this.props.rating*100} - precision={0.5} - emptyIcon={<StarBorderIcon fontSize="inherit" />} - /> - </Container> - <CardActions style={{justifyContent: "space-between"}}> - <FolderIcon style={{color:"#673ab7"}} /> - <IconButton aria-label="Favoritar" size="small"> - <FavoriteIcon /> - </IconButton> - </CardActions> - - </Card> - );} - } - - -export default CollectionCard; diff --git a/src/Components/HelperFunctions/checkAccessLevel.js b/src/Components/HelperFunctions/checkAccessLevel.js deleted file mode 100644 index 5cc5ea4b..00000000 --- a/src/Components/HelperFunctions/checkAccessLevel.js +++ /dev/null @@ -1,14 +0,0 @@ -import React, {useContext} from 'react' -import {Store} from '../../Store.js' - -export function checkAccessLevel (levelToCheck) { - const {state} = useContext(Store) - - if (state.currentUser.id != '') { - return(checkUserRole(levelToCheck)) - } - - const checkUserRole = (userRole) => { - return(state.currentUser.roles.filter((role) => role.name === userRole).length > 0) - } -} diff --git a/src/Components/LevelDescriptionCard.js b/src/Components/LevelDescriptionCard.js deleted file mode 100644 index 7c55a81f..00000000 --- a/src/Components/LevelDescriptionCard.js +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react'; - -import styled from 'styled-components' -import ShinyProgressBar from './ShinyProgressBar.js' -import { Grid } from '@material-ui/core' - -export default function LevelDescriptionCard(props) { - - return ( - <LevelDescDiv> - <Grid container direction="row" justify="space-between" alignItems="center"> - <Grid item xs={6} md={4}> - <CurrentLevelNumber> - NÃvel {props.level} - </CurrentLevelNumber> - <CurrentLevelXP> - XP {props.xp} - </CurrentLevelXP> - </Grid> - <Grid item xs={6} md={4} alignContent='flex-end'> - <CurrentCoins> - {props.coins} COINS - </CurrentCoins> - <NextLevelXP> - {props.xp_to_next_lvl} XP PARA O NÃVEL {props.level+1} - </NextLevelXP> - </Grid> - <ShinyProgressBar percentage={props.bar_size} /> - </Grid> - </LevelDescDiv> - ); -} - -const NextLevelXP = styled.p` - text-align: right; - font-size: large; - font-weight: 500; - color: #575757; - margin-right: 30px; -` - -const CurrentCoins = styled.p` - text-align: right; - font-size: x-large; - font-weight: 500; - color: #575757; - margin-right: 30px; -` - -const CurrentLevelNumber = styled.h1` - font-weight: 500; - font-size: 40px; - color: #646464; - margin-left: 30px; -` - -const CurrentLevelXP = styled.h2` - font-size: x-large; - font-weight: 500; - color: #00A5B9; - margin-left: 30px; -` - -const LevelDescDiv = styled.div` - margin: 20px; - padding: 20px; -` diff --git a/src/Components/NotificationsInner.js b/src/Components/NotificationsInner.js deleted file mode 100644 index 46302879..00000000 --- a/src/Components/NotificationsInner.js +++ /dev/null @@ -1,70 +0,0 @@ -import React, {useState, useContext, useEffect} from 'react' -import styled from 'styled-components' -import {apiDomain} from '../env.js' -import ActivityListItem from './ActivityListItem.js' -import {getRequest} from './HelperFunctions/getAxiosConfig' - -export default function NotificationInner (props) { - const [notifications, setNotifications] = useState([]); - const [notificatonsLength, setLength] = useState(0); - - function handleSuccess (data) { - setNotifications(data) - setLength(data.length) - } - useEffect(() => { - const url = `/feed?offset=0&limit=30` - - getRequest(url, handleSuccess, (error) => {console.log('error while running getNotifications')}) - }, []) - - return ( - <ContainerDiv> - <div className="cabecalho"> - <span style={{fontSize : "15px"}}>NOTIFICAÇÕES •</span> - <span className="cabecalho-marcar">Marcar todas como lidas</span> - </div> - { - notifications.map( (notification) => - <ActivityListItem - onMenuBar={true} - avatar = {notification.owner.avatar ? apiDomain + notification.owner.avatar : null} - 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} - /> - ) - } - </ContainerDiv> - - ) -} - -const ContainerDiv = styled.div` - margin-top : 10px; - right : 5%; - width : 360px; - max-height : 400px; - position : absolute; - box-shadow : 8px 8px 8px 8px - rgba(0,0,0,.1); - overflow-y : scroll; - padding : 5px 5px 5px 5px; - min-width : 160px; - - .cabecalho { - border-bottom : 1px solid #666; - - .cabecalho-marcar { - font-family: Lato,bold; - font-size: 12px; - -webkit-text-decoration-line: underline; - text-decoration-line: underline; - float: right; - } - } -` diff --git a/src/Components/ReportCollectionForm.js b/src/Components/ReportCollectionForm.js deleted file mode 100644 index 34fd87b2..00000000 --- a/src/Components/ReportCollectionForm.js +++ /dev/null @@ -1,103 +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 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 FormControl from '@material-ui/core/FormControl'; -import TextField from '@material-ui/core/TextField'; -import {StyledFormControl, StyledTextField, ButtonsDiv, ButtonCancelar, ButtonEnviar} from './ReportUserForm.js' - -export default function ReportRecursoForm (props) { - const [value, setValue] = React.useState(-1); - - const handleChange = (event) => { - setValue(event.target.value); - }; - - /*values are set according to backend complaint id*/ - const [options] = React.useState([ - {value : "1", text : 'A Coleção viola os direitos autorais.'}, - {value : "2", text : 'A Coleção contém conteúdo ofensivo/abusivo.'}, - {value : "5", text : 'A descrição da Coleção não corresponde ao seu conteúdo.'} - ]) - - const [moreInfo, setMoreInfo] = React.useState({ - key : false, - value : "", - }) - - const handleChangeMoreInfo = (e) => { - const userInput = e.target.value - - const flag = userInput.length > 150 ? true : false - - setMoreInfo({...moreInfo, - key : flag, - value : userInput - }) - } - - const handleSubmit = (e) => { - e.preventDefault() - const finalRadioValue = value - const finalMoreInfo = moreInfo - - if( finalRadioValue != -1 && !(finalMoreInfo.key)) { - props.handleSubmit(finalRadioValue, finalMoreInfo.value) - } - else { - console.log('oops') - } - } - - return ( - <form onSubmit={(e) => handleSubmit(e)} style={{textAlign : "left"}}> - <StyledFormControl component="fieldset"> - <RadioGroup value={value} onChange={handleChange}> - { - options.map(option => - <FormControlLabel value={option.value} control={<Radio color="orange"/>} label={option.text} /> - ) - } - </RadioGroup> - </StyledFormControl> - - <StyledTextField - id = {"report-text-field"} - label={"Escreva mais sobre o problema"} - value = {moreInfo.value} - onChange = {e => handleChangeMoreInfo(e)} - helperText = {moreInfo.value.length + '/150'} - multiline={true} - rowsMax = {"5"} - error = {moreInfo.key} - required = {false} - helperText ={moreInfo.value.length + '/150'} - style={{width : "100%"}} - /> - - <ButtonsDiv> - <ButtonCancelar onClick={props.handleClose}>CANCELAR</ButtonCancelar> - <ButtonEnviar type="submit">ENVIAR</ButtonEnviar> - </ButtonsDiv> - </form> - ) -} diff --git a/src/Components/RequirementsDialog.js b/src/Components/RequirementsDialog.js deleted file mode 100644 index 49aeb473..00000000 --- a/src/Components/RequirementsDialog.js +++ /dev/null @@ -1,61 +0,0 @@ -import React from 'react'; -import Button from '@material-ui/core/Button'; -import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; -import DialogTitle from '@material-ui/core/DialogTitle'; - -export default function MaxWidthDialog(props) { - const [open, setOpen] = React.useState(false); - const fullWidth = true; - const maxWidth = 'sm'; - - const handleClickOpen = () => { - setOpen(true); - }; - - const handleClose = () => { - setOpen(false); - }; - - return ( - <React.Fragment> - <Button variant="outlined" color="primary" onClick={handleClickOpen}> - Mais - </Button> - <Dialog - fullWidth={fullWidth} - maxWidth={maxWidth} - open={open} - onClose={handleClose} - aria-labelledby="max-width-dialog-title" - > - <DialogTitle id="max-width-dialog-title">{props.title}</DialogTitle> - <DialogContent> - <DialogContentText> - {props.description} - <h4>Requisitos</h4> - <dl> - {props.requirements.map( - (r) => { - return( - <div> - <dt>{r.name}</dt> - <dd>{r.description}</dd> - </div> - ); - })} - </dl> - </DialogContentText> - </DialogContent> - <DialogActions> - <Button onClick={handleClose} color="primary"> - Fechar - </Button> - </DialogActions> - </Dialog> - </React.Fragment> - ); -} - diff --git a/src/Components/ResourceCard.js b/src/Components/ResourceCard.js deleted file mode 100644 index 67fbd547..00000000 --- a/src/Components/ResourceCard.js +++ /dev/null @@ -1,208 +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, { Component } from "react"; -import "./CardsAnimation.css"; -import { Container } from "react-grid-system"; -import Card from "@material-ui/core/Card"; -import CardContent from "@material-ui/core/CardContent"; -import CardActions from "@material-ui/core/CardActions"; -import IconButton from "@material-ui/core/IconButton"; -import Typography from "@material-ui/core/Typography"; -import FavoriteIcon from "@material-ui/icons/Favorite"; -import styled from 'styled-components'; -import Rating from "@material-ui/lab/Rating"; -import StarBorderIcon from "@material-ui/icons/StarBorder"; -import { apiDomain } from "../env"; -import AddIcon from "@material-ui/icons/CreateNewFolder"; -import Options from "./CardOptions"; -import Video from "@material-ui/icons/OndemandVideo"; - -//Image Import -import { Animacao } from "ImportImages.js"; -import { Apresentacao } from "ImportImages.js"; -import { AplicativoMovel } from "ImportImages.js"; -import { Audio } from "ImportImages.js"; -import { Empty } from "ImportImages.js"; -import { Imagem } from "ImportImages.js"; -import { Infografico } from "ImportImages.js"; -import { Jogo } from "ImportImages.js"; -import { LivroDigital } from "ImportImages.js"; -import { Mapa } from "ImportImages.js"; -import { Outros } from "ImportImages.js"; -import { SoftwareEducacional } from "ImportImages.js"; -import { Texto } from "ImportImages.js"; -import { video } from "ImportImages.js"; -import { noAvatar } from "ImportImages.js"; - -const types = [ - { label: "Animação", thumb: Animacao }, - { label: "Apresentação", thumb: Apresentacao }, - { label: "Aplicativo Movel", thumb: AplicativoMovel }, - { label: "Ãudio", thumb: Audio }, - { label: "Vazio", thumb: Empty }, - { label: "Imagem", thumb: Imagem }, - { label: "Gráfico", thumb: Infografico }, - { label: "Jogo", thumb: Jogo }, - { label: "Livro", thumb: LivroDigital }, - { label: "Livro digital", thumb: LivroDigital }, - { label: "Mapa", thumb: Mapa }, - { label: "Outros", thumb: Outros }, - { label: "Software Educacional", thumb: SoftwareEducacional }, - { label: "Software", thumb: SoftwareEducacional }, - { label: "Texto", thumb: Texto }, - { label: "VÃdeo", thumb: video } -]; -const slideStyle = { - height: "50px", - width: "50px", - backgroundColor: "white", - borderRadius: "50%" -}; -const publisherStyle = { - color: "white", - paddinLeft: "30px", - fontSize: "15px", -}; - -class ResourceCard extends Component { - constructor(props) { - super(props); - this.state = { - thumbnail: null, - userStyle: "animatiOff", - userAvatar: null - }; - } - renderType(type) { - if (!this.state.thumbnail) { - if (!this.props.thumbnail) { - const aux = types.find(function (element) { return element.label === type }); - this.setState({ thumbnail: aux.thumb }); - } - else { - this.setState({ thumbnail: `${apiDomain}` + this.props.thumbnail }); - } - } - // {/*if (!this.state.thumbnail && !this.props.thumbnail ) { - // var aux = types.find(function(element){ return element.label === type}); - // this.setState({thumbnail: aux.thumb}); - // } - // if (!this.state.thumbnail && this.props.thumbnail ) { - // this.setState({thumbnail: apiDomain + this.props.thumbnail}); - // }*/} - } - onHover() { - this.setState({ userStyle: "animatiOn" }); - } - onIddle() { - this.setState({ userStyle: "animatiOff" }); - } - defAvatar() { - if (!this.state.userAvatar && !this.props.avatar.length) { - this.setState({ userAvatar: noAvatar }); - } - if (!this.state.userAvatar && this.props.avatar) { - this.setState({ userAvatar: apiDomain + this.props.avatar }); - } - } - render() { - this.renderType(this.props.type); - this.defAvatar(); - return ( - <Card - onMouseOver={this.onHover.bind(this)} - onMouseOut={this.onIddle.bind(this)} - > - <Container - style={{ - padding: "0px", - height: "175px", - backgroundColor: "#ff7f00" - }} - > - <div className={this.state.userStyle}> - <img style={slideStyle} src={this.state.userAvatar} alt="Avatar" /> - <StyledPublisher style={publisherStyle}> - Enviado por: <br /> - {this.props.author} - </StyledPublisher> - </div> - <img - src={this.state.thumbnail} - style={{ height: "100%" }} - alt="thumbnail do recurso" - /> - </Container> - <CardContent - style={{ height: "60%", textAlign: "left", paddingBottom: "0px" }} - > - <Typography - variant="body2" - color="textSecondary" - component="p" - style={{ height: "45px", overflow: "hidden", fontSize: "0.8em" }} - > - {this.props.name} - </Typography> - </CardContent> - <Container style={{ textAlign: "left" }}> - <Rating - name="customized-empty" - value={this.props.rating * 10} - precision={0.5} - readOnly - emptyIcon={<StarBorderIcon fontSize="inherit" />} - /> - </Container> - <CardActions - style={{ justifyContent: "space-between", padding: "0px" }} - > - {this.props.type === "VÃdeo" ? ( - <Video style={{ color: "#ff7f00" }} /> - ) : ( - <br /> - )} - <IconButton aria-label="Favoritar" size="small"> - <FavoriteIcon /> - </IconButton> - </CardActions> - <CardActions - style={{ - borderTop: "1px solid #e5e5e5", - justifyContent: "space-between" - }} - > - <IconButton aria-label="Guardar" size="small"> - <AddIcon /> - </IconButton> - <Options /> - </CardActions> - </Card> - ); - } -} - -const StyledPublisher = styled(Typography)` - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; -` - -export default ResourceCard; diff --git a/src/Components/SearchExpansionPanel/SearchEPKeyWord.js b/src/Components/SearchExpansionPanel/SearchEPKeyWord.js deleted file mode 100644 index 101a0e06..00000000 --- a/src/Components/SearchExpansionPanel/SearchEPKeyWord.js +++ /dev/null @@ -1,167 +0,0 @@ -import React from "react"; -import { withStyles } from "@material-ui/core/styles"; -import MuiExpansionPanel from "@material-ui/core/ExpansionPanel"; -import MuiExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary"; -import MuiExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails"; -import Typography from "@material-ui/core/Typography"; -import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import SearchList from "../SearchList"; - -const ExpansionPanel = withStyles({ - root: { - border: "1px solid rgba(0, 0, 0, .125)", - boxShadow: "none", - "&: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", - - "&$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) - } -}))(MuiExpansionPanelDetails); - -export default function SearchExpansionPanels() { - return ( - <div> - <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" - > - <Typography - style={{ - fontSize: "18px", - textTransform: "uppercase", - fontWeight: "500" - }} - > - Filtros - </Typography> - </ExpansionPanelSummary> - </ExpansionPanel> - <ExpansionPanel square> - <ExpansionPanelSummary - expandIcon={<ExpandMoreIcon />} - aria-controls="panel2d-content" - id="panel2d-header" - > - <TesteTypography>Componentes Curriculares</TesteTypography> - </ExpansionPanelSummary> - <ExpansionPanelDetails> - <Typography> - <SearchList /> - </Typography> - </ExpansionPanelDetails> - </ExpansionPanel> - <ExpansionPanel square> - <ExpansionPanelSummary - expandIcon={<ExpandMoreIcon />} - aria-controls="panel3d-content" - id="panel3d-header" - > - <Typography>Tipos de Recurso</Typography> - </ExpansionPanelSummary> - <ExpansionPanelDetails> - <Typography> - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse - malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada - lacus ex, sit amet blandit leo lobortis eget. - </Typography> - </ExpansionPanelDetails> - </ExpansionPanel> - <ExpansionPanel square> - <ExpansionPanelSummary - aria-controls="panel4d-content" - expandIcon={<ExpandMoreIcon />} - id="panel4d-header" - > - <Typography>Etapas de Ensino</Typography> - </ExpansionPanelSummary> - <ExpansionPanelDetails> - <Typography> - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse - malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada - lacus ex, sit amet blandit leo lobortis eget. - </Typography> - </ExpansionPanelDetails> - </ExpansionPanel> - <ExpansionPanel square> - <ExpansionPanelSummary - aria-controls="panel5d-content" - expandIcon={<ExpandMoreIcon />} - id="panel5d-header" - > - <Typography>Idiomas</Typography> - </ExpansionPanelSummary> - <ExpansionPanelDetails> - <Typography> - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse - malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada - lacus ex, sit amet blandit leo lobortis eget. - </Typography> - </ExpansionPanelDetails> - </ExpansionPanel> - <ExpansionPanel square> - <ExpansionPanelSummary - aria-controls="panel6d-content" - expandIcon={<ExpandMoreIcon />} - id="panel6d-header" - > - <Typography>Palavra-Chave</Typography> - </ExpansionPanelSummary> - <ExpansionPanelDetails> - <Typography> - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse - malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada - lacus ex, sit amet blandit leo lobortis eget. - </Typography> - </ExpansionPanelDetails> - </ExpansionPanel> - </div> - ); -} diff --git a/src/Components/SearchList.js b/src/Components/SearchList.js deleted file mode 100644 index 0f789ce1..00000000 --- a/src/Components/SearchList.js +++ /dev/null @@ -1,70 +0,0 @@ -import React from "react"; -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 IconButton from "@material-ui/core/IconButton"; -import CommentIcon from "@material-ui/icons/Comment"; - -const useStyles = makeStyles(theme => ({ - root: { - width: "100%", - maxWidth: 360, - backgroundColor: theme.palette.background.paper - } -})); - -export default function SearchList() { - const classes = useStyles(); - const [checked, setChecked] = React.useState([0]); - - const handleToggle = value => () => { - const currentIndex = checked.indexOf(value); - const newChecked = [...checked]; - - if (currentIndex === -1) { - newChecked.push(value); - } else { - newChecked.splice(currentIndex, 1); - } - - setChecked(newChecked); - }; - - return ( - <List className={classes.root}> - {[0, 1, 2, 3].map(value => { - const labelId = `checkbox-list-label-${value}`; - - return ( - <ListItem - key={value} - role={undefined} - dense - button - onClick={handleToggle(value)} - > - <ListItemIcon> - <Checkbox - edge="start" - checked={checked.indexOf(value) !== -1} - tabIndex={-1} - disableRipple - inputProps={{ "aria-labelledby": labelId }} - /> - </ListItemIcon> - <ListItemText id={labelId} primary={`Line item ${value + 1}`} /> - <ListItemSecondaryAction> - <IconButton edge="end" aria-label="comments"> - <CommentIcon /> - </IconButton> - </ListItemSecondaryAction> - </ListItem> - ); - })} - </List> - ); -} diff --git a/src/Components/SearchSection.js b/src/Components/SearchSection.js deleted file mode 100644 index 2802bf5f..00000000 --- a/src/Components/SearchSection.js +++ /dev/null @@ -1,100 +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, {Component} from 'react'; -import '../App.css'; -// import SearchBar from './SearchBar'; -import {Row} from 'react-grid-system'; -import {MdInfoOutline} from "react-icons/md" -import { FaRegPlayCircle} from "react-icons/fa"; -import ModalVideoApresentacao from "./ModalVideoApresentacao.js" - -//Image Import -import { banner } from "ImportImages.js"; - -const bannerStyle = { - width: "100%", - backgroundImage: `url(${banner})`, - backgroundSize: "cover", - textAlign: "center" -} -const titleStyle = { - color: "white", - paddingTop: "5%", -} -const buttonStyle = { - alignItems: "flex-start", - fontSize: "0.7em", - textAlign: "center", - cursor: "pointer", - borderTopLeftRadius: "15px", - borderTopRightRadius: "15px", - lineHeight: 1.42857143, - width: "20%", - marginTop: "1%", - color: "white", - padding: "1.2%", - borderWidth: "5%", - borderStyle: "none", - borderImage: "initial" -} - -class SearchSection extends Component{ - constructor(props){ - super(props); - this.state={ - color: "#ff7f00", - modalOpen : false - };} - - toggleModal = () => { - this.setState({modalOpen : !this.state.modalOpen}) - } - - render(){ - return( - <React.Fragment> - <ModalVideoApresentacao open={this.state.modalOpen} handleClose={this.toggleModal}/> - <div style={bannerStyle}> - <div style={titleStyle}> - <h2 style={{color : "white"}}>Plataforma MEC de Recursos Educacionais Digitais</h2> - <h3 style={{fontWeight: "100", color: "white"}}> - Encontre e compartilhe vÃdeos, animações e muitos outros Recursos - </h3> - </div> - {/* <Container style={{backgroundColor: "white" ,width: "50%" ,float: "center", alignItems: "center", borderRadius: "5px", color: this.state.color}}> - <SearchBar/> - </Container> */} - <div style={{paddingBottom: "100px", color: "white"}}> - <a href="sobre" style={{color:"#fff",textDecoration: "none", outline:"none", paddingRight : "10px"}}><MdInfoOutline size="24px" style={{verticalAlign: "middle", paddingRight : "5px"}} />SOBRE A PLATAFORMA</a> - <span onClick={this.toggleModal} style={{cursor : "pointer"}}> - <FaRegPlayCircle size="20px" style={{verticalAlign: "middle", paddingRight : "5px"}}/>VÃDEO DE APRESENTAÇÃO - </span> - </div> - <Row justify="center" style={{marginLeft:0, marginRight:0}}> - <button style={{...buttonStyle, ...{backgroundColor: "#ff7f00",fontSize:"1.14em", outline:"none"}}} onClick={()=> {this.props.function("Recursos")}}>Recursos Educacionais Digitais</button> - <button style={{...buttonStyle, ...{backgroundColor: "#e81f4f",fontSize:"1.14em", outline:"none"}}} onClick={()=> {this.props.function("Materiais")}}>Materiais de Formação</button> - <button style={{...buttonStyle, ...{backgroundColor: "#673ab7",fontSize:"1.14em", outline:"none"}}} onClick={()=> {this.props.function("Colecoes")}}>Coleções dos Usuários</button> - </Row> - </div> - </React.Fragment> - ); - } -} - -export default SearchSection; diff --git a/src/Components/Select.js b/src/Components/Select.js deleted file mode 100644 index 5e7adefc..00000000 --- a/src/Components/Select.js +++ /dev/null @@ -1,76 +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 from 'react'; -import { withStyles } from '@material-ui/core/styles'; -import MenuItem from '@material-ui/core/MenuItem'; -import FormControl from '@material-ui/core/FormControl'; -import Select from '@material-ui/core/Select'; -import InputBase from '@material-ui/core/InputBase'; - -const BootstrapInput = withStyles(theme => ({ - input: { - position: 'relative', - fontSize: 16, - width: '80px', - }, -}))(InputBase); - -// const styles = theme => ({ -// root: { -// display: 'flex', -// flexWrap: 'wrap', -// }, -// margin: { -// margin: theme.spacing.unit, -// }, -// bootstrapFormLabel: { -// fontSize: 18, -// }, -// }); - -class CustomizedSelects extends React.Component { - state = { - filter: 1, - }; - - handleChange = event => { - this.setState({ filter: event.target.value }); - }; - - render() { - // const { classes } = this.props; - - return ( - <FormControl> - <Select - value={this.state.filter} - onChange={this.handleChange} - input={<BootstrapInput name="filter"/>} - > - <MenuItem value={1}>Recursos</MenuItem> - <MenuItem value={2}>Materiais</MenuItem> - <MenuItem value={3}>Coleções</MenuItem> - </Select> - </FormControl> - ); - } -} - - -export default (CustomizedSelects); diff --git a/src/Components/ShinyProgressBar.js b/src/Components/ShinyProgressBar.js deleted file mode 100644 index f2d1cc03..00000000 --- a/src/Components/ShinyProgressBar.js +++ /dev/null @@ -1,55 +0,0 @@ -import React, {Component} from 'react'; -import {Container} from 'react-grid-system'; -import Card from '@material-ui/core/Card'; -import CardContent from '@material-ui/core/CardContent'; -import styled from 'styled-components' - - -export default function ShinyProgressBar(props) { - return ( - <ProgressBar> - <ShinyFiller percentage={props.percentage}/> - </ProgressBar> - ); -} - -const ShinyFiller = (props) => { - return ( - <StyledFiller style={{ width: `${props.percentage}%` }}> - <FillerShine/> - </StyledFiller> - ); -} - -const FillerShine = (props) => { - return <StyledShine/> -} - -const ProgressBar = styled.div` - background: #C4C4C4; - position: relative; - height: 30px; - width: 100%; - border-radius: 50px; - margin-left:20px; - margin-right:20px; -` - -const StyledFiller = styled.div` - background: #02A4B9; - height: 100%; - border-radius: 50px; - transition: width 1s ease-in; -` - -const StyledShine = styled.div` - position: relative; - top: 5px; - left: 15px; - background: #03C0CE; - height: 25%; - width: 95%; - border-radius: 50px; - transition: width 1s ease-in; - z-index: +1; -` \ No newline at end of file diff --git a/src/Components/Sidebar.js b/src/Components/Sidebar.js deleted file mode 100644 index bc98fac0..00000000 --- a/src/Components/Sidebar.js +++ /dev/null @@ -1,88 +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, {Component} from 'react'; -import '../App.css'; -import Sidebar from "react-sidebar"; -import BT from './Button'; - -class SidebarMenu extends Component { - constructor(props) { - super(props); - this.state = { - sidebarOpen: false - }; - this.onSetSidebarOpen = this.onSetSidebarOpen.bind(this); - } - - onSetSidebarOpen(open) { - this.setState({ sidebarOpen: open }); - } - - render() { - return ( - <Sidebar - sidebar={ - <div> - <div> - <BT name={"="} method={this.onSetSidebarOpen} parameter={false}/> - <BT name={"FECHAR"} method={this.onSetSidebarOpen} parameter={false}/> - </div> - <BT name={"Página Inicial"}/> - <BT name={"Sobre a Plataforma"}/> - <BT name={"Contato"}/> - <BT name={"Central de Ajuda"}/> - <BT name={"Termos de Uso"}/> - - </div> - } - open={this.state.sidebarOpen} - onSetOpen={this.onSetSidebarOpen} - styles={{root: { - position: "inherit", - overflow: "hidden" - }, - sidebar: { - zIndex: 2, - position: "absolute", - background: "white" - }, - content: { - position: "relative", - overflowY: "auto", - WebkitOverflowScrolling: "touch", - transition: "left .3s ease-out, right .3s ease-out" - }, - overlay: { - zIndex: 1, - position: "fixed", - visibility: "hidden" - }, - dragHandle: { - zIndex: 1, - position: "fixed" - } - }} - > - <BT name={"= MENU"} method={this.onSetSidebarOpen} parameter={true}/> - </Sidebar> - ); - } - } - -export default SidebarMenu; diff --git a/src/Components/StatsBar.js b/src/Components/StatsBar.js deleted file mode 100644 index 0cdde494..00000000 --- a/src/Components/StatsBar.js +++ /dev/null @@ -1,99 +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, {Component} from 'react'; -import {Col,Row, Container} from 'react-grid-system'; -import { apiUrl } from "../env"; -import axios from "axios"; -import mapaBrasil from '../img/mapa-brasil-line-icon.svg'; -const brasilStyle={ - backgroundColor: "#00bcd4", - color: "white", - textAlign: "center", - display: "block", - paddingTop: "10px", - paddingBottom: "10px" -}; -const numberStyle={ - display: "block", - fontSize: "2.1em", - fontWeight: "Bold", - fontFamily: "Roboto, sans-serif", - textAlign: "center" -}; -const statistcStyle={ - display: "inline-block", - padding: "5px", - alignSelf:"flex-end" - -}; -class StatsBar extends Component{ - constructor(props){ - super(props) - this.state ={ - available_resources: 0, - month_publications:0, - month_downloads:0 - } - } - componentDidMount(){ - // https://api.portalmec.c3sl.ufpr.br/v1/statistics - axios.get(`${apiUrl}/statistics`).then((res) => { - this.setState({available_resources:res.data.count, month_publications:res.data.month_publications, month_downloads:res.data.month_downloads}) - }) - } - - render(){ - return( - <div style={brasilStyle}> - <Container> - <Row> - <Col md={6} sm={6} style={{borderRight:"2px dotted #fff", textAlign: "right", alignSelf: "center"}}> - <img src={mapaBrasil} height="83px" alt="mapa do brasil"/> - <span style={statistcStyle}> - <span style={numberStyle}> - {this.state.available_resources} - </span> - <span> - Recursos disponÃveis - </span> - </span> - </Col> - <Col md={6} sm={6} style={{textAlign: "left", - alignSelf:"center"}}> - ESSE MÊS: - <span style={statistcStyle}> - <span style={numberStyle}> - {this.state.month_downloads} - </span> - Baixados - </span> - <span style={statistcStyle}> - <span style={numberStyle}> - {this.state.month_publications} - </span> - Publicados - </span> - </Col> - </Row> - </Container> - </div> - ) - } -} -export default StatsBar; diff --git a/src/Components/TabPanels/PublicUserPageTabs/LastCollections.js b/src/Components/TabPanels/PublicUserPageTabs/LastCollections.js deleted file mode 100644 index d1828064..00000000 --- a/src/Components/TabPanels/PublicUserPageTabs/LastCollections.js +++ /dev/null @@ -1,84 +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 from 'react' -import Grid from '@material-ui/core/Grid'; -import { HeaderGrid, StyledGrid } from '../StyledComponents.js' -import { NoContent } from './TabInicio.js' -import CollectionCardFunction from '../../CollectionCardFunction.js' - -//Image Import -import { ColecaoVazia } from "ImportImages.js"; - -export default function LastCols(props) { - return ( - <React.Fragment> - <HeaderGrid container> - <Grid item xs={12}> - <h3>Últimas alterações em coleções</h3> - </Grid> - </HeaderGrid> - - - { - props.count === 0 || props.collections.length === 0 ? - ( - [ - <Grid container> - <Grid item xs={12}> - <NoContent - image={ColecaoVazia} - text1={props.username + " ainda não disponibilizou nenhuma coleção."} - text2={"Quando disponibilizar, elas aparecerão aqui."} - /> - </Grid> - </Grid> - ] - ) - : - ( - [ - <StyledGrid container spacing={1} style={{ paddingLeft: "0.5em" }}> - { - props.collections.slice(0, 4).map((card) => - <Grid item container md={3} xs={12} key={card.id}> - <CollectionCardFunction - name={card.name} - tags={card.tags} - rating={card.review_average} - id={card.id} - author={card.owner.name} - description={card.description} - thumbnails={card.items_thumbnails} - avatar={card.owner.avatar} - likeCount={card.likes_count} - followed={card.followed} - liked={card.liked} - collections={card.collection_items} - authorID={card.owner.id} - /> - </Grid> - ) - } - </StyledGrid> - ] - ) - } - </React.Fragment> - ) -} diff --git a/src/Components/TabPanels/PublicUserPageTabs/LastLearnObj.js b/src/Components/TabPanels/PublicUserPageTabs/LastLearnObj.js deleted file mode 100644 index a625b345..00000000 --- a/src/Components/TabPanels/PublicUserPageTabs/LastLearnObj.js +++ /dev/null @@ -1,84 +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 from 'react' -import Grid from '@material-ui/core/Grid'; -import ResourceCardFunction from '../../ResourceCardFunction.js' -import { HeaderGrid, StyledGrid } from '../StyledComponents.js' -import { NoContent } from './TabInicio.js' - -//Image Import -import { RecursoVazio } from "ImportImages.js"; - -export default function LastLearnObjs(props) { - return ( - <React.Fragment> - <HeaderGrid container> - <Grid item xs={9}> - <h3>Últimos Recursos Publicados</h3> - </Grid> - </HeaderGrid> - - { - props.count === 0 ? - ( - [ - <Grid container> - <Grid item xs={12}> - <NoContent - image={RecursoVazio} - text1={props.username + " ainda não disponibilizou nenhum recurso."} - text2={"Quando disponibilizar, eles aparecerão aqui."} - /> - </Grid> - </Grid> - ] - ) - : - ( - [ - <StyledGrid container spacing={1} style={{ paddingLeft: "30px", paddingRight: "15px" }}> - { - props.learningObjs.slice(0, 4).map((card) => - <Grid item xs={12} sm={6} md={'auto'} lg={3} key={card.id}> - <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} - - /> - </Grid> - ) - } - </StyledGrid> - ] - ) - } - </React.Fragment> - ) -} diff --git a/src/Components/TabPanels/TabPanelStatusEConquistas.js b/src/Components/TabPanels/TabPanelStatusEConquistas.js deleted file mode 100644 index d9e0c207..00000000 --- a/src/Components/TabPanels/TabPanelStatusEConquistas.js +++ /dev/null @@ -1,112 +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, useEffect} from 'react' -import { Store } from '../../Store.js' -import styled from 'styled-components' -import Paper from '@material-ui/core/Paper'; -import {ContainerDivStyled} from './StyledComponents.js' -import axios from 'axios' -import {apiUrl} from '../../env'; -import LevelDescriptionCard from '../LevelDescriptionCard.js' -import AchievementDescriptionCard from '../AchievementDescriptionCard.js' -import { Grid } from '@material-ui/core' - -export default function TabPanelStatusEConquistas (props) { - // eslint-disable-next-line - const [achievements, setAchievements] = useState([]); - // eslint-disable-next-line - const [level, setLevel] = useState(0); - // eslint-disable-next-line - const [xp, setXP] = useState(0); - // eslint-disable-next-line - const [coins, setCoins] = useState(0); - // eslint-disable-next-line - const [barSize, setBarSize] = useState(0); - // eslint-disable-next-line - const [xpToNextLevel, setXpToNextLevel] = useState(0); - const { state } = useContext(Store) - - useEffect(() => { - axios.all( - ['xp_to_next_lvl', 'percent_to_next_level', 'points', 'xp', 'get_level', - 'completed_achievements'].map((r) => { - return axios.get(apiUrl + '/' + r + '?id=' + state.currentUser.id); - })).then(axios.spread((xp_to_next_lvl, percent_to_next_level, points, - xp, level, completed_achievements) => { - this.setXpToNextLevel(xp_to_next_lvl); - this.setBarSize(100-percent_to_next_level); - this.setCoins(points); - this.setXP(xp); - this.setLevel(level); - this.setAchievements(completed_achievements); - })); - }, []) - - return ( - <div> - <ContainerDivStyled> - <Paper elevation={3}> - <LevelDescriptionCard - xp_to_next_lvl={xpToNextLevel} - bar_size={barSize} - coins={coins} - xp={xp} - level={level} - /> - </Paper> - </ContainerDivStyled> - <AchievementsContainer> - <AchievementsSectionTitle> - Conquistas - </AchievementsSectionTitle> - <AchievementsList> - <Grid container direction="row" justify="space-around" alignItems="center"> - {achievements.map( - (a) => { return ( - <Grid item xs={12} md={5}> - <AchievementDescriptionCard - name={a.title} - description={a.description} - src={a.imgsrc} - requirements={a.requirements} - /> - - </Grid> - )} - )} - </Grid> - </AchievementsList> - </AchievementsContainer> - </div> - ); -} - -const AchievementsSectionTitle = styled.h1` - font-weight: 400; -` -const AchievementsContainer = styled.div` - max-width : 1140px; - margin-left : auto; - margin-right : auto; - margin-bottom: 30px; - margin-top: 70px; -` -const AchievementsList = styled.div` -` diff --git a/src/Components/Tags.js b/src/Components/Tags.js deleted file mode 100644 index 6cc10779..00000000 --- a/src/Components/Tags.js +++ /dev/null @@ -1,19 +0,0 @@ -import React, {Component} from 'react'; -const tagStyle={ - borderRadius: "10px", - backgroundColor: "gray", - color: "white", - padding: "4px", - display: "table", - -}; - -class Tags extends Component { - - render(){ - return( - <div style={tagStyle}> {this.props.name} </div> - ) - } -} -export default Tags; diff --git a/src/Components/UploadPageComponents/FileToUpload.ts b/src/Components/UploadPageComponents/FileToUpload.ts deleted file mode 100644 index 60b6ecb0..00000000 --- a/src/Components/UploadPageComponents/FileToUpload.ts +++ /dev/null @@ -1,106 +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/>.*/ - -export default class FileToUpload { - static chunkSize = 262144; - readonly request: XMLHttpRequest; - readonly uploadUrl: string; - readonly file: File; - readonly name: string; - readonly draftID: string; - readonly _chunkIdentifier: string; - private _chunkNumber: number; - currentChunkStartByte: number; - currentChunkFinalByte: number; - - constructor(file: File, name: string, draftID : string) { - this.request = new XMLHttpRequest(); - this.request.onreadystatechange = function(ev: Event) { - if(this.readyState === XMLHttpRequest.DONE){ - if (this.getResponseHeader('access-token') != null) { - console.log(this.getResponseHeader('access-token')) - localStorage.setItem('@portalmec/accessToken', this.getResponseHeader('access-token')!) - } - } - } - this.request.overrideMimeType('application/octet-stream'); - - this.file = file; - this.name = name; - this.draftID = draftID; - this.uploadUrl = 'https://api.portalmec.c3sl.ufpr.br/v1/learning_objects/' + draftID + '/chunk' - this._chunkIdentifier = draftID + '-' + this.name; - this._chunkNumber = 0; - - this.currentChunkStartByte = 0; - this.currentChunkFinalByte = FileToUpload.chunkSize > this.file.size ? this.file.size : FileToUpload.chunkSize; - } - - uploadFile() { - this.request.open('POST', this.uploadUrl, true); - - let chunk: Blob = this.file.slice(this.currentChunkStartByte, this.currentChunkFinalByte); // split the file according to the boundaries - - //set necessary headers - this.request.setRequestHeader('Content-Range', `bytes ${this.currentChunkStartByte}-${this.currentChunkFinalByte}/${this.file.size}`); - if (localStorage.getItem('@portalmec/uid') != undefined) { - this.request.setRequestHeader('uid', localStorage.getItem('@portalmec/uid')!) - } - if (localStorage.getItem('@portalmec/clientToken') != undefined) { - this.request.setRequestHeader('client', String(localStorage.getItem('@portalmec/clientToken'))) - } - if (localStorage.getItem('@portalmec/accessToken') != undefined) { - this.request.setRequestHeader('access-token', String(localStorage.getItem('@portalmec/accessToken'))) - } - - this.request.onload = () => { - const remainingBytes = this.file.size - this.currentChunkFinalByte; - - if(this.currentChunkFinalByte === this.file.size) { - alert('Yay, upload completed! Chao!'); - return('done'); - } else if (remainingBytes < FileToUpload.chunkSize) { - // if the remaining chunk is smaller than the chunk size we defined - this.currentChunkStartByte = this.currentChunkFinalByte; - this.currentChunkFinalByte = this.currentChunkStartByte + remainingBytes; - } - else { - // keep chunking - this.currentChunkStartByte = this.currentChunkFinalByte; - this.currentChunkFinalByte = this.currentChunkStartByte + FileToUpload.chunkSize; - } - - this._chunkNumber = this._chunkNumber + 1 - this.uploadFile(); - } - - //add attributes - const formData = new FormData(); - formData.append('_chunkFilename', this.file.name); - formData.append('_chunkIdentifier', this._chunkIdentifier); - formData.append('_totalChunks', String(Math.ceil(this.file.size/FileToUpload.chunkSize))); - formData.append('_chunkSize', String(FileToUpload.chunkSize)); - formData.append('_currentChunkSize', String(this.currentChunkFinalByte - this.currentChunkStartByte)); - formData.append('_chunkNumber', String(this._chunkNumber)); - formData.append('_totalSize', String(this.file.size)); - formData.append('file', chunk); - - this.request.send(formData);// send it now! - } - -} diff --git a/src/Components/UploadPageComponents/FileUploadStage.js b/src/Components/UploadPageComponents/FileUploadStage.js deleted file mode 100644 index 880ff018..00000000 --- a/src/Components/UploadPageComponents/FileUploadStage.js +++ /dev/null @@ -1,65 +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, {useState} from 'react' -import styled from 'styled-components' -import {WrapperBox} from './StyledComponents.js' -import DoneIcon from '@material-ui/icons/Done'; -import DeleteIcon from '@material-ui/icons/Delete'; -import {deleteRequest} from '../HelperFunctions/getAxiosConfig.js' - -export default function FileUploadStage (props) { - const [uploading, toggleUploading] = useState(true) - - function handleSuccess (data) { - props.handleNextStage("default") - } - const handleDelete = () => { - const url = `/learning_objects/${props.draftID}` - - deleteRequest(url, handleSuccess, (error) => {console.log(error)}) - } - - return ( - <WrapperBox> - <div className="inner"> - <div className="upload-title"> - {uploading ? 'Carregando arquivo' : 'O arquivo foi carregado'} - </div> - - <div className="uploading"> - <div className="upload-item"> - <div className="item-info"> - <div className="file-status"> - <DoneIcon className="icon icon-margin"/> {props.file.name} - </div> - <div className="remove-file" onClick={handleDelete}> - Excluir <DeleteIcon className="icon icon-remove"/> - </div> - </div> - </div> - <div className="warning"> - <span>Não se esqueça de preencher as</span> - <br/> - <span>informações sobre o recurso ao lado.</span> - </div> - </div> - </div> - </WrapperBox> - ) -} diff --git a/src/Components/UploadPageComponents/ReactFileToUpload.js b/src/Components/UploadPageComponents/ReactFileToUpload.js deleted file mode 100644 index ffbd6a45..00000000 --- a/src/Components/UploadPageComponents/ReactFileToUpload.js +++ /dev/null @@ -1,113 +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, {useState, useEffect} from 'react' -import CloudUploadIcon from '@material-ui/icons/CloudUpload'; -import {DottedBox, BlueButton} from './StyledComponents.js'; -import {getAxiosConfigFromJSON, updateHeaders} from '../HelperFunctions/getAxiosConfig.js' -import AddAPhotoIcon from '@material-ui/icons/AddAPhoto'; -import axios from 'axios' -import {apiUrl} from '../../env'; - -export default function ReactFileToUpload (props) { - const [fileToUpload, setFileToUpload] = useState(null); - const chunkSize = 262144 - const uploadUrl = `${apiUrl}/learning_objects/` + props.draftID + '/chunk' - const [fileName, setFileName] = useState(null) - const [fileSize, setFileSize] = useState(null) - const [fileDoneUploading, setFileDoneUploading] = useState(false) - - async function onFileChange (e) { - const files = e.target.files; - if(!files) return; - - let newFile = e.target.files[0] - console.log(newFile) - setFileToUpload(newFile); - setFileName(newFile.name) - setFileSize(newFile.size) - - let total = Math.ceil(newFile.size/chunkSize) - let currentChunkStartByte = 0; - let currentChunkFinalByte = chunkSize > newFile.size ? newFile.size : chunkSize; - let chunkIdentifier = props.draftID + '-' + newFile.name; - let remainingBytes = 0 - - for (var i = 0; i < total; i++) { - let chunk = newFile.slice(currentChunkStartByte, currentChunkFinalByte) - let config = getAxiosConfigFromJSON() - let formData = new FormData() - formData.append('_chunkFilename', newFile.name); - formData.append('_chunkIdentifier', chunkIdentifier); - formData.append('_totalChunks', total); - formData.append('_chunkSize', chunkSize); - formData.append('_currentChunkSize', chunk.size); - formData.append('_chunkNumber', i); - formData.append('_totalSize', newFile.size); - formData.append('file', chunk); - - try { - const response = await axios.post(uploadUrl, formData, config); - console.log(response) - if (response.headers['access-token']) { - updateHeaders(response.headers) - } - remainingBytes = newFile.size - currentChunkFinalByte; - if (currentChunkFinalByte === newFile.size) { - setFileDoneUploading(true) - } - else if (remainingBytes < chunkSize) { - currentChunkStartByte = currentChunkFinalByte; - currentChunkFinalByte = currentChunkStartByte + remainingBytes; - } - else { - currentChunkStartByte = currentChunkFinalByte; - currentChunkFinalByte = currentChunkStartByte + chunkSize; - } - } catch (error) { - console.log(error) - } - } - }; - - return ( - <div className="upload-container"> - <h2 className="upload-title">File Uploader</h2> - <div className="upload-form"> - <form id="file_upload"> - <DottedBox - > - <AddAPhotoIcon className="icon"/> - <input - type="file" - onChange = {onFileChange} - id="upload-file-thumbnail" - style={{display : "none"}} - /> - <BlueButton> - <label htmlFor="upload-file-thumbnail" style={{width : "inherit", cursor : "pointer"}}> - ESCOLHER IMAGEM - </label> - </BlueButton> - <span style={{marginTop : "6px"}}>Ou arrastar e soltar o arquivo aqui</span> - </DottedBox> - </form> - </div> - </div> - ) -} diff --git a/src/Components/stars.js b/src/Components/stars.js deleted file mode 100644 index 39ea6f90..00000000 --- a/src/Components/stars.js +++ /dev/null @@ -1,230 +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 { randomNumber } from './app'; - -import Widget from 'widget'; - -class WidgetRatings extends React.Component { - constructor(props) { - super(props); - this.fillId = `widgetGrad${randomNumber()}`; - this.state = { - highestWidgetHovered: -Infinity - } - } - static Widget = Widget - - get - widgetRatingsStyle() { - const widgetRatingsStyle = { - position: 'relative', - boxSizing: 'border-box', - display: 'inline-block' - }; - return this.props.ignoreInlineStyles ? {} : widgetRatingsStyle; - } - - get - widgetGradientStyle() { - const widgetGradientStyle = { - position: 'absolute', - zIndex: '0', - width: '0', - height: '0', - visibility: 'hidden' - }; - return this.props.ignoreInlineStyles ? {} : widgetGradientStyle; - } - - stopColorStyle(color) { - const stopColorStyle = { - stopColor: color, - stopOpacity: '1' - }; - return this.props.ignoreInlineStyles ? {} : stopColorStyle; - } - - get - titleText() { - const { - typeOfWidget, - rating: selectedRating - } = this.props; - const hoveredRating = this.state.highestWidgetHovered; - const currentRating = hoveredRating > 0 ? hoveredRating : selectedRating; - // fix it at 2 decimal places and remove trailing 0s - let formattedRating = parseFloat(currentRating.toFixed(2)).toString(); - if (Number.isInteger(currentRating)) { - formattedRating = String(currentRating); - } - let widgetText = `${typeOfWidget}s`; - if (formattedRating === '1') { - widgetText = typeOfWidget; - } - return `${formattedRating} ${widgetText}`; - } - - get - offsetValue() { - const rating = this.props.rating; - const ratingIsInteger = Number.isInteger(rating); - let offsetValue = '0%'; - if (!ratingIsInteger) { - const firstTwoDecimals = rating.toFixed(2).split('.')[1].slice(0, 2); - offsetValue = `${firstTwoDecimals}%`; - } - return offsetValue; - } - - unHoverOverWidget = () => { - this.setState({ - highestWidgetHovered: -Infinity - }) - } - - hoverOverWidget = (rating) => { - return () => { - this.setState({ - highestWidgetHovered: rating - }) - } - } - - get - childrenWithRatingState() { - const { - changeRating, - rating: selectedRating, - children, - ignoreInlineStyles, - gradientPathName, - widgetEmptyColors, - widgetHoverColors, - widgetRatedColors, - widgetDimensions, - widgetSpacings, - svgIconPaths, - svgIconViewBoxes, - svgs - } = this.props; - const { highestWidgetHovered } = this.state; - - const numberOfWidgets = children.length; - return React.Children.map(children, (child, index) => { - const { - svgIconPath, - svgIconViewBox, - widgetHoverColor, - widgetEmptyColor, - widgetRatedColor, - widgetDimension, - widgetSpacing, - svg - } = child.props; - - const widgetRating = index + 1; - const isSelected = widgetRating <= selectedRating; - - // hovered only matters when changeRating is true - const hoverMode = highestWidgetHovered > 0; - const isHovered = widgetRating <= highestWidgetHovered; - const isCurrentHoveredWidget = widgetRating === highestWidgetHovered; - - // only matters when changeRating is false - // given widget 5 and rating 4.2: 5 > 4.2 && 4 < 4.2; - const isPartiallyFullWidget = widgetRating > selectedRating && widgetRating - 1 < selectedRating - - const isFirstWidget = widgetRating === 1; - const isLastWidget = widgetRating === numberOfWidgets; - - return React.cloneElement(child, { - selectedRating: selectedRating, - ignoreInlineStyles, - gradientPathName, - changeRating: changeRating ? () => changeRating(widgetRating) : null, - hoverOverWidget: changeRating ? this.hoverOverWidget(widgetRating) : null, - unHoverOverWidget: changeRating ? this.unHoverOverWidget : null, - inheritFillId: this.fillId, - isSelected, - isHovered, - isCurrentHoveredWidget, - isPartiallyFullWidget, - isFirstWidget, - isLastWidget, - hoverMode, - hasCustomGradientColor: (widgetRatedColor || widgetEmptyColor) && isPartiallyFullWidget, - svgIconPath: svgIconPath || svgIconPaths, - svgIconViewBox: svgIconViewBox || svgIconViewBoxes, - widgetHoverColor: widgetHoverColor || widgetHoverColors, - widgetEmptyColor: widgetEmptyColor || widgetEmptyColors, - widgetRatedColor: widgetRatedColor || widgetRatedColors, - widgetDimension: widgetDimension || widgetDimensions, - widgetSpacing: widgetSpacing || widgetSpacings, - svg: svg || svgs - }); - }); - } - - render() { - const { - widgetEmptyColors, - widgetRatedColors - } = this.props; - - return ( - <div - className="widget-ratings" - title={this.titleText} - style={this.widgetRatingsStyle} - > - <svg - className="widget-grad" - style={this.widgetGradientStyle} - > - <defs> - <linearGradient id={this.fillId} x1="0%" y1="0%" x2="100%" y2="0%"> - <stop offset="0%" className="stop-color-first" style={this.stopColorStyle(widgetRatedColors)} /> - <stop offset={this.offsetValue} className="stop-color-first" style={this.stopColorStyle(widgetRatedColors)} /> - <stop offset={this.offsetValue} className="stop-color-final" style={this.stopColorStyle(widgetEmptyColors)} /> - <stop offset="100%" className="stop-color-final" style={this.stopColorStyle(widgetEmptyColors)} /> - </linearGradient> - </defs> - </svg> - {this.childrenWithRatingState} - </div> - ); - } -} - -WidgetRatings.defaultProps = { - rating: 0, - typeOfWidget: 'Star', - changeRating: null, - ignoreInlineStyles: false, - gradientPathName: '', - svgIconPaths: 'm25,1 6,17h18l-14,11 5,17-15-10-15,10 5-17-14-11h18z', - svgIconViewBoxes: '0 0 51 48', - widgetRatedColors: 'rgb(109, 122, 130)', - widgetEmptyColors: 'rgb(203, 211, 227)', - widgetHoverColors: 'rgb(230, 67, 47)', - widgetDimensions: '50px', - widgetSpacings: '7px', -}; - -export default WidgetRatings; diff --git a/src/index.js b/src/index.js index 8a4d4049..032a5eee 100755 --- a/src/index.js +++ b/src/index.js @@ -33,4 +33,4 @@ ReactDOM.render( // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: http://bit.ly/CRA-PWA -serviceWorker.register(); +serviceWorker.unregister(); diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index ce12e006..00000000 --- a/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "experimentalDecorators" : true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "preserve" - }, - "include": [ - "src" - ] -} -- GitLab