Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
idatt2106_2024_03_frontend
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
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
Scrum_Team_3
idatt2106_2024_03_frontend
Commits
ebc48c88
Commit
ebc48c88
authored
1 year ago
by
Sverre Frogner Haugen
Browse files
Options
Downloads
Patches
Plain Diff
Added userTotalSaving component to HomePage
parent
db0c7b85
No related branches found
No related tags found
1 merge request
!50
Home page
Pipeline
#279868
passed
1 year ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/HomeComponents/TotalSavings.vue
+59
-0
59 additions, 0 deletions
src/components/HomeComponents/TotalSavings.vue
src/utils/HomePageUtils.ts
+17
-0
17 additions, 0 deletions
src/utils/HomePageUtils.ts
src/views/HomePage/HomeView.vue
+74
-10
74 additions, 10 deletions
src/views/HomePage/HomeView.vue
with
150 additions
and
10 deletions
src/components/HomeComponents/TotalSavings.vue
0 → 100644
+
59
−
0
View file @
ebc48c88
<
script
setup
lang=
"ts"
>
import
{
getUserTotalSavings
}
from
'
@/utils/HomePageUtils
'
import
{
ref
}
from
'
vue
'
const
saved
=
ref
(
0
)
async
function
userSavings
(){
saved
.
value
=
await
getUserTotalSavings
()
}
userSavings
()
</
script
>
<
template
>
<div
id =
TotalSavings
>
<img
src=
"../../assets/png/pig_394778.png"
alt =
"logo"
id =
"logo"
/>
<div
id =
SavingsText
>
<h3
id =
SavedInfo
>
Du har spart totalt:
</h3>
<h3
id =
Saved
>
{{
saved
}}
nok
</h3>
</div>
</div>
</
template
>
<
style
scoped
>
#TotalSavings
{
margin-right
:
5%
;
box-shadow
:
5px
5px
10px
rgba
(
0
,
0
,
0
,
0.6
);
border-radius
:
20px
;
padding
:
1%
3%
1%
3%
;
display
:
flex
;
}
#logo
{
max-width
:
7vh
;
max-height
:
7vh
;
margin-right
:
5%
;
}
#SavingsText
{
display
:
flex
;
flex-direction
:
column
;
}
#SavedInfo
{
white-space
:
nowrap
;
}
#Saved
{
font-weight
:
bold
;
}
@media
only
screen
and
(
max-width
:
1000px
)
{
#TotalSavings
{
margin-right
:
0
;
}
}
</
style
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/utils/HomePageUtils.ts
0 → 100644
+
17
−
0
View file @
ebc48c88
import
axios
from
'
axios
'
import
{
useTokenStore
}
from
'
@/stores/token
'
export
async
function
getUserTotalSavings
(){
const
config
=
{
headers
:
{
'
Content-Type
'
:
'
Application/json
'
,
'
Authorization
'
:
'
Bearer
'
+
useTokenStore
().
getJwtToken
}
}
const
response
=
await
axios
.
get
(
"
http://Localhost:8080/users/get/savings
"
,
config
);
const
result
=
response
.
data
return
result
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/views/HomePage/HomeView.vue
+
74
−
10
View file @
ebc48c88
<
script
setup
lang=
"ts"
>
import
ActiveChallengeDisplay
from
'
@/components/challenge/ActiveChallengeDisplay.vue
'
import
{
getAllMilestones
}
from
'
@/utils/MilestoneUtils
'
import
{
useTokenStore
}
from
'
@/stores/token
'
import
{
getActiveChallenges
}
from
'
@/utils/challengeutils
'
import
ActiveMilestonesList
from
'
@/components/milestone/ActiveMilestonesList.vue
'
import
TotalSavings
from
'
@/components/HomeComponents/TotalSavings.vue
'
import
{
ref
}
from
'
vue
'
console
.
log
(
getAllMilestones
(
useTokenStore
().
getJwtToken
));
console
.
log
(
getActiveChallenges
(
useTokenStore
().
getJwtToken
,
0
,
5
))
const
showMilestones
=
ref
(
true
)
const
showChallenges
=
ref
(
false
)
function
checkScreenWidth
()
{
if
(
window
.
innerWidth
>=
1000
){
showMilestones
.
value
=
true
;
showChallenges
.
value
=
true
;
}
}
function
showMilestonesView
(){
showMilestones
.
value
=
true
showChallenges
.
value
=
false
}
function
showChallengesView
(){
showChallenges
.
value
=
true
showMilestones
.
value
=
false
}
checkScreenWidth
()
</
script
>
<
template
>
<div
id =
TopInfo
>
<h2>
Velkommen!
</h2>
<div
id =
TotalSavings
>
<h3>
TotalSavingsDiv
</h3>
</div>
<h2
id =
"Welcome"
>
Velkommen!
</h2>
<TotalSavings
id =
TotalSavings
/>
</div>
<div
id =
MobileButtons
>
<button
class =
mobileButton
@
click=
"showMilestonesView()"
>
Sparemål
</button>
<button
class =
mobileButton
@
click=
"showChallengesView()"
>
Utfordringer
</button>
</div>
<div
id =
HomeViewComponents
>
<div
class =
ActiveMilestones
>
<div
class =
ActiveMilestones
v-show=
"showMilestones"
>
<ActiveMilestonesList/>
</div>
<div
class =
ActiveChallenges
>
<div
class =
ActiveChallenges
v-show=
"showChallenges"
>
<h3>
Placeholder
</h3>
</div>
</div>
</
template
>
...
...
@@ -35,14 +60,27 @@ console.log(getActiveChallenges(useTokenStore().getJwtToken, 0, 5))
align-items
:
center
;
}
#TotalSavings
{
margin-right
:
5%
;
}
#HomeViewComponents
{
display
:
flex
;
}
#MobileButtons
{
width
:
100%
;
display
:
none
;
justify-content
:
space-evenly
;
height
:
10%
;
}
.mobileButton
{
width
:
45%
;
background-color
:
var
(
--color-confirm-button
);
color
:
var
(
--color-buttonText
);
border
:
0
;
font-size
:
2em
;
border-radius
:
20px
;
}
.ActiveMilestones
,
.ActiveChallenges
{
margin
:
2%
;
border-radius
:
20px
;
...
...
@@ -58,4 +96,30 @@ console.log(getActiveChallenges(useTokenStore().getJwtToken, 0, 5))
}
@media
only
screen
and
(
max-width
:
1000px
)
{
#TopInfo
{
flex-direction
:
column
;
}
#TotalSavings
{
width
:
100%
;
}
#TotalSavings
{
margin
:
3%
;
}
.ActiveMilestones
{
width
:
100%
;
}
.ActiveChallenges
{
width
:
100%
;
}
#MobileButtons
{
display
:
flex
;
}
}
</
style
>
\ No newline at end of file
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