Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a21558ad88 | ||
|
|
68f3552569 | ||
|
|
18b12591ca | ||
|
|
3f963ffb07 | ||
|
|
aac024fd5e | ||
|
|
4913c690ec | ||
|
|
b0db577b28 | ||
|
|
9815437a80 | ||
|
|
890a4b2c0e | ||
|
|
8d3cc76d14 |
+7
-3
@@ -4,7 +4,11 @@ VITE_ALCHEMY_API_KEY=
|
|||||||
|
|
||||||
VITE_PK_ENCRYPTION_KEY=
|
VITE_PK_ENCRYPTION_KEY=
|
||||||
|
|
||||||
VITE_WALLETCONNECT2_PROJECT_ID=
|
|
||||||
|
|
||||||
VITE_V3_TOKEN_ADDRESS=
|
VITE_V3_TOKEN_ADDRESS=
|
||||||
VITE_TOKEN_MIGRATION_URI=
|
VITE_TOKEN_MIGRATION_URI=
|
||||||
|
|
||||||
|
AMPLITUDE_API_KEY=
|
||||||
|
BUGSNAG_API_KEY=
|
||||||
|
IOS_APP_ID=
|
||||||
|
INTERCOM_APP_ID=
|
||||||
|
STATUS_PAGE_SCRIPT_URI=
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
Copyright (C) 2023 dYdX Trading Inc.
|
Copyright (C) 2023 dYdX Trading Inc.
|
||||||
|
|
||||||
Subject to your compliance with applicable law, you are granted the right to use the Licensed Work (defined below) under the terms of the GNU Affero General Public License as set forth below; provided, however, that if you violate any such applicable law in your use of the Licensed Work, all of your rights and licenses to use (including any rights to reproduce, distribute, install or modify) the Licensed Work will automatically and immediately terminate.
|
Subject to your compliance with applicable law and the v4 Terms of Use, available at dydx.exchange/legal, you are granted the right to use the Program or Licensed Work (defined below) under the terms of the GNU Affero General Public License as set forth below; provided, however, that if you violate any such applicable law in your use of the Program or Licensed Work, all of your rights and licenses to use (including any rights to reproduce, distribute, install or modify) the Program or Licensed Work will automatically and immediately terminate.
|
||||||
|
|
||||||
|
|
||||||
|
The “Program” or “Licensed Work” shall mean any of the following: dydxprotocol/cosmos-sdk, dydxprotocol/cometbft, dydxprotocol/v4-chain, dydxprotocol/v4-clients, dydxprotocol/v4-web, dydxprotocol/v4-abacus, dydxprotocol/v4-localization, dydxprotocol/v4-documentation, and any dYdX or dYdX Trading Inc. repository reflecting a copy of, or link to, this license.
|
||||||
|
|
||||||
|
|
||||||
The GNU Affero General Public License
|
The GNU Affero General Public License
|
||||||
|
|||||||
@@ -69,6 +69,21 @@ You'll need to provide a Wallet Connect project id to enable onboarding and wall
|
|||||||
- Create a project on https://cloud.walletconnect.com/app
|
- Create a project on https://cloud.walletconnect.com/app
|
||||||
- Copy over the project ID into this [field](https://github.com/dydxprotocol/v4-web/blob/67ecbd75b43e0c264b7b4d2d9b3d969830b0621c/public/configs/env.json#L822C33-L822C46)
|
- Copy over the project ID into this [field](https://github.com/dydxprotocol/v4-web/blob/67ecbd75b43e0c264b7b4d2d9b3d969830b0621c/public/configs/env.json#L822C33-L822C46)
|
||||||
|
|
||||||
|
## Part 4: Set Enviornment variables
|
||||||
|
Set environment variables via `.env`.
|
||||||
|
|
||||||
|
- `VITE_BASE_URL` (required): The base URL of the deployment (e.g., `https://www.example.com`).
|
||||||
|
- `VITE_ALCHEMY_API_KEY` (optional): Add an Alchemy API key for EVM interactions; the app will fall back to public RPCs if not provided.
|
||||||
|
- `VITE_PK_ENCRYPTION_KEY` (optional): AES encryption key used for signature obfuscation; necessary for enabling the "Remember Me" feature.
|
||||||
|
- `VITE_V3_TOKEN_ADDRESS` (optional): Address of the V3 $DYDX token.
|
||||||
|
- `VITE_TOKEN_MIGRATION_URI` (optional): The URL of the token migration website.
|
||||||
|
- `AMPLITUDE_API_KEY` (optional): Amplitude API key for enabling Amplitude; used with `pnpm run build:inject-amplitude`.
|
||||||
|
- `BUGSNAG_API_KEY` (optional): API key for enabling Bugsnag; used with `pnpm run build:inject-bugsnag`.
|
||||||
|
- `IOS_APP_ID` (optional): iOS app ID used for enabling deep linking to the iOS app; used with `pnpm run build:inject-app-deeplinks`.
|
||||||
|
- `INTERCOM_APP_ID` (optional): Used for enabling Intercom; utilized with `pnpm run build:inject-intercom`.
|
||||||
|
- `STATUS_PAGE_SCRIPT_URI` (optional): Used for enabling the status page; used with `pnpm run build:inject-statuspage`.
|
||||||
|
|
||||||
|
|
||||||
# Deployments
|
# Deployments
|
||||||
|
|
||||||
## Deploying with Vercel
|
## Deploying with Vercel
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@
|
|||||||
"@cosmjs/proto-signing": "^0.31.0",
|
"@cosmjs/proto-signing": "^0.31.0",
|
||||||
"@cosmjs/stargate": "^0.31.0",
|
"@cosmjs/stargate": "^0.31.0",
|
||||||
"@cosmjs/tendermint-rpc": "^0.31.0",
|
"@cosmjs/tendermint-rpc": "^0.31.0",
|
||||||
"@dydxprotocol/v4-abacus": "^1.0.3",
|
"@dydxprotocol/v4-abacus": "^1.0.10",
|
||||||
"@dydxprotocol/v4-client-js": "^1.0.0",
|
"@dydxprotocol/v4-client-js": "^1.0.0",
|
||||||
"@dydxprotocol/v4-localization": "^1.0.0",
|
"@dydxprotocol/v4-localization": "^1.0.0",
|
||||||
"@ethersproject/providers": "^5.7.2",
|
"@ethersproject/providers": "^5.7.2",
|
||||||
|
|||||||
Generated
+11
-11
@@ -1,5 +1,9 @@
|
|||||||
lockfileVersion: '6.0'
|
lockfileVersion: '6.0'
|
||||||
|
|
||||||
|
settings:
|
||||||
|
autoInstallPeers: true
|
||||||
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@0xsquid/sdk':
|
'@0xsquid/sdk':
|
||||||
specifier: ^1.10.0
|
specifier: ^1.10.0
|
||||||
@@ -23,8 +27,8 @@ dependencies:
|
|||||||
specifier: ^0.31.0
|
specifier: ^0.31.0
|
||||||
version: 0.31.0
|
version: 0.31.0
|
||||||
'@dydxprotocol/v4-abacus':
|
'@dydxprotocol/v4-abacus':
|
||||||
specifier: ^1.0.3
|
specifier: ^1.0.10
|
||||||
version: 1.0.3
|
version: 1.0.10
|
||||||
'@dydxprotocol/v4-client-js':
|
'@dydxprotocol/v4-client-js':
|
||||||
specifier: ^1.0.0
|
specifier: ^1.0.0
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
@@ -975,8 +979,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
|
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@dydxprotocol/v4-abacus@1.0.3:
|
/@dydxprotocol/v4-abacus@1.0.10:
|
||||||
resolution: {integrity: sha512-GuX37/DMMNSke8ZFcw52II7IVJfUgVGHqoi1Uw2cUb+hgIjjSG3OtbyRWedm5r6nqWq8BNLOexI0VVFB6OMVYg==}
|
resolution: {integrity: sha512-SdxI/JcyxM1ydtR9ImWujeurea3gbxj37qYnw1wz829BQiZ05uNEtll3xJCI0MjpG+01ARsxVys7SHbpjSxwOg==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@dydxprotocol/v4-client-js@1.0.0:
|
/@dydxprotocol/v4-client-js@1.0.0:
|
||||||
@@ -7652,7 +7656,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-WIdaQ8uW1vIbYvNnAVunkC6yxTrneJC7VQ5UUQ0kuw8b0C0A39KTIpoQHCfc8tV7o9vF4niwRhdXEdfAgQEsQQ==}
|
resolution: {integrity: sha512-WIdaQ8uW1vIbYvNnAVunkC6yxTrneJC7VQ5UUQ0kuw8b0C0A39KTIpoQHCfc8tV7o9vF4niwRhdXEdfAgQEsQQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
cosmos-directory-types: 0.0.6
|
cosmos-directory-types: 0.0.6
|
||||||
node-fetch-native: 1.4.0
|
node-fetch-native: 1.4.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/cosmos-directory-types@0.0.6:
|
/cosmos-directory-types@0.0.6:
|
||||||
@@ -11283,8 +11287,8 @@ packages:
|
|||||||
engines: {node: '>=10.5.0'}
|
engines: {node: '>=10.5.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/node-fetch-native@1.4.0:
|
/node-fetch-native@1.4.1:
|
||||||
resolution: {integrity: sha512-F5kfEj95kX8tkDhUCYdV8dg3/8Olx/94zB8+ZNthFs6Bz31UpUi8Xh40TN3thLwXgrwXry1pEg9lJ++tLWTcqA==}
|
resolution: {integrity: sha512-NsXBU0UgBxo2rQLOeWNZqS3fvflWePMECr8CoSWoSTqCqGbVVsvl9vZu1HfQicYN0g5piV9Gh8RTEvo/uP752w==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/node-fetch@2.6.12:
|
/node-fetch@2.6.12:
|
||||||
@@ -14096,7 +14100,3 @@ packages:
|
|||||||
/zwitch@2.0.4:
|
/zwitch@2.0.4:
|
||||||
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
settings:
|
|
||||||
autoInstallPeers: true
|
|
||||||
excludeLinksFromLockfile: false
|
|
||||||
|
|||||||
+21
-2
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"apps": {
|
||||||
|
"iOS": {
|
||||||
|
"scheme": "dydxv4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"deployments": {
|
"deployments": {
|
||||||
"MAINNET": {
|
"MAINNET": {
|
||||||
"environments": [
|
"environments": [
|
||||||
@@ -38,6 +43,7 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -110,6 +116,7 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -181,6 +188,7 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -200,8 +208,8 @@
|
|||||||
"endpoints": {
|
"endpoints": {
|
||||||
"indexers": [
|
"indexers": [
|
||||||
{
|
{
|
||||||
"api": "http://indexer.v4dev4.dydx.exchange",
|
"api": "https://indexer.v4dev4.dydx.exchange",
|
||||||
"socket": "ws://indexer.v4dev4.dydx.exchange"
|
"socket": "wss://indexer.v4dev4.dydx.exchange"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"validators": [
|
"validators": [
|
||||||
@@ -252,6 +260,7 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -323,6 +332,7 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -396,6 +406,7 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -469,6 +480,7 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -546,6 +558,7 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -620,6 +633,7 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -694,6 +708,7 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -768,6 +783,7 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -842,6 +858,7 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -906,6 +923,7 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
@@ -980,6 +998,7 @@
|
|||||||
"dydxChainId": "[mainnet chain id]",
|
"dydxChainId": "[mainnet chain id]",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "[mainnet squid integrator id]",
|
||||||
"isMainNet": true,
|
"isMainNet": true,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"comment": "Change according to mainnet release",
|
"comment": "Change according to mainnet release",
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ Styled.CollapsibleContent = styled(CollapsibleContent)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.IconButton = styled(IconButton)`
|
Styled.IconButton = styled(IconButton)`
|
||||||
|
--button-icon-size: 1em;
|
||||||
${Styled.CollapsibleRoot}[data-state='closed'] & {
|
${Styled.CollapsibleRoot}[data-state='closed'] & {
|
||||||
rotate: -0.5turn;
|
rotate: -0.5turn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ type PickDialogProps = Pick<
|
|||||||
| 'slotHeaderInner'
|
| 'slotHeaderInner'
|
||||||
| 'slotTrigger'
|
| 'slotTrigger'
|
||||||
| 'slotFooter'
|
| 'slotFooter'
|
||||||
|
| 'preventClose'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export const ComboboxDialogMenu = <
|
export const ComboboxDialogMenu = <
|
||||||
@@ -57,6 +58,7 @@ export const ComboboxDialogMenu = <
|
|||||||
children,
|
children,
|
||||||
|
|
||||||
placement = DialogPlacement.Default,
|
placement = DialogPlacement.Default,
|
||||||
|
preventClose,
|
||||||
className,
|
className,
|
||||||
}: ElementProps<MenuItemValue, MenuGroupValue> &
|
}: ElementProps<MenuItemValue, MenuGroupValue> &
|
||||||
PickComboxMenuProps<MenuItemValue, MenuGroupValue> &
|
PickComboxMenuProps<MenuItemValue, MenuGroupValue> &
|
||||||
@@ -72,6 +74,7 @@ export const ComboboxDialogMenu = <
|
|||||||
slotTrigger={slotTrigger}
|
slotTrigger={slotTrigger}
|
||||||
slotFooter={slotFooter}
|
slotFooter={slotFooter}
|
||||||
placement={placement}
|
placement={placement}
|
||||||
|
preventClose={preventClose}
|
||||||
className={className}
|
className={className}
|
||||||
>
|
>
|
||||||
<Styled.ComboboxMenu
|
<Styled.ComboboxMenu
|
||||||
|
|||||||
@@ -33,9 +33,11 @@ export const DropdownHeaderMenu = <MenuItemValue extends string>({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Root>
|
<Root>
|
||||||
<Styled.Trigger className={className}>
|
<Styled.Trigger className={className} asChild>
|
||||||
|
<div>
|
||||||
{children}
|
{children}
|
||||||
<Styled.DropdownIconButton iconName={IconName.Caret} isToggle />
|
<Styled.DropdownIconButton iconName={IconName.Caret} isToggle />
|
||||||
|
</div>
|
||||||
</Styled.Trigger>
|
</Styled.Trigger>
|
||||||
<Portal>
|
<Portal>
|
||||||
<Styled.Content
|
<Styled.Content
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ import {
|
|||||||
CommentIcon,
|
CommentIcon,
|
||||||
CopyIcon,
|
CopyIcon,
|
||||||
CubeIcon,
|
CubeIcon,
|
||||||
|
DepositIcon,
|
||||||
|
DepthChartIcon,
|
||||||
DiscordIcon,
|
DiscordIcon,
|
||||||
EtherscanIcon,
|
EtherscanIcon,
|
||||||
DepthChartIcon,
|
|
||||||
ExportKeysIcon,
|
ExportKeysIcon,
|
||||||
FeedbackIcon,
|
FeedbackIcon,
|
||||||
FileIcon,
|
FileIcon,
|
||||||
@@ -69,6 +70,7 @@ import {
|
|||||||
WarningIcon,
|
WarningIcon,
|
||||||
WebsiteIcon,
|
WebsiteIcon,
|
||||||
WhitepaperIcon,
|
WhitepaperIcon,
|
||||||
|
WithdrawIcon,
|
||||||
} from '@/icons';
|
} from '@/icons';
|
||||||
|
|
||||||
export enum IconName {
|
export enum IconName {
|
||||||
@@ -93,6 +95,7 @@ export enum IconName {
|
|||||||
Comment = 'Comment',
|
Comment = 'Comment',
|
||||||
Copy = 'Copy',
|
Copy = 'Copy',
|
||||||
Cube = 'Cube',
|
Cube = 'Cube',
|
||||||
|
Deposit = 'Deposit',
|
||||||
DepthChart = 'DepthChart',
|
DepthChart = 'DepthChart',
|
||||||
Discord = 'Discord',
|
Discord = 'Discord',
|
||||||
Etherscan = 'Etherscan',
|
Etherscan = 'Etherscan',
|
||||||
@@ -139,6 +142,7 @@ export enum IconName {
|
|||||||
Warning = 'Warning',
|
Warning = 'Warning',
|
||||||
Website = 'Website',
|
Website = 'Website',
|
||||||
Whitepaper = 'Whitepaper',
|
Whitepaper = 'Whitepaper',
|
||||||
|
Withdraw = 'Withdraw',
|
||||||
}
|
}
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
@@ -163,6 +167,7 @@ const icons = {
|
|||||||
[IconName.Comment]: CommentIcon,
|
[IconName.Comment]: CommentIcon,
|
||||||
[IconName.Copy]: CopyIcon,
|
[IconName.Copy]: CopyIcon,
|
||||||
[IconName.Cube]: CubeIcon,
|
[IconName.Cube]: CubeIcon,
|
||||||
|
[IconName.Deposit]: DepositIcon,
|
||||||
[IconName.DepthChart]: DepthChartIcon,
|
[IconName.DepthChart]: DepthChartIcon,
|
||||||
[IconName.Discord]: DiscordIcon,
|
[IconName.Discord]: DiscordIcon,
|
||||||
[IconName.Etherscan]: EtherscanIcon,
|
[IconName.Etherscan]: EtherscanIcon,
|
||||||
@@ -208,6 +213,7 @@ const icons = {
|
|||||||
[IconName.Warning]: WarningIcon,
|
[IconName.Warning]: WarningIcon,
|
||||||
[IconName.Website]: WebsiteIcon,
|
[IconName.Website]: WebsiteIcon,
|
||||||
[IconName.Whitepaper]: WhitepaperIcon,
|
[IconName.Whitepaper]: WhitepaperIcon,
|
||||||
|
[IconName.Withdraw]: WithdrawIcon,
|
||||||
} as Record<IconName, ElementType>;
|
} as Record<IconName, ElementType>;
|
||||||
|
|
||||||
type ElementProps = {
|
type ElementProps = {
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ const Styled: Record<string, AnyStyledComponent> = {};
|
|||||||
const buttonMixin = css`
|
const buttonMixin = css`
|
||||||
// Params
|
// Params
|
||||||
--button-icon-size: 1.125em;
|
--button-icon-size: 1.125em;
|
||||||
|
--button-padding: 0;
|
||||||
|
|
||||||
// Rules
|
// Rules
|
||||||
> * {
|
> * {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ const NavItem = forwardRef(
|
|||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
{slotAfter}
|
{slotAfter}
|
||||||
{subitems?.length && <Styled.Icon iconName={IconName.Caret} />}
|
{subitems?.length && <Styled.Icon iconName={IconName.Triangle} />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -525,7 +525,7 @@ Styled.NavItem = styled(NavItem)<{ orientation: 'horizontal' | 'vertical' }>`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Icon = styled(Icon)`
|
Styled.Icon = styled(Icon)`
|
||||||
height: 0.75em;
|
font-size: 0.375em;
|
||||||
transition: rotate 0.3s var(--ease-out-expo);
|
transition: rotate 0.3s var(--ease-out-expo);
|
||||||
|
|
||||||
${Styled.List}[data-orientation="menu"] & {
|
${Styled.List}[data-orientation="menu"] & {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export const Panel = ({
|
|||||||
hasSeparator,
|
hasSeparator,
|
||||||
className,
|
className,
|
||||||
}: PanelProps & PanelStyleProps) => (
|
}: PanelProps & PanelStyleProps) => (
|
||||||
<Styled.Panel onClick={onClick}>
|
<Styled.Panel onClick={onClick} className={className}>
|
||||||
<Styled.Left>
|
<Styled.Left>
|
||||||
{href ? (
|
{href ? (
|
||||||
<Link to={href}>
|
<Link to={href}>
|
||||||
@@ -53,7 +53,7 @@ export const Panel = ({
|
|||||||
</Styled.Header>
|
</Styled.Header>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
<Styled.Content className={className}>{children}</Styled.Content>
|
<Styled.Content>{children}</Styled.Content>
|
||||||
</Styled.Left>
|
</Styled.Left>
|
||||||
{slotRight}
|
{slotRight}
|
||||||
</Styled.Panel>
|
</Styled.Panel>
|
||||||
@@ -61,11 +61,29 @@ export const Panel = ({
|
|||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
Styled.Panel = styled.section`
|
Styled.Panel = styled.section<{ onClick?: () => void }>`
|
||||||
|
--panel-paddingY: 1rem;
|
||||||
|
--panel-paddingX: 1rem;
|
||||||
|
--panel-content-paddingY: var(--panel-paddingY);
|
||||||
|
--panel-content-paddingX: var(--panel-paddingX);
|
||||||
|
|
||||||
${layoutMixins.row}
|
${layoutMixins.row}
|
||||||
|
|
||||||
background-color: var(--color-layer-3);
|
background-color: var(--color-layer-3);
|
||||||
border-radius: 0.875rem;
|
border-radius: 0.875rem;
|
||||||
|
|
||||||
|
${({ onClick }) =>
|
||||||
|
onClick &&
|
||||||
|
css`
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
button:not(:disabled) {
|
||||||
|
color: var(--button-hover-textColor);
|
||||||
|
filter: var(--button-hover-filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Left = styled.div`
|
Styled.Left = styled.div`
|
||||||
@@ -75,7 +93,7 @@ Styled.Left = styled.div`
|
|||||||
|
|
||||||
Styled.Header = styled.header<{ hasSeparator?: boolean }>`
|
Styled.Header = styled.header<{ hasSeparator?: boolean }>`
|
||||||
${layoutMixins.spacedRow}
|
${layoutMixins.spacedRow}
|
||||||
padding: 1rem 1rem;
|
padding: var(--panel-paddingY) var(--panel-paddingX);
|
||||||
|
|
||||||
${({ hasSeparator }) =>
|
${({ hasSeparator }) =>
|
||||||
hasSeparator &&
|
hasSeparator &&
|
||||||
@@ -94,5 +112,5 @@ Styled.Content = styled.div`
|
|||||||
${layoutMixins.scrollArea}
|
${layoutMixins.scrollArea}
|
||||||
${layoutMixins.stickyArea0}
|
${layoutMixins.stickyArea0}
|
||||||
--stickyArea0-background: transparent;
|
--stickyArea0-background: transparent;
|
||||||
padding: 1rem 1rem;
|
padding: var(--panel-content-paddingY) var(--panel-content-paddingX);
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -7,13 +7,15 @@ import { ButtonShape, ButtonSize } from '@/constants/buttons';
|
|||||||
import { useBreakpoints } from '@/hooks';
|
import { useBreakpoints } from '@/hooks';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
import { type BaseButtonProps } from '@/components/BaseButton';
|
import { type BaseButtonProps } from '@/components/BaseButton';
|
||||||
import { ToggleButton } from '@/components/ToggleButton';
|
import { ToggleButton } from '@/components/ToggleButton';
|
||||||
|
|
||||||
type ElementProps<MenuItemValue extends string> = {
|
type ElementProps<MenuItemValue extends string> = {
|
||||||
items: MenuItem<MenuItemValue>[];
|
items: MenuItem<MenuItemValue>[];
|
||||||
value: MenuItemValue;
|
value: MenuItemValue;
|
||||||
onValueChange: (value: MenuItemValue) => void;
|
onValueChange: (value: any) => void;
|
||||||
|
onInteraction?: () => void;
|
||||||
|
ensureSelected?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StyleProps = {
|
type StyleProps = {
|
||||||
@@ -25,10 +27,14 @@ export const ToggleGroup = forwardRef(
|
|||||||
{
|
{
|
||||||
items,
|
items,
|
||||||
value,
|
value,
|
||||||
|
ensureSelected = true,
|
||||||
onValueChange,
|
onValueChange,
|
||||||
|
onInteraction,
|
||||||
|
|
||||||
className,
|
className,
|
||||||
size,
|
size,
|
||||||
shape = ButtonShape.Pill,
|
shape = ButtonShape.Pill,
|
||||||
|
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}: ElementProps<MenuItemValue> & StyleProps & BaseButtonProps,
|
}: ElementProps<MenuItemValue> & StyleProps & BaseButtonProps,
|
||||||
ref: Ref<HTMLDivElement>
|
ref: Ref<HTMLDivElement>
|
||||||
@@ -40,12 +46,17 @@ export const ToggleGroup = forwardRef(
|
|||||||
ref={ref}
|
ref={ref}
|
||||||
type="single"
|
type="single"
|
||||||
value={value}
|
value={value}
|
||||||
onValueChange={onValueChange}
|
onValueChange={(newValue: MenuItemValue) => {
|
||||||
|
if ((ensureSelected && newValue) || !ensureSelected) {
|
||||||
|
onValueChange(newValue);
|
||||||
|
}
|
||||||
|
onInteraction?.();
|
||||||
|
}}
|
||||||
className={className}
|
className={className}
|
||||||
loop
|
loop
|
||||||
>
|
>
|
||||||
{items.map((item) => (
|
{items.map((item) => (
|
||||||
<Item key={item.value} value={item.value} aria-label={item.label} asChild>
|
<Item key={item.value} value={item.value} asChild>
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
size={size ? size : isTablet ? ButtonSize.Small : ButtonSize.XSmall}
|
size={size ? size : isTablet ? ButtonSize.Small : ButtonSize.XSmall}
|
||||||
shape={shape}
|
shape={shape}
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import { MarketFilters, MARKET_FILTER_LABELS, type MarketData } from '@/constant
|
|||||||
import { getAssets } from '@/state/assetsSelectors';
|
import { getAssets } from '@/state/assetsSelectors';
|
||||||
import { getPerpetualMarkets } from '@/state/perpetualsSelectors';
|
import { getPerpetualMarkets } from '@/state/perpetualsSelectors';
|
||||||
|
|
||||||
|
import { isTruthy } from '@/lib/isTruthy';
|
||||||
|
|
||||||
const filterFunctions = {
|
const filterFunctions = {
|
||||||
[MarketFilters.ALL]: (market: MarketData) => true,
|
[MarketFilters.ALL]: () => true,
|
||||||
[MarketFilters.LAYER_1]: (market: MarketData) => {
|
[MarketFilters.LAYER_1]: (market: MarketData) => {
|
||||||
return market.asset.tags?.toArray().includes('Layer 1');
|
return market.asset.tags?.toArray().includes('Layer 1');
|
||||||
},
|
},
|
||||||
@@ -28,13 +30,15 @@ export const useMarketsData = (
|
|||||||
const allAssets = useSelector(getAssets, shallowEqual) || {};
|
const allAssets = useSelector(getAssets, shallowEqual) || {};
|
||||||
|
|
||||||
const markets = useMemo(() => {
|
const markets = useMemo(() => {
|
||||||
return Object.values(allPerpetualMarkets).map((marketData) => ({
|
return Object.values(allPerpetualMarkets)
|
||||||
asset: allAssets[marketData.assetId],
|
.filter(isTruthy)
|
||||||
tickSizeDecimals: marketData.configs?.tickSizeDecimals,
|
.map((marketData) => ({
|
||||||
...marketData,
|
asset: allAssets[marketData.assetId],
|
||||||
...marketData.perpetual,
|
tickSizeDecimals: marketData.configs?.tickSizeDecimals,
|
||||||
...marketData.configs,
|
...marketData,
|
||||||
})) as MarketData[];
|
...marketData.perpetual,
|
||||||
|
...marketData.configs,
|
||||||
|
})) as MarketData[];
|
||||||
}, [allPerpetualMarkets, allAssets]);
|
}, [allPerpetualMarkets, allAssets]);
|
||||||
|
|
||||||
const filteredMarkets = useMemo(() => {
|
const filteredMarkets = useMemo(() => {
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ import { AlertType } from '@/constants/alerts';
|
|||||||
import { AbacusOrderStatus, ORDER_SIDES } from '@/constants/abacus';
|
import { AbacusOrderStatus, ORDER_SIDES } from '@/constants/abacus';
|
||||||
import { DialogTypes } from '@/constants/dialogs';
|
import { DialogTypes } from '@/constants/dialogs';
|
||||||
import { STRING_KEYS, StringKey } from '@/constants/localization';
|
import { STRING_KEYS, StringKey } from '@/constants/localization';
|
||||||
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
import { type NotificationTypeConfig, NotificationType } from '@/constants/notifications';
|
import { type NotificationTypeConfig, NotificationType } from '@/constants/notifications';
|
||||||
import { ORDER_SIDE_STRINGS } from '@/constants/trade';
|
import { ORDER_SIDE_STRINGS } from '@/constants/trade';
|
||||||
|
|
||||||
|
import { useSelectedNetwork } from '@/hooks';
|
||||||
import { useLocalNotifications } from '@/hooks/useLocalNotifications';
|
import { useLocalNotifications } from '@/hooks/useLocalNotifications';
|
||||||
|
|
||||||
import { Icon, IconName } from '@/components/Icon';
|
import { Icon, IconName } from '@/components/Icon';
|
||||||
@@ -23,7 +25,6 @@ import { OrderStatusIcon } from '@/views/OrderStatusIcon';
|
|||||||
|
|
||||||
import { useStringGetter } from './useStringGetter';
|
import { useStringGetter } from './useStringGetter';
|
||||||
import { TransferStatusSteps } from '@/views/TransferStatusSteps';
|
import { TransferStatusSteps } from '@/views/TransferStatusSteps';
|
||||||
import { TESTNET_CHAIN_ID } from '@dydxprotocol/v4-client-js';
|
|
||||||
|
|
||||||
export const notificationTypes = [
|
export const notificationTypes = [
|
||||||
{
|
{
|
||||||
@@ -124,6 +125,7 @@ export const notificationTypes = [
|
|||||||
useTrigger: ({ trigger }) => {
|
useTrigger: ({ trigger }) => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { transferNotifications } = useLocalNotifications();
|
const { transferNotifications } = useLocalNotifications();
|
||||||
|
const { selectedNetwork } = useSelectedNetwork();
|
||||||
|
|
||||||
const getTitleStringKey = useCallback((type: 'deposit' | 'withdrawal', finished: boolean) => {
|
const getTitleStringKey = useCallback((type: 'deposit' | 'withdrawal', finished: boolean) => {
|
||||||
if (type === 'deposit' && !finished) return STRING_KEYS.DEPOSIT_IN_PROGRESS;
|
if (type === 'deposit' && !finished) return STRING_KEYS.DEPOSIT_IN_PROGRESS;
|
||||||
@@ -136,7 +138,7 @@ export const notificationTypes = [
|
|||||||
for (const transfer of transferNotifications) {
|
for (const transfer of transferNotifications) {
|
||||||
const { fromChainId, status, txHash, toAmount } = transfer;
|
const { fromChainId, status, txHash, toAmount } = transfer;
|
||||||
const finished = Boolean(status) && status?.squidTransactionStatus !== 'ongoing';
|
const finished = Boolean(status) && status?.squidTransactionStatus !== 'ongoing';
|
||||||
const type = fromChainId === TESTNET_CHAIN_ID ? 'withdrawal' : 'deposit';
|
const type = fromChainId === ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId ? 'withdrawal' : 'deposit';
|
||||||
// @ts-ignore status.errors is not in the type definition but can be returned
|
// @ts-ignore status.errors is not in the type definition but can be returned
|
||||||
const error = status?.errors?.length ? status?.errors[0] : status?.error;
|
const error = status?.errors?.length ? status?.errors[0] : status?.error;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,11 @@ const useSquidContext = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const squid = useMemo(
|
const squid = useMemo(
|
||||||
() => new Squid({ baseUrl: ENVIRONMENT_CONFIG_MAP[selectedNetwork]?.endpoints['0xsquid'] }),
|
() =>
|
||||||
|
new Squid({
|
||||||
|
baseUrl: ENVIRONMENT_CONFIG_MAP[selectedNetwork]?.endpoints['0xsquid'],
|
||||||
|
integratorId: ENVIRONMENT_CONFIG_MAP[selectedNetwork]?.squidIntegratorId,
|
||||||
|
}),
|
||||||
[selectedNetwork]
|
[selectedNetwork]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
||||||
|
<g clip-path="url(#clip0_18204_36775)">
|
||||||
|
<path d="M13.2426 6.25736C14.0817 7.09647 14.6531 8.16557 14.8846 9.32946C15.1162 10.4933 14.9973 11.6997 14.5432 12.7961C14.0891 13.8925 13.32 14.8295 12.3334 15.4888C11.3467 16.1481 10.1866 16.5 8.99993 16.5C7.81324 16.5 6.6532 16.1481 5.66651 15.4888C4.67981 14.8295 3.91078 13.8925 3.45665 12.7961C3.00253 11.6997 2.88371 10.4933 3.11522 9.32946C3.34673 8.16557 3.91817 7.09647 4.75729 6.25736" stroke="#C8C7D8" stroke-width="1.35" stroke-linecap="round"/>
|
||||||
|
<path d="M11.25 9L9 11.25M9 11.25L6.75 9M9 11.25V1.6875" stroke="#C8C7D8" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip0_18204_36775">
|
||||||
|
<rect width="18" height="18" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 886 B |
@@ -19,6 +19,7 @@ export { default as CoinsIcon } from './coins.svg';
|
|||||||
export { default as CommentIcon } from './comment.svg';
|
export { default as CommentIcon } from './comment.svg';
|
||||||
export { default as CopyIcon } from './copy.svg';
|
export { default as CopyIcon } from './copy.svg';
|
||||||
export { default as CubeIcon } from './cube.svg';
|
export { default as CubeIcon } from './cube.svg';
|
||||||
|
export { default as DepositIcon } from './deposit.svg';
|
||||||
export { default as DepthChartIcon } from './depth-chart.svg';
|
export { default as DepthChartIcon } from './depth-chart.svg';
|
||||||
export { default as DiscordIcon } from './discord.svg';
|
export { default as DiscordIcon } from './discord.svg';
|
||||||
export { default as ExportKeysIcon } from './export-keys.svg';
|
export { default as ExportKeysIcon } from './export-keys.svg';
|
||||||
@@ -59,6 +60,7 @@ export { default as TransferIcon } from './transfer.svg';
|
|||||||
export { default as TriangleIcon } from './triangle.svg';
|
export { default as TriangleIcon } from './triangle.svg';
|
||||||
export { default as TryAgainIcon } from './try-again.svg';
|
export { default as TryAgainIcon } from './try-again.svg';
|
||||||
export { default as WarningIcon } from './warning.svg';
|
export { default as WarningIcon } from './warning.svg';
|
||||||
|
export { default as WithdrawIcon } from './withdraw.svg';
|
||||||
|
|
||||||
// Wallets
|
// Wallets
|
||||||
export { default as BitkeepIcon } from './wallets/bitkeep.svg';
|
export { default as BitkeepIcon } from './wallets/bitkeep.svg';
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
||||||
|
<path d="M13.2426 6.2573C14.0817 7.09641 14.6531 8.16551 14.8846 9.3294C15.1162 10.4933 14.9973 11.6997 14.5432 12.796C14.0891 13.8924 13.32 14.8295 12.3334 15.4888C11.3467 16.148 10.1866 16.4999 8.99993 16.4999C7.81324 16.4999 6.6532 16.148 5.66651 15.4888C4.67981 14.8295 3.91078 13.8924 3.45665 12.796C3.00253 11.6997 2.88371 10.4933 3.11522 9.3294C3.34673 8.16551 3.91817 7.09641 4.75729 6.2573" stroke="#C8C7D8" stroke-width="1.35" stroke-linecap="round"/>
|
||||||
|
<path d="M11.25 2.9375L9 0.6875M9 0.6875L6.75 2.9375M9 0.6875V10.25" stroke="#C8C7D8" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 723 B |
+10
-6
@@ -180,7 +180,7 @@ Styled.MobileProfileLayout = styled.div`
|
|||||||
${layoutMixins.contentContainerPage}
|
${layoutMixins.contentContainerPage}
|
||||||
|
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
padding: 1rem;
|
padding: 1.25rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Header = styled.header`
|
Styled.Header = styled.header`
|
||||||
@@ -278,13 +278,17 @@ Styled.RewardsPanel = styled(Panel)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.TablePanel = styled(Panel)`
|
Styled.TablePanel = styled(Panel)`
|
||||||
max-width: calc(100vw - 2rem);
|
--panel-content-paddingY: 0;
|
||||||
max-height: 10rem;
|
--panel-content-paddingX: 0;
|
||||||
margin-top: 0.5rem;
|
|
||||||
padding: 0;
|
> div > div {
|
||||||
border-radius: 0.875rem;
|
margin-top: 0.5rem;
|
||||||
|
--scrollArea-height: 10rem;
|
||||||
|
border-radius: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
|
max-height: 10rem;
|
||||||
--tableCell-padding: 0.25rem 1rem;
|
--tableCell-padding: 0.25rem 1rem;
|
||||||
--tableRow-backgroundColor: var(--color-layer-3);
|
--tableRow-backgroundColor: var(--color-layer-3);
|
||||||
background-color: var(--color-layer-3);
|
background-color: var(--color-layer-3);
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ export const AccountDetailsAndHistory = () => {
|
|||||||
key: 'BuyingPower',
|
key: 'BuyingPower',
|
||||||
labelKey: STRING_KEYS.BUYING_POWER,
|
labelKey: STRING_KEYS.BUYING_POWER,
|
||||||
type: OutputType.Fiat,
|
type: OutputType.Fiat,
|
||||||
value: buyingPower?.current,
|
value: MustBigNumber(buyingPower?.current).lt(0) ? undefined : buyingPower?.current, // show '-' when buying power is negative
|
||||||
},
|
},
|
||||||
].filter(isTruthy);
|
].filter(isTruthy);
|
||||||
|
|
||||||
|
|||||||
+131
-106
@@ -1,12 +1,12 @@
|
|||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { Nullable } from '@dydxprotocol/v4-abacus';
|
import { Nullable } from '@dydxprotocol/v4-abacus';
|
||||||
import styled, { AnyStyledComponent } from 'styled-components';
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
|
|
||||||
import { FeeTier } from '@/constants/abacus';
|
import { FeeTier } from '@/constants/abacus';
|
||||||
import { FEE_DECIMALS, QUANTUM_MULTIPLIER } from '@/constants/numbers';
|
import { FEE_DECIMALS } from '@/constants/numbers';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { useAccounts, useBreakpoints, useStringGetter } from '@/hooks';
|
import { useBreakpoints, useStringGetter } from '@/hooks';
|
||||||
import { breakpoints } from '@/styles';
|
import { breakpoints } from '@/styles';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
import { tableMixins } from '@/styles/tableMixins';
|
import { tableMixins } from '@/styles/tableMixins';
|
||||||
@@ -29,9 +29,8 @@ const EQUALITY_SYMBOL_MAP = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const Fees = () => {
|
export const Fees = () => {
|
||||||
const { dydxAddress } = useAccounts();
|
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { isNotTablet } = useBreakpoints();
|
const { isTablet, isNotTablet } = useBreakpoints();
|
||||||
const userFeeTier = useSelector(getUserFeeTier, shallowEqual);
|
const userFeeTier = useSelector(getUserFeeTier, shallowEqual);
|
||||||
const userStats = useSelector(getUserStats, shallowEqual);
|
const userStats = useSelector(getUserStats, shallowEqual);
|
||||||
const feeTiers = useSelector(getFeeTiers, shallowEqual);
|
const feeTiers = useSelector(getFeeTiers, shallowEqual);
|
||||||
@@ -56,28 +55,28 @@ export const Fees = () => {
|
|||||||
<Styled.AdditionalConditions>
|
<Styled.AdditionalConditions>
|
||||||
{!isAdditional && !totalShare && !makerShare && <Output type={OutputType.Text} />}
|
{!isAdditional && !totalShare && !makerShare && <Output type={OutputType.Text} />}
|
||||||
{!!totalShare && (
|
{!!totalShare && (
|
||||||
<Styled.TextRow>
|
<Styled.AdditionalConditionsText>
|
||||||
{isAdditional && <span>{stringGetter({ key: STRING_KEYS.AND })}</span>}
|
{isAdditional && stringGetter({ key: STRING_KEYS.AND })}{' '}
|
||||||
<span>{stringGetter({ key: STRING_KEYS.EXCHANGE_MARKET_SHARE })}</span>
|
{stringGetter({ key: STRING_KEYS.EXCHANGE_MARKET_SHARE })}{' '}
|
||||||
<Styled.Highlighted>{'>'}</Styled.Highlighted>
|
<Styled.Highlighted>{'>'}</Styled.Highlighted>{' '}
|
||||||
<Styled.HighlightOutput
|
<Styled.HighlightOutput
|
||||||
type={OutputType.Percent}
|
type={OutputType.Percent}
|
||||||
value={totalShare}
|
value={totalShare}
|
||||||
fractionDigits={0}
|
fractionDigits={0}
|
||||||
/>
|
/>
|
||||||
</Styled.TextRow>
|
</Styled.AdditionalConditionsText>
|
||||||
)}
|
)}
|
||||||
{!!makerShare && (
|
{!!makerShare && (
|
||||||
<Styled.TextRow>
|
<Styled.AdditionalConditionsText>
|
||||||
{isAdditional && <span>{stringGetter({ key: STRING_KEYS.AND })}</span>}
|
{isAdditional && stringGetter({ key: STRING_KEYS.AND })}{' '}
|
||||||
<span>{stringGetter({ key: STRING_KEYS.MAKER_MARKET_SHARE })}</span>
|
{stringGetter({ key: STRING_KEYS.MAKER_MARKET_SHARE })}{' '}
|
||||||
<Styled.Highlighted>{'>'}</Styled.Highlighted>
|
<Styled.Highlighted>{'>'}</Styled.Highlighted>{' '}
|
||||||
<Styled.HighlightOutput
|
<Styled.HighlightOutput
|
||||||
type={OutputType.Percent}
|
type={OutputType.Percent}
|
||||||
value={makerShare}
|
value={makerShare}
|
||||||
fractionDigits={0}
|
fractionDigits={0}
|
||||||
/>
|
/>
|
||||||
</Styled.TextRow>
|
</Styled.AdditionalConditionsText>
|
||||||
)}
|
)}
|
||||||
</Styled.AdditionalConditions>
|
</Styled.AdditionalConditions>
|
||||||
),
|
),
|
||||||
@@ -103,91 +102,90 @@ export const Fees = () => {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<div>
|
|
||||||
<Styled.FeeTable
|
<Styled.FeeTable
|
||||||
label="Fee Tiers"
|
label="Fee Tiers"
|
||||||
data={feeTiers || []}
|
data={feeTiers || []}
|
||||||
getRowKey={(row: FeeTier) => row.tier}
|
getRowKey={(row: FeeTier) => row.tier}
|
||||||
getRowAttributes={(row: FeeTier) => ({
|
getRowAttributes={(row: FeeTier) => ({
|
||||||
'data-yours': row.tier === userFeeTier,
|
'data-yours': row.tier === userFeeTier,
|
||||||
})}
|
})}
|
||||||
columns={(
|
columns={(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
columnKey: 'tier',
|
columnKey: 'tier',
|
||||||
getCellValue: (row) => row.tier,
|
getCellValue: (row) => row.tier,
|
||||||
label: stringGetter({ key: STRING_KEYS.TIER }),
|
label: stringGetter({ key: STRING_KEYS.TIER }),
|
||||||
allowsSorting: false,
|
allowsSorting: false,
|
||||||
renderCell: ({ tier }) => (
|
renderCell: ({ tier }) => (
|
||||||
<Styled.Tier>
|
<Styled.Tier>
|
||||||
<Styled.Output type={OutputType.Text} value={tier} />
|
<Styled.Output type={OutputType.Text} value={tier} />
|
||||||
{tier === userFeeTier && (
|
{tier === userFeeTier && (
|
||||||
<Styled.YouTag size={TagSize.Medium}>
|
<Styled.YouTag size={TagSize.Medium}>
|
||||||
{stringGetter({ key: STRING_KEYS.YOU })}
|
{stringGetter({ key: STRING_KEYS.YOU })}
|
||||||
</Styled.YouTag>
|
</Styled.YouTag>
|
||||||
)}
|
)}
|
||||||
</Styled.Tier>
|
</Styled.Tier>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
columnKey: 'volume',
|
columnKey: 'volume',
|
||||||
getCellValue: (row) => row.volume,
|
getCellValue: (row) => row.volume,
|
||||||
label: stringGetter({ key: STRING_KEYS.VOLUME_30D }),
|
label: stringGetter({ key: STRING_KEYS.VOLUME_30D }),
|
||||||
allowsSorting: false,
|
allowsSorting: false,
|
||||||
renderCell: ({ symbol, volume, makerShare, totalShare }) => (
|
renderCell: ({ symbol, volume, makerShare, totalShare }) => (
|
||||||
<>
|
<>
|
||||||
<span>{`${
|
<span>{`${
|
||||||
symbol in EQUALITY_SYMBOL_MAP
|
symbol in EQUALITY_SYMBOL_MAP
|
||||||
? EQUALITY_SYMBOL_MAP[symbol as keyof typeof EQUALITY_SYMBOL_MAP]
|
? EQUALITY_SYMBOL_MAP[symbol as keyof typeof EQUALITY_SYMBOL_MAP]
|
||||||
: symbol
|
: symbol
|
||||||
} `}</span>
|
} `}</span>
|
||||||
<Styled.HighlightOutput type={OutputType.CompactFiat} value={volume} />
|
<Styled.HighlightOutput type={OutputType.CompactFiat} value={volume} />
|
||||||
{!isNotTablet &&
|
{isTablet &&
|
||||||
AdditionalConditions({ totalShare, makerShare, isAdditional: true })}
|
AdditionalConditions({ totalShare, makerShare, isAdditional: true })}
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
isNotTablet && {
|
isNotTablet && {
|
||||||
columnKey: 'condition',
|
columnKey: 'condition',
|
||||||
getCellValue: (row) => row.volume,
|
getCellValue: (row) => row.volume,
|
||||||
label: stringGetter({ key: STRING_KEYS.ADDITIONAL_CONDITION }),
|
label: stringGetter({ key: STRING_KEYS.ADDITIONAL_CONDITION }),
|
||||||
allowsSorting: false,
|
allowsSorting: false,
|
||||||
renderCell: ({ totalShare, makerShare }) =>
|
renderCell: ({ totalShare, makerShare }) =>
|
||||||
AdditionalConditions({ totalShare, makerShare }),
|
AdditionalConditions({ totalShare, makerShare }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
columnKey: 'maker',
|
columnKey: 'maker',
|
||||||
getCellValue: (row) => row.maker,
|
getCellValue: (row) => row.maker,
|
||||||
label: stringGetter({ key: STRING_KEYS.MAKER }),
|
label: stringGetter({ key: STRING_KEYS.MAKER }),
|
||||||
allowsSorting: false,
|
allowsSorting: false,
|
||||||
renderCell: ({ maker }) => (
|
renderCell: ({ maker }) => (
|
||||||
<Styled.HighlightOutput
|
<Styled.HighlightOutput
|
||||||
type={OutputType.SmallPercent}
|
type={OutputType.SmallPercent}
|
||||||
value={maker}
|
value={maker}
|
||||||
fractionDigits={FEE_DECIMALS}
|
fractionDigits={FEE_DECIMALS}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
columnKey: 'taker',
|
columnKey: 'taker',
|
||||||
getCellValue: (row) => row.taker,
|
getCellValue: (row) => row.taker,
|
||||||
label: stringGetter({ key: STRING_KEYS.TAKER }),
|
label: stringGetter({ key: STRING_KEYS.TAKER }),
|
||||||
allowsSorting: false,
|
allowsSorting: false,
|
||||||
renderCell: ({ taker }) => (
|
renderCell: ({ taker }) => (
|
||||||
<Styled.HighlightOutput
|
<Styled.HighlightOutput
|
||||||
type={OutputType.SmallPercent}
|
type={OutputType.SmallPercent}
|
||||||
value={taker}
|
value={taker}
|
||||||
fractionDigits={FEE_DECIMALS}
|
fractionDigits={FEE_DECIMALS}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
] as ColumnDef<FeeTier>[]
|
] as ColumnDef<FeeTier>[]
|
||||||
).filter(isTruthy)}
|
).filter(isTruthy)}
|
||||||
selectionBehavior="replace"
|
selectionBehavior="replace"
|
||||||
withOuterBorder={isNotTablet}
|
withOuterBorder={isNotTablet}
|
||||||
withInnerBorders
|
withInnerBorders
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</Styled.ContentWrapper>
|
</Styled.ContentWrapper>
|
||||||
</AttachedExpandingSection>
|
</AttachedExpandingSection>
|
||||||
);
|
);
|
||||||
@@ -198,21 +196,43 @@ const Styled: Record<string, AnyStyledComponent> = {};
|
|||||||
Styled.ContentWrapper = styled.div`
|
Styled.ContentWrapper = styled.div`
|
||||||
${layoutMixins.flexColumn}
|
${layoutMixins.flexColumn}
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
|
max-width: 100vw;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.AdditionalConditions = styled.div`
|
Styled.AdditionalConditions = styled.div`
|
||||||
${tableMixins.cellContentColumn}
|
${tableMixins.cellContentColumn}
|
||||||
|
justify-content: end;
|
||||||
|
|
||||||
color: var(--color-text-0);
|
color: var(--color-text-0);
|
||||||
|
font: var(--font-small-book);
|
||||||
|
|
||||||
> :nth-child(2) {
|
> :nth-child(2) {
|
||||||
font: var(--font-base-book);
|
font: var(--font-small-book);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.AdditionalConditionsText = styled.span`
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5ch;
|
||||||
|
|
||||||
|
@media ${breakpoints.mobile} {
|
||||||
|
display: inline;
|
||||||
|
max-width: 8rem;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
output {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.FeesDetails = styled(Details)`
|
Styled.FeesDetails = styled(Details)`
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
|
||||||
|
@media ${breakpoints.notTablet} {
|
||||||
|
margin: 0 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
@media ${breakpoints.tablet} {
|
||||||
padding: 1rem 1rem 0 1rem;
|
padding: 1rem 1rem 0 1rem;
|
||||||
--details-grid-numColumns: 1;
|
--details-grid-numColumns: 1;
|
||||||
@@ -237,11 +257,7 @@ Styled.FeesDetails = styled(Details)`
|
|||||||
}
|
}
|
||||||
|
|
||||||
output {
|
output {
|
||||||
font: var(--font-medium-book);
|
font: var(--font-base-book);
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
|
||||||
font: var(--font-base-book);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -271,6 +287,11 @@ Styled.FeeTable = styled(Table)`
|
|||||||
|
|
||||||
font: var(--font-base-book);
|
font: var(--font-base-book);
|
||||||
|
|
||||||
|
@media ${breakpoints.mobile} {
|
||||||
|
--tableCell-padding: 1rem 1.25rem;
|
||||||
|
font: var(--font-small-book);
|
||||||
|
}
|
||||||
|
|
||||||
tbody tr {
|
tbody tr {
|
||||||
&[data-yours='true'] {
|
&[data-yours='true'] {
|
||||||
background-color: var(--color-layer-3);
|
background-color: var(--color-layer-3);
|
||||||
@@ -283,6 +304,10 @@ Styled.FeeTable = styled(Table)`
|
|||||||
|
|
||||||
@media ${breakpoints.notTablet} {
|
@media ${breakpoints.notTablet} {
|
||||||
--tableHeader-backgroundColor: var(--color-layer-1);
|
--tableHeader-backgroundColor: var(--color-layer-1);
|
||||||
|
|
||||||
|
thead tr {
|
||||||
|
--border-width: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ export const DYDXBalancePanel = () => {
|
|||||||
const { chainTokenLabel } = useTokenConfigs();
|
const { chainTokenLabel } = useTokenConfigs();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Panel
|
<Styled.Panel
|
||||||
slotHeader={
|
slotHeader={
|
||||||
<Styled.Header>
|
<Styled.Header>
|
||||||
<Styled.Title>
|
<Styled.Title>
|
||||||
{/* <AssetIcon symbol="DYDX" /> */}
|
<AssetIcon symbol={chainTokenLabel} />
|
||||||
{chainTokenLabel}
|
{chainTokenLabel}
|
||||||
</Styled.Title>
|
</Styled.Title>
|
||||||
<Styled.ReceiveAndTransferButtons>
|
<Styled.ReceiveAndTransferButtons>
|
||||||
@@ -117,14 +117,19 @@ export const DYDXBalancePanel = () => {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Styled.Content>
|
</Styled.Content>
|
||||||
</Panel>
|
</Styled.Panel>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
|
Styled.Panel = styled(Panel)`
|
||||||
|
--panel-paddingX: 1.5rem;
|
||||||
|
`;
|
||||||
|
|
||||||
Styled.Header = styled.div`
|
Styled.Header = styled.div`
|
||||||
${layoutMixins.spacedRow}
|
${layoutMixins.spacedRow}
|
||||||
|
gap: 1rem;
|
||||||
padding: 1rem 1.5rem 0;
|
padding: 1rem 1.5rem 0;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -177,7 +182,7 @@ Styled.WalletAndStakedBalance = styled(Details)`
|
|||||||
--details-item-backgroundColor: var(--color-layer-6);
|
--details-item-backgroundColor: var(--color-layer-6);
|
||||||
|
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
gap: 0.5rem;
|
gap: 1rem;
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export const MigratePanel = () => {
|
|||||||
</Styled.Description>
|
</Styled.Description>
|
||||||
</Styled.MigratePanel>
|
</Styled.MigratePanel>
|
||||||
) : (
|
) : (
|
||||||
<Styled.MobileMigratePanel
|
<Styled.MigratePanel
|
||||||
slotHeader={
|
slotHeader={
|
||||||
<Styled.MobileMigrateHeader>
|
<Styled.MobileMigrateHeader>
|
||||||
<h3>
|
<h3>
|
||||||
@@ -88,49 +88,52 @@ export const MigratePanel = () => {
|
|||||||
</Styled.MobileMigrateHeader>
|
</Styled.MobileMigrateHeader>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Styled.WithReceipt
|
<Styled.Column>
|
||||||
slotReceipt={
|
<Styled.WithReceipt
|
||||||
<Styled.Details
|
slotReceipt={
|
||||||
items={[
|
<Styled.Details
|
||||||
{
|
items={[
|
||||||
key: 'available-to-migrate',
|
{
|
||||||
label: (
|
key: 'available-to-migrate',
|
||||||
<Styled.InlineRow>
|
label: (
|
||||||
{stringGetter({ key: STRING_KEYS.AVAILABLE_TO_MIGRATE })}
|
<Styled.InlineRow>
|
||||||
<Tag>DYDX</Tag>
|
{stringGetter({ key: STRING_KEYS.AVAILABLE_TO_MIGRATE })}
|
||||||
</Styled.InlineRow>
|
<Tag>DYDX</Tag>
|
||||||
),
|
</Styled.InlineRow>
|
||||||
value: <Output type={OutputType.Asset} value={tokenBalance} />,
|
),
|
||||||
},
|
value: <Output type={OutputType.Asset} value={tokenBalance} />,
|
||||||
]}
|
},
|
||||||
/>
|
]}
|
||||||
}
|
/>
|
||||||
>
|
}
|
||||||
{import.meta.env.VITE_TOKEN_MIGRATION_URI && (
|
>
|
||||||
<Button
|
{import.meta.env.VITE_TOKEN_MIGRATION_URI && (
|
||||||
action={tokenBalance ? ButtonAction.Primary : ButtonAction.Base}
|
<Button
|
||||||
size={ButtonSize.Medium}
|
action={tokenBalance ? ButtonAction.Primary : ButtonAction.Base}
|
||||||
slotRight={<Icon iconName={IconName.LinkOut} />}
|
size={ButtonSize.Medium}
|
||||||
href={import.meta.env.VITE_TOKEN_MIGRATION_URI}
|
slotRight={<Icon iconName={IconName.LinkOut} />}
|
||||||
>
|
href={import.meta.env.VITE_TOKEN_MIGRATION_URI}
|
||||||
{stringGetter({ key: STRING_KEYS.MIGRATE_NOW })}
|
>
|
||||||
</Button>
|
{stringGetter({ key: STRING_KEYS.MIGRATE_NOW })}
|
||||||
)}
|
</Button>
|
||||||
</Styled.WithReceipt>
|
)}
|
||||||
<Styled.InlineRow>
|
</Styled.WithReceipt>
|
||||||
{stringGetter({ key: STRING_KEYS.WANT_TO_LEARN })}
|
<Styled.InlineRow>
|
||||||
<Link href={TOKEN_MIGRATION_LEARN_MORE_LINK} withIcon>
|
{stringGetter({ key: STRING_KEYS.WANT_TO_LEARN })}
|
||||||
{stringGetter({ key: STRING_KEYS.CLICK_HERE })}
|
<Link href={TOKEN_MIGRATION_LEARN_MORE_LINK} withIcon>
|
||||||
</Link>
|
{stringGetter({ key: STRING_KEYS.CLICK_HERE })}
|
||||||
</Styled.InlineRow>
|
</Link>
|
||||||
</Styled.MobileMigratePanel>
|
</Styled.InlineRow>
|
||||||
|
</Styled.Column>
|
||||||
|
</Styled.MigratePanel>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
Styled.MigratePanel = styled(Panel)`
|
Styled.MigratePanel = styled(Panel)`
|
||||||
padding: 1rem 1.5rem;
|
--panel-paddingX: 1.5rem;
|
||||||
|
width: 100%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Title = styled.h3`
|
Styled.Title = styled.h3`
|
||||||
@@ -163,10 +166,9 @@ Styled.Description = styled.div`
|
|||||||
--link-color: var(--color-text-1);
|
--link-color: var(--color-text-1);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.MobileMigratePanel = styled(Panel)`
|
Styled.Column = styled.div`
|
||||||
${layoutMixins.flexColumn}
|
${layoutMixins.flexColumn}
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -40,11 +40,7 @@ export const RewardsPage = () => {
|
|||||||
<Styled.Page>
|
<Styled.Page>
|
||||||
{import.meta.env.VITE_V3_TOKEN_ADDRESS && <MigratePanel />}
|
{import.meta.env.VITE_V3_TOKEN_ADDRESS && <MigratePanel />}
|
||||||
<Styled.PanelRow>
|
<Styled.PanelRow>
|
||||||
{isTablet && (
|
{isTablet && <DYDXBalancePanel />}
|
||||||
<Styled.BalancePanelContainer>
|
|
||||||
<DYDXBalancePanel />
|
|
||||||
</Styled.BalancePanelContainer>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Styled.Panel
|
<Styled.Panel
|
||||||
slotHeader={<Styled.Title>{stringGetter({ key: STRING_KEYS.GOVERNANCE })}</Styled.Title>}
|
slotHeader={<Styled.Title>{stringGetter({ key: STRING_KEYS.GOVERNANCE })}</Styled.Title>}
|
||||||
@@ -72,11 +68,7 @@ export const RewardsPage = () => {
|
|||||||
</Styled.Description>
|
</Styled.Description>
|
||||||
</Styled.Panel>
|
</Styled.Panel>
|
||||||
|
|
||||||
{isNotTablet && (
|
{isNotTablet && <DYDXBalancePanel />}
|
||||||
<Styled.BalancePanelContainer>
|
|
||||||
<DYDXBalancePanel />
|
|
||||||
</Styled.BalancePanelContainer>
|
|
||||||
)}
|
|
||||||
</Styled.PanelRow>
|
</Styled.PanelRow>
|
||||||
</Styled.Page>
|
</Styled.Page>
|
||||||
);
|
);
|
||||||
@@ -87,10 +79,26 @@ const Styled: Record<string, AnyStyledComponent> = {};
|
|||||||
Styled.Page = styled.div`
|
Styled.Page = styled.div`
|
||||||
${layoutMixins.contentContainerPage}
|
${layoutMixins.contentContainerPage}
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
|
padding: 2rem;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
--content-max-width: 70rem;
|
||||||
|
max-width: min(calc(100vw - 4rem), var(--content-max-width));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media ${breakpoints.tablet} {
|
||||||
|
padding: 1.25rem;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
max-width: calc(100vw - 2.5rem);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Panel = styled(Panel)`
|
Styled.Panel = styled(Panel)`
|
||||||
padding: 1rem 1.5rem;
|
--panel-paddingX: 1.5rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Title = styled.h3`
|
Styled.Title = styled.h3`
|
||||||
@@ -105,27 +113,14 @@ Styled.Description = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.PanelRow = styled.div`
|
Styled.PanelRow = styled.div`
|
||||||
${layoutMixins.spacedRow}
|
${layoutMixins.gridEqualColumns}
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
max-width: min(100vw, var(--content-max-width));
|
|
||||||
align-items: flex-start;
|
|
||||||
|
|
||||||
> section {
|
align-items: flex-start;
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
@media ${breakpoints.tablet} {
|
||||||
grid-auto-flow: row;
|
grid-auto-flow: row;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
max-width: auto;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.BalancePanelContainer = styled.div`
|
|
||||||
width: 21.25rem;
|
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
|
||||||
width: auto;
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -135,5 +130,5 @@ Styled.IconButton = styled(IconButton)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Arrow = styled.div`
|
Styled.Arrow = styled.div`
|
||||||
padding: 1rem 1.5rem;
|
padding: 1rem;
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -227,8 +227,8 @@ export const HorizontalPanel = ({ isOpen = true, setIsOpen }: ElementProps) => {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
value={view}
|
value={view}
|
||||||
onValueChange={(newView: string) => {
|
onValueChange={setView}
|
||||||
setView((newView || view) as PanelView);
|
onInteraction={() => {
|
||||||
setIsOpen?.(true);
|
setIsOpen?.(true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -151,7 +151,10 @@ export const AccountInfoConnectedState = () => {
|
|||||||
),
|
),
|
||||||
label: stringGetter({ key: STRING_KEYS.BUYING_POWER }),
|
label: stringGetter({ key: STRING_KEYS.BUYING_POWER }),
|
||||||
type: OutputType.Fiat,
|
type: OutputType.Fiat,
|
||||||
value: buyingPower,
|
value:
|
||||||
|
MustBigNumber(buyingPower?.current).lt(0) && buyingPower?.postOrder === null
|
||||||
|
? undefined
|
||||||
|
: buyingPower,
|
||||||
},
|
},
|
||||||
].map(
|
].map(
|
||||||
({
|
({
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const MarketFilter = ({
|
|||||||
<>
|
<>
|
||||||
{!isSearch && (
|
{!isSearch && (
|
||||||
<ToggleGroup
|
<ToggleGroup
|
||||||
items={Object.entries(filters).map(([key, value]) => ({
|
items={Object.values(filters).map((value) => ({
|
||||||
label: stringGetter({ key: MARKET_FILTER_LABELS[value] }),
|
label: stringGetter({ key: MARKET_FILTER_LABELS[value] }),
|
||||||
value,
|
value,
|
||||||
}))}
|
}))}
|
||||||
|
|||||||
@@ -198,8 +198,6 @@ Styled.Details = styled(Details)`
|
|||||||
@media ${breakpoints.tablet} {
|
@media ${breakpoints.tablet} {
|
||||||
${layoutMixins.withOuterAndInnerBorders}
|
${layoutMixins.withOuterAndInnerBorders}
|
||||||
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
|
|
||||||
font: var(--font-small-book);
|
font: var(--font-small-book);
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
|
|||||||
@@ -246,9 +246,7 @@ export const FundingChart = ({ selectedLocale }: ElementProps) => {
|
|||||||
}[rate] || '',
|
}[rate] || '',
|
||||||
}))}
|
}))}
|
||||||
value={fundingRateView}
|
value={fundingRateView}
|
||||||
onValueChange={(newRate: FundingRateResolution) => {
|
onValueChange={setFundingRateView}
|
||||||
if (newRate) setFundingRateView(newRate);
|
|
||||||
}}
|
|
||||||
size={ButtonSize.XSmall}
|
size={ButtonSize.XSmall}
|
||||||
/>
|
/>
|
||||||
</Styled.FundingRateToggle>
|
</Styled.FundingRateToggle>
|
||||||
|
|||||||
@@ -73,9 +73,7 @@ export const TradeDialog = ({ isOpen, setIsOpen, slotTrigger }: ElementProps) =>
|
|||||||
<Styled.ToggleGroup
|
<Styled.ToggleGroup
|
||||||
items={allTradeTypeItems}
|
items={allTradeTypeItems}
|
||||||
value={selectedTradeType}
|
value={selectedTradeType}
|
||||||
onValueChange={(tradeType: TradeTypes) =>
|
onValueChange={onTradeTypeChange}
|
||||||
onTradeTypeChange(tradeType || selectedTradeType)
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { type FormEvent, useCallback, useEffect, useMemo, useState } from 'react
|
|||||||
import styled, { type AnyStyledComponent } from 'styled-components';
|
import styled, { type AnyStyledComponent } from 'styled-components';
|
||||||
import { type NumberFormatValues } from 'react-number-format';
|
import { type NumberFormatValues } from 'react-number-format';
|
||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
import { TESTNET_CHAIN_ID } from '@dydxprotocol/v4-client-js';
|
|
||||||
import { parseUnits } from 'viem'
|
import { parseUnits } from 'viem'
|
||||||
|
|
||||||
import erc20 from '@/abi/erc20.json';
|
import erc20 from '@/abi/erc20.json';
|
||||||
@@ -10,10 +9,11 @@ import { TransferInputField, TransferInputTokenResource, TransferType } from '@/
|
|||||||
import { AlertType } from '@/constants/alerts';
|
import { AlertType } from '@/constants/alerts';
|
||||||
import { ButtonSize } from '@/constants/buttons';
|
import { ButtonSize } from '@/constants/buttons';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
import { NumberSign } from '@/constants/numbers';
|
import { NumberSign } from '@/constants/numbers';
|
||||||
import type { EvmAddress } from '@/constants/wallets';
|
import type { EvmAddress } from '@/constants/wallets';
|
||||||
|
|
||||||
import { useAccounts, useDebounce, useStringGetter } from '@/hooks';
|
import { useAccounts, useDebounce, useStringGetter, useSelectedNetwork } from '@/hooks';
|
||||||
import { useAccountBalance, CHAIN_DEFAULT_TOKEN_ADDRESS } from '@/hooks/useAccountBalance';
|
import { useAccountBalance, CHAIN_DEFAULT_TOKEN_ADDRESS } from '@/hooks/useAccountBalance';
|
||||||
import { useLocalNotifications } from '@/hooks/useLocalNotifications';
|
import { useLocalNotifications } from '@/hooks/useLocalNotifications';
|
||||||
import { NATIVE_TOKEN_ADDRESS, useSquid } from '@/hooks/useSquid';
|
import { NATIVE_TOKEN_ADDRESS, useSquid } from '@/hooks/useSquid';
|
||||||
@@ -54,6 +54,7 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
|||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const [error, setError] = useState<Error | null>(null);
|
const [error, setError] = useState<Error | null>(null);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const { selectedNetwork } = useSelectedNetwork();
|
||||||
|
|
||||||
const { evmAddress, signerWagmi } = useAccounts();
|
const { evmAddress, signerWagmi } = useAccounts();
|
||||||
const { publicClientWagmi } = useWalletConnection();
|
const { publicClientWagmi } = useWalletConnection();
|
||||||
@@ -239,7 +240,7 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
|||||||
if (txHash) {
|
if (txHash) {
|
||||||
addTransferNotification({
|
addTransferNotification({
|
||||||
txHash: txHash,
|
txHash: txHash,
|
||||||
toChainId: TESTNET_CHAIN_ID,
|
toChainId: ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId,
|
||||||
fromChainId: chainIdStr || undefined,
|
fromChainId: chainIdStr || undefined,
|
||||||
toAmount: summary?.usdcSize || undefined,
|
toAmount: summary?.usdcSize || undefined,
|
||||||
triggeredAt: Date.now(),
|
triggeredAt: Date.now(),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { type Dispatch, type SetStateAction, useState, type ReactNode } from 'react';
|
import { type Dispatch, type SetStateAction, useState, type ReactNode } from 'react';
|
||||||
import styled, { type AnyStyledComponent, } from 'styled-components';
|
import styled, { type AnyStyledComponent } from 'styled-components';
|
||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
import type { RouteData } from '@0xsquid/sdk';
|
import type { RouteData } from '@0xsquid/sdk';
|
||||||
|
|
||||||
@@ -32,6 +32,8 @@ import { WithReceipt } from '@/components/WithReceipt';
|
|||||||
import { getSubaccountBuyingPower, getSubaccountEquity } from '@/state/accountSelectors';
|
import { getSubaccountBuyingPower, getSubaccountEquity } from '@/state/accountSelectors';
|
||||||
import { getTransferInputs } from '@/state/inputsSelectors';
|
import { getTransferInputs } from '@/state/inputsSelectors';
|
||||||
|
|
||||||
|
import { MustBigNumber } from '@/lib/numbers';
|
||||||
|
|
||||||
import { SlippageEditor } from '../SlippageEditor';
|
import { SlippageEditor } from '../SlippageEditor';
|
||||||
|
|
||||||
type ElementProps = {
|
type ElementProps = {
|
||||||
@@ -131,7 +133,7 @@ export const DepositButtonAndReceipt = ({
|
|||||||
value: (
|
value: (
|
||||||
<DiffOutput
|
<DiffOutput
|
||||||
type={OutputType.Fiat}
|
type={OutputType.Fiat}
|
||||||
value={buyingPower}
|
value={MustBigNumber(buyingPower).lt(0) ? undefined : buyingPower}
|
||||||
newValue={newBuyingPower}
|
newValue={newBuyingPower}
|
||||||
sign={NumberSign.Positive}
|
sign={NumberSign.Positive}
|
||||||
withDiff={Boolean(newBuyingPower) && buyingPower !== newBuyingPower}
|
withDiff={Boolean(newBuyingPower) && buyingPower !== newBuyingPower}
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import type { ChangeEvent, FormEvent } from 'react';
|
|||||||
import styled, { type AnyStyledComponent } from 'styled-components';
|
import styled, { type AnyStyledComponent } from 'styled-components';
|
||||||
import type { NumberFormatValues } from 'react-number-format';
|
import type { NumberFormatValues } from 'react-number-format';
|
||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
import { TESTNET_CHAIN_ID } from '@dydxprotocol/v4-client-js';
|
|
||||||
import { isAddress } from 'viem';
|
import { isAddress } from 'viem';
|
||||||
|
|
||||||
import { TransferInputField, TransferInputTokenResource, TransferType } from '@/constants/abacus';
|
import { TransferInputField, TransferInputTokenResource, TransferType } from '@/constants/abacus';
|
||||||
import { AlertType } from '@/constants/alerts';
|
import { AlertType } from '@/constants/alerts';
|
||||||
import { ButtonSize } from '@/constants/buttons';
|
import { ButtonSize } from '@/constants/buttons';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
import { NumberSign } from '@/constants/numbers';
|
import { NumberSign } from '@/constants/numbers';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
useDebounce,
|
useDebounce,
|
||||||
useDydxClient,
|
useDydxClient,
|
||||||
useRestrictions,
|
useRestrictions,
|
||||||
|
useSelectedNetwork,
|
||||||
useStringGetter,
|
useStringGetter,
|
||||||
useSubaccount,
|
useSubaccount,
|
||||||
} from '@/hooks';
|
} from '@/hooks';
|
||||||
@@ -52,6 +53,7 @@ export const WithdrawForm = () => {
|
|||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const [error, setError] = useState<string>();
|
const [error, setError] = useState<string>();
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const { selectedNetwork } = useSelectedNetwork();
|
||||||
|
|
||||||
const { sendSquidWithdraw } = useSubaccount();
|
const { sendSquidWithdraw } = useSubaccount();
|
||||||
const { freeCollateral } = useSelector(getSubaccount, shallowEqual) || {};
|
const { freeCollateral } = useSelector(getSubaccount, shallowEqual) || {};
|
||||||
@@ -164,7 +166,7 @@ export const WithdrawForm = () => {
|
|||||||
const hash = `0x${Buffer.from(txHash.hash).toString('hex')}`;
|
const hash = `0x${Buffer.from(txHash.hash).toString('hex')}`;
|
||||||
addTransferNotification({
|
addTransferNotification({
|
||||||
txHash: hash,
|
txHash: hash,
|
||||||
fromChainId: TESTNET_CHAIN_ID,
|
fromChainId: ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId,
|
||||||
toChainId: chainIdStr || undefined,
|
toChainId: chainIdStr || undefined,
|
||||||
toAmount: debouncedAmountBN.toNumber(),
|
toAmount: debouncedAmountBN.toNumber(),
|
||||||
triggeredAt: Date.now(),
|
triggeredAt: Date.now(),
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ export const ClosePositionForm = ({
|
|||||||
value: value.toString(),
|
value: value.toString(),
|
||||||
}))}
|
}))}
|
||||||
value={percent?.toString() ?? ''}
|
value={percent?.toString() ?? ''}
|
||||||
onValueChange={(value: any) => onSelectPercentage((value || percent?.toString()) ?? '')}
|
onValueChange={onSelectPercentage}
|
||||||
shape={ButtonShape.Rectangle}
|
shape={ButtonShape.Rectangle}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -153,9 +153,7 @@ export const MarketLeverageInput = ({
|
|||||||
value: MustBigNumber(leverageAmount).toFixed(LEVERAGE_DECIMALS),
|
value: MustBigNumber(leverageAmount).toFixed(LEVERAGE_DECIMALS),
|
||||||
}))}
|
}))}
|
||||||
value={MustBigNumber(formattedLeverageValue).abs().toFixed(LEVERAGE_DECIMALS)} // sign agnostic
|
value={MustBigNumber(formattedLeverageValue).abs().toFixed(LEVERAGE_DECIMALS)} // sign agnostic
|
||||||
onValueChange={(option?: number) =>
|
onValueChange={updateLeverage}
|
||||||
updateLeverage(option === undefined ? formattedLeverageValue : option)
|
|
||||||
}
|
|
||||||
shape={ButtonShape.Rectangle}
|
shape={ButtonShape.Rectangle}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import { truncateAddress } from '@/lib/wallet';
|
|||||||
|
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
import { headerMixins } from '@/styles/headerMixins';
|
import { headerMixins } from '@/styles/headerMixins';
|
||||||
|
import { MustBigNumber } from '@/lib/numbers';
|
||||||
|
|
||||||
export const AccountMenu = () => {
|
export const AccountMenu = () => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
@@ -49,6 +50,8 @@ export const AccountMenu = () => {
|
|||||||
|
|
||||||
const { evmAddress, walletType, dydxAddress, hdKey } = useAccounts();
|
const { evmAddress, walletType, dydxAddress, hdKey } = useAccounts();
|
||||||
|
|
||||||
|
const usdcBalance = freeCollateral?.current || 0;
|
||||||
|
|
||||||
const onRecoverKeys = () => {
|
const onRecoverKeys = () => {
|
||||||
dispatch(openDialog({ type: DialogTypes.Onboarding }));
|
dispatch(openDialog({ type: DialogTypes.Onboarding }));
|
||||||
};
|
};
|
||||||
@@ -122,7 +125,11 @@ export const AccountMenu = () => {
|
|||||||
</Styled.label>
|
</Styled.label>
|
||||||
<Styled.BalanceOutput type={OutputType.Asset} value={nativeTokenBalance} />
|
<Styled.BalanceOutput type={OutputType.Asset} value={nativeTokenBalance} />
|
||||||
</div>
|
</div>
|
||||||
<AssetActions asset={DydxChainAsset.CHAINTOKEN} dispatch={dispatch} />
|
<AssetActions
|
||||||
|
asset={DydxChainAsset.CHAINTOKEN}
|
||||||
|
dispatch={dispatch}
|
||||||
|
hasBalance={nativeTokenBalance.gt(0)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
@@ -135,11 +142,16 @@ export const AccountMenu = () => {
|
|||||||
</Styled.label>
|
</Styled.label>
|
||||||
<Styled.BalanceOutput
|
<Styled.BalanceOutput
|
||||||
type={OutputType.Asset}
|
type={OutputType.Asset}
|
||||||
value={freeCollateral?.current || 0}
|
value={usdcBalance}
|
||||||
fractionDigits={2}
|
fractionDigits={2}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<AssetActions asset={DydxChainAsset.USDC} dispatch={dispatch} />
|
<AssetActions
|
||||||
|
asset={DydxChainAsset.USDC}
|
||||||
|
dispatch={dispatch}
|
||||||
|
hasBalance={MustBigNumber(usdcBalance).gt(0)}
|
||||||
|
withOnboarding
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Styled.Balances>
|
</Styled.Balances>
|
||||||
</Styled.AccountInfo>
|
</Styled.AccountInfo>
|
||||||
@@ -212,28 +224,48 @@ export const AccountMenu = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const AssetActions = memo(({ asset, dispatch }: { asset: DydxChainAsset; dispatch: Dispatch }) => (
|
const AssetActions = memo(
|
||||||
<Styled.InlineRow>
|
({
|
||||||
{[
|
asset,
|
||||||
// TODO(@rosepuppy): Add withdraw action for USDC
|
dispatch,
|
||||||
{
|
withOnboarding,
|
||||||
dialogType: DialogTypes.Receive,
|
hasBalance,
|
||||||
iconName: IconName.Qr,
|
}: {
|
||||||
},
|
asset: DydxChainAsset;
|
||||||
{ dialogType: DialogTypes.Transfer, iconName: IconName.Send },
|
dispatch: Dispatch;
|
||||||
].map(({ iconName, dialogType }) => (
|
withOnboarding?: boolean;
|
||||||
<IconButton
|
hasBalance?: boolean;
|
||||||
key={dialogType}
|
}) => (
|
||||||
action={ButtonAction.Base}
|
<Styled.InlineRow>
|
||||||
shape={ButtonShape.Square}
|
{[
|
||||||
iconName={iconName}
|
withOnboarding &&
|
||||||
onClick={() =>
|
hasBalance && {
|
||||||
dispatch(openDialog({ type: dialogType, dialogProps: { selectedAsset: asset } }))
|
dialogType: DialogTypes.Withdraw,
|
||||||
}
|
iconName: IconName.Withdraw,
|
||||||
/>
|
},
|
||||||
))}
|
withOnboarding && {
|
||||||
</Styled.InlineRow>
|
dialogType: DialogTypes.Deposit,
|
||||||
));
|
iconName: IconName.Deposit,
|
||||||
|
},
|
||||||
|
hasBalance && {
|
||||||
|
dialogType: DialogTypes.Transfer,
|
||||||
|
dialogProps: { selectedAsset: asset },
|
||||||
|
iconName: IconName.Send,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
.filter(isTruthy)
|
||||||
|
.map(({ iconName, dialogType, dialogProps }) => (
|
||||||
|
<Styled.IconButton
|
||||||
|
key={dialogType}
|
||||||
|
action={ButtonAction.Base}
|
||||||
|
shape={ButtonShape.Square}
|
||||||
|
iconName={iconName}
|
||||||
|
onClick={() => dispatch(openDialog({ type: dialogType, dialogProps }))}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Styled.InlineRow>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
@@ -351,3 +383,7 @@ Styled.ConnectToChain = styled(Styled.Column)`
|
|||||||
font: var(--font-small-book);
|
font: var(--font-small-book);
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
Styled.IconButton = styled(IconButton)`
|
||||||
|
--button-padding: 0 0.25rem;
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
import { groupBy } from 'lodash';
|
import { groupBy } from 'lodash';
|
||||||
|
|
||||||
import { type Notification, NotificationStatus } from '@/constants/notifications';
|
import { type Notification, NotificationStatus } from '@/constants/notifications';
|
||||||
|
|
||||||
|
import { useBreakpoints } from '@/hooks';
|
||||||
import { useNotifications } from '@/hooks/useNotifications';
|
import { useNotifications } from '@/hooks/useNotifications';
|
||||||
|
import { CloseIcon } from '@/icons';
|
||||||
|
|
||||||
import { Button } from '@/components/Button';
|
import { Button } from '@/components/Button';
|
||||||
import { ButtonAction, ButtonSize } from '@/constants/buttons';
|
import { ButtonAction, ButtonSize } from '@/constants/buttons';
|
||||||
@@ -13,10 +16,6 @@ import { DialogPlacement } from '@/components/Dialog';
|
|||||||
import { Output, OutputType } from '@/components/Output';
|
import { Output, OutputType } from '@/components/Output';
|
||||||
import { IconButton } from '@/components/IconButton';
|
import { IconButton } from '@/components/IconButton';
|
||||||
import { Toolbar } from '@/components/Toolbar';
|
import { Toolbar } from '@/components/Toolbar';
|
||||||
import { CloseIcon } from '@/icons';
|
|
||||||
|
|
||||||
import styled from 'styled-components';
|
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
|
||||||
|
|
||||||
type ElementProps = {
|
type ElementProps = {
|
||||||
slotTrigger?: React.ReactNode;
|
slotTrigger?: React.ReactNode;
|
||||||
@@ -27,6 +26,7 @@ export const NotificationsMenu = ({
|
|||||||
slotTrigger,
|
slotTrigger,
|
||||||
placement = DialogPlacement.Sidebar,
|
placement = DialogPlacement.Sidebar,
|
||||||
}: ElementProps) => {
|
}: ElementProps) => {
|
||||||
|
const { isTablet } = useBreakpoints();
|
||||||
const {
|
const {
|
||||||
notifications,
|
notifications,
|
||||||
getDisplayData,
|
getDisplayData,
|
||||||
@@ -173,6 +173,7 @@ export const NotificationsMenu = ({
|
|||||||
</$FooterToolbar>
|
</$FooterToolbar>
|
||||||
}
|
}
|
||||||
placement={placement}
|
placement={placement}
|
||||||
|
preventClose={isTablet}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user