Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frontend-MECRED
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
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
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
MECRED
Frontend-MECRED
Commits
ec97b714
Commit
ec97b714
authored
1 month ago
by
Guilherme Eduardo
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#299
: FIX change name share button on profile page
parent
c2f19cdd
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#41946
passed
1 month ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/perfil/[id]/components/UserCard.js
+39
-8
39 additions, 8 deletions
src/app/perfil/[id]/components/UserCard.js
with
39 additions
and
8 deletions
src/app/perfil/[id]/components/UserCard.js
+
39
−
8
View file @
ec97b714
...
...
@@ -19,6 +19,7 @@ import FollowersCards from "./FollowersCards";
import
ProfileComplaints
from
"
./ProfileComplaints
"
;
import
ProfileAchievementsMenu
from
"
./ProfileAchievementsMenu
"
;
import
{
Person
}
from
"
@mui/icons-material
"
;
import
{
TramSharp
}
from
'
@mui/icons-material
'
;
const
roles
=
[
{
...
...
@@ -103,6 +104,8 @@ export default function UserCard({ profileData, idLogin, achievements, progresse
const
[
translateItems
,
setTranslateItems
]
=
useState
(
""
)
const
[
optButton
,
setOptButton
]
=
useState
(
0
)
const
[
verifyCurator
,
setVerifyCurator
]
=
useState
(
false
)
const
[
userVerified
,
setUserVerified
]
=
useState
(
false
)
const
[
medalActive
,
setMedalActive
]
=
useState
(
0
)
/**
...
...
@@ -150,7 +153,12 @@ export default function UserCard({ profileData, idLogin, achievements, progresse
})
}
//Conta quantas medalhas ativas o usuário possui
const
countMedalBeingUsed
=
items
?.
filter
(
item
=>
item
.
being_used
).
length
;
setMedalActive
(
countMedalBeingUsed
)
fetchFollowers
()
verifier
()
/**
* Função que faz a tradução conforme os cargos do usuário.
...
...
@@ -174,6 +182,26 @@ export default function UserCard({ profileData, idLogin, achievements, progresse
.
then
(
roles
=>
setTranslateItems
(
roles
))
},
[
profileData
])
// Função que análisa se o usuário é considerado "verificado" conforme cargo
const
verifier
=
async
()
=>
{
const
all_roles
=
[
"
teacher
"
,
"
admin
"
,
"
curator
"
,
"
moderator
"
,
"
supervisor
"
,
"
editor
"
,
"
partner
"
,
"
publisher
"
,
"
submitter
"
];
// Extrai todos os nomes dos cargos do usuário
const
user_roles
=
profileData
[
"
roles
"
].
map
(
role
=>
role
.
name
);
// Verifica se algum cargo do usuário está na lista de roles permitidos
const
verifier_user_roles
=
user_roles
.
find
(
role
=>
all_roles
.
includes
(
role
));
if
(
verifier_user_roles
)
{
setUserVerified
(
true
);
}
};
/*
* Menu de seleção do usuário
...
...
@@ -213,7 +241,7 @@ export default function UserCard({ profileData, idLogin, achievements, progresse
}
cons
ole
.
log
(
"
teste
"
,
items
)
//
cons
t cargo =
return
(
...
...
@@ -233,7 +261,7 @@ export default function UserCard({ profileData, idLogin, achievements, progresse
<
div
className
=
'
flex flex-col justify-start
'
>
<
div
className
=
'
flex flex-row max-sm:flex-col-reverse
'
>
<
div
className
=
{
`flex flex-row w-2/3 max-sm:w-full items-center text-darkGray-HC-white font-bold max-sm:text-3xl text-4xl max-sm:mr-5 max-sm:mb-5
${
items
.
length
===
0
?
"
mb-3
"
:
""
}
`
}
>
<
div
className
=
{
`flex flex-row w-2/3 max-sm:w-full items-center text-darkGray-HC-white font-bold max-sm:text-3xl text-4xl max-sm:mr-5 max-sm:mb-5
${
medalActive
===
0
?
"
mb-3
"
:
""
}
`
}
>
<
img
src
=
"
/usuario-perfil.svg
"
alt
=
"
perfil
"
className
=
'
flex aspect-square mr-4 max-lg:mx-4 w-[28px] h-[28px] rounded-full
'
/>
<
div
className
=
'
shrink-0 max-lg:w-[20px] max-lg:h-[20px] h-[28px] p-0 m-0
'
/>
{
profileData
[
"
name
"
]}
...
...
@@ -243,18 +271,21 @@ export default function UserCard({ profileData, idLogin, achievements, progresse
<
/div
>
{
profileData
[
"
email
"
]
&&
profileData
[
"
id
"
]
!==
35342
&&
(
{
/*
{profileData["email"] && profileData["id"] !== 35342 && (
<div className='mb-3 truncate flex flex-row items-center text-darkGray-HC-white max-sm:text-base text-2xl'>
<
img
src
=
"
/
usuario-verifi
ca
d
o.svg
"
alt
=
"
ocupacao
"
className
=
'
flex aspect-square mr-4 max-lg:mx-4 w-[28px] h-[28px] rounded-full
'
/>
<img src="/
ocupa
cao.svg" alt="ocupacao" className='flex aspect-square mr-4 max-lg:mx-4 w-[28px] h-[28px] rounded-full' />
<div className='shrink-0 h-[28px] max-lg:w-[20px] max-lg:h-[20px]' />
{profileData["email"]}
</div>
)}
)}
*/
}
<
div
className
=
'
mb-3
'
>
{
translateItems
&&
<
div
className
=
'
flex flex-row items-center mt-1 text-darkGray-HC-white max-sm:text-base text-xl
'
>
<
img
src
=
"
/ocupacao.svg
"
alt
=
"
verificado
"
className
=
'
flex aspect-square mr-4 max-lg:mx-4 w-[28px] h-[28px] rounded-full
'
/>
{
userVerified
?
<
img
src
=
"
/usuario-verificado.svg
"
alt
=
"
verificado
"
className
=
'
flex aspect-square mr-4 max-lg:mx-4 w-[28px] h-[28px] rounded-full
'
/>
:
null
}
<
div
className
=
'
shrink-0 h-[28px] max-lg:w-[20px] max-lg:h-[20px]
'
/>
{
translateItems
}
<
/div
>
...
...
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