Skip to content

Commit

Permalink
Fix up more styling
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkchen committed Nov 11, 2023
1 parent db940f9 commit 5fd5988
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
17 changes: 0 additions & 17 deletions client/src/components/Swap/OnRamp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
usePrepareContractWrite,
useWaitForTransaction
} from 'wagmi'
import { useWindowSize } from "@uidotdev/usehooks";
import Confetti from 'react-confetti';

import { RowBetween } from '../layouts/Row'
import { ThemedText } from '../../theme/text'
Expand Down Expand Up @@ -46,15 +44,13 @@ export const OnRamp: React.FC<OnRampProps> = ({
} = useSmartContracts();
const { refetchIntentHash } = useOnRamperIntents();
const { refetchUsdcBalance } = useBalances();
const size = useWindowSize();

/*
* State
*/

const [shouldConfigureRampWrite, setShouldConfigureRampWrite] = useState<boolean>(false);
const [shouldFetchVerifyProof, setShouldFetchVerifyProof] = useState<boolean>(false);
const [showConfetti, setShowConfetti] = useState<boolean>(false);
const [tx, setTx] = useState<string | null>(null);

// ----- transaction state -----
Expand Down Expand Up @@ -123,11 +119,6 @@ export const OnRamp: React.FC<OnRampProps> = ({

refetchUsdcBalance?.();
refetchIntentHash?.();

setShowConfetti(true);
setTimeout(() => {
setShowConfetti(false);
}, 5000);
},
});

Expand Down Expand Up @@ -177,14 +168,6 @@ export const OnRamp: React.FC<OnRampProps> = ({
return (
<Container>
<TitleContainer>
{showConfetti ? (
<Confetti
recycle={false}
numberOfPieces={500}
width={size.width ?? undefined}
height={document.documentElement.scrollHeight}
/>
) : null}
<RowBetween style={{ paddingBottom: '1.5rem' }}>
<div style={{ flex: 0.5 }}>
<button
Expand Down
30 changes: 28 additions & 2 deletions client/src/components/modals/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useEffect, useMemo, useState } from "react";
import styled from 'styled-components';
import { ArrowLeft } from 'react-feather';
import { useNavigate } from 'react-router-dom';
import { CircuitType } from '@zkp2p/circuits-circom/scripts/generate_input';
import Confetti from 'react-confetti';
import { useWindowSize } from '@uidotdev/usehooks';

import { ThemedText } from '../../theme/text'
import { LabeledSwitch } from "../common/LabeledSwitch";
Expand Down Expand Up @@ -53,6 +54,7 @@ export const Modal: React.FC<ModalProps> = ({
*/

const { isProvingTypeFast } = useProofGenSettings();
const size = useWindowSize();

/*
* State
Expand All @@ -61,6 +63,7 @@ export const Modal: React.FC<ModalProps> = ({
const [shouldShowProofAndSignals, setShouldShowProofAndSignals] = useState<boolean>(false);

const [ctaButtonTitle, setCtaButtonTitle] = useState<string>("");
const [showConfetti, setShowConfetti] = useState<boolean>(true);

/*
* Handlers
Expand Down Expand Up @@ -241,10 +244,29 @@ export const Modal: React.FC<ModalProps> = ({
return verificationStepRows;
};

useEffect(() => {
if (transactionAddress?.length) {
setShowConfetti(true);
setTimeout(() => {
setShowConfetti(false);
}, 5000);
}
}, [transactionAddress])

return (
<ModalAndOverlayContainer>
<Overlay onClick={handleOverlayClick}/>

{showConfetti ? (
<ConfettiContainer>
<Confetti
recycle={false}
numberOfPieces={500}
width={size.width ?? undefined}
height={document.documentElement.scrollHeight}
/>
</ConfettiContainer>
) : null}
<ModalContainer>
<TitleCenteredRow>
<button
Expand Down Expand Up @@ -300,7 +322,7 @@ export const Modal: React.FC<ModalProps> = ({

{transactionAddress?.length ? (
<Link
href={`https://goerli.etherscan.io/address/${transactionAddress}`}
href={`https://goerli.etherscan.io/tx/${transactionAddress}`}
target="_blank"
rel="noopener noreferrer">
<ThemedText.LabelSmall textAlign="left">
Expand Down Expand Up @@ -367,3 +389,7 @@ const Link = styled.a`
text-decoration: underline;
}
`;

const ConfettiContainer = styled.div`
z-index: 20;
`;

0 comments on commit 5fd5988

Please sign in to comment.