From dff9ba6a4ae9c8e42485701e306f81c993a78fa3 Mon Sep 17 00:00:00 2001 From: Povindu Samarasekara Date: Wed, 24 Sep 2025 17:45:38 +0530 Subject: [PATCH] feat: integrations section --- .../ClientApp/src/content.config.ts | 14 +++++++ .../ClientApp/src/data/navigation.ts | 40 +------------------ .../src/pages/integrations/[...slug].astro | 37 +++++++++++++++++ .../src/pages/integrations/index.astro | 35 ++++++++++++++++ 4 files changed, 88 insertions(+), 38 deletions(-) create mode 100644 Source/SuperOffice.DocsNext/ClientApp/src/pages/integrations/[...slug].astro create mode 100644 Source/SuperOffice.DocsNext/ClientApp/src/pages/integrations/index.astro diff --git a/Source/SuperOffice.DocsNext/ClientApp/src/content.config.ts b/Source/SuperOffice.DocsNext/ClientApp/src/content.config.ts index d057a0ee..485e79f7 100644 --- a/Source/SuperOffice.DocsNext/ClientApp/src/content.config.ts +++ b/Source/SuperOffice.DocsNext/ClientApp/src/content.config.ts @@ -23,6 +23,17 @@ const enDocs = defineCollection({ schema: DocsSchema, }); +const integrationDocs = defineCollection({ + loader: glob({ + pattern: partialBuild ? [] : [ + "**/*.md", + "!**/includes/**", + ], + base: "external-content/superoffice-docs/integrations" + }), + schema: DocsSchema, +}); + const apiDocs = defineCollection({ loader: glob({ pattern: partialBuild ? [] : [ @@ -155,6 +166,7 @@ const tocFiles = defineCollection({ pattern: [ "contribution/**/toc.yml", "superoffice-docs/docs/**/toc.yml", + "superoffice-docs/integrations/**/toc.yml", "superoffice-docs/release-notes/**/toc.yml", ], base: "./external-content", @@ -166,6 +178,7 @@ const landingPages = defineCollection({ loader: glob({ pattern: [ "contribution/**/*.yml", + "superoffice-docs/integrations/*.yml", "superoffice-docs/docs/**/*.yml", "!**/toc.yml", "!**/reference/**", // Because CRMScript.Event.Trigger.yml isn't a valid landing page @@ -186,6 +199,7 @@ export const collections = { "api-docs": apiDocs, "crmscript": CRMScript, "nsscripting": NSScriptingRef, + "integration-docs": integrationDocs, contribute: contribution, "release-notes": releaseNotes, cats: landingPages, diff --git a/Source/SuperOffice.DocsNext/ClientApp/src/data/navigation.ts b/Source/SuperOffice.DocsNext/ClientApp/src/data/navigation.ts index b7cf0a4c..e1457ab2 100644 --- a/Source/SuperOffice.DocsNext/ClientApp/src/data/navigation.ts +++ b/Source/SuperOffice.DocsNext/ClientApp/src/data/navigation.ts @@ -1,6 +1,3 @@ -const base = import.meta.env.BASE_URL; - - export const headerData = { links: [ { @@ -8,41 +5,8 @@ export const headerData = { href: "en/learn" }, { - text: 'Areas', - links: [ - { - text: 'Company', - href: 'en/company', - }, - { - text: 'Contact', - href: 'en/contact', - }, - { - text: 'Diary', - href: 'en/diary', - }, - { - text: 'Document', - href: 'en/document', - }, - { - text: 'Email', - href: 'en/email', - }, - { - text: 'Project', - href: 'en/project', - }, - { - text: 'Request', - href: 'en/request', - }, - { - text: 'Sale', - href: 'en/sale', - }, - ], + text: 'Integrations', + href: "integrations" }, { text: 'CRM Online', diff --git a/Source/SuperOffice.DocsNext/ClientApp/src/pages/integrations/[...slug].astro b/Source/SuperOffice.DocsNext/ClientApp/src/pages/integrations/[...slug].astro new file mode 100644 index 00000000..d785b8fc --- /dev/null +++ b/Source/SuperOffice.DocsNext/ClientApp/src/pages/integrations/[...slug].astro @@ -0,0 +1,37 @@ +--- +import { render } from "astro:content"; +import { getCollection } from "astro:content"; +import { stripFilePathAndExtension } from "@utils/slugUtils"; +import { getTocByPath } from "@utils/tocUtils"; +import ContentLayout from "@layouts/ContentLayout.astro"; + +const tocData = await getTocByPath('superoffice-docs/integrations'); + +export async function getStaticPaths() { + const docEntries = await getCollection("integration-docs"); + const referencePath = "superoffice-docs/integrations" as const; + + const paths = docEntries.map((entry) => { + const slug = stripFilePathAndExtension(entry.filePath!, referencePath); + + return { + params: { slug }, + props: { entry } + }; + }); + + return paths; +} + +const { entry } = Astro.props; +const { Content, headings } = await render(entry); +--- + + + {Content && } +["data"], + { YamlMime: "SubCategory" } +>; + +const collectionPath = "superoffice-docs/integrations" as const; + +// This route supports only the SubCategory YAML at integrations/index.yml. +// It is a special case since we have an index.yml at the root of the repo/collection. +const page = await getEntry("cats", collectionPath); +if (!page) throw new Error("Missing superoffice-docs/integrations/index.yml"); + +const CategoryData = page.data as SubCategoryDataType; + +// Build ToC for the sidebar +const tocEntries = await getCollection("toc", (entry) => + entry.id.startsWith(collectionPath) +); + +const ToCData = await getTableOfContentsFromCollection(tocEntries, collectionPath); + +export const prerender = true; +--- + + \ No newline at end of file