Skip to content

Commit

Permalink
Fixed the snap blank page issue in user settings
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek-01k committed Oct 28, 2024
1 parent e9e95de commit b704294
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/components/PushSnap/PushSnapSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react';
import SnapExample from 'assets/snap/SnapExample.svg?react';
import InfoLogo from 'assets/snap/spam-icon.svg?react';
import SnapExample from 'assets/snap/SnapExample.svg';
import InfoLogo from 'assets/snap/spam-icon.svg';
import { Image, Section } from 'components/SharedStyling';
import { H2V2, ItemHV2, ItemVV2, SpanV2 } from 'components/reusables/SharedStylingV2';
import LoaderSpinner, { LOADER_TYPE } from 'components/reusables/loaders/LoaderSpinner';
Expand All @@ -11,15 +11,21 @@ import AboutSnapModal from 'modules/snap/AboutSnapModal';
import styled, { useTheme } from 'styled-components';
import PushSnapConfigureModal from './PushSnapConfigureModal';
import { Button } from 'blocks';
import { SnoozeDurationType } from 'types';

const PushSnapSettings = () => {
const { account } = useAccount();
const { account, isWalletConnected, connect } = useAccount();

const theme = useTheme();
const [walletConnected, setWalletConnected] = useState(false);
const [loading, setLoading] = useState(false);
const [addedAddress, setAddedAddress] = useState(false);

const [snoozeDuration, setSnoozeDuration] = useState<SnoozeDurationType>({
enabled: false,
hrsLeft: 0,
});

const [snapInstalled, setSnapInstalled] = useState(false);
const defaultSnapOrigin = `npm:@pushprotocol/snap`;

Expand Down Expand Up @@ -72,6 +78,7 @@ const PushSnapSettings = () => {
async function connectToMetaMask() {
setLoading(true);
try {
if (!isWalletConnected) await connect();
if (!snapInstalled) {
await connectSnap();
setSnapInstalled(true);
Expand Down Expand Up @@ -186,7 +193,10 @@ const PushSnapSettings = () => {
>
Snap Settings
</SpanV2>
<PushSnapConfigureModal />
<PushSnapConfigureModal
snoozeDuration={snoozeDuration}
setSnoozeDuration={setSnoozeDuration}
/>
</>
)}
</>
Expand Down

0 comments on commit b704294

Please sign in to comment.