@@ -86,7 +81,7 @@ export default function DepositAmounts() {
-
+
);
}
diff --git a/src/components/pool/liquidity/common/add-liquidity/preview-screen/preview-screen.tsx b/src/components/pool/liquidity/common/add-liquidity/preview-screen/preview-screen.tsx
new file mode 100644
index 00000000..ec0c5a4d
--- /dev/null
+++ b/src/components/pool/liquidity/common/add-liquidity/preview-screen/preview-screen.tsx
@@ -0,0 +1,226 @@
+import * as React from "react";
+import {
+ Card,
+ CardContent,
+ Typography,
+} from "@mui/material";
+
+import { variables } from "../../../../../../theme";
+import { makeStyles } from "@mui/styles";
+import { MdClose } from "react-icons/md";
+import useOutsideClick from "../../../../../../lib/utility/click-functions/outside-click";
+
+const useStyles = makeStyles({
+ confirmSwapCard: {
+ position: "absolute",
+ top: "20vh",
+ left: "40%",
+ width: "451px",
+ zIndex: "2",
+ textAlign: "left",
+ backgroundColor: "#fff",
+ },
+ confirmSwap: {
+ fontSize: "20px",
+ },
+ mdClose: {
+ fontSize: "20px",
+ },
+
+ confirmLiquidityButton: {
+ display: "flex",
+ flexDirection: "row",
+ alignItems: "center",
+ padding: "16px ",
+ backgroundColor: variables.primary.superPurple,
+ borderRadius: "4px",
+ color: variables.white,
+ fontSize: "20px",
+ marginTop: "32px",
+ width: "100%",
+ height: "56px",
+ justifyContent: "center",
+ border: "none"
+ },
+ mdHelpOutlineIcon: {
+ color: variables.primary.darkSilver,
+ cursor: "pointer",
+ },
+ topBanner: {
+ display: "flex",
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "center",
+ marginBottom: "7%",
+ flexWrap: "wrap"
+ },
+ tokenSection: {
+ display: "flex",
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "center",
+ listStyle: "none",
+ fontSize: "28px"
+ },
+ poolTokens: {
+ display: "flex",
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "center"
+ },
+ poolTokenNames: {
+ fontSize: "28px"
+ },
+ poolTokenText: {
+ fontSize: "16px",
+ fontWeight: "600",
+
+ },
+ poolArea: {
+
+ fontWeight: "600",
+
+ },
+ poolAreaToken: {
+ display: "flex",
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "center",
+ fontSize: "24px",
+ },
+ selectedRange: {
+ display: "flex",
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "center",
+
+ },
+ selectedRangeButtons: {
+ backgroundColor: "#E7E9F9",
+ alignItems: "center",
+ borderRadius: "8px",
+ padding: "2px 1px 2px 1px"
+ },
+ selectedRangeButton: {
+ border: "0px",
+ borderRadius: "8px",
+ backgroundColor: variables.white,
+ padding: "4px 10px 4px 10px"
+ },
+ priceButtons: {
+ display: "flex",
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "center",
+ gap: "10px",
+ marginBottom: "2%"
+ },
+ priceButton: {
+ textAlign: "center",
+ backgroundColor: "#FAFBFC",
+ borderRadius: "8px",
+ border: "1px solid #E7E9F9",
+ },
+ currentPrice: {
+ width: "100%",
+ textAlign: "center",
+ backgroundColor: "#FAFBFC",
+ borderRadius: "8px",
+ border: "1px solid #E7E9F9",
+ fontWeight: "500"
+ }
+
+});
+
+export default function PreviewScreen(props: any) {
+ const classes = useStyles();
+ const checkClick = React.useRef(null);
+ useOutsideClick(checkClick, props.handlePreviewOpen);
+ return (
+
+ {
+
+ <>
+
+
+ Add Liquidity
+
+ {
+ props.handlePreviewOpen(false);
+ }
+ }
+ />
+
+
+
+
+ {props.depositAmount.token1 +
+ " / " +
+ props.depositAmount.token2}
+
+
+
+
+
+
+
{props.depositAmount.token1}
+
{props.depositAmount.amount1}
+
+
+
{props.depositAmount.token2}
+
{props.depositAmount.amount2}
+
+
+
Fee Tier
+
{props.depositAmount.feeTier}
+
+
+
+
Selected Range
+
+ {props.depositAmount.token1}
+ {props.depositAmount.token2}
+
+
+
+
+
Min Price
+
{props.priceRange.minPrice}
+
{props.depositAmount.token1} per {props.depositAmount.token2}
+
Your position will be 100% composed of {props.depositAmount.token1} at this price.
+
+
+
Max Price
+
{props.priceRange.maxPrice}
+
{props.depositAmount.token1} per {props.depositAmount.token2}
+
Your position will be 100% composed of {props.depositAmount.token2} at this price.
+
+
+
+
+
Current Price
+
{props.priceRange.currentPrice}
+
ETH per LSK
+
+
+ {
+ props.handlePreviewOpen(false);
+
+ }}
+ >
+ Add Liquidity
+
+ >
+
+ }
+
+ );
+}
diff --git a/src/components/pool/liquidity/common/add-liquidity/set-price-range/deposit-button.tsx b/src/components/pool/liquidity/common/add-liquidity/set-price-range/deposit-button.tsx
index 7ca78794..0d09b8e7 100644
--- a/src/components/pool/liquidity/common/add-liquidity/set-price-range/deposit-button.tsx
+++ b/src/components/pool/liquidity/common/add-liquidity/set-price-range/deposit-button.tsx
@@ -9,18 +9,21 @@ const useStyles = makeStyles({
button: {
width: "100%",
border: "0px",
- borderRadius: "4px",
+ borderRadius: "8px",
color: variables.white,
- backgroundColor: variables.primary.superPurple
+ backgroundColor: variables.primary.superPurple,
+ fontSize: "20px",
+ margin: "2% 0% 0% 0%",
+ cursor: "pointer"
}
})
export default function DepositButton(props:Iprops){
const classes = useStyles();
return(
-
+
{props.buttonTitle}
-
+
)
}
\ No newline at end of file
diff --git a/src/components/pool/liquidity/common/add-liquidity/set-price-range/price-banner.tsx b/src/components/pool/liquidity/common/add-liquidity/set-price-range/price-banner.tsx
index 78cc350e..fce4cd9d 100644
--- a/src/components/pool/liquidity/common/add-liquidity/set-price-range/price-banner.tsx
+++ b/src/components/pool/liquidity/common/add-liquidity/set-price-range/price-banner.tsx
@@ -2,13 +2,6 @@ import { makeStyles } from "@mui/styles";
import React from "react";
import {MdAdd , MdRemove} from "react-icons/md";
-interface Iprops {
- buttonTitle: string;
- amount: string;
- tokenTitle: string;
-
-}
-
const useStyles = makeStyles({
button: {
width: "45%",
@@ -49,8 +42,10 @@ export default function PriceBanner(props: Iprops) {
}
if (amountVal>0 ){
setCalculatedAmount(amountVal.toString());
+ props.setPrice(amountVal.toString());
}else{
setCalculatedAmount("0");
+ props.setPrice(amountVal.toString());
}
};
diff --git a/src/components/pool/liquidity/common/add-liquidity/set-price-range/set-price-range.tsx b/src/components/pool/liquidity/common/add-liquidity/set-price-range/set-price-range.tsx
index d941fe54..57730e14 100644
--- a/src/components/pool/liquidity/common/add-liquidity/set-price-range/set-price-range.tsx
+++ b/src/components/pool/liquidity/common/add-liquidity/set-price-range/set-price-range.tsx
@@ -1,11 +1,9 @@
import { makeStyles } from "@mui/styles";
import React from "react";
-import DepositButton from "./deposit-button";
+import CreatePool from "../../../create-pool/create-pool";
import PriceBanner from "./price-banner";
-interface Iprops {
- componentName: string;
-}
+
const useStyles = makeStyles({
setPriceRange: {
@@ -29,23 +27,9 @@ const useStyles = makeStyles({
},
});
-export default function SetPriceRange(props: Iprops) {
- const componentName: string = props.componentName;
- const [buttonTitle, setButtonTile] = React.useState("Enter an Amount");
- const [userInputAmount, setUserInputAmount] = React.useState("");
- const [currentLSKperTokenAmount, setCurrentLSKperTokenAmount] = React.useState("");
- const [minAmount, setminAmount] = React.useState("");
- const [maxAmount, setmaxAmount] = React.useState("");
-
- const classes = useStyles();
+export default function SetPriceRange(props:any) {
- const handelButtonTitle = () =>{
- if (userInputAmount==null || userInputAmount.toLowerCase() == "0"){
- return("Enter an Amount");
- }else if (minAmount==null || minAmount.toLowerCase() == "0" || maxAmount==null || maxAmount.toLowerCase() == "0"){
- return("Set price Range");
- }
- }
+ const classes = useStyles();
return (
@@ -58,6 +42,7 @@ export default function SetPriceRange(props: Iprops) {
}
}}
*/}
+
Set price range
@@ -65,18 +50,18 @@ export default function SetPriceRange(props: Iprops) {
buttonTitle={"Min Price"}
amount={"0"}
tokenTitle={"Eth per DAI"}
+ setPrice = {props.setMinPrice}
/>
-
-
-
+
);
}
diff --git a/src/components/pool/liquidity/common/models/liquidity-models.tsx b/src/components/pool/liquidity/common/models/liquidity-models.tsx
new file mode 100644
index 00000000..f7404863
--- /dev/null
+++ b/src/components/pool/liquidity/common/models/liquidity-models.tsx
@@ -0,0 +1,14 @@
+export interface IpriceRange {
+ minPrice: string,
+ maxPrice: string,
+ currentPrice: string
+ }
+
+export interface IdepositAmounts {
+ token1: string,
+ token2: string,
+ amount1: string,
+ amount2: string,
+ feeTier: string,
+ }
+
\ No newline at end of file
diff --git a/src/components/pool/liquidity/create-pool/__snapshots__/price-input-box.test.tsx.snap b/src/components/pool/liquidity/create-pool/__snapshots__/price-input-box.test.tsx.snap
new file mode 100644
index 00000000..9b2e4638
--- /dev/null
+++ b/src/components/pool/liquidity/create-pool/__snapshots__/price-input-box.test.tsx.snap
@@ -0,0 +1,19 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`PriceInputBox component checks if the component matches the snapshot 1`] = `
+
+
+
+ Current LSK per ETH price
+
+
+
+
+`;
diff --git a/src/components/pool/liquidity/create-pool/create-pool-text.tsx b/src/components/pool/liquidity/create-pool/create-pool-text.tsx
new file mode 100644
index 00000000..defdd0ef
--- /dev/null
+++ b/src/components/pool/liquidity/create-pool/create-pool-text.tsx
@@ -0,0 +1,26 @@
+import { makeStyles } from "@mui/styles"
+
+const useStyles = makeStyles ({
+ textField: {
+ fontSize: "14px",
+ lineHeight: "24px",
+ backgroundColor: "#E7E9F9",
+ padding: "16px",
+ border: "1px solid #6953F4",
+ borderRadius: "8px",
+ margin: "0px",
+ fontWeight: "500"
+ }
+})
+export default function CreatePoolText(){
+ const classes = useStyles();
+ return(
+ <>
+
+ This pool must be initialized before you can add liquidity. To initialize, select a starting price for the pool. Then, enter your liquidity price range and deposit amount. Gas fees will be higher than usual due to the initialization transaction.
+
+ >
+
+
+ )
+}
\ No newline at end of file
diff --git a/src/components/pool/liquidity/create-pool/create-pool.tsx b/src/components/pool/liquidity/create-pool/create-pool.tsx
new file mode 100644
index 00000000..4d9f2d09
--- /dev/null
+++ b/src/components/pool/liquidity/create-pool/create-pool.tsx
@@ -0,0 +1,12 @@
+import CreatePoolText from "./create-pool-text"
+import PriceInputBox from "./price-input-box"
+
+export default function CreatePool(){
+ return (
+ <>
+
+
+
+ >
+ )
+}
\ No newline at end of file
diff --git a/src/components/pool/liquidity/create-pool/price-input-box.test.tsx b/src/components/pool/liquidity/create-pool/price-input-box.test.tsx
new file mode 100644
index 00000000..070237f0
--- /dev/null
+++ b/src/components/pool/liquidity/create-pool/price-input-box.test.tsx
@@ -0,0 +1,22 @@
+import * as React from "react";
+import "@testing-library/jest-dom/extend-expect";
+import { screen, fireEvent, render } from "@testing-library/react";
+import PriceInputBox from "./price-input-box";
+
+const renderComponent = () => {
+ return render(
);
+};
+
+describe("PriceInputBox component", () => {
+ it("checks if the component matches the snapshot", () => {
+ const { container } = renderComponent();
+ expect(container).toMatchSnapshot();
+ });
+
+ it("checks if input is working correctly on entering text", () => {
+ const wrapper = renderComponent();
+ const amountInput = wrapper.getByTestId("amount-input");
+ fireEvent.change(amountInput, { target: { value: "2000" } });
+ expect(screen.getByTestId("amount-input")).toHaveValue("2000");
+ });
+});
diff --git a/src/components/pool/liquidity/create-pool/price-input-box.tsx b/src/components/pool/liquidity/create-pool/price-input-box.tsx
new file mode 100644
index 00000000..a9725514
--- /dev/null
+++ b/src/components/pool/liquidity/create-pool/price-input-box.tsx
@@ -0,0 +1,64 @@
+import { makeStyles } from "@mui/styles";
+import { variables } from "../../../../theme";
+
+
+
+
+const useStyles = makeStyles({
+ amountTextTokenField: {
+ display: "flex",
+ flexDirection: "row",
+ alignItems: "center",
+ justifyContent: "space-between",
+ borderColor: variables.primary.stone,
+ border: "1px solid",
+ borderRadius: "4px",
+ height: "56px"
+
+ },
+ inputFieldText: {
+ padding: "0px 0px 0px 5px",
+ width: "100%",
+ fontSize: "20px",
+ lineHeight: "24px",
+ color: variables.primary.darkSilver,
+ textAlign: "left"
+ },
+ input: {
+ padding: "0px 0px 0px 5px",
+ width: "25%",
+ fontSize: "20px",
+ lineHeight: "24px",
+ borderRadius: "4px",
+ textAlign: "left",
+ height: "50px",
+ border: "0px solid black",
+ outline: "none",
+ },
+
+})
+
+interface Iprops {
+ defaultText:string
+}
+
+
+
+export default function PriceInputBox(props:Iprops){
+ const classes = useStyles();
+ const handleInputValue=()=>{
+ if (props.defaultText!= null){
+ return (
Current LSK per ETH price
)
+ }
+ }
+ return (
+ <>
+
+ {handleInputValue()}
+
+
+
+ >
+
+ )
+}
\ No newline at end of file
diff --git a/src/components/pool/liquidity/home/liquidity-home.tsx b/src/components/pool/liquidity/home/liquidity-home.tsx
index 1f39a280..115c5369 100644
--- a/src/components/pool/liquidity/home/liquidity-home.tsx
+++ b/src/components/pool/liquidity/home/liquidity-home.tsx
@@ -9,6 +9,7 @@ import theme from "../../../../theme/theme";
import PoolHomeButton from "./home-button";
import { MdHelpOutline } from "react-icons/md";
import { variables } from "../../../../theme";
+import Link from "next/link";
const useStyles = makeStyles({
grid: {
display: "flex",
@@ -99,8 +100,12 @@ export default function LiquidityHome() {
-