From 8f1234fdb18392dd9687d3fdfef3c8774ac10c2f Mon Sep 17 00:00:00 2001
From: Luiz Felipe Bolsoni Gomes <8636507+LuizAsFight@users.noreply.github.com>
Date: Wed, 15 Jun 2022 02:21:07 -0300
Subject: [PATCH 2/4] fix: correct behavior when typing only "." in the coin
input (#291)
---
.../src/systems/Core/components/CoinInput.tsx | 12 +++++++++++-
.../systems/Pool/pages/AddLiquidity.test.tsx | 19 +++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/packages/app/src/systems/Core/components/CoinInput.tsx b/packages/app/src/systems/Core/components/CoinInput.tsx
index 806cc13d..856c7fa3 100644
--- a/packages/app/src/systems/Core/components/CoinInput.tsx
+++ b/packages/app/src/systems/Core/components/CoinInput.tsx
@@ -168,7 +168,17 @@ export function useCoinInput({
function getRightValue(value: string, displayType: string) {
if (displayType === "text") return parseToFormattedNumber(value);
- return value === "0.0" ? "0" : value;
+
+ switch (value) {
+ case "0.0":
+ return "0";
+
+ case ".":
+ return "0.";
+
+ default:
+ return value;
+ }
}
type CoinInputProps = Omit &
diff --git a/packages/app/src/systems/Pool/pages/AddLiquidity.test.tsx b/packages/app/src/systems/Pool/pages/AddLiquidity.test.tsx
index 3a5e27e6..60d9446b 100644
--- a/packages/app/src/systems/Pool/pages/AddLiquidity.test.tsx
+++ b/packages/app/src/systems/Pool/pages/AddLiquidity.test.tsx
@@ -196,4 +196,23 @@ describe("Add Liquidity", () => {
const successFeedback = await screen.findByText(/New pool created/i);
expect(successFeedback).toBeInTheDocument();
});
+
+ it("should show '0.' if typed only '.' in the input", async () => {
+ jest.unmock("../hooks/useUserPositions.ts");
+
+ renderWithRouter(, {
+ route: "/pool/add-liquidity",
+ });
+
+ const coinFromInput = screen.getByLabelText(/Coin From Input/);
+ fireEvent.change(coinFromInput, {
+ target: {
+ value: ".",
+ },
+ });
+
+ await waitFor(() => {
+ expect(coinFromInput).toHaveValue("0.");
+ });
+ });
});
From 222e171d3ee313f3fb9943ef73a61a3e96032e02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luiz=20Est=C3=A1cio=20=7C=20stacio=2Eeth?=
Date: Thu, 16 Jun 2022 16:57:45 -0300
Subject: [PATCH 3/4] feat: add agreement and update copy (#290)
* feat: add legal agreement
* fix: jest tests
* fix: e2e tests
* chore: use getByAriaLabel(
---
docs/LEGAL_DISCLAIMER.md | 0
packages/app/cypress/e2e/App.cy.ts | 3 +-
.../src/styles/components/welcome-page.css | 4 ++
.../systems/Core/components/PrivateRoute.tsx | 5 +-
.../Welcome/components/WelcomeDone.tsx | 48 ++++++++++++++-----
.../Welcome/components/WelcomePage.test.tsx | 10 +++-
.../systems/Welcome/hooks/useWelcomeSteps.tsx | 27 ++++++++++-
.../src/systems/Welcome/pages/WelcomePage.tsx | 4 --
8 files changed, 81 insertions(+), 20 deletions(-)
create mode 100644 docs/LEGAL_DISCLAIMER.md
diff --git a/docs/LEGAL_DISCLAIMER.md b/docs/LEGAL_DISCLAIMER.md
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/app/cypress/e2e/App.cy.ts b/packages/app/cypress/e2e/App.cy.ts
index b32d4876..aa22347d 100644
--- a/packages/app/cypress/e2e/App.cy.ts
+++ b/packages/app/cypress/e2e/App.cy.ts
@@ -7,7 +7,8 @@ describe('End-to-end Test: 😁 Happy Path', () => {
// create a wallet and fund it
cy.contains('button', /Create wallet/i).click();
cy.contains('button', 'Give me ETH').click();
- cy.contains('button', 'Go to Swap').click();
+ cy.getByAriaLabel('Accept the use agreement').check();
+ cy.contains('button', 'Get Swapping!').click();
cy.contains('Enter amount');
// mint tokens
diff --git a/packages/app/src/styles/components/welcome-page.css b/packages/app/src/styles/components/welcome-page.css
index ea4505ae..d8a65461 100644
--- a/packages/app/src/styles/components/welcome-page.css
+++ b/packages/app/src/styles/components/welcome-page.css
@@ -9,6 +9,10 @@
}
.welcomePage--content {
@apply relative m-8 grid place-items-center max-h-[100vh];
+
+ @media (max-width: 640px) {
+ @apply m-0 my-4;
+ }
}
/*
WelcomeSidebar
diff --git a/packages/app/src/systems/Core/components/PrivateRoute.tsx b/packages/app/src/systems/Core/components/PrivateRoute.tsx
index 4d87972c..ca20d2f2 100644
--- a/packages/app/src/systems/Core/components/PrivateRoute.tsx
+++ b/packages/app/src/systems/Core/components/PrivateRoute.tsx
@@ -3,13 +3,14 @@ import { Navigate } from "react-router-dom";
import { useWallet } from "../hooks";
-import { getCurrent } from "~/systems/Welcome";
+import { getCurrent, getAgreement } from "~/systems/Welcome";
import { Pages } from "~/types";
export function PrivateRoute({ children }: { children: ReactNode }) {
const current = getCurrent();
+ const acceptAgreement = getAgreement();
const wallet = useWallet();
- if (current.id > 2 || (wallet && !current.id)) {
+ if ((current.id > 2 && acceptAgreement) || (wallet && !current.id)) {
return <>{children}>;
}
return ;
diff --git a/packages/app/src/systems/Welcome/components/WelcomeDone.tsx b/packages/app/src/systems/Welcome/components/WelcomeDone.tsx
index 2a52ed4e..4b1caba6 100644
--- a/packages/app/src/systems/Welcome/components/WelcomeDone.tsx
+++ b/packages/app/src/systems/Welcome/components/WelcomeDone.tsx
@@ -1,31 +1,57 @@
-import { useNavigate } from "react-router-dom";
-
import { useWelcomeSteps } from "../hooks";
import { WelcomeStep } from "./WelcomeStep";
import { relativeUrl } from "~/systems/Core";
-import { Button } from "~/systems/UI";
+import { Button, Link } from "~/systems/UI";
+
+const DISCLAIMER_URL =
+ "https://github.com/FuelLabs/swayswap/blob/master/docs/LEGAL_DISCLAIMER.md";
export function WelcomeDone() {
- const navigate = useNavigate();
- const { send } = useWelcomeSteps();
+ const { send, state } = useWelcomeSteps();
function handleDone() {
- navigate("/swap");
send("FINISH");
}
return (
-
Done, congrats!
+
Wallet Created!
- Now you are done to swap your coins using the fatest modular execution
- layer
+ Now you're ready to swap and pool test assets using Fuel:
+ the fastest modular execution layer.