Skip to content

Commit

Permalink
chore(root): migrate comments to cusdis
Browse files Browse the repository at this point in the history
  • Loading branch information
hendraaagil committed Jun 8, 2021
1 parent 5d65c44 commit 2556df2
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONTENTFUL_SPACE_ID = ''
CONTENTFUL_ACCESS_KEY = ''
NEXT_PUBLIC_DISQUS_SHORTNAME = ''
NEXT_PUBLIC_CUSDIS_APPID = ''
NEXT_PUBLIC_SITE_URL = ''
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ First, copy `.env.example` and paste as `.env.local`, fill all field:
```bash
CONTENTFUL_SPACE_ID = ''
CONTENTFUL_ACCESS_KEY = ''
NEXT_PUBLIC_DISQUS_SHORTNAME = ''
NEXT_PUBLIC_CUSDIS_APPID = ''
NEXT_PUBLIC_SITE_URL = ''
```

Expand All @@ -23,7 +23,7 @@ Last, open [http://localhost:3000](http://localhost:3000) with your browser to s

## Credits

Built with [Chakra UI](https://chakra-ui.com), [Contentful](https://contentful.com) and [Next.js](https://nextjs.org).
Built with [Chakra UI](https://chakra-ui.com), [Contentful](https://contentful.com), [Cusdis](https://cusdis.com) and [Next.js](https://nextjs.org).

## License

Expand Down
19 changes: 19 additions & 0 deletions components/blog/Comments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ReactCusdis } from 'react-cusdis';

const Disqus = ({ pageUrl, pageId, pageTitle }) => {
const appId = process.env.NEXT_PUBLIC_CUSDIS_APPID;

return (
<ReactCusdis
attrs={{
host: 'https://cusdis.com',
appId,
pageId,
pageTitle,
pageUrl,
}}
/>
);
};

export default Disqus;
10 changes: 0 additions & 10 deletions components/blog/Disqus.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"@emotion/styled": "11",
"contentful": "^8.3.5",
"date-fns": "^2.21.3",
"disqus-react": "^1.0.11",
"framer-motion": "4.1.17",
"next": "10.2.2",
"next-seo": "^4.24.0",
"nprogress": "^0.2.0",
"react": "17.0.2",
"react-cusdis": "^2.1.3",
"react-dom": "17.0.2",
"react-icons": "^4.2.0",
"react-markdown": "^6.0.2",
Expand Down
4 changes: 2 additions & 2 deletions pages/blog/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Badge, Box, Divider, Heading, HStack, Text } from '@chakra-ui/react';
import { format } from 'date-fns';

import MarkdownComponent from '../../components/blog/MarkdownComponent';
import Disqus from '../../components/blog/Disqus';
import Comments from '../../components/blog/Comments';

const client = createClient({
space: process.env.CONTENTFUL_SPACE_ID,
Expand Down Expand Up @@ -119,7 +119,7 @@ const DetailBlog = ({ blog }) => {
<MarkdownComponent markdownContent={markdownContent} />
</Box>
<Divider my={4} />
<Disqus url={url} identifier={id} title={title} />
<Comments pageUrl={url} pageId={id} pageTitle={title} />
</>
);
};
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1461,11 +1461,6 @@ diffie-hellman@^5.0.0:
miller-rabin "^4.0.0"
randombytes "^2.0.0"

disqus-react@^1.0.11:
version "1.0.11"
resolved "https://registry.yarnpkg.com/disqus-react/-/disqus-react-1.0.11.tgz#7949923320835310666cbfc77aae90577711434a"
integrity sha512-DZGc6kk16EGLAJtJAn+EdNHy44pBD0QJnuuOSyMf6qqsZrIYwkBFe72mdvRKfGYD1toR7bAvkRjmec/YQTrG+w==

domain-browser@4.19.0:
version "4.19.0"
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-4.19.0.tgz#1093e17c0a17dbd521182fe90d49ac1370054af1"
Expand Down Expand Up @@ -2785,6 +2780,11 @@ react-clientside-effect@^1.2.2:
dependencies:
"@babel/runtime" "^7.12.13"

react-cusdis@^2.1.3:
version "2.1.3"
resolved "https://registry.yarnpkg.com/react-cusdis/-/react-cusdis-2.1.3.tgz#95ed31822689f2621a2cc1d9a4c8d4ff64030686"
integrity sha512-fUJOAUY7a3y21fNzlRWUSTr/ZMsejQAYWIWdsNuBPPZHbUrBvke/8Gw4OL5Mlrth7jLw8VTNssX0WBX5/prorQ==

react-dom@17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
Expand Down

1 comment on commit 2556df2

@vercel
Copy link

@vercel vercel bot commented on 2556df2 Jun 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.