diff --git a/documentation/package-lock.json b/documentation/package-lock.json index 36fc9bfa..64dd438d 100644 --- a/documentation/package-lock.json +++ b/documentation/package-lock.json @@ -11,6 +11,7 @@ "@docusaurus/core": "2.4.0", "@docusaurus/plugin-client-redirects": "2.4.0", "@docusaurus/preset-classic": "2.4.0", + "@giscus/react": "^2.4.0", "@headlessui/react": "^1.7.15", "@mdx-js/react": "^1.6.22", "@swc/core": "^1.3.64", @@ -2643,6 +2644,18 @@ "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==", "optional": true }, + "node_modules/@giscus/react": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@giscus/react/-/react-2.4.0.tgz", + "integrity": "sha512-y8d8qiZ2sBuaXRcgn/ZWfMlRs9bx26p62BU/HEKQQ+IfHo3B/kglgPjX/IqudwlX+DOlHUl1NvtFo9C8Eqo0eQ==", + "dependencies": { + "giscus": "^1.4.0" + }, + "peerDependencies": { + "react": "^16 || ^17 || ^18", + "react-dom": "^16 || ^17 || ^18" + } + }, "node_modules/@hapi/hoek": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", @@ -2740,6 +2753,19 @@ "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==" }, + "node_modules/@lit-labs/ssr-dom-shim": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.0.tgz", + "integrity": "sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==" + }, + "node_modules/@lit/reactive-element": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.4.tgz", + "integrity": "sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ==", + "dependencies": { + "@lit-labs/ssr-dom-shim": "^1.2.0" + } + }, "node_modules/@mdx-js/mdx": { "version": "1.6.22", "resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-1.6.22.tgz", @@ -3751,6 +3777,11 @@ "@types/node": "*" } }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==" + }, "node_modules/@types/unist": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", @@ -7435,6 +7466,14 @@ "node": ">=6" } }, + "node_modules/giscus": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/giscus/-/giscus-1.4.0.tgz", + "integrity": "sha512-Pll+pcclTx47NcFDw8nuka2Ja85Gc4XWpzSgL0rszOQaMQRQIV8UMR+zP4a+/N3tV2TXc1SZ537kWlsN6EsAaw==", + "dependencies": { + "lit": "^3.1.0" + } + }, "node_modules/github-slugger": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.4.0.tgz", @@ -8745,6 +8784,34 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, + "node_modules/lit": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lit/-/lit-3.1.2.tgz", + "integrity": "sha512-VZx5iAyMtX7CV4K8iTLdCkMaYZ7ipjJZ0JcSdJ0zIdGxxyurjIn7yuuSxNBD7QmjvcNJwr0JS4cAdAtsy7gZ6w==", + "dependencies": { + "@lit/reactive-element": "^2.0.4", + "lit-element": "^4.0.4", + "lit-html": "^3.1.2" + } + }, + "node_modules/lit-element": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.0.4.tgz", + "integrity": "sha512-98CvgulX6eCPs6TyAIQoJZBCQPo80rgXR+dVBs61cstJXqtI+USQZAbA4gFHh6L/mxBx9MrgPLHLsUgDUHAcCQ==", + "dependencies": { + "@lit-labs/ssr-dom-shim": "^1.2.0", + "@lit/reactive-element": "^2.0.4", + "lit-html": "^3.1.2" + } + }, + "node_modules/lit-html": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.1.2.tgz", + "integrity": "sha512-3OBZSUrPnAHoKJ9AMjRL/m01YJxQMf+TMHanNtTHG68ubjnZxK0RFl102DPzsw4mWnHibfZIBJm3LWCZ/LmMvg==", + "dependencies": { + "@types/trusted-types": "^2.0.2" + } + }, "node_modules/loader-runner": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", @@ -17176,6 +17243,14 @@ "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==", "optional": true }, + "@giscus/react": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@giscus/react/-/react-2.4.0.tgz", + "integrity": "sha512-y8d8qiZ2sBuaXRcgn/ZWfMlRs9bx26p62BU/HEKQQ+IfHo3B/kglgPjX/IqudwlX+DOlHUl1NvtFo9C8Eqo0eQ==", + "requires": { + "giscus": "^1.4.0" + } + }, "@hapi/hoek": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", @@ -17256,6 +17331,19 @@ "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==" }, + "@lit-labs/ssr-dom-shim": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.0.tgz", + "integrity": "sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==" + }, + "@lit/reactive-element": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.4.tgz", + "integrity": "sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ==", + "requires": { + "@lit-labs/ssr-dom-shim": "^1.2.0" + } + }, "@mdx-js/mdx": { "version": "1.6.22", "resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-1.6.22.tgz", @@ -17980,6 +18068,11 @@ "@types/node": "*" } }, + "@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==" + }, "@types/unist": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", @@ -20749,6 +20842,14 @@ "pump": "^3.0.0" } }, + "giscus": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/giscus/-/giscus-1.4.0.tgz", + "integrity": "sha512-Pll+pcclTx47NcFDw8nuka2Ja85Gc4XWpzSgL0rszOQaMQRQIV8UMR+zP4a+/N3tV2TXc1SZ537kWlsN6EsAaw==", + "requires": { + "lit": "^3.1.0" + } + }, "github-slugger": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.4.0.tgz", @@ -21684,6 +21785,34 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, + "lit": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lit/-/lit-3.1.2.tgz", + "integrity": "sha512-VZx5iAyMtX7CV4K8iTLdCkMaYZ7ipjJZ0JcSdJ0zIdGxxyurjIn7yuuSxNBD7QmjvcNJwr0JS4cAdAtsy7gZ6w==", + "requires": { + "@lit/reactive-element": "^2.0.4", + "lit-element": "^4.0.4", + "lit-html": "^3.1.2" + } + }, + "lit-element": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.0.4.tgz", + "integrity": "sha512-98CvgulX6eCPs6TyAIQoJZBCQPo80rgXR+dVBs61cstJXqtI+USQZAbA4gFHh6L/mxBx9MrgPLHLsUgDUHAcCQ==", + "requires": { + "@lit-labs/ssr-dom-shim": "^1.2.0", + "@lit/reactive-element": "^2.0.4", + "lit-html": "^3.1.2" + } + }, + "lit-html": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.1.2.tgz", + "integrity": "sha512-3OBZSUrPnAHoKJ9AMjRL/m01YJxQMf+TMHanNtTHG68ubjnZxK0RFl102DPzsw4mWnHibfZIBJm3LWCZ/LmMvg==", + "requires": { + "@types/trusted-types": "^2.0.2" + } + }, "loader-runner": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", diff --git a/documentation/package.json b/documentation/package.json index c67a46ca..f57181f6 100644 --- a/documentation/package.json +++ b/documentation/package.json @@ -19,6 +19,7 @@ "@docusaurus/core": "2.4.0", "@docusaurus/plugin-client-redirects": "2.4.0", "@docusaurus/preset-classic": "2.4.0", + "@giscus/react": "^2.4.0", "@headlessui/react": "^1.7.15", "@mdx-js/react": "^1.6.22", "@swc/core": "^1.3.64", diff --git a/documentation/src/components/blog-comment/index.tsx b/documentation/src/components/blog-comment/index.tsx new file mode 100644 index 00000000..167d9e90 --- /dev/null +++ b/documentation/src/components/blog-comment/index.tsx @@ -0,0 +1,33 @@ +import React from 'react' +import { useThemeConfig, useColorMode } from '@docusaurus/theme-common' +import { ThemeConfig } from '@docusaurus/preset-classic' +import BrowserOnly from '@docusaurus/BrowserOnly' +import Giscus, { GiscusProps, Theme } from '@giscus/react' + +export type GiscusConfig = GiscusProps & { darkTheme: Theme } + +const defaultConfig: Partial & { darkTheme: string } = { + id: 'comments', + repo: "PrepVerse/CodePoint", + repoId: "R_kgDOItEdJw", + category: "Q&A", + categoryId: "DIC_kwDOItEdJ84CZ4tA", + mapping: 'pathname', + reactionsEnabled: '1', + emitMetadata: '0', + inputPosition: 'top', + lang: 'en', + theme: 'light', + darkTheme: 'dark_dimmed', +} + +export default function Comment(): JSX.Element { + const themeConfig = useThemeConfig() as ThemeConfig & { giscus: GiscusConfig } + const giscus = { ...defaultConfig, ...themeConfig.giscus } + giscus.theme = useColorMode().colorMode === 'dark' ? giscus.darkTheme : giscus.theme + return ( + Loading Comments...}> + {() => } + + ) +} \ No newline at end of file diff --git a/documentation/src/prepverse-theme/blog-layout.tsx b/documentation/src/prepverse-theme/blog-layout.tsx index 36718a2a..00e0b707 100644 --- a/documentation/src/prepverse-theme/blog-layout.tsx +++ b/documentation/src/prepverse-theme/blog-layout.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react"; import { CommonLayout } from "./common-layout"; import { CommonHeader } from "./common-header"; import { BlogFooter } from "./blog-footer"; +import BackToTopButton from '@theme/BackToTopButton' import clsx from "clsx"; import { BannerSidebar } from "../components/banner/banner-sidebar"; import { BannerModal } from "../components/banner/banner-modal"; @@ -62,7 +63,7 @@ export const RefineBlogLayout = (props: any) => { "left-0", )} > - + {/* */}
{
+ ); }; diff --git a/documentation/src/prepverse-theme/doc-item-layout.tsx b/documentation/src/prepverse-theme/doc-item-layout.tsx index aed4e7cd..fefda2f4 100644 --- a/documentation/src/prepverse-theme/doc-item-layout.tsx +++ b/documentation/src/prepverse-theme/doc-item-layout.tsx @@ -8,6 +8,7 @@ import React from "react"; import { useDocTOCwithTutorial } from "../components/tutorial-toc/index"; import { useCurrentTutorial } from "../hooks/use-current-tutorial"; import { DocBreadcrumbs } from "./doc-breadcrumbs"; +import BackToTopButton from '@theme/BackToTopButton' import { SourceCodeBadge } from "./doc-sourcecode-badge"; import { SwizzleBadge } from "./doc-swizzle-badge"; import { DocTOC } from "./doc-toc"; @@ -92,6 +93,7 @@ export const DocItemLayout = ({ children }) => { {children} +
diff --git a/documentation/src/theme/BlogPostPage/index.js b/documentation/src/theme/BlogPostPage/index.js index 04707fa1..0d811fdc 100644 --- a/documentation/src/theme/BlogPostPage/index.js +++ b/documentation/src/theme/BlogPostPage/index.js @@ -11,6 +11,7 @@ import { import BlogLayout from "@theme/BlogLayout"; import BlogPostPageMetadata from "@theme/BlogPostPage/Metadata"; import { BlogTOC } from "../../prepverse-theme/blog-toc"; +import Comment from '@site/src/components/blog-comment' import { BlogPostPageView, PostPaginator } from "../../components/blog"; @@ -22,6 +23,7 @@ function BlogPostPageContent({ children }) { }> {children} + ); }