From 504591ff4fd7cc70016c821f557fd0240d27394f Mon Sep 17 00:00:00 2001 From: connoratrug Date: Thu, 3 Oct 2024 16:46:54 +0200 Subject: [PATCH] fix: hide empty resource section Closes #4288 --- .../[resourceType]/[resource]/index.vue | 16 ++++++++++------ .../content/ContentBlockAttachedFiles.vue | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/nuxt3-ssr/pages/[schema]/ssr-catalogue/[catalogue]/[resourceType]/[resource]/index.vue b/apps/nuxt3-ssr/pages/[schema]/ssr-catalogue/[catalogue]/[resourceType]/[resource]/index.vue index 4651925a77..8fa661dca7 100644 --- a/apps/nuxt3-ssr/pages/[schema]/ssr-catalogue/[catalogue]/[resourceType]/[resource]/index.vue +++ b/apps/nuxt3-ssr/pages/[schema]/ssr-catalogue/[catalogue]/[resourceType]/[resource]/index.vue @@ -264,12 +264,12 @@ const networks = computed(() => ) ); -let tocItems = computed(() => { +const tocItems = computed(() => { let tableOffContents = [ { label: "Description", id: "Description" }, { label: "General design", id: "GeneralDesign" }, ]; - if (population) { + if (showPopulation.value) { tableOffContents.push({ label: "Population", id: "population", @@ -500,6 +500,12 @@ if (route.params.catalogue) { const contributors = computed(() => resource.value.peopleInvolved); const organisations = computed(() => resource.value.organisationsInvolved); +const showPopulation = computed( + () => + !!population.filter( + (item) => item.content !== undefined && item.content !== "" + ).length +);