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
a2d2530f
Commit
a2d2530f
authored
5 years ago
by
Raul Almeida
Browse files
Options
Downloads
Patches
Plain Diff
Add get to level description card
TODO: backend percentage to next level
parent
4e5475f9
No related branches found
No related tags found
1 merge request
!21
Gamification
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Components/LevelDescriptionCard.js
+6
-6
6 additions, 6 deletions
src/Components/LevelDescriptionCard.js
src/Components/TabPanels/TabPanelStatusEConquistas.js
+29
-9
29 additions, 9 deletions
src/Components/TabPanels/TabPanelStatusEConquistas.js
with
35 additions
and
15 deletions
src/Components/LevelDescriptionCard.js
+
6
−
6
View file @
a2d2530f
...
@@ -18,21 +18,21 @@ export default function LevelDescriptionCard(props) {
...
@@ -18,21 +18,21 @@ export default function LevelDescriptionCard(props) {
<
Grid
container
direction
=
"
row
"
justify
=
"
space-between
"
alignItems
=
"
center
"
>
<
Grid
container
direction
=
"
row
"
justify
=
"
space-between
"
alignItems
=
"
center
"
>
<
Grid
item
xs
=
{
6
}
md
=
{
4
}
>
<
Grid
item
xs
=
{
6
}
md
=
{
4
}
>
<
CurrentLevelNumber
>
<
CurrentLevelNumber
>
Nível
Nível
{
props
.
level
}
<
/CurrentLevelNumber
>
<
/CurrentLevelNumber
>
<
CurrentLevelXP
>
<
CurrentLevelXP
>
XP
4096
XP
{
props
.
xp
}
<
/CurrentLevelXP
>
<
/CurrentLevelXP
>
<
/Grid
>
<
/Grid
>
<
Grid
item
xs
=
{
6
}
md
=
{
4
}
alignContent
=
'
flex-end
'
>
<
Grid
item
xs
=
{
6
}
md
=
{
4
}
alignContent
=
'
flex-end
'
>
<
CurrentCoins
>
<
CurrentCoins
>
256
COINS
{
props
.
coins
}
COINS
<
/CurrentCoins
>
<
/CurrentCoins
>
<
NextLevelXP
>
<
NextLevelXP
>
512
XP
PARA
O
NÍVEL
32
{
props
.
xp_to_next_lvl
}
XP
PARA
O
NÍVEL
{
props
.
level
+
1
}
<
/NextLevelXP
>
<
/NextLevelXP
>
<
/Grid
>
<
/Grid
>
<
ShinyProgressBar
percentage
=
'
66
'
/>
<
ShinyProgressBar
percentage
=
{
props
.
bar_size
}
/
>
<
/Grid
>
<
/Grid
>
<
/LevelDescDiv
>
<
/LevelDescDiv
>
);
);
...
...
This diff is collapsed.
Click to expand it.
src/Components/TabPanels/TabPanelStatusEConquistas.js
+
29
−
9
View file @
a2d2530f
import
React
,
{
useContext
,
useState
,
useEffect
}
from
'
react
'
import
React
,
{
useContext
,
useState
,
useEffect
}
from
'
react
'
import
{
Store
}
from
'
../../Store.js
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
Container
}
from
'
react-grid-system
'
import
{
Container
}
from
'
react-grid-system
'
import
Paper
from
'
@material-ui/core/Paper
'
;
import
Paper
from
'
@material-ui/core/Paper
'
;
...
@@ -15,22 +16,41 @@ import { Grid } from '@material-ui/core'
...
@@ -15,22 +16,41 @@ import { Grid } from '@material-ui/core'
export
default
function
TabPanelStatusEConquistas
(
props
)
{
export
default
function
TabPanelStatusEConquistas
(
props
)
{
const
[
achievements
,
setAchievements
]
=
useState
([]);
const
[
achievements
,
setAchievements
]
=
useState
([]);
const
[
level
,
setLevel
]
=
useState
(
0
);
const
[
xp
,
setXP
]
=
useState
(
0
);
const
[
coins
,
setCoins
]
=
useState
(
0
);
const
[
barSize
,
setBarSize
]
=
useState
(
0
);
const
[
xpToNextLevel
,
setXpToNextLevel
]
=
useState
(
0
);
const
{
state
}
=
useContext
(
Store
)
useEffect
(()
=>
{
useEffect
(()
=>
{
axios
.
get
(
`https://api.portalmec.c3sl.ufpr.br/v1/users/1`
)
axios
.
all
(
.
then
(
res
=>
{
[
'
xp_to_next_lvl
'
,
'
percent_to_next_level
'
,
'
points
'
,
'
xp
'
,
'
get_level
'
,
const
achievements
=
res
.
data
;
'
completed_achievements
'
].
map
((
r
)
=>
{
console
.
log
(
"
Teste
"
);
return
axios
.
get
(
apiUrl
+
'
/
'
+
r
+
'
/
'
+
state
.
currentUser
.
id
);
console
.
log
(
achievements
);
}).
then
(
axios
.
spread
((
xp_to_next_lvl
,
percent_to_next_level
,
points
,
//this.setAchievements(achievements);
xp
,
level
,
completed_achievements
)
=>
{
})
this
.
setXpToNextLevel
(
xp_to_next_lvl
);
this
.
setBarSize
(
100
-
percent_to_next_level
);
this
.
setCoins
(
points
);
this
.
setXP
(
xp
);
this
.
setLevel
(
level
);
this
.
setAchievements
(
completed_achievements
);
})))
},
[])
},
[])
return
(
return
(
<
div
>
<
div
>
<
ContainerDivStyled
>
<
ContainerDivStyled
>
<
Paper
elevation
=
{
3
}
>
<
Paper
elevation
=
{
3
}
>
<
LevelDescriptionCard
/>
<
LevelDescriptionCard
xp_to_next_lvl
=
{
xpToNextLevel
}
bar_size
=
{
barSize
}
coins
=
{
coins
}
xp
=
{
xp
}
level
=
{
level
}
/
>
<
/Paper
>
<
/Paper
>
<
/ContainerDivStyled
>
<
/ContainerDivStyled
>
<
AchievementsContainer
>
<
AchievementsContainer
>
...
@@ -43,7 +63,7 @@ export default function TabPanelStatusEConquistas (props) {
...
@@ -43,7 +63,7 @@ export default function TabPanelStatusEConquistas (props) {
(
a
)
=>
{
return
(
(
a
)
=>
{
return
(
<
Grid
item
xs
=
{
12
}
md
=
{
5
}
>
<
Grid
item
xs
=
{
12
}
md
=
{
5
}
>
<
AchievementDescriptionCard
<
AchievementDescriptionCard
titl
e
=
{
a
.
title
}
nam
e
=
{
a
.
title
}
description
=
{
a
.
description
}
description
=
{
a
.
description
}
src
=
{
a
.
imgsrc
}
src
=
{
a
.
imgsrc
}
requirements
=
{
a
.
requirements
}
/
>
requirements
=
{
a
.
requirements
}
/
>
...
...
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