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
c533565d
Commit
c533565d
authored
4 years ago
by
lfr20
Browse files
Options
Downloads
Patches
Plain Diff
add a tab to open the collection page in other browser tab
parent
cc133d53
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/ColCardPublicOptions.js
+127
-82
127 additions, 82 deletions
src/Components/ColCardPublicOptions.js
with
127 additions
and
82 deletions
src/Components/ColCardPublicOptions.js
+
127
−
82
View file @
c533565d
...
...
@@ -16,92 +16,137 @@ 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/Button
'
;
import
Menu
from
'
@material-ui/core/Menu
'
;
import
ListItemIcon
from
'
@material-ui/core/ListItemIcon
'
;
import
MenuItem
from
'
@material-ui/core/MenuItem
'
;
import
OpenIcon
from
'
@material-ui/icons/OpenInNew
'
;
import
{
Link
}
from
'
react-router-dom
'
import
MoreVertIcon
from
'
@material-ui/icons/MoreVert
'
;
import
styled
from
'
styled-components
'
import
ErrorIcon
from
'
@material-ui/icons/Error
'
;
import
ReportModal
from
'
./ReportModal.js
'
import
{
getAxiosConfig
}
from
'
../Components/HelperFunctions/getAxiosConfig
'
import
axios
from
'
axios
'
import
{
apiUrl
}
from
'
../env
'
;
export
default
function
ColCardPublicOptions
(
props
)
{
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
(
null
);
function
handleClick
(
event
)
{
setAnchorEl
(
event
.
currentTarget
);
}
function
handleClose
()
{
setAnchorEl
(
null
);
}
const
[
reportModalOpen
,
toggleReportModal
]
=
useState
(
false
)
const
handleReportModal
=
(
value
)
=>
{
toggleReportModal
(
value
)}
const
handleUnfollow
=
()
=>
{
let
config
=
getAxiosConfig
()
let
payload
=
{}
import
React
,
{
useState
}
from
"
react
"
;
import
Button
from
"
@material-ui/core/Button
"
;
import
Menu
from
"
@material-ui/core/Menu
"
;
import
ListItemIcon
from
"
@material-ui/core/ListItemIcon
"
;
import
MenuItem
from
"
@material-ui/core/MenuItem
"
;
import
OpenIcon
from
"
@material-ui/icons/OpenInNew
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
MoreVertIcon
from
"
@material-ui/icons/MoreVert
"
;
import
styled
from
"
styled-components
"
;
import
ErrorIcon
from
"
@material-ui/icons/Error
"
;
import
ReportModal
from
"
./ReportModal.js
"
;
import
{
getAxiosConfig
}
from
"
../Components/HelperFunctions/getAxiosConfig
"
;
import
axios
from
"
axios
"
;
import
ReportProblemIcon
from
'
@material-ui/icons/ReportProblem
'
;
import
OpenInBrowserIcon
from
'
@material-ui/icons/OpenInBrowser
'
;
import
{
apiUrl
}
from
"
../env
"
;
export
default
function
ColCardPublicOptions
(
props
)
{
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
(
null
);
function
handleClick
(
event
)
{
setAnchorEl
(
event
.
currentTarget
);
}
axios
.
put
(
(
`
${
apiUrl
}
/collections/`
+
props
.
id
+
'
/follow
'
),
payload
,
config
).
then
(
(
response
)
=>
{
console
.
log
(
response
.
data
)
if
(
response
.
headers
[
'
access-token
'
]
)
{
sessionStorage
.
setItem
(
'
@portalmec/accessToken
'
,
response
.
headers
[
'
access-token
'
])
}
},
(
error
)
=>
{
console
.
log
(
error
)})
}
function
handleClose
()
{
setAnchorEl
(
null
);
}
return
(
<>
<
ReportModal
open
=
{
reportModalOpen
}
handleClose
=
{()
=>
handleReportModal
(
false
)}
form
=
"
colecao
"
complainableId
=
{
props
.
id
}
complainableType
=
{
"
Collection
"
}
/
>
<
div
style
=
{{
fontSize
:
"
12px
"
}}
>
<
Button
aria
-
controls
=
"
simple-menu
"
aria
-
haspopup
=
"
true
"
onClick
=
{
handleClick
}
style
=
{{
color
:
"
#666
"
}}
>
<
MoreVertIcon
style
=
{{
color
:
"
inherit
"
}}
/
>
<
/Button
>
<
Menu
id
=
"
simple-menu
"
anchorEl
=
{
anchorEl
}
keepMounted
open
=
{
Boolean
(
anchorEl
)}
onClose
=
{
handleClose
}
>
<
StyledMenuItem
>
<
Link
to
=
{
"
/colecao-do-usuario/
"
+
props
.
id
}
>
<
ListItemIcon
><
OpenIcon
/><
/ListItemIcon>Abri
r
<
/Link
>
<
/StyledMenuItem
>
<
StyledMenuItem
onClick
=
{
handleUnfollow
}
>
<
ListItemIcon
><
ErrorIcon
/><
/ListItemIcon>Deixar de Segui
r
<
/StyledMenuItem
>
<
StyledMenuItem
onClick
=
{()
=>
{
handleReportModal
(
true
)}}
>
<
ListItemIcon
><
ErrorIcon
/><
/ListItemIcon>Reporta
r
<
/StyledMenuItem
>
<
/Menu
>
<
/div
>
const
[
reportModalOpen
,
toggleReportModal
]
=
useState
(
false
);
const
handleReportModal
=
(
value
)
=>
{
toggleReportModal
(
value
);
};
const
handleUnfollow
=
()
=>
{
let
config
=
getAxiosConfig
();
let
payload
=
{};
axios
.
put
(
`
${
apiUrl
}
/collections/`
+
props
.
id
+
"
/follow
"
,
payload
,
config
)
.
then
(
(
response
)
=>
{
console
.
log
(
response
.
data
);
if
(
response
.
headers
[
"
access-token
"
])
{
sessionStorage
.
setItem
(
"
@portalmec/accessToken
"
,
response
.
headers
[
"
access-token
"
]
);
}
},
(
error
)
=>
{
console
.
log
(
error
);
}
);
};
return
(
<>
<
ReportModal
open
=
{
reportModalOpen
}
handleClose
=
{()
=>
handleReportModal
(
false
)}
form
=
"
colecao
"
complainableId
=
{
props
.
id
}
complainableType
=
{
"
Collection
"
}
/
>
<
div
style
=
{{
fontSize
:
"
12px
"
}}
>
<
Button
aria
-
controls
=
"
simple-menu
"
aria
-
haspopup
=
"
true
"
onClick
=
{
handleClick
}
style
=
{{
color
:
"
#666
"
}}
>
<
MoreVertIcon
style
=
{{
color
:
"
inherit
"
}}
/
>
<
/Button
>
<
Menu
id
=
"
simple-menu
"
anchorEl
=
{
anchorEl
}
keepMounted
open
=
{
Boolean
(
anchorEl
)}
onClose
=
{
handleClose
}
>
<
StyledMenuItem
>
<
Link
to
=
{
"
/colecao-do-usuario/
"
+
props
.
id
}
>
<
ListItemIcon
>
<
OpenIcon
/>
<
/ListItemIcon
>
Abrir
<
/Link
>
<
/StyledMenuItem
>
<
StyledMenuItem
onClick
=
{()
=>
window
.
open
(
"
/colecao-do-usuario/
"
+
props
.
id
,
"
_blank
"
)
}
>
<
ListItemIcon
>
<
OpenInBrowserIcon
/>
<
/ListItemIcon
>
Abrir
em
nova
guia
<
/StyledMenuItem
>
<
StyledMenuItem
onClick
=
{
handleUnfollow
}
>
<
ListItemIcon
>
<
ErrorIcon
/>
<
/ListItemIcon
>
Deixar
de
Seguir
<
/StyledMenuItem
>
<
StyledMenuItem
onClick
=
{()
=>
{
handleReportModal
(
true
);
}}
>
<
ListItemIcon
>
<
ReportProblemIcon
/>
<
/ListItemIcon
>
Reportar
<
/StyledMenuItem
>
<
/Menu
>
<
/div
>
<
/
>
)
)
;
}
export
const
StyledMenuItem
=
styled
(
MenuItem
)
`
color
: #666 !important;
color: #666 !important;
.MuiSvgIcon-root {
vertical-align
: middle !important;
}
a {
text-decoration
: none !important;
color
: #666 !important;
}
`
.MuiSvgIcon-root {
vertical-align: middle !important;
}
a {
text-decoration: none !important;
color: #666 !important;
}
`
;
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