(feature) get nextDay work with new refactoring

This commit is contained in:
Julien Calixte
2023-07-22 13:41:59 +02:00
parent ff11534291
commit ca3cbe3470
4 changed files with 57 additions and 15 deletions

View File

@@ -10,6 +10,6 @@ import FeatureSteps from '@/modules/feature/FeatureSteps.vue'
<style scoped lang="scss"> <style scoped lang="scss">
main { main {
height: calc(100vh - 2 * 1rem); min-height: calc(100vh - 2 * 1rem);
} }
</style> </style>

View File

@@ -20,7 +20,10 @@ const remainingBlueBuckets = computed(() =>
const hasFeaturesInProgress = computed( const hasFeaturesInProgress = computed(
() => featuresInProgress.value.length > 0 () => featuresInProgress.value.length > 0
) )
const hasFeaturesDone = computed(() => featuresInProgress.value.length > 0) const hasFeaturesDone = computed(() => featuresDone.value.length > 0)
const isLive = computed(
() => props.step.title.toLocaleLowerCase() === 'release'
)
</script> </script>
<template> <template>
@@ -44,7 +47,12 @@ const hasFeaturesDone = computed(() => featuresInProgress.value.length > 0)
<section class="done"> <section class="done">
<h5>📝</h5> <h5>📝</h5>
<ul v-if="hasFeaturesDone"> <ul v-if="hasFeaturesDone">
<li v-for="feature in featuresDone" :key="feature.name" class="bin"> <li
v-for="feature in featuresDone"
:key="feature.name"
class="bin"
:class="{ 'green-bin': isLive }"
>
<div> <div>
{{ feature.name }} {{ feature.name }}
</div> </div>
@@ -66,6 +74,8 @@ const hasFeaturesDone = computed(() => featuresInProgress.value.length > 0)
@import url('https://fonts.googleapis.com/css2?family=Cutive+Mono&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Cutive+Mono&display=swap');
.feature-step { .feature-step {
--success-color: #20bf6b;
header { header {
padding: 0.5rem; padding: 0.5rem;
border: solid 2px var(--background-color); border: solid 2px var(--background-color);
@@ -102,6 +112,12 @@ const hasFeaturesDone = computed(() => featuresInProgress.value.length > 0)
font-size: 18pt; font-size: 18pt;
} }
.green-bin {
background-color: var(--success-color);
border: 3px solid var(--success-color);
color: white;
}
li { li {
flex-direction: column; flex-direction: column;
} }

View File

@@ -10,20 +10,37 @@ const featureBoard = createFeatureBoard()
const features = ref<Feature[]>([]) const features = ref<Feature[]>([])
const meanComplexity = computed(() => const meanComplexity = computed(
sumElements(features.value.map((feature) => feature.complexity)) () =>
sumElements(features.value.map((feature) => feature.complexity)) /
features.value.length
) )
const meanLeadTime = computed(() => const meanLeadTime = computed(
sumElements(features.value.map((feature) => feature.leadTime)) () =>
sumElements(features.value.map((feature) => feature.leadTime)) /
features.value.length
) )
onMounted(() => (features.value = featureBoard.initBoard(featureSteps))) onMounted(() => (features.value = featureBoard.initBoard(featureSteps)))
const nextDay = () => (features.value = featureBoard.nextDay(features.value)) const nextDay = () => {
features.value = featureBoard.nextDay(features.value)
}
const getStepFeatures = (stepIndex: number) => const featuresGroupedByStep = computed(() => {
features.value.filter((feature) => feature.step === stepIndex) const groupedByStep: Record<number, Feature[]> = {}
features.value.forEach((feature) => {
if (!groupedByStep[feature.step]) {
groupedByStep[feature.step] = [feature]
} else {
groupedByStep[feature.step].push(feature)
}
})
return groupedByStep
})
</script> </script>
<template> <template>
@@ -41,13 +58,14 @@ const getStepFeatures = (stepIndex: number) =>
v-for="step in featureSteps" v-for="step in featureSteps"
:key="step.title" :key="step.title"
:step="step" :step="step"
:features="getStepFeatures(step.stepIndex)" :features="featuresGroupedByStep[step.stepIndex] ?? []"
/> />
</ul> </ul>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.dashboard { .dashboard,
pre {
color: black; color: black;
} }
@@ -56,7 +74,7 @@ const getStepFeatures = (stepIndex: number) =>
flex: 1; flex: 1;
gap: 1rem; gap: 1rem;
flex-wrap: wrap; flex-wrap: wrap;
align-items: flex-start; align-items: stretch;
margin: 0 1rem; margin: 0 1rem;
border: 3px solid var(--background-color); border: 3px solid var(--background-color);
@@ -70,7 +88,6 @@ const getStepFeatures = (stepIndex: number) =>
li:not(:last-child) { li:not(:last-child) {
padding-right: 1rem; padding-right: 1rem;
border-right: 3px solid var(--background-color);
border-radius: 0; border-radius: 0;
} }

View File

@@ -24,8 +24,17 @@ export const createFeatureBoard = () => {
if (isFeatureLive) { if (isFeatureLive) {
return return
} }
feature.leadTime++ feature.leadTime++
switch (feature.status) {
case 'doing':
feature.status = 'done'
break
case 'done':
feature.status = 'doing'
feature.step--
break
}
}) })
return features return features