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
Harbor Registry
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
aaff3e04
Commit
aaff3e04
authored
4 years ago
by
lfr20
Browse files
Options
Downloads
Patches
Plain Diff
Added sign up modal if the user is not logged
parent
96fd39d5
No related branches found
No related tags found
6 merge requests
!57
Merge of develop into master
,
!56
Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...
,
!39
Update admin system
,
!32
Homologa
,
!31
Fix console error
,
!28
Training materials
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Components/ButtonGuardarColecao.js
+49
-12
49 additions, 12 deletions
src/Components/ButtonGuardarColecao.js
with
49 additions
and
12 deletions
src/Components/ButtonGuardarColecao.js
+
49
−
12
View file @
aaff3e04
import
React
,
{
useState
,
useContext
}
from
'
react
'
import
{
Store
}
from
'
../Store.js
'
import
React
,
{
useState
,
useContext
}
from
'
react
'
import
{
Store
}
from
'
../Store.js
'
import
Button
from
'
@material-ui/core/Button
'
;
import
styled
from
'
styled-components
'
import
CreateNewFolderIcon
from
'
@material-ui/icons/CreateNewFolder
'
;
import
GuardarModal
from
'
./GuardarModal
'
import
SignUpModal
from
'
./SignUpModal
'
import
LoginModal
from
'
./LoginModal.js
'
import
Snackbar
from
'
@material-ui/core/Snackbar
'
;
import
MuiAlert
from
'
@material-ui/lab/Alert
'
;
export
default
function
ButtonGuardarColecao
(
props
)
{
const
{
state
}
=
useContext
(
Store
)
export
default
function
ButtonGuardarColecao
(
props
)
{
const
{
state
}
=
useContext
(
Store
)
const
[
saveToCol
,
toggleSave
]
=
useState
(
false
)
const
handleGuardar
=
()
=>
{
if
(
state
.
currentUser
.
id
===
''
)
{
console
.
log
(
'
abrir login modal
'
);
if
(
!
state
.
currentUser
.
id
)
{
handleLogin
()
}
else
{
toggleSave
(
true
);
}
}
const
handleSignUp
=
()
=>
{
setSignUp
(
!
signUpOpen
)
}
const
handleLogin
=
()
=>
{
setLogin
(
!
loginOpen
)
}
function
Alert
(
props
)
{
return
<
MuiAlert
elevation
=
{
6
}
variant
=
"
filled
"
{...
props
}
/>
;
}
function
toggleLoginSnackbar
(
reason
)
{
if
(
reason
===
'
clickaway
'
)
{
return
;
}
handleSuccessfulLogin
(
false
);
}
const
[
signUpOpen
,
setSignUp
]
=
useState
(
false
)
const
[
loginOpen
,
setLogin
]
=
useState
(
false
)
const
[
successfulLoginOpen
,
handleSuccessfulLogin
]
=
useState
(
false
)
return
(
<>
<
GuardarModal
open
=
{
saveToCol
}
handleClose
=
{()
=>
{
toggleSave
(
false
)}}
thumb
=
{
props
.
thumb
}
title
=
{
props
.
title
}
recursoId
=
{
props
.
learningObjectId
}
/
>
<
StyledButton
onClick
=
{
handleGuardar
}
>
<
CreateNewFolderIcon
/>
&
nbsp
;
GUARDAR
<
/StyledButton
>
<
SignUpModal
open
=
{
signUpOpen
}
handleClose
=
{
handleSignUp
}
openLogin
=
{
handleLogin
}
/
>
<
LoginModal
open
=
{
loginOpen
}
handleClose
=
{()
=>
setLogin
(
false
)}
openSignUp
=
{
handleSignUp
}
openSnackbar
=
{()
=>
{
handleSuccessfulLogin
(
true
)
}}
/
>
<
Snackbar
open
=
{
successfulLoginOpen
}
autoHideDuration
=
{
1000
}
onClose
=
{
toggleLoginSnackbar
}
anchorOrigin
=
{{
vertical
:
'
top
'
,
horizontal
:
'
center
'
}}
>
<
Alert
severity
=
"
success
"
style
=
{{
backgroundColor
:
"
#00acc1
"
}}
>
Você
está
conectado
(
a
)
!<
/Alert
>
<
/Snackbar
>
<
GuardarModal
open
=
{
saveToCol
}
handleClose
=
{()
=>
{
toggleSave
(
false
)
}}
thumb
=
{
props
.
thumb
}
title
=
{
props
.
title
}
recursoId
=
{
props
.
learningObjectId
}
/
>
<
StyledButton
onClick
=
{
handleGuardar
}
>
<
CreateNewFolderIcon
/>
&
nbsp
;
GUARDAR
<
/StyledButton
>
<
/
>
)
}
...
...
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