From 821fdf3e9666423ca39ad37cecf7b2834c3aaa5d Mon Sep 17 00:00:00 2001
From: Luis Felipe Risch <lfr20@inf.ufpr.br>
Date: Sat, 13 Feb 2021 11:18:20 -0300
Subject: [PATCH] Removed unecessary comment

---
 src/Components/CollectionCardFunction.js | 81 ++++++------------------
 1 file changed, 21 insertions(+), 60 deletions(-)

diff --git a/src/Components/CollectionCardFunction.js b/src/Components/CollectionCardFunction.js
index e177fa5f..44c58ea8 100644
--- a/src/Components/CollectionCardFunction.js
+++ b/src/Components/CollectionCardFunction.js
@@ -16,9 +16,9 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, {useState, useContext, useEffect} from 'react';
-import {Store} from '../Store.js'
-import {apiDomain} from '../env';
+import React, { useState, useContext, useEffect } from 'react';
+import { Store } from '../Store.js'
+import { apiDomain } from '../env';
 import noAvatar from "../img/default_profile.png";
 import Button from '@material-ui/core/Button';
 import styled from 'styled-components'
@@ -35,7 +35,7 @@ import LockIcon from '@material-ui/icons/Lock';
 import ColCardOwnerOptions from './ColCardOwnerOptions.js'
 import ColCardPublicOptions from './ColCardPublicOptions'
 import { Link } from 'react-router-dom';
-import {putRequest} from '../Components/HelperFunctions/getAxiosConfig'
+import { putRequest } from '../Components/HelperFunctions/getAxiosConfig'
 import SignUpModal from './SignUpModal'
 import LoginModal from './LoginModal.js'
 import Snackbar from '@material-ui/core/Snackbar';
@@ -58,12 +58,12 @@ export default function CollectionCardFunction(props) {
     const [successfulLoginOpen, handleSuccessfulLogin] = useState(false)
 
 
-    function handleSuccessLike (data) {
+    function handleSuccessLike(data) {
         toggleLiked(!liked)
         setLikesCount(data.count)
     }
     const handleLike = () => {
-        putRequest(`/collections/${props.id}/like`, {}, handleSuccessLike, (error) => {console.log(error)})
+        putRequest(`/collections/${props.id}/like`, {}, handleSuccessLike, (error) => { console.log(error) })
     }
 
     const [followingHover, handleFollowingHover] = useState(false)
@@ -72,11 +72,11 @@ export default function CollectionCardFunction(props) {
     const [slideIn, setSlide] = useState(false)
     const controlSlide = () => { setSlide(!slideIn) }
 
-    function handleSuccessFollow (data) {
+    function handleSuccessFollow(data) {
         handleToggleUserFollowingCol()
     }
     const handleFollow = () => {
-        putRequest(`/collections/${props.id}/follow`, {}, handleSuccessFollow, (error) => {console.log(error)})
+        putRequest(`/collections/${props.id}/follow`, {}, handleSuccessFollow, (error) => { console.log(error) })
     }
 
     const RenderFollowButton = () => {
@@ -88,49 +88,6 @@ export default function CollectionCardFunction(props) {
     }
 
     useEffect(() => {
-        // setTimeout(function () {
-        //     if (state.currentUser.id) {
-        //         const config = getAxiosConfig();
-        //         axios({
-        //             method: 'get',
-        //             url: `${apiUrl}/users/${state.currentUser.id}/following/Collection`,
-        //             headers: config.headers
-        //         }).then(
-        //             (response) => {
-        //                 const data = response.data
-        //                 for (let i = 0; i < data.length; i++)
-        //                     if (data[i].followable.id === props.id)
-        //                         toggleUserFollowingCol(true)
-        //                 saveHeaders(response)
-        //             })
-        //     }
-        //     else {
-        //         toggleLiked(false);
-        //         toggleUserFollowingCol(false);
-        //     }
-        // }, 1000);
-
-        // setTimeout(function () {
-        //     if (state.currentUser.id) {
-        //         const config = getAxiosConfig();
-        //         axios({
-        //             method: 'get',
-        //             url: `${apiUrl}/users/${state.currentUser.id}/collections/liked`,
-        //             headers: config.headers
-        //         }).then(
-        //             (response) => {
-        //                 const data = response.data
-        //                 for (let i = 0; i < data.length; i++)
-        //                     if (data[i].id === props.id)
-        //                         toggleLiked(true)
-        //                 saveHeaders(response)
-        //             })
-        //     }
-        //     else {
-        //         toggleLiked(false);
-        //         toggleUserFollowingCol(false);
-        //     }
-        // }, 2000);
         if (!state.currentUser.id) {
             toggleLiked(false);
             toggleUserFollowingCol(false);
@@ -174,15 +131,19 @@ export default function CollectionCardFunction(props) {
                         <p>{props.author}</p>
                     </EnviadoPor>
                 </HeaderContainer>
-                <TagContainer container direction="row">
-                    {
-                        props.tags.map((tag) =>
-                            <Grid item key={tag.id}>
-                                <span >{tag.name}</span>
-                            </Grid>
-                        )
-                    }
-                </TagContainer>
+                {
+                    props.tags ?
+                        <TagContainer container direction="row">
+                            {
+                                props.tags.map((tag) =>
+                                    <Grid item key={tag.id}>
+                                        <span >{tag.name}</span>
+                                    </Grid>
+                                )
+                            }
+                        </TagContainer> :
+                        null
+                }
             </SlideContentDiv>
         )
     }
-- 
GitLab