From 42fbb1964403cb4d57611a63b3f1f860d2c64aba Mon Sep 17 00:00:00 2001 From: "Ajdin Lokvancic (TME)" Date: Sun, 3 Aug 2025 19:58:03 +0200 Subject: [PATCH 1/4] Update Giscus configuration with correct repository details --- docusaurus.config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 8ca69fb..5fbeedc 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -224,10 +224,10 @@ const config: Config = { // Giscus configuration giscus: { - repo: 'YOUR_GITHUB_USERNAME/YOUR_REPOSITORY_NAME', - repoId: 'YOUR_REPOSITORY_ID', - category: 'Announcements', - categoryId: 'YOUR_CATEGORY_ID', + repo: 'NETVPX/pterodactyl-api-docs', + repoId: '1031403272', + category: 'Pages', + categoryId: '45543850', }, // Comprehensive metadata for SEO From 07359802e8374b452bb25c280a9da3761ee09657 Mon Sep 17 00:00:00 2001 From: AjdinDev Date: Sun, 3 Aug 2025 20:10:22 +0200 Subject: [PATCH 2/4] Change Giscus configuration to use environment variables for repo details --- docusaurus.config.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 5fbeedc..86ee5d4 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -224,10 +224,10 @@ const config: Config = { // Giscus configuration giscus: { - repo: 'NETVPX/pterodactyl-api-docs', - repoId: '1031403272', + repo: process.env.GISCUS_REPO, + repoId: process.env.GISCUS_REPO_ID, category: 'Pages', - categoryId: '45543850', + categoryId: process.env.GISCUS_CATEGORY_ID, }, // Comprehensive metadata for SEO From be3149c9c2a3c60902e3e212c3340e606bca7b17 Mon Sep 17 00:00:00 2001 From: AjdinDev Date: Sun, 3 Aug 2025 20:15:32 +0200 Subject: [PATCH 3/4] Change GiscusComments component to use a typed context for improved type safety --- src/components/GiscusComments/index.tsx | 16 ++++++++++------ src/theme/DocItem/Footer/index.tsx | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/GiscusComments/index.tsx b/src/components/GiscusComments/index.tsx index 171ee66..8361b1f 100644 --- a/src/components/GiscusComments/index.tsx +++ b/src/components/GiscusComments/index.tsx @@ -3,18 +3,22 @@ import Giscus from '@giscus/react'; import { useColorMode } from '@docusaurus/theme-common'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +interface GiscusConfig { + repo: string; + repoId: string; + category: string; + categoryId: string; +} + export default function GiscusComments() { const { colorMode } = useColorMode(); - const { - siteConfig: { - themeConfig: { giscus }, - }, - } = useDocusaurusContext(); + const { siteConfig } = useDocusaurusContext(); + const giscus = (siteConfig.themeConfig as any).giscus as GiscusConfig; return ( ; -export default function FooterWrapper(props: Props): JSX.Element { +export default function FooterWrapper(props: Props) { const {metadata} = useDoc(); const {frontMatter} = metadata; From 829ed39300fd039fb95d5a179d4909f94c699033 Mon Sep 17 00:00:00 2001 From: AjdinDev Date: Sun, 3 Aug 2025 20:16:24 +0200 Subject: [PATCH 4/4] Remove unused React import and add type declaration for GiscusComments component --- src/components/GiscusComments/index.tsx | 1 - src/types/global.d.ts | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 src/types/global.d.ts diff --git a/src/components/GiscusComments/index.tsx b/src/components/GiscusComments/index.tsx index 8361b1f..ef6eb08 100644 --- a/src/components/GiscusComments/index.tsx +++ b/src/components/GiscusComments/index.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import Giscus from '@giscus/react'; import { useColorMode } from '@docusaurus/theme-common'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; diff --git a/src/types/global.d.ts b/src/types/global.d.ts new file mode 100644 index 0000000..7cde74b --- /dev/null +++ b/src/types/global.d.ts @@ -0,0 +1,4 @@ +declare module '@site/src/components/GiscusComments' { + const GiscusComments: React.FC; + export default GiscusComments; +} \ No newline at end of file