Skip to content
Snippets Groups Projects
Commit b050d1ed authored by Victor Ekholt Gunrell Kaste's avatar Victor Ekholt Gunrell Kaste
Browse files

feat: Adde greyscale to completed challenges

parent 802e349a
No related branches found
No related tags found
No related merge requests found
Pipeline #275350 failed
...@@ -4,6 +4,7 @@ interface Step { ...@@ -4,6 +4,7 @@ interface Step {
showPanel: boolean; showPanel: boolean;
description: string; description: string;
percentFinished: number; percentFinished: number;
unFinished: boolean;
} }
export default { export default {
data() { data() {
...@@ -13,18 +14,28 @@ export default { ...@@ -13,18 +14,28 @@ export default {
title: 'Spain trip' as string, title: 'Spain trip' as string,
//This will be changed to info gathered from backend //This will be changed to info gathered from backend
steps: [ steps: [
{ title: 'Challenge 1', showPanel: false, description: 'Save 50kr on coffee in 3 days', percentFinished: 22 }, { title: 'Challenge 1', showPanel: false, description: 'Save 50kr on coffee in 3 days', percentFinished: 22, unFinished: false },
{ title: 'Challenge 2', showPanel: false, description: 'Save 500kr on food in 7 days', percentFinished: 73 }, { title: 'Challenge 2', showPanel: false, description: 'Save 500kr on food in 7 days', percentFinished: 73, unFinished: false },
{ title: 'Challenge 3', showPanel: false, description: 'Save 350kr on clothes in 5 days', percentFinished: 50 }, { title: 'Challenge 3', showPanel: false, description: 'Save 350kr on clothes in 5 days', percentFinished: 50, unFinished: true },
{ title: 'Challenge 4', showPanel: false, description: 'Save 150kr on coffee in 4 days', percentFinished: 10 }, { title: 'Challenge 4', showPanel: false, description: 'Save 150kr on coffee in 4 days', percentFinished: 10, unFinished: true },
{ title: 'Challenge 5', showPanel: false, description: 'Save 50kr on coffee in 3 days', percentFinished: 90 } { title: 'Challenge 5', showPanel: false, description: 'Save 50kr on coffee in 3 days', percentFinished: 90, unFinished: true }
] ]
, ,
bluePanelMaxHeight: 'auto' as string bluePanelMaxHeight: 'auto' as string
}; };
}, },
mounted() { mounted() {
this.togglePanel(this.steps[2]); setTimeout(() => {
this.togglePanel(this.steps[2]);
}, 500);
},
computed: {
computeImageFilter() {
return (step: Step) => {
return step.unFinished ? 'none' : 'grayscale(100%)';
};
}
}, },
methods: { methods: {
togglePanel(step: Step) { togglePanel(step: Step) {
...@@ -40,12 +51,8 @@ export default { ...@@ -40,12 +51,8 @@ export default {
if (step.showPanel) { if (step.showPanel) {
this.$nextTick(() => { this.$nextTick(() => {
const panel = document.getElementById(`panel-${this.steps.indexOf(step)}`); const panel = document.getElementById(`panel-${this.steps.indexOf(step)}`);
console.log(panel);
if (panel) { if (panel) {
setTimeout(() => { panel.scrollIntoView({ behavior: 'smooth', block: 'center' });
panel.scrollIntoView({ behavior: 'smooth', block: 'center' });
console.log('I should have scrolled');
}, 100); // Wait for 1 second before scrolling
} }
}); });
} }
...@@ -56,11 +63,24 @@ export default { ...@@ -56,11 +63,24 @@ export default {
<template> <template>
<div class="col-lg-8"> <div class="col-lg-8">
<div class="SavingGoalTitle text-center">{{title}}</div> <div class="SavingGoalTitle text-center">
{{title}}
<br>
<p class="d-inline-flex gap-1">
<button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample" style="font-size: 25px;">
See more info
</button>
</p>
<div class="collapse" id="collapseExample">
<div class="card card-body bg-primary mx-auto" style="width: 80%;">
Total saved: 20kr
</div>
</div>
</div>
<ul class="timeline"> <ul class="timeline">
<li v-for="(step, index) in steps" :key="index" :class="{ 'timeline-inverted': index % 2 !== 0 }"> <li v-for="(step, index) in steps" :key="index" :class="{ 'timeline-inverted': index % 2 !== 0 }">
<div class="timeline-image z-1" @click="togglePanel(step)"> <div class="timeline-image z-1" @click="togglePanel(step)">
<img class="circular-image" :src="step.showPanel ? altImage : image" alt=""> <img class="circular-image" :src="step.showPanel ? altImage : image" :style="{ filter: computeImageFilter(step) }" alt="">
</div> </div>
<div class="timeline-panel z-3" :id="'panel-' + index" v-show="step.showPanel"> <div class="timeline-panel z-3" :id="'panel-' + index" v-show="step.showPanel">
<div class="timeline-heading"> <div class="timeline-heading">
...@@ -95,9 +115,8 @@ export default { ...@@ -95,9 +115,8 @@ export default {
<style scoped> <style scoped>
.col-lg-8 { .col-lg-8 {
width: 63%; width: 58%;
margin-bottom: 20px; margin-bottom: 20px;
max-height: 1000px;
} }
.SavingGoalTitle { .SavingGoalTitle {
......
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