Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rede De Mentores
Frontend
Commits
647bc6d6
Unverified
Commit
647bc6d6
authored
Jun 29, 2020
by
Larissa Martins
Committed by
GitHub
Jun 29, 2020
Browse files
Merge pull request #32 from 2020-1-RDM/fix-funcao-olho
Fix funcao olho
parents
8cde943a
d34cabb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/components/RedeCard/RedeCard.jsx
View file @
647bc6d6
import
React
from
'
react
'
;
import
{
object
,
func
,
bool
}
from
'
prop-types
'
;
import
Container
from
'
./StyledComponents
'
;
//
import visible from '../../assets/visibility-button.png';
import
visible
from
'
../../assets/visibility-button.png
'
;
import
remove
from
'
../../assets/rubbish-bin-delete-button.png
'
;
import
edition
from
'
../../assets/create-new-pencil-button.png
'
;
import
notVisible
from
'
../../assets/invisible-button.png
'
;
...
...
@@ -29,6 +29,7 @@ const Card = ({
onClickRemove
,
onClickEdit
,
todosHorarios
,
isVisible
,
})
=>
{
const
nextAvailableHours
=
mentoria
.
dateTime
.
slice
(
0
,
3
)
.
map
((
day
)
=>
<
RedeButton
claro
descricao
=
{
`
${
day
.
day
.
slice
(
0
,
3
)}
-
${
day
.
times
[
0
].
hour
}
`
}
onClick
=
{
onClickSchedule
}
/>);
...
...
@@ -61,7 +62,7 @@ const Card = ({
<>
<
RedeIcon
imageUrl
=
{
remove
}
onClick
=
{
onClickRemove
}
/>
<
RedeIcon
imageUrl
=
{
mentoria
.
data
?
mentoria
.
data
.
isV
isible
:
notVisible
}
imageUrl
=
{
isVisible
?
v
isible
:
notVisible
}
onClick
=
{
onClickVisible
}
/>
<
RedeIcon
imageUrl
=
{
edition
}
onClick
=
{
onClickEdit
}
/>
...
...
src/pages/mentor/Mentor.jsx
View file @
647bc6d6
...
...
@@ -26,8 +26,8 @@ function Mentor() {
if
(
global
.
confirm
(
'
Você deseja realmente deletar essa mentoria ?
'
))
{
desativarMentoria
(
config
)
.
then
(()
=>
{
const
allMentorias
=
mentorias
;
m
entorias
.
splice
(
index
,
1
);
const
allMentorias
=
[...
mentorias
]
;
allM
entorias
.
splice
(
index
,
1
);
setMentorias
(
allMentorias
);
enqueueSnackbar
(
'
Mentoria deletada!
'
,
{
variant
:
'
success
'
,
autoHideDuration
:
2500
});
})
...
...
@@ -41,16 +41,31 @@ function Mentor() {
};
const
changeVisibility
=
(
i
)
=>
{
const
allMentorias
=
mentorias
;
allMentorias
[
i
].
data
.
isVisible
=
!
allMentorias
[
i
].
data
.
isVisible
;
setMentorias
(
allMentorias
);
const
allMentorias
=
[...
mentorias
];
const
token
=
sessionStorage
.
getItem
(
'
token
'
);
const
{
id
}
=
mentorias
[
i
];
const
config
=
{
params
:
{
id
},
headers
:
{
Authorization
:
`Bearer
${
token
}
`
},
};
mudarVisibilidade
(
config
);
mudarVisibilidade
(
config
).
then
(
()
=>
{
allMentorias
[
i
].
data
.
isVisible
=
!
allMentorias
[
i
].
data
.
isVisible
;
setMentorias
(
allMentorias
);
let
message
;
if
(
allMentorias
[
i
].
data
.
isVisible
)
message
=
'
Mentoria não está mais disponível para os mentorandos!
'
;
else
message
=
'
Mentoria está disponível para os mentorandos!
'
;
enqueueSnackbar
(
message
,
{
variant
:
'
success
'
,
autoHideDuration
:
2500
});
},
).
catch
(
()
=>
{
enqueueSnackbar
(
'
Falha ao atualizar essa mentoria. Verifique sua conexão e tente novamente.
'
,
{
variant
:
'
error
'
,
autoHideDuration
:
2500
},
);
},
);
};
const
editPage
=
(
mentoria
)
=>
{
...
...
@@ -124,6 +139,7 @@ function Mentor() {
onClickRemove
=
{
()
=>
changeAvalibility
(
i
)
}
onClickVisible
=
{
()
=>
changeVisibility
(
i
)
}
onClickEdit
=
{
()
=>
editPage
(
mentoria
)
}
isVisible
=
{
mentoria
.
data
.
isVisible
}
todosHorarios
/>
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment