-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update version, split chains #973
Merged
0xjocke
merged 2 commits into
Synthetixio:add-notify-copy
from
Haoqian-Zheng:add-notify-copy
Oct 11, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file renamed
BIN
+133 KB
...pter-npm-0.83.0-0ac1951e74-3ed2ac30be.zip → ...pter-npm-0.85.1-80fcc73749-1d53d9dd5f.zip
Binary file not shown.
Binary file renamed
BIN
+18 KB
...tils-npm-0.83.0-7f82213bca-9198e742ea.zip → ...tils-npm-0.85.1-7e14e76776-fd40cee58f.zip
Binary file not shown.
Binary file renamed
BIN
+106 KB
...core-npm-0.83.0-bf88384e1c-67d0925829.zip → ...core-npm-0.85.1-b88964e016-5c873a1835.zip
Binary file not shown.
Binary file removed
BIN
-53.2 KB
.yarn/cache/@notifi-network-notifi-frontend-client-npm-0.83.0-f516e59800-6d16d31b7f.zip
Binary file not shown.
Binary file added
BIN
+53.4 KB
.yarn/cache/@notifi-network-notifi-frontend-client-npm-0.85.1-976ec6b4c6-65b9d928c9.zip
Binary file not shown.
Binary file removed
BIN
-114 KB
.yarn/cache/@notifi-network-notifi-graphql-npm-0.83.0-d837c0be16-bc26986c43.zip
Binary file not shown.
Binary file added
BIN
+114 KB
.yarn/cache/@notifi-network-notifi-graphql-npm-0.85.1-731a2e2b32-ecea5c6037.zip
Binary file not shown.
Binary file removed
BIN
-518 KB
.yarn/cache/@notifi-network-notifi-react-card-npm-0.83.0-277a746fb9-9256009aab.zip
Binary file not shown.
Binary file added
BIN
+522 KB
.yarn/cache/@notifi-network-notifi-react-card-npm-0.85.2-0a38e612fc-6b891354ab.zip
Binary file not shown.
Binary file renamed
BIN
+61.8 KB
...ooks-npm-0.83.0-6d9091fe5f-4f2fd36df2.zip → ...ooks-npm-0.85.1-e9352d49ab-f2d95e15de.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { lazy, Suspense } from 'react'; | ||
import { | ||
Button, | ||
Popover, | ||
PopoverTrigger, | ||
PopoverContent, | ||
useDisclosure, | ||
} from '@chakra-ui/react'; | ||
import { | ||
NotificationsIcon, | ||
} from '@snx-v2/icons'; | ||
import { safeImport } from '@synthetixio/safe-import'; | ||
import './notifibutton.css'; | ||
import { useUnreadState } from '@notifi-network/notifi-react-card'; | ||
|
||
const NotifiCard = lazy(() => safeImport(() => import('@snx-v2/Notifi'))); | ||
|
||
export const NotifiButton: React.FC = () => { | ||
|
||
const notifiModal = useDisclosure(); | ||
const { hasUnreadNotification, unreadNotificationCount } = useUnreadState(); | ||
|
||
return ( | ||
<Popover | ||
closeOnBlur={false} | ||
onClose={notifiModal.onClose} | ||
isOpen={notifiModal.isOpen} | ||
> | ||
<PopoverTrigger> | ||
<Button | ||
ml={2} | ||
height={10} | ||
width={10} | ||
bg="navy.900" | ||
borderColor="gray.900" | ||
borderWidth="1px" | ||
borderRadius="4px" | ||
_hover={{ | ||
bg: 'blackAlpha.400', | ||
cursor: 'pointer', | ||
}} | ||
onClick={notifiModal.onOpen} | ||
> | ||
<NotificationsIcon color="white" /> | ||
{hasUnreadNotification && ( | ||
<div className='notifi-unread-counter'> | ||
<div> | ||
{unreadNotificationCount > 99 ? '99' : unreadNotificationCount} | ||
</div> | ||
</div> | ||
)} | ||
</Button> | ||
</PopoverTrigger> | ||
<PopoverContent border="none" width="333px"> | ||
<Suspense fallback={null}> | ||
<NotifiCard onClose={notifiModal.onClose} /> | ||
</Suspense> | ||
</PopoverContent> | ||
</Popover> | ||
); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { arrayify } from '@ethersproject/bytes'; | ||
import { NotifiContext } from '@notifi-network/notifi-react-card'; | ||
import React, { PropsWithChildren, useContext } from 'react'; | ||
import { ContractContext } from '@snx-v2/ContractContext'; | ||
import { SignerContext } from '@snx-v2/SignerContext'; | ||
import { NetworkIdByName } from '@snx-v2/useSynthetixContracts'; | ||
|
||
const isTestnet = (networkId: null | number) => { | ||
if (networkId === NetworkIdByName['mainnet-ovm'] || networkId === NetworkIdByName['mainnet']) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
|
||
export const NotifiContextWrapper: React.FC<PropsWithChildren<{}>> = ({children}: PropsWithChildren<{}>) => { | ||
const { networkId, walletAddress } = useContext(ContractContext); | ||
const signer = useContext(SignerContext); | ||
if (signer === null || walletAddress === null || networkId === null) { | ||
// account is required | ||
return null; | ||
} | ||
const isL2 = networkId === NetworkIdByName['mainnet-ovm']; | ||
const isMainnet = !isTestnet(networkId); | ||
const walletBlockchain = isL2 ? 'OPTIMISM' : 'ETHEREUM'; | ||
|
||
const env = isMainnet ? 'Production' : 'Development'; | ||
|
||
return ( | ||
<NotifiContext | ||
dappAddress="synthetix" | ||
env={env} | ||
signMessage={async (message: Uint8Array) => { | ||
const result = await signer.signMessage(message); | ||
return arrayify(result); | ||
}} | ||
walletPublicKey={walletAddress} | ||
walletBlockchain={walletBlockchain} | ||
> | ||
{children} | ||
</NotifiContext> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './NotifiButton'; | ||
export * from './NotifiContextWrapper'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.notifi-unread-counter { | ||
position: absolute; | ||
top: 0.2rem; | ||
bottom: 0; | ||
left: 1.2rem; | ||
right: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: 0.7rem; | ||
color: #000; | ||
text-align: center; | ||
width: 1.05rem; | ||
height: 1.05rem; | ||
background-color: #82F7C5; | ||
border-radius: 50px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "@snx-v2/NotifiButton", | ||
"private": true, | ||
"main": "index.ts", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"@chakra-ui/react": "^2.5.0", | ||
"@notifi-network/notifi-react-card": "^0.85.2", | ||
"@snx-v2/icons": "workspace:*", | ||
"@synthetixio/safe-import": "workspace:*", | ||
"react": "^18.2.0" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about testnet? Is the address same for op goerli and eth goerli?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently yes