tornado-initiation-ui/components/Steps.vue

40 lines
861 B
Vue
Raw Normal View History

2020-10-12 19:41:52 +02:00
<template>
<div class="steps">
2020-11-20 17:11:39 +01:00
<step v-for="(step, index) in getData" :key="index" :data="step" />
2020-10-12 19:41:52 +02:00
</div>
</template>
<script>
import Step from '@/components/Step'
2020-10-21 21:45:22 +02:00
import { mapState } from 'vuex'
2020-10-12 19:41:52 +02:00
export default {
components: {
Step,
},
2020-10-21 21:45:22 +02:00
computed: {
...mapState('steps', ['steps']),
2020-11-21 11:46:25 +01:00
...mapState('airdrop', ['airdrops', 'notificationIndex']),
2020-11-20 17:11:39 +01:00
getData() {
if (Array.isArray(this.airdrops)) {
return this.steps.map((step, index) => {
if (step.contract === 'Airdrop.sol') {
2020-11-21 11:46:25 +01:00
const dropIndex = index - this.airdrops.length + 2
2020-11-20 17:11:39 +01:00
return {
...step,
2020-11-21 11:46:25 +01:00
airdrops: this.airdrops[dropIndex],
isActive: this.notificationIndex === dropIndex,
2020-11-20 17:11:39 +01:00
}
}
return step
})
}
return this.steps
},
2020-10-12 19:41:52 +02:00
},
}
</script>