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
217ce23a
Commit
217ce23a
authored
11 months ago
by
vildemv
Browse files
Options
Downloads
Patches
Plain Diff
Created a separate component for all inactive challenges.
parent
a24eba09
No related branches found
Branches containing commit
No related tags found
1 merge request
!53
Frontend improvements
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/challenge/InactiveChallengeList.vue
+114
-0
114 additions, 0 deletions
src/components/challenge/InactiveChallengeList.vue
with
114 additions
and
0 deletions
src/components/challenge/InactiveChallengeList.vue
0 → 100644
+
114
−
0
View file @
217ce23a
<
script
setup
lang=
"ts"
>
import
PotentialChallengeDisplay
from
'
@/components/challenge/InactiveChallengeDisplay.vue
'
import
{
onMounted
,
ref
}
from
'
vue
'
import
{
getInactiveChallenges
}
from
'
@/utils/challengeutils
'
import
{
useTokenStore
}
from
'
@/stores/token
'
import
router
from
'
@/router
'
interface
Challenge
{
challengeId
:
number
,
challengeTitle
:
string
,
challengeDescription
:
string
,
goalSum
:
number
,
expirationDate
:
string
}
const
token
:
string
=
useTokenStore
().
jwtToken
;
const
inactiveChallenges
=
ref
<
Challenge
[]
>
([])
onMounted
(
async
()
=>
{
try
{
await
fetchInactiveChallenges
();
}
catch
(
error
)
{
console
.
error
(
'
Error fetching user info:
'
,
error
);
}
})
const
fetchInactiveChallenges
=
async
()
=>
{
try
{
const
{
content
}
=
await
getInactiveChallenges
(
token
)
inactiveChallenges
.
value
=
content
;
}
catch
(
error
)
{
console
.
error
(
'
Error fetching active challenges:
'
,
error
);
}
}
// Function to handle the emitted challengeAccepted event
const
handleChallengeAccepted
=
async
()
=>
{
await
fetchInactiveChallenges
();
}
// Function to handle the emitted challengeDeclined event
const
handleChallengeDeclined
=
async
()
=>
{
await
fetchInactiveChallenges
();
}
</
script
>
<
template
>
<div
class=
"inactive-challenge-list"
>
<div
class=
"challenge-recommendations"
>
<PotentialChallengeDisplay
class=
"potential-challenge"
v-for=
"(potentialChallenge, index) in inactiveChallenges"
:key=
"index"
:challenge=
"potentialChallenge"
@
challengeAccepted=
"handleChallengeAccepted"
@
challengeDeclined=
"handleChallengeDeclined"
></PotentialChallengeDisplay>
<h4
class=
"challenge-placeholder"
v-if=
"inactiveChallenges.length == 0"
>
Ojda, her gikk det unna.
<br>
Vi har for øyeblikket ingen flere forslag til utfordringer.
<br>
Lag din egen personlige utfordring eller kom tilbake senere!
<br>
Nye utfordringer blir generert med gjevne mellomrom.
</h4>
</div>
</div>
</
template
>
<
style
scoped
>
.inactive-challenge-list
{
display
:
flex
;
flex-direction
:
column
;
place-content
:
space-between
;
gap
:
2.5%
;
width
:
100%
;
height
:
100%
;
}
.challenge-recommendations
{
display
:
flex
;
flex-direction
:
column
;
height
:
100%
;
width
:
100%
;
gap
:
2.5%
;
}
.challenge-placeholder
{
text-align
:
center
;
}
.potential-challenge
{
border-radius
:
20px
;
border
:
2px
solid
var
(
--color-border
);
box-shadow
:
0
4px
4px
var
(
--color-shadow
);
height
:
calc
(
100%
/
3
);
width
:
100%
;
}
.potential-challenge
:hover
{
transform
:
scale
(
1.02
);
}
</
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