From 5e762117701067ff953f72bea24f394490db87c0 Mon Sep 17 00:00:00 2001 From: igorgoldobin Date: Sat, 8 Jun 2024 17:51:01 +1000 Subject: [PATCH 1/2] feat: added giscus integration --- .env.template | 1 + package.json | 1 + src/components/comments/comments.js | 33 +++++++++++++++++++++-------- yarn.lock | 11 ++++++++++ 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/.env.template b/.env.template index 310daeebe..28a9eca36 100644 --- a/.env.template +++ b/.env.template @@ -17,3 +17,4 @@ GITHUB_REPO=#{GITHUB_REPO} GATSBY_ALGOLIA_APP_ID=#{GATSBY_ALGOLIA_APP_ID} GATSBY_ALGOLIA_SEARCH_KEY=#{GATSBY_ALGOLIA_SEARCH_KEY} ALGOLIA_ADMIN_KEY=#{ALGOLIA_ADMIN_KEY} +GISCUS_REPO_ID=#{GISCUS_REPO_ID} diff --git a/package.json b/package.json index 290d174e9..f536b99b0 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "dependencies": { "@auth0/auth0-react": "^2.2.4", + "@giscus/react": "^1.0.0", "@microsoft/applicationinsights-web": "^3.1.0", "@raae/gatsby-remark-oembed": "^0.3.3", "algoliasearch": "^4.22.1", diff --git a/src/components/comments/comments.js b/src/components/comments/comments.js index fa5f02d30..6af8f615e 100644 --- a/src/components/comments/comments.js +++ b/src/components/comments/comments.js @@ -1,16 +1,31 @@ -import { Disqus } from 'gatsby-plugin-disqus'; +import { Giscus } from '@giscus/react'; import React from 'react'; import PropTypes from 'prop-types'; -const Comments = (props) => { - let disqusConfig = { - identifier: props.ruleGuid, - title: props.title, - }; +const GISCUS_REPO_ID = process.env.GISCUS_REPO_ID; + +const Comments = () => { return ( -
- -
+ <> +
+ +
+ ); }; diff --git a/yarn.lock b/yarn.lock index 4565f4ecf..17defbaac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2430,6 +2430,16 @@ __metadata: languageName: node linkType: hard +"@giscus/react@npm:^1.0.0": + version: 1.1.2 + resolution: "@giscus/react@npm:1.1.2" + peerDependencies: + react: ^16 || ^17 || ^18 + react-dom: ^16 || ^17 || ^18 + checksum: 63d0cb7324c0953f7e87420c97324f3732adc4a08547db33d922e611647419b8ac7ea7053f248e56f638ce21b7df6bd6aa78c71cdb426910d320238604835a10 + languageName: node + linkType: hard + "@graphql-codegen/add@npm:^3.2.3": version: 3.2.3 resolution: "@graphql-codegen/add@npm:3.2.3" @@ -5711,6 +5721,7 @@ __metadata: "@fortawesome/free-brands-svg-icons": "npm:^6.5.1" "@fortawesome/free-solid-svg-icons": "npm:^6.5.1" "@fortawesome/react-fontawesome": "npm:^0.2.0" + "@giscus/react": "npm:^1.0.0" "@microsoft/applicationinsights-web": "npm:^3.1.0" "@playwright/test": "npm:^1.41.2" "@raae/gatsby-remark-oembed": "npm:^0.3.3" From 4e01a0c503dde3930b478b2eca5755e82eff06cf Mon Sep 17 00:00:00 2001 From: Igor Goldobin Date: Sat, 15 Jun 2024 14:53:25 +1000 Subject: [PATCH 2/2] Update template-build.yml to include GISCUS_REPO_ID --- .github/workflows/template-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/template-build.yml b/.github/workflows/template-build.yml index 065e245bb..bf91bb83f 100644 --- a/.github/workflows/template-build.yml +++ b/.github/workflows/template-build.yml @@ -130,6 +130,7 @@ jobs: GATSBY_ALGOLIA_APP_ID: ${{ vars.GATSBY_ALGOLIA_APP_ID }} GATSBY_ALGOLIA_SEARCH_KEY: ${{ secrets.GATSBY_ALGOLIA_SEARCH_KEY }} ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} + GISCUS_REPO_ID: ${{ secrets.GISCUS_REPO_ID }} - name: Rename env file run: |