Skip to content
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

Release #998

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 10 additions & 1 deletion v2/components/Navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
GuideIcon,
NineDots,
LoansIcon,
// NotificationsIcon,
OptimismIcon,
// SettingsIcon,
StakingIcon,
Expand All @@ -45,6 +44,7 @@ import { WalletModal } from '@snx-v2/WalletModal';
import { ContractContext } from '@snx-v2/ContractContext';
import { useDelegateWallet } from '@snx-v2/useDelegateWallet';
import { EXTERNAL_LINKS } from '@snx-v2/Constants';
import { NotifiButton, NotifiContextWrapper } from '@snx-v2/NotifiButton';

interface NavigationProps {
currentNetwork: NetworkId;
Expand Down Expand Up @@ -112,6 +112,15 @@ export const NavigationUI = ({
>
<Link to="/">{size === 'desktop' ? <StakingLogo /> : <StakingIcon />}</Link>
<Flex alignItems="center">
{isWalletConnected && walletAddress && !delegateWallet && (
<>
{size === 'desktop' && (
<NotifiContextWrapper>
<NotifiButton />
</NotifiContextWrapper>
)}
</>
)}
{isWalletConnected && walletAddress && (
<>
{size === 'desktop' && (
Expand Down
1 change: 1 addition & 0 deletions v2/components/Navigation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@snx-v2/Constants": "workspace:*",
"@snx-v2/ContractContext": "workspace:*",
"@snx-v2/EpochPrice": "workspace:^",
"@snx-v2/NotifiButton": "workspace:*",
"@snx-v2/UserBalances": "workspace:*",
"@snx-v2/WalletModal": "workspace:*",
"@snx-v2/formatters": "workspace:*",
Expand Down
70 changes: 70 additions & 0 deletions v2/components/Notifi/NotifiCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import {
NotifiInputFieldsText,
NotifiInputSeparators,
NotifiSubscriptionCard,
} from '@notifi-network/notifi-react-card';
import './notifi.css';
import React, { useContext } from 'react';
import { ContractContext } from '@snx-v2/ContractContext';
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 NotifiCard: React.FC<{ onClose: () => void }> = ({ onClose }) => {
const { networkId, walletAddress } = useContext(ContractContext);
if (walletAddress === null || networkId === null) {
// account is required
return null;
}
const isL2 = networkId === NetworkIdByName['mainnet-ovm'];
const isMainnet = !isTestnet(networkId);

const cardId = isMainnet
? isL2
? '283fa53b4b8e4ed1a2234615bf01d240'
: '5ece3cd3ec504576b10ab396d619dc9b'
: '8a569abd38974f76837960bd9bf36049';

const inputLabels: NotifiInputFieldsText = {
label: {},
placeholderText: {
email: 'Email address',
telegram: 'Telegram ID',
},
};

const inputSeparators: NotifiInputSeparators = {
emailSeparator: {
content: 'OR',
},
telegramSeparator: {
content: 'OR',
},
};

return (
<NotifiSubscriptionCard
cardId={cardId}
inputLabels={inputLabels}
inputSeparators={inputSeparators}
inputs={{ userWallet: walletAddress }}
copy={{
FetchedStateCard: {
SubscriptionCardV1: {
EditCard: {
AlertListPreview: {
description: 'Get real-time alerts to the destinations of your choice',
},
},
},
},
}}
darkMode
onClose={onClose}
/>
);
};
3 changes: 3 additions & 0 deletions v2/components/Notifi/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { NotifiCard } from './NotifiCard';
export { NotifiCard } from './NotifiCard';
export default NotifiCard;
Loading
Loading