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
0e7b49b6
Unverified
Commit
0e7b49b6
authored
Jun 29, 2020
by
Larissa Martins
Committed by
GitHub
Jun 29, 2020
Browse files
Merge pull request #36 from 2020-1-RDM/modal
Fix modal tela do mentor
parents
647bc6d6
cf80d23b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/pages/adm/StyledComponents/ContainerIcon.jsx
View file @
0e7b49b6
import
styled
from
'
styled-components
'
;
// eslint-disable-next-line import/no-extraneous-dependencies
import
{
shade
}
from
'
polished
'
;
import
COLOR
from
'
../../../utils/colors.constants
'
;
...
...
src/pages/mentor/Mentor.jsx
View file @
0e7b49b6
...
...
@@ -4,7 +4,7 @@ import { Container } from '@material-ui/core';
import
{
useSnackbar
}
from
'
notistack
'
;
import
StyledContainer
from
'
./StyledComponents
'
;
import
Card
from
'
../../components/RedeCard/RedeCard
'
;
//
import
ProfileInfo from '../../components/RedeProfileInfo/RedeProfileInfo
';
import
ModalRep
from
'
../adm/StyledComponents/ModalReprove
'
;
import
{
mentoriasByMentor
,
desativarMentoria
,
mudarVisibilidade
}
from
'
../../services/mentoria
'
;
import
{
profile
}
from
'
../../services/user
'
;
import
RedeButton
from
'
../../components/RedeButton/RedeButton
'
;
...
...
@@ -12,32 +12,32 @@ import { userTypes } from '../../utils/userType.constants';
function
Mentor
()
{
const
history
=
useHistory
();
const
[
flagModalRep
,
setFlagModalRep
]
=
useState
(
false
);
const
[
mentoringId
,
setMentoringId
]
=
useState
(
''
);
const
[
mentorias
,
setMentorias
]
=
useState
([]);
const
{
enqueueSnackbar
}
=
useSnackbar
();
const
changeAva
l
ibility
=
(
index
)
=>
{
const
changeAvai
la
bility
=
()
=>
{
const
token
=
sessionStorage
.
getItem
(
'
token
'
);
const
{
id
}
=
mentori
as
[
index
]
;
const
id
=
mentori
ngId
;
const
config
=
{
params
:
{
id
},
headers
:
{
Authorization
:
`Bearer
${
token
}
`
},
};
if
(
global
.
confirm
(
'
Você deseja realmente deletar essa mentoria ?
'
))
{
desativarMentoria
(
config
)
.
then
(()
=>
{
const
allMentorias
=
[...
mentorias
];
allMentorias
.
splice
(
index
,
1
);
setMentorias
(
allMentorias
);
enqueueSnackbar
(
'
Mentoria deletada!
'
,
{
variant
:
'
success
'
,
autoHideDuration
:
2500
});
})
.
catch
(()
=>
{
enqueueSnackbar
(
'
Falha ao deletar essa mentoria. Verifique sua conexão e tente novamente.
'
,
{
variant
:
'
error
'
,
autoHideDuration
:
2500
},
);
});
}
desativarMentoria
(
config
)
.
then
(()
=>
{
setMentorias
(
mentorias
.
filter
((
el
)
=>
el
.
id
!==
id
));
enqueueSnackbar
(
'
Mentoria deletada!
'
,
{
variant
:
'
success
'
,
autoHideDuration
:
2500
});
// eslint-disable-next-line no-use-before-define
fechaModalRep
();
})
.
catch
(()
=>
{
enqueueSnackbar
(
'
Falha ao deletar essa mentoria. Verifique sua conexão e tente novamente.
'
,
{
variant
:
'
error
'
,
autoHideDuration
:
2500
},
);
});
};
const
changeVisibility
=
(
i
)
=>
{
...
...
@@ -123,6 +123,16 @@ function Mentor() {
fetchCards
();
},
[]);
// eslint-disable-next-line no-shadow
function
abreModalRep
(
mentoriaId
)
{
setMentoringId
(
mentoriaId
);
setFlagModalRep
(
true
);
}
function
fechaModalRep
()
{
setFlagModalRep
(
false
);
}
return
(
<>
<
Container
>
...
...
@@ -136,7 +146,7 @@ function Mentor() {
<
Card
key
=
{
mentoria
.
id
}
mentoria
=
{
mentoria
.
data
}
onClickRemove
=
{
()
=>
changeAvalibility
(
i
)
}
onClickRemove
=
{
()
=>
abreModalRep
(
mentoria
.
id
)
}
onClickVisible
=
{
()
=>
changeVisibility
(
i
)
}
onClickEdit
=
{
()
=>
editPage
(
mentoria
)
}
isVisible
=
{
mentoria
.
data
.
isVisible
}
...
...
@@ -144,6 +154,11 @@ function Mentor() {
/>
))
)
:
(<
StyledContainer
.
Subtitle
>
Nenhuma mentoria encontrada!
</
StyledContainer
.
Subtitle
>)
}
<
ModalRep
open
=
{
flagModalRep
}
handleClose
=
{
()
=>
fechaModalRep
()
}
evaluateMentoring
=
{
()
=>
changeAvailability
()
}
/>
</
StyledContainer
>
</
Container
>
</>
...
...
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