diff --git a/src/components/Modal/SwapModal/index.tsx b/src/components/Modal/SwapModal/index.tsx new file mode 100644 index 0000000..115298e --- /dev/null +++ b/src/components/Modal/SwapModal/index.tsx @@ -0,0 +1,47 @@ +import ReactModal from "react-modal"; +import { useScreenClass } from "react-grid-system"; +import { useNavigate } from "react-router-dom"; +import SwapPage from "pages/Trade/Swap"; +import IconButton from "components/IconButton"; +import { MOBILE_SCREEN_CLASS } from "constants/layout"; +import useSettingsModal from "hooks/modals/useSettingsModal"; +import Modal from "components/Modal"; + +import iconSetting from "assets/icons/icon-setting.svg"; +import iconSettingHover from "assets/icons/icon-setting-hover.svg"; + +function SwapModal(props: ReactModal.Props) { + const navigate = useNavigate(); + const screenClass = useScreenClass(); + const settingsModal = useSettingsModal(); + + const { + onRequestClose = () => { + navigate("..", { replace: true, relative: "route" }); + }, + ...modalProps + } = props; + + return ( + settingsModal.open()} + /> + } + {...modalProps} + > + + + ); +} + +export default SwapModal; diff --git a/src/pages/Tokens/TokenDetail/index.tsx b/src/pages/Tokens/TokenDetail/index.tsx index f1fff62..efc8d70 100644 --- a/src/pages/Tokens/TokenDetail/index.tsx +++ b/src/pages/Tokens/TokenDetail/index.tsx @@ -17,7 +17,7 @@ import { Visible, useScreenClass, } from "react-grid-system"; -import { Link, useNavigate, useParams } from "react-router-dom"; +import { Link, Outlet, useNavigate, useParams } from "react-router-dom"; import iconBookmark from "assets/icons/icon-bookmark-default.svg"; import iconBookmarkSelected from "assets/icons/icon-bookmark-selected.svg"; @@ -124,12 +124,12 @@ function TokenDetailPage() { )} - {tokenAddress && ( + {asset?.token && ( @@ -141,7 +141,7 @@ function TokenDetailPage() { ), - [asset, tokenAddress], + [asset], ); return ( @@ -352,6 +352,7 @@ function TokenDetailPage() { /> {tokenAddress && } + ); } diff --git a/src/pages/Wallet/Assets.tsx b/src/pages/Wallet/Assets.tsx index ad90d1c..015d311 100644 --- a/src/pages/Wallet/Assets.tsx +++ b/src/pages/Wallet/Assets.tsx @@ -248,7 +248,7 @@ function Assets() { {typeof row.token === "string" && ( , + children: [{ path: "swap", element: }], }, { path: "wallet", @@ -63,6 +65,7 @@ const routes = createBrowserRouter([ children: [ { path: ":poolAddress/add", element: }, { path: ":poolAddress/remove", element: }, + { path: "swap", element: }, ], }, {