Skip to content

Commit

Permalink
Change terms modal policy
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan1814 committed Jul 29, 2024
1 parent 1b01e32 commit c57db01
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
10 changes: 9 additions & 1 deletion apps/Cloverfield/components/App/AccountData/CreateAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
} from "components/Icons";
import { WEB_SETTING } from "@symmio/frontend-sdk/config";
import GradientButton from "components/Button/GradientButton";
import TermsAndServices from "components/TermsAndServices";

const Wrapper = styled.div<{ modal?: boolean }>`
border: none;
Expand Down Expand Up @@ -119,6 +120,7 @@ export default function CreateAccount({ onClose }: { onClose?: () => void }) {
const { account, chainId } = useActiveWagmi();
const [name, setName] = useState("");
const [, setTxHash] = useState("");
const [showTerms, setShowTerms] = useState(false);
const userWhitelisted = useUserWhitelist();
const isTermsAccepted = useIsTermsAccepted();

Expand Down Expand Up @@ -160,7 +162,12 @@ export default function CreateAccount({ onClose }: { onClose?: () => void }) {
}

if (WEB_SETTING.showSignModal && !isTermsAccepted) {
return <GradientButton label={"Accept Terms Please"} disabled={true} />;
return (
<GradientButton
onClick={() => setShowTerms(true)}
label={"Accept Terms Please"}
/>
);
}

if (userWhitelisted === false) {
Expand Down Expand Up @@ -233,6 +240,7 @@ export default function CreateAccount({ onClose }: { onClose?: () => void }) {
<DescriptionText>{`Create Account > Deposit ${collateralCurrency?.symbol} > Enjoy Trading`}</DescriptionText>
)}
</ContentWrapper>
{showTerms && <TermsAndServices onDismiss={() => setShowTerms(false)} />}
</Wrapper>
);
}
8 changes: 6 additions & 2 deletions apps/Cloverfield/components/TermsAndServices/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import { useIsTermsAccepted } from "@symmio/frontend-sdk/state/user/hooks";

import TermsModal from "components/ReviewModal/TermsModal";

export default function TermsAndServices() {
export default function TermsAndServices({
onDismiss,
}: {
onDismiss: () => void;
}) {
const { account } = useActiveWagmi();
const isTermsAccepted = useIsTermsAccepted();

if (account && !isTermsAccepted) {
return <TermsModal onDismiss={() => {}} />;
return <TermsModal onDismiss={onDismiss} />;
}
return null;
}
3 changes: 0 additions & 3 deletions apps/Cloverfield/pages/trade/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import FavoriteBar from "components/App/FavoriteBar";
import AccountOverview from "components/App/AccountData";
import { UpdaterRoot } from "components/EmptyComponent";
import WrapperBanner from "components/Banner";
import TermsAndServices from "components/TermsAndServices";
import { WEB_SETTING } from "@symmio/frontend-sdk/config";

export const Container = styled(Column)`
background: ${({ theme }) => theme.bg};
Expand Down Expand Up @@ -58,7 +56,6 @@ export const LeftColumn = styled(Column)<{ gap?: string }>`
export default function ID() {
return (
<Container>
{WEB_SETTING.showSignModal && <TermsAndServices />}
<WrapperBanner />
<UpdaterRoot />
<WhitelistUpdater />
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const WEB_SETTING = {

checkWhiteList: false,

showSignModal: true,
showSignModal: false,

notAllowedMethods: [] as string[],
showTpSl: true,
Expand Down

0 comments on commit c57db01

Please sign in to comment.