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
61c46386
Commit
61c46386
authored
4 years ago
by
Lucas Eduardo Schoenfelder
Browse files
Options
Downloads
Patches
Plain Diff
done
parent
dd9dae4d
No related branches found
No related tags found
3 merge requests
!57
Merge of develop into master
,
!56
Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...
,
!24
Tela recurso
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Components/CriarColecaoForm.js
+216
-0
216 additions, 0 deletions
src/Components/CriarColecaoForm.js
src/Components/CriarColecaoModal.js
+133
-0
133 additions, 0 deletions
src/Components/CriarColecaoModal.js
with
349 additions
and
0 deletions
src/Components/CriarColecaoForm.js
0 → 100644
+
216
−
0
View file @
61c46386
/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana
This file is part of Plataforma Integrada MEC.
Plataforma Integrada MEC is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Plataforma Integrada MEC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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
}
from
'
react
'
import
{
Store
}
from
'
../Store.js
'
import
{
Button
}
from
'
@material-ui/core
'
;
import
styled
from
'
styled-components
'
import
Radio
from
'
@material-ui/core/Radio
'
;
import
RadioGroup
from
'
@material-ui/core/RadioGroup
'
;
import
FormControlLabel
from
'
@material-ui/core/FormControlLabel
'
;
import
FormControl
from
'
@material-ui/core/FormControl
'
;
import
TextField
from
'
@material-ui/core/TextField
'
;
import
axios
from
'
axios
'
import
{
apiUrl
}
from
'
../env
'
;
export
default
function
CriarColecaoForm
(
props
)
{
const
{
state
}
=
useContext
(
Store
)
const
[
value
,
setValue
]
=
React
.
useState
(
-
1
);
/*values are set according to backend complaint id*/
const
[
options
]
=
React
.
useState
([
{
value
:
"
pública
"
,
text
:
'
Pública (Sua coleção estará disponível para todos)
'
},
{
value
:
"
privada
"
,
text
:
'
Privada (Somente você poderá visualizar esta coleção)
'
}
])
const
handleChange
=
(
event
)
=>
{
setValue
(
event
.
target
.
value
);
};
const
[
colName
,
setColName
]
=
React
.
useState
({
key
:
false
,
value
:
""
,
})
const
handleColName
=
(
e
)
=>
{
const
userInput
=
e
.
target
.
value
const
flag
=
userInput
.
length
==
0
?
true
:
false
setColName
({...
colName
,
key
:
flag
,
value
:
userInput
})
}
const
formSubmit
=
(
e
)
=>
{
e
.
preventDefault
()
{
/*if user didn't select either one, default to privada*/
}
const
finalRadioValue
=
value
===
'
pública
'
?
'
public
'
:
'
private
'
const
finalColName
=
colName
console
.
log
(
finalRadioValue
,
finalColName
.
value
)
if
(
!
(
finalColName
.
key
))
{
let
payload
=
{
"
collection
"
:
{
"
name
"
:
finalColName
.
value
,
"
owner_id
"
:
state
.
currentUser
.
id
,
"
owner_type
"
:
"
User
"
,
"
privacy
"
:
finalRadioValue
}
}
let
config
=
{
headers
:
{
'
Accept
'
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
'
Access-Token
'
:
sessionStorage
.
getItem
(
'
@portalmec/accessToken
'
),
'
Client
'
:
sessionStorage
.
getItem
(
'
@portalmec/clientToken
'
),
'
Uid
'
:
sessionStorage
.
getItem
(
'
@portalmec/uid
'
)
}
}
axios
.
post
(
(
`
${
apiUrl
}
/collections/`
),
payload
,
config
).
then
(
(
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
headers
[
'
access-token
'
]
)
{
sessionStorage
.
setItem
(
'
@portalmec/accessToken
'
,
response
.
headers
[
'
access-token
'
])
}
props
.
finalize
(
response
.
data
.
id
)
},
(
error
)
=>
{
console
.
log
(
error
)})
}
}
return
(
<
form
onSubmit
=
{(
e
)
=>
{
formSubmit
(
e
)}}
style
=
{{
textAlign
:
"
left
"
}}
>
<
StyledTextField
id
=
{
"
col-name
"
}
label
=
{
"
Nome da coleção
"
}
type
=
{
"
text
"
}
value
=
{
colName
.
value
}
onChange
=
{
e
=>
handleColName
(
e
)}
error
=
{
colName
.
key
}
helperText
=
{
colName
.
key
?
<
span
>
O
nome
é
importante
para
identificar
a
sua
coleção
na
plataforma
.
<
br
/>
Ex
:
Matemática
Ensino
Médio
<
/span> : ""
}
required
=
{
true
}
style
=
{{
width
:
"
100%
"
}}
/
>
<
span
style
=
{{
fontSize
:
"
12px
"
,
color
:
"
#b3b3b3
"
}}
>
Esta
coleção
é
:
<
/span
>
<
StyledFormControl
component
=
"
fieldset
"
>
<
RadioGroup
value
=
{
value
}
onChange
=
{
handleChange
}
>
{
options
.
map
(
option
=>
<
FormControlLabel
key
=
{
option
.
value
}
value
=
{
option
.
value
}
control
=
{
<
Radio
color
=
"
#673ab7
"
/>
}
label
=
{
option
.
text
}
/
>
)
}
<
/RadioGroup
>
<
/StyledFormControl
>
<
ButtonsDiv
>
<
ButtonCancelar
onClick
=
{
props
.
handleClose
}
>
CANCELAR
<
/ButtonCancelar
>
<
ButtonEnviar
type
=
"
submit
"
>
CRIAR
COLEÇÃO
<
/ButtonEnviar
>
<
/ButtonsDiv
>
<
/form
>
);
}
export
const
ButtonsDiv
=
styled
.
div
`
display : flex;
flex-direction : row;
justify-content : center;
align-items : center;
`
export
const
ButtonCancelar
=
styled
(
Button
)
`
&:hover {
background-color : rgba(158,158,158,0.2) !important;
}
height : 36px !important;
padding-left : 16px !important;
padding-right : 16px !important;
font-weight : 500 !important;
border-radius : 3px !important;
color :#666 !important;
background-color: transparent;
min-width : 88px !important;
height : 36px !important;
`
export
const
ButtonEnviar
=
styled
(
Button
)
`
background-color : #673ab7 !important;
color : #fff !important;
font-size: 14px !important;
font-weight: 500 !important;
height: 36px !important;
border-radius: 3px !important;
padding-left: 16px !important;
padding-right: 16px !important;
box-shadow: 0 2px 5px 0 rgba(0,0,0,.26) !important;
outline : none !important;
min-width : 88px !important;
vertical-align : middle !important;
margin : 6px 8px !important;
text-decoration : none !important;
.MuiButton-label {
padding-right : 16px;
padding-left : 16px;
}
`
export
const
StyledTextField
=
styled
(
TextField
)
`
margin : 18px 0 !important;
.MuiFormHelperText-root {
text-align : right;
}
label.Mui-focused {
color : #673ab7;
}
label.Mui-focused.Mui-error {
color : red;
}
.MuiInput-underline::after {
border-bottom: 2px solid #673ab7;
}
`
export
const
StyledFormControl
=
styled
(
FormControl
)
`
display : block !important;
.MuiFormControlLabel-root {
color : #666;
}
.MuiIconButton-label {
color : #666;
}
.PrivateRadioButtonIcon-checked {
color : orange;
}
.MuiTypography-body1 {
font-size : 14px;
}
`
This diff is collapsed.
Click to expand it.
src/Components/CriarColecaoModal.js
0 → 100644
+
133
−
0
View file @
61c46386
/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana
This file is part of Plataforma Integrada MEC.
Plataforma Integrada MEC is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Plataforma Integrada MEC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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
}
from
'
react
'
import
{
Button
}
from
'
@material-ui/core
'
;
import
Modal
from
'
@material-ui/core/Modal
'
;
import
Backdrop
from
'
@material-ui/core/Backdrop
'
;
import
Fade
from
'
@material-ui/core/Fade
'
;
import
styled
from
'
styled-components
'
import
CriarColecaoForm
from
'
./CriarColecaoForm.js
'
import
CloseIcon
from
'
@material-ui/icons/Close
'
;
function
CloseModalButton
(
props
)
{
return
(
<
StyledCloseModalButton
onClick
=
{
props
.
handleClose
}
>
<
CloseIcon
/>
<
/StyledCloseModalButton
>
)
}
export
default
function
CriarColecaoModal
(
props
)
{
return
(
<
StyledModal
aria
-
labelledby
=
"
transition-modal-title
"
aria
-
describedby
=
"
transition-modal-description
"
open
=
{
props
.
open
}
animation
=
{
true
}
centered
=
{
true
}
onClose
=
{
props
.
handleClose
}
closeAfterTransition
BackdropComponent
=
{
Backdrop
}
BackdropProps
=
{{
timeout
:
500
,
}}
>
<
Fade
in
=
{
props
.
open
}
>
<
Container
>
<
Header
>
<
span
style
=
{{
width
:
"
32px
"
}}
/
>
<
h2
>
Criar
Coleção
<
/h2
>
<
CloseModalButton
handleClose
=
{
props
.
handleClose
}
/
>
<
/Header
>
<
Content
style
=
{{
paddingTop
:
"
0
"
}}
>
<
CriarColecaoForm
handleClose
=
{
props
.
handleClose
}
finalize
=
{
props
.
handleClose
}
/
>
<
/Content
>
<
/Container
>
<
/Fade
>
<
/StyledModal
>
)
}
const
Content
=
styled
.
div
`
padding : 20px 30px;
overflow-y: visible;
`
const
Header
=
styled
.
div
`
display : flex;
flex-direction : row;
padding : 10px 26px 0 26px;
align-items : center;
justify-content : space-between;
height : 64px;
h2 {
font-size : 26px;
font-weight : lighter;
color : #666
}
`
const
StyledCloseModalButton
=
styled
(
Button
)
`
display : inline-block;
position : relative;
float : right !important;
margin-right : -8px !important;
background : transparent !important;
min-width: 0 !important;
width : 40px;
`
const
StyledModal
=
styled
(
Modal
)
`
.djXaxP{
margin : 0 !important;
}
display : flex;
align-items: center;
justify-content : center;
text-align : center;
padding : 10px !important;
max-width : none;
max-height : none;
`
const
Container
=
styled
.
div
`
box-sizing : border-box;
box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12);
background-color : white;
align : center;
display : flex;
flex-direction : column;
min-width : 240px;
max-height : none;
position : relative;
padding : 10px;
border-radius : 4px;
@media screen and (min-width : 96px) {
width : 500px;
}
@media screen and (max-width : 699px) {
width : 100%;
height : 100%;
}
`
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