Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into issue-#1602
Browse files Browse the repository at this point in the history
  • Loading branch information
GrandSchtroumpf committed Dec 17, 2024
2 parents a108c24 + a164bf1 commit c57197d
Show file tree
Hide file tree
Showing 155 changed files with 1,242 additions and 1,003 deletions.
2 changes: 1 addition & 1 deletion e2e/pages/simulator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test } from '@playwright/test';
import { capitalize } from 'lodash';
import capitalize from 'lodash/capitalize';
import { mockApi } from '../utils/mock-api';
import {
DebugDriver,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/screenshots/simulator/recurring/Recurring_range_limit/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/screenshots/simulator/recurring/Recurring_range_range/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/deposit/form.png
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/undercut/form.png
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/withdraw/form.png
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<meta name="twitter:title" content="Carbon DeFi - Automated trading strategies">
<meta name="twitter:description" content="Carbon DeFi is an advanced onchain trading protocol enabling automated limit orders, efficiently adjustable w/ custom price ranges, grid trading like recurring orders, works like a DEX trading bot.">
<meta name="twitter:image" content="https://framerusercontent.com/images/7YeuJPKg50bkh0m7b1yRwhCNIoE.png">

<!-- Preload fonts that are the most likely to be used quickly -->
<link rel="preload" href="assets/font/title/medium.woff2" as="font" type="font/woff2"/>
<link rel="preload" href="assets/font/text/medium.woff2" as="font" type="font/woff2"/>
</head>

<body>
Expand Down
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@babel/core": "^7.0.0-0",
"@bancor/carbon-sdk": "0.0.99-DEV",
"@bancor/carbon-sdk": "0.0.103-DEV",
"@cloudflare/workers-types": "^4.20230717.0",
"@ethersproject/abi": "^5.0.0",
"@ethersproject/bytes": "^5.0.0",
Expand All @@ -29,11 +29,11 @@
"@types/body-scroll-lock": "^3.1.0",
"@types/lodash": "4.14.191",
"@types/node": "^20.0.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react": "19.0.1",
"@types/react-dom": "19.0.2",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@vitejs/plugin-react": "^4.3.1",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/coverage-v8": "^1.6.0",
"autoprefixer": "^10.4.12",
"body-scroll-lock": "^4.0.0-beta.0",
Expand All @@ -58,9 +58,8 @@
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-unused-imports": "^2.0.0",
"ethers": "^5.1.3",
"framer-motion": "7.6.7",
"framer-motion": "11.13.5",
"fuse.js": "^6.6.2",
"graphemer": "^1.4.0",
"highcharts": "^11.1.0",
"highcharts-react-official": "^3.2.0",
"husky": "^8.0.3",
Expand All @@ -72,10 +71,9 @@
"postcss": "^8.4.31",
"prettier": "^2.7.1",
"prettier-plugin-tailwindcss": "^0.1.13",
"react": "^18.2.0",
"react-day-picker": "^8.10.0",
"react-dom": "^18.2.0",
"source-map-explorer": "^2.5.3",
"react": "19.0.0",
"react-day-picker": "9.4.2",
"react-dom": "19.0.0",
"tailwind-merge": "^2.2.2",
"tailwindcss": "3.4.3",
"typechain": "^8.1.0",
Expand All @@ -92,7 +90,6 @@
"scripts": {
"compile-abis": "typechain --target ethers-v5 --out-dir \"src/abis/types\" \"src/abis/**/*.json\"",
"prepare": "yarn husky install",
"analyze": "source-map-explorer 'build/static/js/*.js'",
"start": "vite",
"start:ethereum": "cross-env VITE_NETWORK=ethereum vite",
"start:sei": "cross-env VITE_NETWORK=sei vite",
Expand All @@ -109,7 +106,8 @@
"lint": "eslint --ext .tsx,.ts .",
"pre-commit": "yarn lint-staged",
"e2e:report": "npx playwright show-report e2e/playwright-report",
"update-browserslist": "npx update-browserslist-db@latest"
"update-browserslist": "npx update-browserslist-db@latest",
"analyze": "npx analyze -c vite.config.ts"
},
"browserslist": {
"production": [
Expand All @@ -129,7 +127,8 @@
]
},
"devDependencies": {
"@types/d3": "^7.4.3"
"@types/d3": "^7.4.3",
"vite-bundle-analyzer": "^0.15.2"
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
}
}
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const App = () => {
<>
<NotificationAlerts />
<MainMenu />
<main className="mb-16 mt-80 grid flex-grow">
<main className="mb-16 grid flex-grow">
<MainContent />
</main>
<Footer />
Expand Down
4 changes: 2 additions & 2 deletions src/components/activity/useActivityQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const useActivityQuery = (
params: QueryActivityParams = {},
config: ActivityQueryConfig = {}
) => {
const { tokensMap, isPending, importToken } = useTokens();
const { tokensMap, isPending, importTokens } = useTokens();
const { Token } = useContract();
const validParams = isValidParams(params);

Expand All @@ -100,7 +100,7 @@ export const useActivityQuery = (
return fetchTokenData(Token, address);
});
const tokens = await Promise.all(getTokens);
tokens.forEach((data) => importToken(data));
importTokens(tokens);
};

return useQuery({
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FC } from 'react';
import { FC, HTMLAttributes } from 'react';
import { ReactComponent as IconCheck } from 'assets/icons/check.svg';
import { cn } from 'utils/helpers';

type Props = JSX.IntrinsicElements['button'] & {
type Props = HTMLAttributes<HTMLButtonElement> & {
isChecked: boolean;
setIsChecked: (isChecked: boolean) => void;
};
Expand Down
34 changes: 29 additions & 5 deletions src/components/common/PairLogoName.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
import { TokensOverlap } from 'components/common/tokensOverlap';
import { WarningWithTooltip } from 'components/common/WarningWithTooltip/WarningWithTooltip';
import { TradePair } from 'libs/modals/modals/ModalTradeTokenList';
import { FC } from 'react';
import { Token } from 'libs/tokens';
import { FC, memo } from 'react';
import { TokenLogo } from './imager/Imager';

const suspiciousTokenTooltipMsg =
'This token is not part of any known token list. Always conduct your own research before trading.';

interface Props {
interface TokenProps {
token: Token;
}
export const _TokenLogoName: FC<TokenProps> = ({ token }) => {
return (
<>
<TokenLogo token={token} size={30} />
{token.symbol}
{token.isSuspicious && (
<WarningWithTooltip tooltipContent={suspiciousTokenTooltipMsg} />
)}
</>
);
};
export const TokenLogoName = memo(_TokenLogoName, (a, b) => {
return a.token.address === b.token.address;
});

interface PairProps {
pair: TradePair;
}

export const PairLogoName: FC<Props> = ({
pair: { baseToken, quoteToken },
}) => {
const _PairLogoName: FC<PairProps> = ({ pair: { baseToken, quoteToken } }) => {
return (
<>
<TokensOverlap tokens={[baseToken, quoteToken]} size={30} />
Expand All @@ -30,3 +48,9 @@ export const PairLogoName: FC<Props> = ({
</>
);
};
export const PairLogoName = memo(_PairLogoName, (a, b) => {
return (
a.pair.baseToken.address === b.pair.baseToken.address &&
a.pair.quoteToken.address === b.pair.quoteToken.address
);
});
2 changes: 1 addition & 1 deletion src/components/common/Toaster/Toaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const Toaster: FC = () => {
return (
<ul
id="toaster"
className="fixed bottom-16 right-16 z-10 flex min-w-[250px] flex-col gap-8"
className="fixed bottom-16 right-24 z-10 flex min-w-[250px] flex-col gap-8"
>
{toaster.toasts.map((toast) => (
<ToastItem key={toast.id} {...toast} />
Expand Down
82 changes: 82 additions & 0 deletions src/components/common/calendar/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
.rdp-root {
@apply text-14;
}
.rdp-months {
display: flex;
gap: 30px;
position: relative;
}
.rdp-nav {
position: absolute;
top: 0;
inset-inline: 0;
display: flex;
align-items: center;
justify-content: space-between;
}
.rdp-nav button {
color: rgba(255 255 255 / 0.6);
}
.rdp-nav button:hover {
color: white;
}
.rdp-month {
display: flex;
flex-direction: column;
gap: 20px;
}
.rdp-month_caption {
text-align: center;
}
.rdp-weekday {
@apply text-12;
font-weight: 400;
color: rgba(255 255 255 / 0.2);
}

.rdp-day {
color: rgba(255 255 255 / 0.6);
padding-inline: 0;
}
.rdp-disabled {
opacity: 0.5;
}
.rdp-outside {
opacity: 0.2;
}
.rdp-day_button {
width: 36px;
height: 32px;
border-radius: 8px;
}
.rdp-range_middle .rdp-day_button {
@apply bg-primary/20;
color: white;
border-radius: 0;
}
.rdp-day_button:hover {
@apply bg-black;
color: white;
}
.rdp-range_start .rdp-day_button {
@apply bg-primary;
color: black;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.rdp-range_end .rdp-day_button {
@apply bg-primary;
color: black;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.rdp-range_start.rdp-range_end .rdp-day_button {
border-radius: 8px;
}

.rdp-today .rdp-day_button {
border: solid 1px white;
}
.rdp-hidden {
visibility: hidden;
}
58 changes: 12 additions & 46 deletions src/components/common/calendar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentProps } from 'react';
import { DayPicker } from 'react-day-picker';
import { ReactComponent as Chevron } from 'assets/icons/chevron.svg';
import { cn } from 'utils/helpers';
import './index.css';

export type CalendarProps = ComponentProps<typeof DayPicker>;

Expand All @@ -16,52 +16,18 @@ export const Calendar = ({
<DayPicker
showOutsideDays={showOutsideDays}
className={className}
classNames={{
months: 'flex flex-col sm:flex-row gap-30',
month: 'flex flex-col gap-20',
caption: 'flex items-center',
caption_start: 'flex-row ',
caption_label: 'flex-1 text-center text-14 order-1',
nav: 'contents gap-10',
nav_button: 'size-16 bg-transparent opacity-50 hover:opacity-100',
nav_button_previous: 'order-0',
nav_button_next: 'order-2',
table: 'border-collapse',
head_row: 'flex m-b-1',
head_cell: 'text-white/20 rounded-8 w-36 text-12 font-weight-400',
row: 'flex w-full mt-4',
cell: 'p-0 text-14',
day: cn(
'text-white/60 h-32 w-36 p-0 rounded-8 border-box',
'focus-visible:border focus-visible:border-white/50 focus-visible:outline-none',
'hover:!bg-background-900 hover:text-white'
),
day_selected:
'focus-visible:bg-primary/80 font-weight-500 !text-white bg-primary/20 !rounded-0 [&:not(.outside)]:opacity-100',
day_range_start:
'!rounded-l-8 [&:not(.outside)]:!bg-primary [&:not(.outside)]:!text-black',
day_range_end:
'!rounded-r-8 [&:not(.outside)]:!bg-primary [&:not(.outside)]:!text-black',
day_today: 'border border-white/80',
day_outside: 'outside !opacity-20',
day_disabled: 'hover:!text-white !text-white/20 opacity-50',
day_range_middle: 'aria-selected:bg-primary/20',
day_hidden: 'invisible',
...classNames,
}}
classNames={classNames}
components={{
IconLeft: () => (
<Chevron
className="size-16 rotate-90"
data-testid="date-picker-left-arrow"
/>
),
IconRight: () => (
<Chevron
className="size-16 -rotate-90"
data-testid="date-picker-right-arrow"
/>
),
Chevron: ({ orientation }) => {
const rotate = orientation === 'left' ? 90 : -90;
return (
<Chevron
style={{ transform: `rotate(${rotate}deg)` }}
className="size-16 rotate-90"
data-testid={`date-picker-${orientation}-arrow`}
/>
);
},
}}
weekStartsOn={weekStartsOn}
{...props}
Expand Down
3 changes: 1 addition & 2 deletions src/components/common/imager/Imager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const Imager = ({
...props
}: ImageProps) => {
const { source } = useImager(src, fallbackSrc);

return (
<img
{...props}
Expand All @@ -90,7 +89,7 @@ export const TokenLogo = ({ token, size, className }: TokenLogoProps) => {
src={token.logoURI}
alt={token.name ?? token.symbol}
title={token.symbol}
className={className}
className={cn(className, 'border border-black bg-black')}
/>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { cn } from 'utils/helpers';
export const Page: FC<{
children: ReactNode;
title?: string;
widget?: JSX.Element;
widget?: ReactNode;
hideTitle?: boolean;
className?: string;
}> = ({ children, title, widget, hideTitle, className }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/searchInput/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { KeyboardEventHandler } from 'react';
import { HTMLAttributes, KeyboardEventHandler } from 'react';
import { ReactComponent as IconSearch } from 'assets/icons/search.svg';
import { ReactComponent as IconClose } from 'assets/icons/times.svg';
import { cn } from 'utils/helpers';

type InputProps = JSX.IntrinsicElements['input'];
type InputProps = HTMLAttributes<HTMLInputElement>;
interface Props extends InputProps {
value: string;
setValue: (value: string) => void;
Expand Down
Loading

0 comments on commit c57197d

Please sign in to comment.