Skip to content

Commit

Permalink
'Swap' form: reduce queries amount (#362)
Browse files Browse the repository at this point in the history
* Refactor 'Swap' form to reduce amount of queries (raw version)

* Hide most of tokens that are known but not exchangeable
  • Loading branch information
keshan3262 authored Jun 15, 2021
1 parent 5b4dbe8 commit bd9e83e
Show file tree
Hide file tree
Showing 7 changed files with 957 additions and 744 deletions.
11 changes: 11 additions & 0 deletions public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1983,5 +1983,16 @@
},
"ledgerLiveBridgeGuide": {
"message": "To connect to Ledger, please activate the Ledger Live application on your device, open Tezos Wallet application and allow a WebSocket connection to your Temple account."
},
"noExchangerFoundForToken": {
"message": "No exchanger was found for token $symbol$ ($name$).",
"placeholders": {
"symbol": {
"content": "$1"
},
"name": {
"content": "$2"
}
}
}
}
27 changes: 15 additions & 12 deletions src/app/pages/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,29 @@ import React from "react";
import { ReactComponent as SwapIcon } from "app/icons/swap.svg";
import PageLayout from "app/layouts/PageLayout";
import SwapForm from "app/templates/SwapForm";
import { SwappableAssetsProvider } from "app/templates/SwapForm/useSwappableAssets";
import { t } from "lib/i18n/react";

type SwapProps = {
assetSlug?: string | null;
};

const Swap: React.FC<SwapProps> = ({ assetSlug }) => (
<PageLayout
pageTitle={
<>
<SwapIcon className="w-auto h-4 mr-1 stroke-current" /> {t("swap")}
</>
}
>
<div className="py-4">
<div className="w-full max-w-sm mx-auto">
<SwapForm assetSlug={assetSlug} />
<SwappableAssetsProvider initialAssetKey={assetSlug ?? undefined}>
<PageLayout
pageTitle={
<>
<SwapIcon className="w-auto h-4 mr-1 stroke-current" /> {t("swap")}
</>
}
>
<div className="py-4">
<div className="w-full max-w-sm mx-auto">
<SwapForm assetSlug={assetSlug} />
</div>
</div>
</div>
</PageLayout>
</PageLayout>
</SwappableAssetsProvider>
);

export default Swap;
Loading

0 comments on commit bd9e83e

Please sign in to comment.