Skip to content
Snippets Groups Projects
Commit 9162bb17 authored by Lucas Eduardo Schoenfelder's avatar Lucas Eduardo Schoenfelder
Browse files

adicionado trabalho dos ultimos dias. checar o retorno das rotas no card de...

adicionado trabalho dos ultimos dias. checar o retorno das rotas no card de contato (testei agora e nao estavam funcionando)
parent fe4ff462
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,8 @@ GNU Affero General Public License for more details. ...@@ -16,7 +16,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License 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/>.*/ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/
import React, { useState } from 'react'; import React, { useState, useContext } from 'react';
import {Store} from '../Store.js'
import Card from '@material-ui/core/Card'; import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent'; import CardContent from '@material-ui/core/CardContent';
import noAvatar from "../img/default_profile.png"; import noAvatar from "../img/default_profile.png";
...@@ -27,11 +28,16 @@ import FollowButton from './ContactButtons/FollowButton.js' ...@@ -27,11 +28,16 @@ import FollowButton from './ContactButtons/FollowButton.js'
import FollowingButton from './ContactButtons/FollowingButton.js' import FollowingButton from './ContactButtons/FollowingButton.js'
import FollowersCountButton from './ContactButtons/FollowersCountButton.js' import FollowersCountButton from './ContactButtons/FollowersCountButton.js'
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import CircularProgress from '@material-ui/core/CircularProgress';
import Rubi from '../img/rubi.png';
export default function ImgMediaCard(props) { export default function ImgMediaCard(props) {
const {state} = useContext(Store)
const [followedBoolean, setFollowedBoolean] = useState(props.followed) const [followedBoolean, setFollowedBoolean] = useState(props.followed)
const toggleFollowed = () => { setFollowedBoolean(!followedBoolean) } const toggleFollowed = () => { setFollowedBoolean(!followedBoolean) }
function isOnStore () {
return (window.location.href.includes("loja"))
}
return ( return (
<StyledCard> <StyledCard>
<CardDiv> <CardDiv>
...@@ -67,7 +73,24 @@ export default function ImgMediaCard(props) { ...@@ -67,7 +73,24 @@ export default function ImgMediaCard(props) {
<b>{props.numCollections}</b> {props.numCollections !== 1 ? "Coleções" : "Coleção"} | <b>{props.numLearningObjects}</b> {props.numLearningObjects !== 1 ? "Recursos" : "Recurso"} <b>{props.numCollections}</b> {props.numCollections !== 1 ? "Coleções" : "Coleção"} | <b>{props.numLearningObjects}</b> {props.numLearningObjects !== 1 ? "Recursos" : "Recurso"}
</span> </span>
</Link> </Link>
{
isOnStore() ?
(
<div style={{display : "flex", flexDirection : "row", justifyContent : "space-around", padding : "20px"}}>
<span style={{display : "flex"}}>
Nível
<div style={{borderRadius : "50%", background : "lightgrey", border : "4px solid gray", height : "25px", width : "25px", marginLeft : "10px"}}>
{state.currentUser.level}
</div>
</span>
<div style={{borderLeft : "1px solid lightgrey"}}/>
<img src={Rubi} alt="gemas-icon" style={{maxHeight : "25px"}}/>
<span > {state.currentUser.coins} gemas</span>
</div>
)
:
(
<div style={{ display: "flex", justifyContent: "center" }}> <div style={{ display: "flex", justifyContent: "center" }}>
{ {
followedBoolean ? followedBoolean ?
...@@ -97,8 +120,10 @@ export default function ImgMediaCard(props) { ...@@ -97,8 +120,10 @@ export default function ImgMediaCard(props) {
</React.Fragment> </React.Fragment>
) )
} }
</div> </div>
)
}
</UserInfo> </UserInfo>
</CardContent> </CardContent>
</CardAreaDiv> </CardAreaDiv>
......
...@@ -73,16 +73,12 @@ export default function ItemStoreContainer(props) { ...@@ -73,16 +73,12 @@ export default function ItemStoreContainer(props) {
// }, []) // }, [])
useEffect(() => { useEffect(() => {
// axios.get((`${apiUrl}/users/` + state.currentUser.id)) getRequest("/users/238", (data) => {
// .then((response) => { setCurrUser(data);
// setCurrUser(response.data); setIsLoading(false)
// setIsLoading(false); }, (error) => {
// }, console.log(error);
// (error) => { })
// console.log(error);
// setIsLoading(false);
// }
// )
getRequest("/items", (data) => { getRequest("/items", (data) => {
console.log(data) console.log(data)
setBadges(data.filter(item => item.item_type === "badge")) setBadges(data.filter(item => item.item_type === "badge"))
......
src/img/rubi.png

7.09 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment