scinote-web/app/javascript/vue/experiments/renderers/completed_tasks.vue

43 lines
997 B
Vue
Raw Normal View History

2023-12-07 03:53:11 +08:00
<template>
<div class="relative leading-5 h-full flex items-center">
<div>
2023-12-07 03:53:11 +08:00
{{ i18n.t('experiments.card.completed_value', {
completed: params.data.completed_tasks,
all: params.data.total_tasks
}) }}
<div class="py-1">
2023-12-11 16:18:22 +08:00
<div class="w-24 h-1 bg-sn-light-grey">
<div class="h-full"
:class="{
'bg-sn-black': params.data.archived_on,
'bg-sn-blue': !params.data.archived_on
}"
:style="{
width: `${progress}%`
}"></div>
2023-12-07 03:53:11 +08:00
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'CompletedTasksRenderer',
props: {
params: {
required: true,
},
},
computed: {
progress() {
const { completed_tasks: completedTasks, total_tasks: totalTasks } = this.params.data;
if (totalTasks === 0) return 0;
return (completedTasks / totalTasks) * 100;
}
}
2023-12-07 03:53:11 +08:00
};
</script>