Skip to content

Commit bdcdc4d

Browse files
authored
Merge pull request #1685 from OpenQDev/chris
Chris
2 parents f478683 + ee77381 commit bdcdc4d

File tree

9 files changed

+99
-28
lines changed

9 files changed

+99
-28
lines changed

__tests__/Layout/__snapshots__/FirstTimeBanner.test.js.snap

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,57 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`FirstTimeBanner should show nothing 1`] = `null`;
3+
exports[`FirstTimeBanner should show nothing 1`] = `
4+
<div
5+
className="w-full bg-[#21262d] border-gray-700 border-b grid grid-cols-[1fr_1fr_1fr_1fr] py-4 items-center px-4"
6+
>
7+
<div
8+
className="col-start-2 col-end-4 text-center text-sm min-w-[240px]"
9+
>
10+
Welcome to
11+
<span
12+
className="font-bold"
13+
>
14+
OpenQ!
15+
</span>
16+
<br />
17+
<br />
18+
<div>
19+
You
20+
'
21+
re early to the party - most EthDenver 2023 bounties will be minted on March 20.
22+
</div>
23+
<br />
24+
<div>
25+
Some will be minted later as sponsors finalize decisions.
26+
</div>
27+
<br />
28+
<div>
29+
Keep an eye on your inbox for updates.
30+
</div>
31+
</div>
32+
<div
33+
className="flex justify-self-end"
34+
>
35+
<button
36+
className="px-4"
37+
onClick={[Function]}
38+
>
39+
<svg
40+
className="fill-muted hover:fill-blue-400 w-4 h-4"
41+
height="16"
42+
viewBox="0 0 16 16"
43+
width="16"
44+
xmlns="http://www.w3.org/2000/svg"
45+
>
46+
<path
47+
d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"
48+
fillRule="evenodd"
49+
/>
50+
</svg>
51+
</button>
52+
</div>
53+
</div>
54+
`;
455

556
exports[`FirstTimeBanner should show the Banner and match DOM Snapshot 1`] = `
657
<div
@@ -15,19 +66,21 @@ exports[`FirstTimeBanner should show the Banner and match DOM Snapshot 1`] = `
1566
>
1667
OpenQ!
1768
</span>
18-
Since it
19-
'
20-
s your first time with us, check out our
21-
22-
<a
23-
className="text-blue-400 hover:underline"
24-
href="https://www.youtube.com/watch?v=HixkRY2v_pA&ab_channel=OpenQ"
25-
rel="noopener noreferrer"
26-
target="_blank"
27-
>
28-
demo
29-
</a>
30-
.
69+
<br />
70+
<br />
71+
<div>
72+
You
73+
'
74+
re early to the party - most EthDenver 2023 bounties will be minted on March 20.
75+
</div>
76+
<br />
77+
<div>
78+
Some will be minted later as sponsors finalize decisions.
79+
</div>
80+
<br />
81+
<div>
82+
Keep an eye on your inbox for updates.
83+
</div>
3184
</div>
3285
<div
3386
className="flex justify-self-end"

components/BountyCard/BountyCardDetailsModal/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import TotalValue from '../../Bounty/TotalValue';
1111
import LabelsList from '../../Bounty/LabelsList';
1212
import ModalLarge from '../../Utils/ModalLarge';
1313
import useGetTokenValues from '../../../hooks/useGetTokenValues';
14+
import GithubHtmlRenderer from '../../Utils/HtmlReneder';
1415

1516
const BountyCardDetailsModal = ({ bounty, closeModal, showModal, watchingState, setStatefulWatched }) => {
1617
const modal = useRef();
@@ -152,7 +153,7 @@ const BountyCardDetailsModal = ({ bounty, closeModal, showModal, watchingState,
152153
<div className='flex text-lg text-muted px-8 pb-4'>
153154
<div className='flex flex-col w-full mt-2 p-4 border-web-gray border rounded-sm bg-dark-mode gap-2'>
154155
Issue content:
155-
<section className='markdown-body' dangerouslySetInnerHTML={{ __html: bounty.bodyHTML }}></section>
156+
<GithubHtmlRenderer className={'markdown-body'} html={bounty.bodyHTML} />
156157
</div>
157158
</div>
158159
)}

components/Requests/RequestPage/__snapshots__/RequestPage.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exports[`RequestPage should match initial DOM Snapshot 1`] = `
1313
<div
1414
class="border-web-gray border flex justify-center content-center h-24 rounded-sm items-center"
1515
>
16-
You have received 0 new requests.
16+
You have received 0 requests.
1717
</div>
1818
</div>
1919
<div

components/Requests/RequestPage/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const RequestPage = () => {
5353
<div className='my-6'>
5454
<h2 className='text-2xl font-semibold pb-4 border-b border-web-gray my-4'>Manage your bounties</h2>
5555
<div className='border-web-gray border flex justify-center content-center h-24 rounded-sm items-center'>
56-
You have received {requestsLength} new request{getPlural(requestsLength)}.
56+
You have received {requestsLength} request{getPlural(requestsLength)}.
5757
</div>
5858
</div>
5959
<div className='my-6'>

components/Utils/ActionBubble/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { ethers } from 'ethers';
88
import Jazzicon from './../Jazzicon';
99
import useWeb3 from '../../../hooks/useWeb3';
1010
import ToolTipNew from './../ToolTipNew';
11+
import GithubHtmlRenderer from '../HtmlReneder';
1112

1213
const ActionBubble = ({ bounty, action }) => {
1314
const [appState] = useContext(StoreContext);
@@ -208,12 +209,7 @@ const ActionBubble = ({ bounty, action }) => {
208209
)}
209210
</div>
210211
{!action && bodyHTML && (
211-
<div
212-
className='w-full p-8 p-4 border-web-gray border-t markdown-body'
213-
dangerouslySetInnerHTML={{
214-
__html: bodyHTML,
215-
}}
216-
></div>
212+
<GithubHtmlRenderer className={'w-full p-8 p-4 border-web-gray border-t markdown-body'} html={bodyHTML} />
217213
)}
218214
</div>
219215
</div>

components/Utils/HtmlReneder.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
import DOMPurify from 'dompurify';
3+
const GithubHtmlRenderer = ({ html, className }) => {
4+
const purified = DOMPurify.sanitize(html);
5+
return <div className={className} dangerouslySetInnerHTML={{ __html: purified }} />;
6+
};
7+
export default GithubHtmlRenderer;

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@ethersproject/experimental": "5.7.0",
3030
"@ethersproject/providers": "5.1.2",
3131
"@ethersproject/units": "5.7.0",
32+
"@knocklabs/react-notification-feed": "^0.8.4",
3233
"@kycdao/widget": "0.5.10",
3334
"@magic-ext/oauth": "7.6.0",
3435
"@metamask/jazzicon": "2.0.0",
@@ -39,8 +40,8 @@
3940
"@testing-library/user-event": "14.4.3",
4041
"@types/uuid": "9.0.1",
4142
"@walletconnect/ethereum-provider": "2.4.7",
42-
"@walletconnect/web3-provider": "1.8.0",
4343
"@walletconnect/utils": "1.8.0",
44+
"@walletconnect/web3-provider": "1.8.0",
4445
"@web3-react/core": "8.1.2-beta.0",
4546
"@web3-react/metamask": "8.1.2-beta.0",
4647
"@web3-react/walletconnect-v2": "8.1.2-beta.0",
@@ -55,6 +56,7 @@
5556
"canvas-confetti": "1.6.0",
5657
"chai": "4.3.7",
5758
"cross-fetch": "3.1.5",
59+
"dompurify": "^3.0.1",
5860
"eslint-config-prettier": "8.7.0",
5961
"eslint-plugin-prettier": "4.2.1",
6062
"eslint-plugin-unused-imports": "2.0.0",
@@ -83,8 +85,7 @@
8385
"styled-components": "^5.3.8",
8486
"tiny-invariant": "1.3.1",
8587
"uuid": "9.0.0",
86-
"web3": "1.8.2",
87-
"@knocklabs/react-notification-feed": "^0.8.4"
88+
"web3": "1.8.2"
8889
},
8990
"devDependencies": {
9091
"@babel/eslint-parser": "7.19.1",

pages/contract/[id]/[address].js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,18 @@ const address = ({ address, mergedBounty, renderError }) => {
120120
};
121121

122122
useEffect(() => {
123+
let cancel;
123124
if (internalMenu) {
124-
sessionStorage.setItem(address, internalMenu);
125+
setTimeout(() => {
126+
if (!cancel) {
127+
sessionStorage.setItem(address, internalMenu);
128+
}
129+
}, 1000);
130+
console.log(internalMenu);
125131
}
132+
return () => {
133+
cancel = true;
134+
};
126135
}, [internalMenu]);
127136

128137
useEffect(() => {
@@ -183,7 +192,6 @@ const address = ({ address, mergedBounty, renderError }) => {
183192
// set route and populate
184193
if (address) {
185194
const route = sessionStorage.getItem(address);
186-
187195
if (route !== internalMenu) {
188196
setInternalMenu(route || 'View');
189197
}

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8292,6 +8292,11 @@ dompurify@^2.2.0:
82928292
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.4.4.tgz#c17803931dd524e1b68e0e940a84567f9498f4bd"
82938293
integrity sha512-1e2SpqHiRx4DPvmRuXU5J0di3iQACwJM+mFGE2HAkkK7Tbnfk9WcghcAmyWc9CRrjyRRUpmuhPUH6LphQQR3EQ==
82948294

8295+
dompurify@^3.0.1:
8296+
version "3.0.1"
8297+
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.0.1.tgz#a0933f38931b3238934dd632043b727e53004289"
8298+
integrity sha512-60tsgvPKwItxZZdfLmamp0MTcecCta3avOhsLgPZ0qcWt96OasFfhkeIRbJ6br5i0fQawT1/RBGB5L58/Jpwuw==
8299+
82958300
domutils@^1.7.0:
82968301
version "1.7.0"
82978302
resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a"

0 commit comments

Comments
 (0)