Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
idatt2106_2024_02_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
IDATT2106 - Gruppe 2
idatt2106_2024_02_frontend
Commits
101db904
Commit
101db904
authored
11 months ago
by
Ina Martini
Browse files
Options
Downloads
Patches
Plain Diff
feat: when first logged in a new speech array should be displayed
parent
47768834
No related branches found
Branches containing commit
No related tags found
3 merge requests
!66
Final merge
,
!42
Refactor interactiveSpare to modal
,
!4
Pipeline fix
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/views/HomeView.vue
+23
-16
23 additions, 16 deletions
src/views/HomeView.vue
with
23 additions
and
16 deletions
src/views/HomeView.vue
+
23
−
16
View file @
101db904
...
...
@@ -42,7 +42,7 @@
</
template
>
<
script
setup
lang=
"ts"
>
import
{
onMounted
,
ref
,
toRefs
}
from
'
vue
'
import
{
onMounted
,
ref
}
from
'
vue
'
import
InteractiveSpare
from
'
@/components/InteractiveSpare.vue
'
import
ButtonAddGoalOrChallenge
from
'
@/components/ButtonAddGoalOrChallenge.vue
'
import
type
{
Challenge
}
from
'
@/types/challenge
'
...
...
@@ -50,6 +50,7 @@ import type { Goal } from '@/types/goal'
import
{
useGoalStore
}
from
'
@/stores/goalStore
'
import
{
useChallengeStore
}
from
'
@/stores/challengeStore
'
import
SavingsPath
from
'
@/components/SavingsPath.vue
'
import
router
from
"
@/router
"
;
const
goalStore
=
useGoalStore
()
const
challengeStore
=
useChallengeStore
()
...
...
@@ -63,34 +64,40 @@ const goals = ref<Goal[]>([])
const
goal
=
ref
<
Goal
|
null
|
undefined
>
(
null
)
onMounted
(
async
()
=>
{
await
goalStore
.
getUserGoals
()
await
challengeStore
.
getUserChallenges
()
challenges
.
value
=
challengeStore
.
challenges
goals
.
value
=
goalStore
.
goals
goal
.
value
=
goals
.
value
[
0
]
await
goalStore
.
getUserGoals
()
await
challengeStore
.
getUserChallenges
()
challenges
.
value
=
challengeStore
.
challenges
goals
.
value
=
goalStore
.
goals
goal
.
value
=
goals
.
value
[
0
]
firstLoggedInSpeech
()
})
const
updateSpeech
=
(
newSpeech
:
string
[])
=>
{
speech
.
value
=
newSpeech
;
console
.
log
(
'
New speech available:
'
,
speech
.
value
)
newSpeechAvailable
.
value
=
true
;
}
updateSpeech
([
'
Hei, jeg er Spare!
'
,
'
Jeg skal hjelpe deg med å spare penger.
'
,
'
Du får varsel når jeg har noe å si!
'
])
// Check if the user is logging in for the first time, and display the first login speech
const
firstLoggedInSpeech
=
()
=>
{
const
isFirstLogin
=
router
.
currentRoute
.
value
.
query
.
firstLogin
===
'
true
'
;
if
(
isFirstLogin
)
{
updateSpeech
([
'
Hei, jeg er Spare!
'
,
'
Jeg skal hjelpe deg med å spare penger.
'
,
'
Du får varsel når jeg har noe å si!
'
]);
// reset the query parameter
router
.
replace
({
name
:
'
home
'
,
query
:
{
firstLogin
:
'
false
'
}});
openInteractiveSpare
()
}
}
const
openInteractiveSpare
=
()
=>
{
console
.
log
(
'
Opening interactive spare available
'
,
newSpeechAvailable
.
value
)
// Check if there's new speech available before opening the modal.
if
(
newSpeechAvailable
.
value
)
{
isModalOpen
.
value
=
true
// Open the modal
newSpeechAvailable
.
value
=
false
// Reset the flag since the speech will now be displayed
console
.
log
(
'
Opening interactive spare
'
)
}
else
{
console
.
log
(
'
No new speech available
'
)
}
}
const
openHelp
=
()
=>
{
...
...
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