Merge branch 'main' of github.com:jcalixte/loopycode

This commit is contained in:
Julien Calixte
2024-11-09 12:46:53 +01:00
3 changed files with 33 additions and 6 deletions

View File

@@ -12,7 +12,18 @@ import { RouterLink, RouterView } from 'vue-router'
</nav> </nav>
</header> </header>
<RouterView /> <main>
<RouterView />
</main>
<footer>
<a
href="https://github.com/jcalixte/failwell/issues"
target="_blank"
rel="noopener noreferrer"
>report an issue</a
>
</footer>
</div> </div>
</template> </template>
@@ -32,4 +43,13 @@ nav {
img.logo { img.logo {
max-width: 40px; max-width: 40px;
} }
main {
flex: 1;
}
footer {
text-align: right;
font-size: 0.8rem;
}
</style> </style>

View File

@@ -202,6 +202,12 @@ export const useTaskRecordStore = defineStore('task-record-store', {
) )
if (nextStepIndex >= 0) { if (nextStepIndex >= 0) {
const latestStartDate = Math.max(
...Object.values(record.stepRecords).map((stepRecord) =>
new Date(stepRecord.start).getTime()
)
)
task.steps task.steps
.filter((_, index) => index > nextStepIndex) .filter((_, index) => index > nextStepIndex)
.map((step) => step.id) .map((step) => step.id)
@@ -212,7 +218,7 @@ export const useTaskRecordStore = defineStore('task-record-store', {
this.startStepRecord({ this.startStepRecord({
taskId: task.id, taskId: task.id,
stepId: task.steps[nextStepIndex].id, stepId: task.steps[nextStepIndex].id,
start: toISODate(new Date()) start: toISODate(new Date(latestStartDate))
}) })
} }
} }

View File

@@ -2,6 +2,7 @@
import EstimationTimeArrival from '@/components/EstimationTimeArrival.vue' import EstimationTimeArrival from '@/components/EstimationTimeArrival.vue'
import { adaptStepsToTextarea } from '@/modules/task/infra/adaptStepsToTextarea' import { adaptStepsToTextarea } from '@/modules/task/infra/adaptStepsToTextarea'
import { useTaskStore } from '@/modules/task/stores/useTask.store' import { useTaskStore } from '@/modules/task/stores/useTask.store'
import { logicOr } from '@vueuse/math'
import { useMagicKeys, whenever } from '@vueuse/core' import { useMagicKeys, whenever } from '@vueuse/core'
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
@@ -43,13 +44,13 @@ const isNextDisabled = computed(
currentIndex.value === task.value?.stepHistory.length - 2 currentIndex.value === task.value?.stepHistory.length - 2
) )
const { n, p } = useMagicKeys() const { n, p, right, left } = useMagicKeys()
whenever(p, () => { whenever(logicOr(p, left), () => {
goToPrev() goToPrev()
}) })
whenever(n, () => { whenever(logicOr(n, right), () => {
goToNext() goToNext()
}) })
</script> </script>
@@ -65,7 +66,7 @@ whenever(n, () => {
<h2 class="subtitle"> <h2 class="subtitle">
<estimation-time-arrival :estimation="task.totalEstimation" /> <estimation-time-arrival :estimation="task.totalEstimation" />
</h2> </h2>
<div class="buttons" v-if="!isPrevDisabled || !isNextDisabled"> <div class="buttons is-centered" v-if="!isPrevDisabled || !isNextDisabled">
<button class="button" :disabled="isPrevDisabled" @click="goToPrev"> <button class="button" :disabled="isPrevDisabled" @click="goToPrev">
<img src="/icons/arrow-left.svg" alt="go back" /></button <img src="/icons/arrow-left.svg" alt="go back" /></button
><button class="button" :disabled="isNextDisabled" @click="goToNext"> ><button class="button" :disabled="isNextDisabled" @click="goToNext">