Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTC Review #1001

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"max": "Max",
"minutes": "minutes",
"minutesShort": "Min",
"myOrders": "My orders",
"myOrders": "OTC",
"networks": "Networks",
"no": "No",
"noResultsFound": "No results found",
Expand Down Expand Up @@ -89,29 +89,33 @@
"gasFreeSwaps.paragraph": "You found a gasless swap!",
"gasFreeSwaps.paragraph2": "Some swaps do not require you to pay gas because the transaction is handled by the maker. You'll still need to sign the swap using your wallet to proceed.",
"gasFreeSwaps.title": "Gasless swap",
"protocolFee.paragraph": "AirSwap protocol fees are distributed to active contributor community members. By using AirSwap you're supporting the development and stewardship of decentralized trading protocols.",
"protocolFee.paragraph": "A protocol fee is processed on each swap and distributed to AirSwap contributors and active participants in the decentralized governance process. Using AirSwap supports the development and stewardship of decentralized protocols.",
"protocolFee.title": "Protocol Fee"
},
"marketing": {
"welcomeMessage": "Swap tokens with zero slippage"
},
"orders": {
"actionCannotBeReversed": "This action cannot be reversed",
"actionCannotBeReversed": "This will cancel the order on-chain",
"afterFee": "After {{fee}} fee",
"amount": "Amount",
"anyone": "Anyone",
"approve": "Approve",
"orderAmount": "Order amount",
"feeAmount": "Protocol fee",
"currentApprovalAmount": "Current approval",
"requiredApprovalAmount": "Required approval",
"approveTokenInYourWallet": "Approve token in your wallet",
"approvalComplete": "Approved",
"approvalProcessing": "Approval processing...",
"areYouSureYouWantToCancel": "Are you sure you want to cancel?",
"availableOrders": "Available orders",
"bestQuote": "Best quote",
"cancelOrder": "Cancel order",
"cancelOrder": "Cancel",
"chooseToken": "Select token",
"clearCustomServer": "Clear custom server",
"confirmCancel": "Confirm cancel",
"connectWallet": "Connect your wallet to view your swaps",
"confirmCancel": "Cancel",
"connectWallet": "Connect your wallet to proceed",
"continue": "Continue",
"copyLink": "Copy link",
"counterPartyAddress": "Counterparty address",
Expand All @@ -136,7 +140,8 @@
"insufficientBalance": "Insufficient {{symbol}} balance",
"listed": "Listed",
"listingType": "Listing type",
"makeNewOrder": "New order",
"makeAnOrder": "Make an order",
"makeNewOrder": "Make new order",
"makeNewSwap": "New swap",
"moreInformation": "More information",
"nativeCurrencyMaxInfoText": "{{amount}}. This amount is calculated after subtracting a {{fee}} gas fee from your total balance.",
Expand All @@ -145,11 +150,7 @@
"noIndexersFound": "No indexer nodes found",
"orderSuccessfullyCreated": "Order successfully created.",
"pendingWallet": "Waiting for wallet",
"pendingConfirmation": "Confirm the swap to proceed",
"pendingCancellation": "Confirm the cancellation to proceed",
"pendingApproval": "Confirm the approval to proceed",
"pendingDeposit": "Confirm the deposit to proceed",
"pendingSignature": "Confirm the order to proceed",
"pendingConfirmation": "Confirm to proceed",
"price": "Price",
"priceDifference": "Price difference",
"protocolFee": "Fee",
Expand All @@ -166,7 +167,7 @@
"selectedServer": "Selected {{serverUrl}} as custom server",
"settings": "Settings",
"specificTaker": "Specific Taker",
"startByCreatingANewOrder": "Start by creating a new order.",
"startByCreatingANewOrder": "Start by making an order.",
"swapExpired": "Swap expired",
"swapExpiredCallToAction": "Please try again",
"swapFailed": "Error submitting swap",
Expand All @@ -181,22 +182,22 @@
"thisOrderIsForADifferentTaker": "This order is for a different taker",
"thisOrderIsForAnotherChain": "This order is for {{chainName}}",
"thisOrderWasForADifferentTaker": "This order was for a different taker",
"takeSwap": "Take swap",
"takeSwap": "Take",
"to": "To",
"tokenInfoNotFound": "Token info not found",
"tokenPairUnavailable": "No quotes available",
"noValidResponses": "No servers currently available",
"total": "Total",
"track": "Track",
"trackTransaction": "Available in transaction history",
"trackTransaction": "View in transaction history",
"transactionCompleted": "Swap complete",
"transactionSent": "Sending order...",
"transactionSentToMaker": "Sending order to the maker",
"transactionSubmitted": "Swap processing...",
"unableTake": "Unable to take",
"viewAllQuotes": "View all quotes",
"wrapMessage": "No protocol fee for ETH/WETH swaps",
"youHaveNoOpenOTCOrders": "You have no open OTC orders."
"youHaveNoOpenOTCOrders": "You have no orders."
},
"toast": {
"approvalComplete": "Approval Complete",
Expand Down
4 changes: 1 addition & 3 deletions public/locales/th/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@
"noIndexerOrdersFound": "ไม่พบคำสั่งซื้อสำหรับคู่โทเค็นนี้",
"noIndexersFound": "ไม่พบโหนดดัชนี",
"orderSuccessfullyCreated": "สร้างคำสั่งซื้อสำเร็จ",
"pendingApproval": "รอการอนุมัติ",
"pendingDeposit": "รอการฝาก",
"pendingSignature": "รอลายเซ็น",
"pendingConfirmation": "รอการอนุมัติ",
"price": "ราคา",
"priceDifference": "ความแตกต่างของราคา",
"protocolFee": "ค่าธรรมเนียม",
Expand Down
39 changes: 19 additions & 20 deletions src/components/@reviewScreens/ApproveReview/ApproveReview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const ApproveReview: FC<ApproveReviewProps> = ({
<Container className={className}>
<StyledWidgetHeader>
<Title type="h2" as="h1">
{t("orders.approve")} {tokenSymbol}
{t("orders.approve")}
</Title>
</StyledWidgetHeader>
<OrderReviewToken
Expand All @@ -103,41 +103,40 @@ const ApproveReview: FC<ApproveReviewProps> = ({
tokenUri={justifiedToken?.logoURI}
/>
<ReviewList>
{readableAllowance !== "0" && (
<ReviewListItem>
<ReviewListItemLabel>Current approve amount</ReviewListItemLabel>
<ReviewListItemValue>
{readableAllowance} {tokenSymbol}
</ReviewListItemValue>
</ReviewListItem>
)}
{roundedFeeAmount && (
<>
<ReviewListItem>
<ReviewListItemLabel>Order amount</ReviewListItemLabel>
<ReviewListItemValue>
{amount} {tokenSymbol}
</ReviewListItemValue>
<ReviewListItemLabel>
{t("orders.orderAmount")}
</ReviewListItemLabel>
<ReviewListItemValue>{amount}</ReviewListItemValue>
</ReviewListItem>
<ReviewListItem>
<ReviewListItemLabel>
{t("orders.protocolFee")}
{t("orders.feeAmount")}
<StyledIconButton
icon="information-circle-outline"
onClick={toggleShowFeeInfo}
/>
</ReviewListItemLabel>
<ReviewListItemValue>
{roundedFeeAmount} {tokenSymbol}
</ReviewListItemValue>
<ReviewListItemValue>{roundedFeeAmount}</ReviewListItemValue>
</ReviewListItem>
</>
)}

{readableAllowance !== "0" && (
<ReviewListItem>
<ReviewListItemLabel>
{t("orders.currentApprovalAmount")}
</ReviewListItemLabel>
<ReviewListItemValue>{readableAllowance}</ReviewListItemValue>
</ReviewListItem>
)}
<ReviewListItem>
<ReviewListItemLabel>Total approve amount</ReviewListItemLabel>
<ReviewListItemLabel>
{t("orders.requiredApprovalAmount")}
</ReviewListItemLabel>
<ReviewListItemValue>
{roundedAmountPlusFee || amount} {tokenSymbol}
{roundedAmountPlusFee || amount}
</ReviewListItemValue>
</ReviewListItem>
</ReviewList>
Expand Down
2 changes: 1 addition & 1 deletion src/components/@widgets/MakeWidget/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const getActionButtonTranslation = (
}

if (hasInsufficientAllowance) {
return `${i18n.t("orders.approve")} ${makerTokenSymbol}`;
return `${i18n.t("orders.continue")}`;
}

return i18n.t("common.review");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export const getActionButtonTranslation = (
return i18n.t("wallet.connectWallet");
}

return i18n.t("orders.makeNewOrder");
return i18n.t("orders.makeAnOrder");
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const Container = styled.div<{ orderStatus: OrderStatus }>`

position: relative;
align-items: center;
height: 3.5rem;
height: 3rem;

${Circle} {
background: ${({ theme, orderStatus }) =>
Expand All @@ -60,7 +60,7 @@ export const Text = styled.div`
-webkit-box-orient: vertical;
position: relative;
font-family: ${fontMono};
font-size: 1rem;
font-size: 0.75rem;
font-weight: 500;
text-overflow: ellipsis;
text-transform: uppercase;
Expand All @@ -71,7 +71,7 @@ export const Text = styled.div`
pointer-events: none;

@media ${breakPoints.tabletPortraitUp} {
font-size: 1.25rem;
font-size: 1rem;
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const ActionButtons: FC<ActionButtonsProps> = ({
if (hasInsufficientBalance) {
return (
<Container center className={className}>
<SignButton disabled intent="neutral">
<SignButton disabled intent="neutral" isFilled={true}>
{t("orders.insufficientBalance")}
</SignButton>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const ActionButtons: FC<ActionButtonsProps> = ({
if (shouldEnterAmount) {
return (
<Container center className={className}>
<SignButton disabled intent="primary">
<SignButton disabled intent="primary" isFilled={true}>
{t("orders.enterAmount")}
</SignButton>
</Container>
Expand All @@ -110,7 +110,7 @@ const ActionButtons: FC<ActionButtonsProps> = ({
if (hasInsufficientBalance) {
return (
<Container center className={className}>
<SignButton disabled intent="neutral">
<SignButton disabled intent="neutral" isFilled={true}>
{t("orders.insufficientBalance")}
</SignButton>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const AvailableOrdersWidget = ({
onFullOrderLinkClick={onFullOrderLinkClick}
/>
<ActionButton
title={t("orders.makeNewOrder")}
title={t("orders.makeAnOrder")}
onClick={handleCreateSwapClick}
/>
</Container>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Page/Page.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const StyledPage = styled.div`
position: relative;
min-width: 18rem;
height: 100vh;
min-height: 37.5rem;
min-height: 34.5rem;

@media (min-height: 29rem) and (max-width: ${breakpointSizes.phone}) {
display: flex;
Expand Down
2 changes: 2 additions & 0 deletions src/components/TokenSelect/TokenSelect.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const MaxButtonStyle = css`
bottom: 1px;
align-self: center;
border-radius: 0.25rem;
text-transform: uppercase;
font-family: ${fontWide};
font-weight: 500;
font-size: 0.75rem;
Expand All @@ -117,6 +118,7 @@ export const MaxButton = styled.button`

width: ${() => (isActiveLanguageLogographic() ? "1.75rem" : "auto")};
font-size: ${() => (isActiveLanguageLogographic() ? "0.75rem" : "0.6875rem")};
font-weight: 700;
`;

export const InfoLabel = styled.div`
Expand Down
5 changes: 1 addition & 4 deletions src/components/Toolbar/Toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { FC, useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";

import { useAppSelector } from "../../app/hooks";
import { selectMyOrdersReducer } from "../../features/myOrders/myOrdersSlice";
import useMediaQuery from "../../hooks/useMediaQuery";
import useWindowSize from "../../hooks/useWindowSize";
import { AppRoutes } from "../../routes";
Expand Down Expand Up @@ -31,7 +29,6 @@ const Toolbar: FC<ToolbarProps> = ({
}) => {
const { t } = useTranslation();
const { width, height } = useWindowSize();
const { userOrders } = useAppSelector(selectMyOrdersReducer);
const isTabletPortraitUp = useMediaQuery(breakPoints.tabletPortraitUp);
const containerRef = useRef<HTMLDivElement>(null);
const mobileTopBarRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -78,7 +75,7 @@ const Toolbar: FC<ToolbarProps> = ({
iconName="plus"
iconSize={0.875}
text={t("common.otc")}
link={`/${userOrders.length ? AppRoutes.myOrders : AppRoutes.make}`}
link={`/${AppRoutes.myOrders}`}
/>
<ToolbarButton
iconName="bars"
Expand Down
20 changes: 3 additions & 17 deletions src/components/WalletSignScreen/WalletSignScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,11 @@ const WalletSignScreen: FC<WalletConfirmScreenProps> = ({
<OverlayContainer className={className}>
<OverlayLoader />
<OverlayTitle type="h2">{i18n.t("orders.pendingWallet")}</OverlayTitle>
<OverlaySubHeading>{getDescription(type)}</OverlaySubHeading>
<OverlaySubHeading>
{i18n.t("orders.pendingConfirmation")}
</OverlaySubHeading>
</OverlayContainer>
);
};

const getDescription = (type: WalletSignScreenType) => {
if (type === "approve") {
return i18n.t("orders.pendingApproval");
}
if (type === "deposit") {
return i18n.t("orders.pendingDeposit");
}
if (type === "swap") {
return i18n.t("orders.pendingConfirmation");
}
if (type === "cancel") {
return i18n.t("orders.pendingCancellation");
}
return i18n.t("orders.pendingSignature");
};

export default WalletSignScreen;
7 changes: 6 additions & 1 deletion src/features/metadata/metadataApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ export const getActiveTokensFromLocalStorage = (
getActiveTokensLocalStorageKey(account, chainId)
);

return savedTokenString ? JSON.parse(savedTokenString) : undefined;
try {
return savedTokenString ? JSON.parse(savedTokenString) : undefined;
} catch (e) {
console.error(e);
return undefined;
}
};

export const getUnknownTokensFromLocalStorage = (
Expand Down
6 changes: 1 addition & 5 deletions src/features/wallet/subcomponents/SiteNavigation.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { FC, ReactElement } from "react";
import { useTranslation } from "react-i18next";

import { useAppSelector } from "../../../app/hooks";
import { AppRoutes } from "../../../routes";
import { selectMyOrdersReducer } from "../../myOrders/myOrdersSlice";
import {
Container,
NavigationLink,
Expand All @@ -17,8 +15,6 @@ interface NavigationProps {
const SiteNavigation: FC<NavigationProps> = ({ className }): ReactElement => {
const { t } = useTranslation();

const { userOrders } = useAppSelector(selectMyOrdersReducer);

return (
<Container className={className}>
<NavigationNavLink
Expand All @@ -33,7 +29,7 @@ const SiteNavigation: FC<NavigationProps> = ({ className }): ReactElement => {
{t("common.rfq")}
</NavigationNavLink>
<NavigationNavLink
to={`/${userOrders.length ? AppRoutes.myOrders : AppRoutes.make}`}
to={`/${AppRoutes.myOrders}`}
isActive={(match, location) => {
return (
location.pathname.includes(AppRoutes.myOrders) ||
Expand Down
2 changes: 1 addition & 1 deletion src/style/sizes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export const sizes = {
tradeContainerPadding: "3.75rem",
tradeContainerMobilePadding: "1.25rem",
widgetGutter: "1rem",
widgetSize: "37.5rem",
widgetSize: "34.5rem",
widgetMobileSize: "27.75rem",
};
Loading
Loading