Skip to content
Snippets Groups Projects
Commit 58f942ef authored by Harry Linrui XU's avatar Harry Linrui XU
Browse files

fix: Show interactive spare component only on first login by flipping watch effect default value

parent e10eecdc
No related branches found
No related tags found
3 merge requests!66Final merge,!49Create spare component,!4Pipeline fix
Pipeline #282769 failed
...@@ -53,13 +53,11 @@ const props = defineProps({ ...@@ -53,13 +53,11 @@ const props = defineProps({
imageDirection: String, imageDirection: String,
show: { show: {
type: Boolean, type: Boolean,
default: true, default: false,
required: false required: false
} }
}) })
watchEffect(() => { isModalOpen.value = props.show
watchEffect(() => {
isModalOpen.value = props.show
}) })
</script> </script>
\ No newline at end of file
...@@ -3,11 +3,13 @@ ...@@ -3,11 +3,13 @@
<div class="flex flex-col basis-1/3 order-last md:order-first md:basis-1/4 md:pl-1 mt-10"> <div class="flex flex-col basis-1/3 order-last md:order-first md:basis-1/4 md:pl-1 mt-10">
<SpareComponent <SpareComponent
:speech="speech" :speech="speech"
:png-size="15" :show="showWelcome"
:png-size="12"
:direction="'right'" :direction="'right'"
:imageDirection="'right'" :imageDirection="'right'"
class="mt-24"
></SpareComponent> ></SpareComponent>
<div class="flex flex-row gap-2 items-center mx-auto my-4 md:flex-col md:gap-4 md:m-8"> <div class="flex flex-row gap-2 items-center mx-auto mt-4 mb-20 md:flex-col md:gap-4 md:m-8">
<ButtonAddGoalOrChallenge :buttonText="'Legg til sparemål'" :type="'goal'" /> <ButtonAddGoalOrChallenge :buttonText="'Legg til sparemål'" :type="'goal'" />
<ButtonAddGoalOrChallenge <ButtonAddGoalOrChallenge
:buttonText="'Legg til spareutfordring'" :buttonText="'Legg til spareutfordring'"
...@@ -47,7 +49,6 @@ onMounted(async () => { ...@@ -47,7 +49,6 @@ onMounted(async () => {
goals.value = goalStore.goals goals.value = goalStore.goals
goal.value = goals.value[0] goal.value = goals.value[0]
firstLoggedInSpeech() firstLoggedInSpeech()
SpareSpeech()
}) })
// Check if the user is logging in for the first time, and display the first login speech // Check if the user is logging in for the first time, and display the first login speech
...@@ -55,21 +56,10 @@ const firstLoggedInSpeech = () => { ...@@ -55,21 +56,10 @@ const firstLoggedInSpeech = () => {
const isFirstLogin = router.currentRoute.value.query.firstLogin === 'true' const isFirstLogin = router.currentRoute.value.query.firstLogin === 'true'
if (isFirstLogin) { if (isFirstLogin) {
showWelcome.value = true showWelcome.value = true
speech.value = [ speech.value.push('Hei, jeg er Spare!')
'Hei, jeg er Spare!', speech.value.push('Jeg skal hjelpe deg med å spare penger.')
'Jeg skal hjelpe deg med å spare penger.', speech.value.push('Trykk på meg for å høre hva jeg har å si 🐷')
'Trykk på meg for å høre hva jeg har å si 🐷'
]
router.replace({ name: 'home', query: { firstLogin: 'false' } }) router.replace({ name: 'home', query: { firstLogin: 'false' } })
showWelcome.value = false
} }
} }
const SpareSpeech = () => {
speech.value = [
'Hei! Jeg er sparegrisen, Spare!',
'Valkommen til SpareSti 👑',
'Du kan trykke på meg for å høre hva jeg har å si 🐷'
]
}
</script> </script>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment