Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b37187f7 authored by VIAUD Nathan's avatar VIAUD Nathan
Browse files

starting visualize orphan content

parent ddb8ad25
Branches
No related tags found
No related merge requests found
Pipeline #936139 passed
...@@ -216,6 +216,9 @@ function runPreviewAtPage(): void { ...@@ -216,6 +216,9 @@ function runPreviewAtPage(): void {
if (prevNode) { if (prevNode) {
contentPath = `${prevNode.data.contentId}/content/${openedNode.data.contentId}`; contentPath = `${prevNode.data.contentId}/content/${openedNode.data.contentId}`;
} else { } else {
// Here to launch orphan preview
// contentPath = `content/${openedNode.data.contentId}`;
// console.log('Launching orphan preview at', contentPath);
error = true; error = true;
waitingToastDismiss(); waitingToastDismiss();
toaster.warning('🚨Contenu orphelin non visualisable', { duration: 3000 }); toaster.warning('🚨Contenu orphelin non visualisable', { duration: 3000 });
......
...@@ -110,6 +110,22 @@ function createContentJSON(): EpocV1 { ...@@ -110,6 +110,22 @@ function createContentJSON(): EpocV1 {
pageNode = getNextNode(pageNode); pageNode = getNextNode(pageNode);
} }
}); });
// Adding orphan content to contentJSON
const pageNodes = nodes.value.filter((node) => {
return node.type === 'page' || node.type === 'activity';
});
//? Detect if the page is an orphan
let isOrphan = true;
for(const node of pageNodes) {
for(const chapter of Object.values(epoc.chapters)) {
if(chapter.contents.includes(node.data.contentId)) {
isOrphan = false;
break;
}
}
}
if (validBadges) { if (validBadges) {
epoc.badges = exportBadgesToPage(validBadges); epoc.badges = exportBadgesToPage(validBadges);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment