Skip to content

Commit

Permalink
create a computed for ordered pages
Browse files Browse the repository at this point in the history
  • Loading branch information
bellangerq committed Nov 15, 2024
1 parent 4ebf5be commit 105fe3e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions confiture-web-app/src/pages/audit/AuditGenerationPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ const topics = computed(() => {
const auditIsInProgress = computed(() => resultsStore.auditProgress < 1);
const orderedPages = computed(() => {
return sortBy(auditStore.currentAudit?.pages, "order");
});
function updateCurrentPageId(i: number) {
auditStore.updateCurrentPageId(
i === 0
? auditStore.currentAudit?.transverseElementsPage.id ?? null
: auditStore.currentAudit?.pages
? sortBy(auditStore.currentAudit.pages, "order").at(i - 1)?.id ?? null
? orderedPages.value.at(i - 1)?.id ?? null
: null
);
}
Expand Down Expand Up @@ -220,13 +224,10 @@ const tabsData = computed((): TabData[] => {
...(transversePage
? [{ label: transversePage?.name, data: transversePage }]
: []),
...sortBy(
auditStore.currentAudit?.pages.map((p) => ({
label: p.name,
data: p
})) ?? [],
(p) => p.data.order
)
...(orderedPages.value.map((p) => ({
label: p.name,
data: p
})) ?? [])
];
});
</script>
Expand Down

0 comments on commit 105fe3e

Please sign in to comment.