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
09288455
Commit
09288455
authored
11 months ago
by
Ina Martini
Browse files
Options
Downloads
Patches
Plain Diff
fix: add help button
parent
2dfcf7b9
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
+59
-16
59 additions, 16 deletions
src/views/HomeView.vue
with
59 additions
and
16 deletions
src/views/HomeView.vue
+
59
−
16
View file @
09288455
<
template
>
<
template
>
<div
class=
"flex flex-col items-center max-h-[60vh] md:flex-row md:max-h-[80vh] mx-auto"
>
<div
class=
"flex flex-col items-center max-h-[60vh] md:flex-row md:max-h-[80vh] mx-auto"
>
<div
class=
"flex flex-col basis-1/3 order-last md:order-first md:basis-1/4 md:pl-10"
>
<div
class=
"flex flex-col basis-1/3 order-last md:order-first md:basis-1/4 md:pl-1 mt-10"
>
<img
v-if=
"newSpeechAvailable"
alt=
"Varsel"
class=
"jump scale-x-[-1] w-1/12 h-1/12 ml-52 cursor-pointer z-10"
src=
"@/assets/varsel.png"
/>
<div
class=
"flex items-center"
>
<div
class=
"flex items-center"
>
<img
v-if=
"speech.length > 0"
alt=
"Varsel"
<a
@
click=
"openInteractiveSpare"
class=
"hover:bg-transparent z-20"
>
class=
"scale-x-[-1] md:h-1/6 md:w-1/6 w-1/6 h-1/6 cursor-pointer"
src=
"@/assets/varsel.png"
/>
<a
@
click=
"openInteractiveSpare"
class=
"hover:bg-transparent"
>
<img
alt=
"Spare"
<img
alt=
"Spare"
class=
"scale-x-[-1] md:h-5/6 md:w-5/6 w-2/3 h-2/3 cursor-pointer"
class=
"scale-x-[-1] md:h-5/6 md:w-5/6 w-2/3 h-2/3 cursor-pointer
ml-14 md:ml-10
"
src=
"@/assets/spare.png"
src=
"@/assets/spare.png"
/>
/>
</a>
</a>
...
@@ -29,11 +29,20 @@
...
@@ -29,11 +29,20 @@
:pngSize=
"15"
:pngSize=
"15"
:is-modal-open=
"isModalOpen"
:is-modal-open=
"isModalOpen"
class=
"opacity-0 h-0 w-0 md:opacity-100 md:h-auto md:w-auto"
class=
"opacity-0 h-0 w-0 md:opacity-100 md:h-auto md:w-auto"
v-if=
"isModalOpen"
></InteractiveSpare>
></InteractiveSpare>
<div
class=
"fixed bottom-5 left-5"
>
<a
@
click=
"openHelp"
class=
"hover:cursor-pointer"
>
<img
alt=
"Hjelp"
class=
"w-1/12"
src=
"@/assets/hjelp.png"
/>
</a>
</div>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
onMounted
,
ref
}
from
'
vue
'
import
{
onMounted
,
ref
,
toRefs
}
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
'
...
@@ -45,6 +54,8 @@ import SavingsPath from '@/components/SavingsPath.vue'
...
@@ -45,6 +54,8 @@ import SavingsPath from '@/components/SavingsPath.vue'
const
goalStore
=
useGoalStore
()
const
goalStore
=
useGoalStore
()
const
challengeStore
=
useChallengeStore
()
const
challengeStore
=
useChallengeStore
()
const
isModalOpen
=
ref
(
false
)
const
isModalOpen
=
ref
(
false
)
const
speech
=
ref
<
string
[]
>
([])
const
newSpeechAvailable
=
ref
(
false
)
const
challenges
=
ref
<
Challenge
[]
>
([])
const
challenges
=
ref
<
Challenge
[]
>
([])
const
goals
=
ref
<
Goal
[]
>
([])
const
goals
=
ref
<
Goal
[]
>
([])
...
@@ -59,17 +70,49 @@ onMounted(async () => {
...
@@ -59,17 +70,49 @@ onMounted(async () => {
goal
.
value
=
goals
.
value
[
0
]
goal
.
value
=
goals
.
value
[
0
]
})
})
// Speech array for InteractiveSpare component
const
updateSpeech
=
(
newSpeech
:
string
[])
=>
{
const
speechArray
=
[
speech
.
value
=
newSpeech
;
newSpeechAvailable
.
value
=
true
;
console
.
log
(
'
New speech available:
'
,
speech
.
value
)
}
updateSpeech
([
'
Hei, jeg er Spare!
'
,
'
Hei, jeg er Spare!
'
,
'
Jeg skal hjelpe deg med å spare penger.
'
,
'
Jeg skal hjelpe deg med å spare penger.
'
,
'
Klikk på meg for å høre mer.
'
'
Du får varsel når jeg har noe å si!
'
]
])
const
speech
=
ref
(
speechArray
)
const
openInteractiveSpare
=
()
=>
{
const
openInteractiveSpare
=
()
=>
{
isModalOpen
.
value
=
true
console
.
log
(
'
Opening interactive spare available
'
,
newSpeechAvailable
.
value
)
console
.
log
(
'
Modal opened
'
)
// 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
=
()
=>
{
updateSpeech
([
'
Heisann, jeg er Spare!
'
,
'
Jeg skal hjelpe deg med å spare penger.
'
,
'
Du kan legge til sparemål og spareutfordringer!
'
,
'
Sammen kan vi spare penger og nå dine mål!
'
,
])
openInteractiveSpare
()
}
}
</
script
>
</
script
>
<
style
>
@keyframes
jump
{
0
%,
100
%
{
transform
:
translateY
(
0
);
}
50
%
{
transform
:
translateY
(
-10px
);
}
}
.jump
{
animation
:
jump
0.6s
infinite
ease-in-out
;
}
</
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