diff --git a/src/Components/CollectionAuthor.js b/src/Components/CollectionAuthor.js new file mode 100644 index 0000000000000000000000000000000000000000..77693108ae1dfcdbc60457da066b8779c20a28f3 --- /dev/null +++ b/src/Components/CollectionAuthor.js @@ -0,0 +1,50 @@ +/*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'; +import styled from 'styled-components'; + + +export default function CollectionAuthor(props) { + return ( + <Grid container + direction="column" + justify="center" + alignItems="center"> + <UserAvatar src={props.imgsrc}/> + <InfoText>Coleção organizada por:</InfoText> + <UserName>{props.name}</UserName> + </Grid> + ); +} + +const UserAvatar = styled.img` + border-radius: 100px; + width: 100px; + height: auto; +` +const InfoText = styled.p` + margin-bottom: 0; + padding-bottom: 0; + color: #666; +` +const UserName = styled.h1` + margin-top: 10px; + color: #673ab7; +` diff --git a/src/Components/CollectionCommentSection.js b/src/Components/CollectionCommentSection.js new file mode 100644 index 0000000000000000000000000000000000000000..a3fb2f91ebac3960fc95fe58fbca9cbd3f4e8859 --- /dev/null +++ b/src/Components/CollectionCommentSection.js @@ -0,0 +1,65 @@ +/*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 { Grid } from '@material-ui/core'; +import styled from 'styled-components'; +import Button from '@material-ui/core/Button'; +import Card from '@material-ui/core/Card'; + +export default function CollectionCommentSection() { + return ( + <BackDiv> + <CommentContainer container direction="row" justify="center" alignItems="center"> + <Grid item style={{width: '100%'}} xs={12}> + <Title>Conte sua experiência com a Coleção</Title> + <Divider /> + </Grid> + <Grid item> + avatar + </Grid> + <Grid item> + avaliação (componente separado, grid container direction="column" e no final tem um grid item container direction="row" (escrever + botão de enviar)) + </Grid> + + </CommentContainer> + componente de compartilhar opiniao com a rede, grid container direction="column" + modal + n esqueça que tem que colocar modal de login em tudo se a pessoa n estiver logada + </BackDiv> + ); +} + +const BackDiv = styled(Card)` + background-color: white; + padding: 7px; +` +const CommentContainer = styled(Grid)` + background-color: #f4f4f4; +` +const Title = styled.p` + color: rgb(102, 102, 102); + font-weight: 300; + font-size: 1.5em; + margin-left: 30px; +` +const Divider = styled.div` + margin-top: 10px; + margin-bottom: 10px; + background-color: rgb(102, 102, 102); + height: 0.5px; +` diff --git a/src/Components/CollectionDescription.js b/src/Components/CollectionDescription.js new file mode 100644 index 0000000000000000000000000000000000000000..938139f90102f7dcf5f3e82467cf58c45dc01900 --- /dev/null +++ b/src/Components/CollectionDescription.js @@ -0,0 +1,79 @@ +/*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 } from 'react'; +import { Store } from '../Store.js' +import { Grid } from '@material-ui/core'; +import Button from '@material-ui/core/Button'; +import GetAppIcon from '@material-ui/icons/GetApp'; +import AddIcon from '@material-ui/icons/Add'; +import styled from 'styled-components'; +import CollectionReview from './CollectionReview.js'; +import FollowCollectionButton from './FollowCollectionButton.js'; + +export default function CollectionDescription(props) { + const { state } = useContext(Store); + console.log(state.currentUser); + return ( + <Grid container direction="column" justify="center" alignItems="center"> + <Grid item> + <Title>{props.title}</Title> + </Grid> + <Grid item container + direction="row" justify="space-between" alignItems="center" + > + <Grid item sm={4}> + <CollectionReview/> + </Grid> + <Grid item container sm={8} + direction="column" justify="center" alignItems="flex-end" + > + <Grid item style={{marginBottom: 10}}> + <DownloadButton + variant="outlined" + color="primary" + startIcon={<GetAppIcon fontSize="large"/>} + size="large" + > + <ButtonText>Baixar Coleção</ButtonText> + </DownloadButton> + </Grid> + <Grid item> + <FollowCollectionButton user_id={state.currentUser.id}/> + </Grid> + </Grid> + </Grid> + + </Grid> + ); +} + +const Title=styled.h1` + font-size: 3em; + color: rgb(102, 102, 102); + float: left; +` +const ButtonText=styled.span` + font-weight: bolder; + font-size: 1.2em; +` +const DownloadButton=styled(Button)` + padding-left: 10, + padding-right: 10, + width: 210, +` diff --git a/src/Components/CollectionReview.js b/src/Components/CollectionReview.js new file mode 100644 index 0000000000000000000000000000000000000000..83487d0d1bf3cdd546f8ae9b8f5e1eb74d210f5e --- /dev/null +++ b/src/Components/CollectionReview.js @@ -0,0 +1,59 @@ +/*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 { Grid } from '@material-ui/core'; +import styled from 'styled-components'; +import Rating from '@material-ui/lab/Rating'; +import IconButton from '@material-ui/core/IconButton'; +import StarBorderIcon from '@material-ui/icons/StarBorder'; +import FavoriteIcon from '@material-ui/icons/Favorite'; +import InfoIcon from '@material-ui/icons/Info'; + +export default function CollectionReview() { + //TODO: axios aqui + //TODO: chamar o modal de report + const likes = 2; + const [liked, setLiked] = useState(false); + const [stars, setStars] = useState(0); + + return ( + <Grid container direction="row" justify="center" alignItems="center"> + <Grid item sm={8}> + <Rating + name="customized-empty" + value={stars} + onChange={(e, value) => {setStars(value)}} + precision={0.5} + style={{color:"#666"}} + emptyIcon={<StarBorderIcon fontSize="inherit" />} + /> + </Grid> + <Grid item sm={4}> + <IconButton aria-label="like" onClick={() => setLiked(!liked)}> + {likes + (liked ? 1 : 0)}<FavoriteIcon /> + </IconButton> + </Grid> + <Grid item sm={12}> + <IconButton aria-label="report" style={{fontSize: 'small'}}> + <InfoIcon />Reportar erro ou abuso + </IconButton> + </Grid> + </Grid> + ); +} diff --git a/src/Components/FollowCollectionButton.js b/src/Components/FollowCollectionButton.js new file mode 100644 index 0000000000000000000000000000000000000000..a172e7728139877fcc6b99b8856441cd68bd1f1d --- /dev/null +++ b/src/Components/FollowCollectionButton.js @@ -0,0 +1,77 @@ +/*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 Button from '@material-ui/core/Button'; +import CheckIcon from '@material-ui/icons/Check'; +import AddIcon from '@material-ui/icons/Add'; +import styled from 'styled-components'; +import SignUpModal from './SignUpModal.js'; + +export default function FollowCollectionButton(props) { + const [icon, setIcon] = useState(<AddIcon fontSize="large"/>); + const [button_text, setButtonText] = useState("Seguir Coleção"); + const [variant, setVariant] = useState("outlined"); + const [sign_up_open, setSignUpOpen] = useState(false); + + const handleClick = () => { + //aqui tem que ter: + //se o usuário não está logado, abre a tela de criar conta + + //setSignUpOpen(true); + + //se o usuário já segue a coleção,deixa de seguir + + //setButtonText("Seguir Coleção"); + + //se o usuário não segue a coleção, muda o visual por alguns instantes e depois mostra o "deixa de seguir" + setVariant("contained"); + setButtonText("Seguindo"); + setIcon(<CheckIcon fontSize="large"/>) + }; + + return ( + <div> + <FollowButton + variant={variant} + color="primary" + startIcon={icon} + size="large" + onClick={() => handleClick()} + > + <ButtonText>{button_text}</ButtonText> + </FollowButton> + <SignUpModal open={sign_up_open} handleClose={() => setSignUpOpen(false)} /> + </div> + ); +} + +const Title=styled.h1` + font-size: 3em; + color: rgb(102, 102, 102); + float: left; +` +const ButtonText=styled.span` + font-weight: bolder; + font-size: 1.2em; +` +const FollowButton=styled(Button)` + padding-left: 10, + padding-right: 10, + width: 210, +` diff --git a/src/Components/ResourceList.js b/src/Components/ResourceList.js new file mode 100644 index 0000000000000000000000000000000000000000..5c5230fb954045f2a0e66c90256fcad5f5b3d29a --- /dev/null +++ b/src/Components/ResourceList.js @@ -0,0 +1,119 @@ +/*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 { Grid } from '@material-ui/core'; +import styled from 'styled-components'; +import Button from '@material-ui/core/Button'; +import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'; +import CheckBoxIcon from '@material-ui/icons/CheckBox'; +import GetAppIcon from '@material-ui/icons/GetApp'; +import ResourceCardFunction from './ResourceCardFunction.js'; + + +export default function ResourceList(props) { + const [selected, setSelected] = useState(Array.apply( + null, {length: props.resources.length}).map(i => false)); + const [selectable, setSelectable] = useState(false); + + const updateSelected = (index) => { + let new_selected = selected.slice(); + new_selected[index] = !new_selected[index]; + setSelected(new_selected); + } + + const checkBoxIcon = (s) => { + if (s) + return <CheckBoxIcon />; + else + return <CheckBoxOutlineBlankIcon />; + } + + return ( + <ResourceListContainer> + <Grid container direction="row" justify="space-between" alignItems="center"> + <Grid item> + <Title>{props.resources.length} recurso{props.resources.length == 1 ? "" : "s"}</Title> + </Grid> + <Grid item> + <Button color="primary" onClick={() => setSelectable(!selectable)}> + <PanelButtonText> + Ativar seleção + </PanelButtonText> + </Button> + </Grid> + <Grid item> + <Button + color="primary" + variant="outlined" + startIcon={<GetAppIcon fontSize="large"/>} + > + <PanelButtonText>baixar seleção</PanelButtonText> + </Button> + </Grid> + </Grid> + <Grid container direction="row" justify="space-around" alignItems="center"> + {props.resources.map((r) => { + return ( + <Grid item key={r.title}> + <ResourceCardFunction + type={r.type} + author={r.author} + tags={r.tags} + published={r.published} + title={r.title} + rating={r.rating} + likeCount={r.likeCount} + liked={r.liked} + thumbnail={r.thumbnail} + /> + {selectable ? + (<SelectButton + variant="outline" + color="primary" + startIcon={checkBoxIcon(selected[props.resources.indexOf(r)])} + onClick={() => updateSelected(props.resources.indexOf(r))} + > + Selecionar + </SelectButton>) + : + <span></span>} + + </Grid> + ); + })} + </Grid> + </ResourceListContainer> + ); +} + +const ResourceListContainer=styled.div` + margin-left: 20; + margin-right: 20; +` +const Title=styled.p` + color: rgb(102, 102, 102); + font-size: 2em; + font-weigth: 300; +` +const SelectButton=styled(Button)` + width: 100%; +` +const PanelButtonText=styled.span` + font-weight: 900; +` diff --git a/src/Components/VerticalRuler.js b/src/Components/VerticalRuler.js new file mode 100644 index 0000000000000000000000000000000000000000..eb178b1336e30b671c5627b9ec4a76c487a52602 --- /dev/null +++ b/src/Components/VerticalRuler.js @@ -0,0 +1,30 @@ +/*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'; + + +export default function VerticalRuler(props) { + return ( + <div + style={{ + borderLeft: ''+props.width+'px solid '+props.color, + height:props.height + }}/> + ); +} diff --git a/src/Pages/CollectionPage.js b/src/Pages/CollectionPage.js index 53f2351c0eade585a0709d459f9f940299b60bb5..834d16e6b69aa822720f6fcbe3e57c3b5becc84a 100644 --- a/src/Pages/CollectionPage.js +++ b/src/Pages/CollectionPage.js @@ -16,15 +16,57 @@ 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 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'; +export default function CollectionPage() { + return ( + <Grid container + direction="row" + justify="space-around" + alignItems="center" + style={mainContainerStyle}> -class CollectionPage extends Component { - render() { - return ( - <h1> Página visulizar coleção</h1> - ); - } - } + <Grid item xs={10} md={3}> + <CollectionAuthor name="Glaucia Gomes" imgsrc="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcdn2.iconfinder.com%2Fdata%2Ficons%2Fsocial-flat-buttons-3%2F512%2Fduckduckgo-512.png&f=1&nofb=1"/> + </Grid> -export default CollectionPage; + <VerticalRuler width={1} height={300} color="rgb(238, 238, 238)"/> + + <Grid item xs={10} md={6}> + <CollectionDescription title="Linguagem de Programacao"/> + </Grid> + + <Grid container item direction="row" justify="center" alignItems="center" style={{backgroundColor: '#f4f4f4'}}> + <Grid item xs={10}> + <ResourceList resources={[{ + type: "Outros", + author: "Luciano Hulk", + tags: ["Recursos_do_luciano", "Matemática"], + published: true, + title: "Caldeirão do Pitágoras", + rating: 0.5, + likeCount: 8, + liked: false, + avatar: null, + thumbnail: null + }]} + selectable={true} + /> + </Grid> + <Grid item xs={10} style={{marginTop: 40}}> + <CollectionCommentSection /> + </Grid> + </Grid> + </Grid> + ); +} + +const mainContainerStyle = { + marginTop: '5%', +}