diff --git a/src/Components/ContactCard.js b/src/Components/ContactCard.js index bacf2c87feb01ee0f5a236eda286391518314d6c..6a37118df4db6f053d20cae072e2eb2e163a8f2a 100644 --- a/src/Components/ContactCard.js +++ b/src/Components/ContactCard.js @@ -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 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 CardContent from '@material-ui/core/CardContent'; import noAvatar from "../img/default_profile.png"; @@ -27,11 +28,16 @@ import FollowButton from './ContactButtons/FollowButton.js' import FollowingButton from './ContactButtons/FollowingButton.js' import FollowersCountButton from './ContactButtons/FollowersCountButton.js' import { Link } from 'react-router-dom'; +import CircularProgress from '@material-ui/core/CircularProgress'; +import Rubi from '../img/rubi.png'; export default function ImgMediaCard(props) { - + const {state} = useContext(Store) const [followedBoolean, setFollowedBoolean] = useState(props.followed) const toggleFollowed = () => { setFollowedBoolean(!followedBoolean) } + function isOnStore () { + return (window.location.href.includes("loja")) + } return ( <StyledCard> <CardDiv> @@ -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"} </span> </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" }}> { followedBoolean ? @@ -97,8 +120,10 @@ export default function ImgMediaCard(props) { </React.Fragment> ) } - </div> + ) + } + </UserInfo> </CardContent> </CardAreaDiv> diff --git a/src/Pages/ItemStore.js b/src/Pages/ItemStore.js index 8ac7f1d61a508aacde78f0365ce752624b4c6d40..f513b8a5f3b7b932bcdda24c1796bf521064e391 100644 --- a/src/Pages/ItemStore.js +++ b/src/Pages/ItemStore.js @@ -73,16 +73,12 @@ export default function ItemStoreContainer(props) { // }, []) useEffect(() => { - // axios.get((`${apiUrl}/users/` + state.currentUser.id)) - // .then((response) => { - // setCurrUser(response.data); - // setIsLoading(false); - // }, - // (error) => { - // console.log(error); - // setIsLoading(false); - // } - // ) + getRequest("/users/238", (data) => { + setCurrUser(data); + setIsLoading(false) + }, (error) => { + console.log(error); + }) getRequest("/items", (data) => { console.log(data) setBadges(data.filter(item => item.item_type === "badge")) diff --git a/src/img/rubi.png b/src/img/rubi.png new file mode 100644 index 0000000000000000000000000000000000000000..3a5da3d8a3108d0fdb3200a843fc1dd7c9d2a5b8 Binary files /dev/null and b/src/img/rubi.png differ