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
1 year 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
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 @@
...
@@ -42,7 +42,7 @@
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
onMounted
,
ref
,
toRefs
}
from
'
vue
'
import
{
onMounted
,
ref
}
from
'
vue
'
import
InteractiveSpare
from
'
@/components/InteractiveSpare.vue
'
import
InteractiveSpare
from
'
@/components/InteractiveSpare.vue
'
import
ButtonAddGoalOrChallenge
from
'
@/components/ButtonAddGoalOrChallenge.vue
'
import
ButtonAddGoalOrChallenge
from
'
@/components/ButtonAddGoalOrChallenge.vue
'
import
type
{
Challenge
}
from
'
@/types/challenge
'
import
type
{
Challenge
}
from
'
@/types/challenge
'
...
@@ -50,6 +50,7 @@ import type { Goal } from '@/types/goal'
...
@@ -50,6 +50,7 @@ import type { Goal } from '@/types/goal'
import
{
useGoalStore
}
from
'
@/stores/goalStore
'
import
{
useGoalStore
}
from
'
@/stores/goalStore
'
import
{
useChallengeStore
}
from
'
@/stores/challengeStore
'
import
{
useChallengeStore
}
from
'
@/stores/challengeStore
'
import
SavingsPath
from
'
@/components/SavingsPath.vue
'
import
SavingsPath
from
'
@/components/SavingsPath.vue
'
import
router
from
"
@/router
"
;
const
goalStore
=
useGoalStore
()
const
goalStore
=
useGoalStore
()
const
challengeStore
=
useChallengeStore
()
const
challengeStore
=
useChallengeStore
()
...
@@ -63,34 +64,40 @@ const goals = ref<Goal[]>([])
...
@@ -63,34 +64,40 @@ const goals = ref<Goal[]>([])
const
goal
=
ref
<
Goal
|
null
|
undefined
>
(
null
)
const
goal
=
ref
<
Goal
|
null
|
undefined
>
(
null
)
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
await
goalStore
.
getUserGoals
()
await
goalStore
.
getUserGoals
()
await
challengeStore
.
getUserChallenges
()
await
challengeStore
.
getUserChallenges
()
challenges
.
value
=
challengeStore
.
challenges
challenges
.
value
=
challengeStore
.
challenges
goals
.
value
=
goalStore
.
goals
goals
.
value
=
goalStore
.
goals
goal
.
value
=
goals
.
value
[
0
]
goal
.
value
=
goals
.
value
[
0
]
firstLoggedInSpeech
()
})
})
const
updateSpeech
=
(
newSpeech
:
string
[])
=>
{
const
updateSpeech
=
(
newSpeech
:
string
[])
=>
{
speech
.
value
=
newSpeech
;
speech
.
value
=
newSpeech
;
console
.
log
(
'
New speech available:
'
,
speech
.
value
)
newSpeechAvailable
.
value
=
true
;
newSpeechAvailable
.
value
=
true
;
}
}
updateSpeech
([
// Check if the user is logging in for the first time, and display the first login speech
'
Hei, jeg er Spare!
'
,
const
firstLoggedInSpeech
=
()
=>
{
'
Jeg skal hjelpe deg med å spare penger.
'
,
const
isFirstLogin
=
router
.
currentRoute
.
value
.
query
.
firstLogin
===
'
true
'
;
'
Du får varsel når jeg har noe å si!
'
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
=
()
=>
{
const
openInteractiveSpare
=
()
=>
{
console
.
log
(
'
Opening interactive spare available
'
,
newSpeechAvailable
.
value
)
// Check if there's new speech available before opening the modal.
// Check if there's new speech available before opening the modal.
if
(
newSpeechAvailable
.
value
)
{
if
(
newSpeechAvailable
.
value
)
{
isModalOpen
.
value
=
true
// Open the modal
isModalOpen
.
value
=
true
// Open the modal
newSpeechAvailable
.
value
=
false
// Reset the flag since the speech will now be displayed
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
=
()
=>
{
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