Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PortalMEC-React
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PortalMEC
PortalMEC-React
Commits
821fdf3e
Commit
821fdf3e
authored
4 years ago
by
lfr20
Browse files
Options
Downloads
Patches
Plain Diff
Removed unecessary comment
parent
c6e03c14
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!57
Merge of develop into master
,
!56
Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...
,
!39
Update admin system
,
!36
Fix perfil into develop
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Components/CollectionCardFunction.js
+21
-60
21 additions, 60 deletions
src/Components/CollectionCardFunction.js
with
21 additions
and
60 deletions
src/Components/CollectionCardFunction.js
+
21
−
60
View file @
821fdf3e
...
...
@@ -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
>
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment