From 8ff963cef2822bcb2e49994ad9b2fdfe43cd0a91 Mon Sep 17 00:00:00 2001 From: oskarvu Date: Tue, 17 Dec 2024 14:34:01 +0700 Subject: [PATCH 1/5] Remove and replace base devnet icon --- .../select-network/views/SelectNetworkDialogView.stories.ts | 2 +- packages/app/src/ui/assets/chains/baseDevNet.svg | 3 --- packages/app/src/ui/assets/index.ts | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 packages/app/src/ui/assets/chains/baseDevNet.svg diff --git a/packages/app/src/features/dialogs/select-network/views/SelectNetworkDialogView.stories.ts b/packages/app/src/features/dialogs/select-network/views/SelectNetworkDialogView.stories.ts index 8c6d85b19..2090e7b8d 100644 --- a/packages/app/src/features/dialogs/select-network/views/SelectNetworkDialogView.stories.ts +++ b/packages/app/src/features/dialogs/select-network/views/SelectNetworkDialogView.stories.ts @@ -28,7 +28,7 @@ const meta: Meta = { onSelect: () => {}, }, { - logo: assets.chain.baseDevNet, + logo: assets.chain.base, name: 'Base', supportedPages: ['Savings', 'Farms'], selected: false, diff --git a/packages/app/src/ui/assets/chains/baseDevNet.svg b/packages/app/src/ui/assets/chains/baseDevNet.svg deleted file mode 100644 index a084bf510..000000000 --- a/packages/app/src/ui/assets/chains/baseDevNet.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/app/src/ui/assets/index.ts b/packages/app/src/ui/assets/index.ts index ab372d579..4efe2854e 100644 --- a/packages/app/src/ui/assets/index.ts +++ b/packages/app/src/ui/assets/index.ts @@ -18,7 +18,6 @@ import symbolDark from './brand/symbol-dark.svg' import symbolGradient from './brand/symbol-gradient.svg' import symboLight from './brand/symbol-light.svg' import base from './chains/base.svg' -import baseDevNet from './chains/baseDevNet.svg' import ethereum from './chains/ethereum.svg' import gnosis from './chains/gnosis.svg' import checkCircle from './check-circle.svg' @@ -162,7 +161,6 @@ export const assets = { gnosis, ethereum, unknown, - baseDevNet, base, }, token: { From 39dd730fbaa5cc24e1c44510bf95a33c420b293c Mon Sep 17 00:00:00 2001 From: oskarvu Date: Tue, 17 Dec 2024 14:34:38 +0700 Subject: [PATCH 2/5] Make sure savings opportunity layout works correctly --- .../savings/components/savings-opportunity/components/Card.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/src/features/savings/components/savings-opportunity/components/Card.tsx b/packages/app/src/features/savings/components/savings-opportunity/components/Card.tsx index 3550cdf76..b979cfe16 100644 --- a/packages/app/src/features/savings/components/savings-opportunity/components/Card.tsx +++ b/packages/app/src/features/savings/components/savings-opportunity/components/Card.tsx @@ -14,7 +14,7 @@ export function Card({ children, hasNoCash }: CardProps) { spacing="m" className={cn( 'grid grid-cols-1 gap-8 bg-center bg-cover', - 'bg-savings-opportunity-panel bg-no-repeat lg:grid-cols-[3fr_2fr]', + 'bg-savings-opportunity-panel bg-no-repeat xl:grid-cols-[3fr_2fr]', hasNoCash && 'gap-6 lg:grid-cols-1', )} data-testid={testIds.savings.opportunity.panel} From 492f16cf3170e5e38b60139026776c4ca619c22c Mon Sep 17 00:00:00 2001 From: oskarvu Date: Tue, 17 Dec 2024 14:34:58 +0700 Subject: [PATCH 3/5] Change savings token card header --- .../components/savings-token-panel/SavingsTokenPanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/src/features/savings/components/savings-token-panel/SavingsTokenPanel.tsx b/packages/app/src/features/savings/components/savings-token-panel/SavingsTokenPanel.tsx index eb7d57095..a50c65750 100644 --- a/packages/app/src/features/savings/components/savings-token-panel/SavingsTokenPanel.tsx +++ b/packages/app/src/features/savings/components/savings-token-panel/SavingsTokenPanel.tsx @@ -56,7 +56,7 @@ export function SavingsTokenPanel({
- {savingsType === 'sdai' ? 'Savings DAI' : 'Savings USDS'} + {savingsType === 'sdai' ? 'DAI Savings' : 'USDS Savings'}
From 99b4ba7671eee6aac5a8b628c8ac36add72f5bde Mon Sep 17 00:00:00 2001 From: oskarvu Date: Tue, 17 Dec 2024 14:38:28 +0700 Subject: [PATCH 4/5] Display chains for which savings are available --- packages/app/src/config/chain/index.ts | 21 +++++++++++++++++-- .../components/Explainer.tsx | 12 +++++------ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/packages/app/src/config/chain/index.ts b/packages/app/src/config/chain/index.ts index 97eeb975a..f86e336db 100644 --- a/packages/app/src/config/chain/index.ts +++ b/packages/app/src/config/chain/index.ts @@ -19,7 +19,7 @@ import { base, gnosis, mainnet } from 'viem/chains' import { NATIVE_ASSET_MOCK_ADDRESS, infoSkyApiUrl } from '../consts' import { AppConfig } from '../feature-flags' import { PLAYWRIGHT_USDS_CONTRACTS_NOT_AVAILABLE_KEY } from '../wagmi/config.e2e' -import { farmAddresses, farmStablecoinsEntryGroup, susdsAddresses } from './constants' +import { SUPPORTED_CHAINS, farmAddresses, farmStablecoinsEntryGroup, susdsAddresses } from './constants' import { ChainConfigEntry, ChainMeta, SupportedChainId } from './types' const commonTokenSymbolToReplacedName = { @@ -308,7 +308,7 @@ const chainConfig: Record = { psmStables: [TokenSymbol('USDC'), TokenSymbol('USDS')], meta: { name: 'Base', - logo: assets.chain.baseDevNet, + logo: assets.chain.base, }, tokensWithMalformedApprove: [], permitSupport: {}, @@ -348,6 +348,23 @@ const chainConfig: Record = { }, } +export const featureAvailability = (function getFeatureAvailability(): Record< + 'savings' | 'markets' | 'farms', + SupportedChainId[] +> { + // @note: using SUPPORTED_CHAIN instead of Object.values(chainConfig) to maintain chains order, + // since chain config members are automatically sorted in js (object key is a number). + const getSupportedChains = (predicate: (config: ChainConfigEntry) => boolean) => + SUPPORTED_CHAINS.map((chain) => chainConfig[chain.id]) + .filter(predicate) + .map((config) => config.originChainId) + return { + savings: getSupportedChains((config) => config.savings !== undefined), + markets: getSupportedChains((config) => config.markets !== undefined), + farms: getSupportedChains((config) => config.farms !== undefined), + } +})() + export function getChainConfigEntry(chainId: number): ChainConfigEntry { const sandboxConfig = useStore.getState().appConfig.sandbox const sandbox = useStore.getState().sandbox.network diff --git a/packages/app/src/features/savings/components/savings-opportunity/components/Explainer.tsx b/packages/app/src/features/savings/components/savings-opportunity/components/Explainer.tsx index 87486c6da..f97d60e30 100644 --- a/packages/app/src/features/savings/components/savings-opportunity/components/Explainer.tsx +++ b/packages/app/src/features/savings/components/savings-opportunity/components/Explainer.tsx @@ -1,4 +1,4 @@ -import { getChainConfigEntry } from '@/config/chain' +import { featureAvailability, getChainConfigEntry } from '@/config/chain' import { SupportedChainId } from '@/config/chain/types' import { USD_MOCK_TOKEN } from '@/domain/types/Token' import { TokenSymbol } from '@/domain/types/TokenSymbol' @@ -6,7 +6,7 @@ import { SavingsMeta } from '@/features/savings/logic/makeSavingsMeta' import { getTokenImage } from '@/ui/assets' import { testIds } from '@/ui/utils/testIds' import { NormalizedUnitNumber } from '@marsfoundation/common-universal' -import { ArrowRightIcon } from 'lucide-react' +import { SlashIcon } from 'lucide-react' export interface ExplainerProps { stablecoinValue?: NormalizedUnitNumber @@ -16,7 +16,7 @@ export interface ExplainerProps { export function Explainer({ stablecoinValue, savingsMeta, originChainId }: ExplainerProps) { const { stablecoin, rateName } = savingsMeta.primary - const { savings, sdaiSymbol, susdsSymbol } = getChainConfigEntry(originChainId) + const { savings } = getChainConfigEntry(originChainId) return (
@@ -24,9 +24,9 @@ export function Explainer({ stablecoinValue, savingsMeta, originChainId }: Expla {savings?.inputTokens.map((symbol) => ( ))} - - {[sdaiSymbol, susdsSymbol].filter(Boolean).map((symbol) => ( - + + {featureAvailability.savings.map((chainId) => ( + ))}
From c36c3e094552d8178fd9b8c3c2c4fa07bce816ab Mon Sep 17 00:00:00 2001 From: oskarvu Date: Tue, 17 Dec 2024 15:20:41 +0700 Subject: [PATCH 5/5] Fix lint --- packages/app/src/config/chain/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/app/src/config/chain/index.ts b/packages/app/src/config/chain/index.ts index f86e336db..94630321c 100644 --- a/packages/app/src/config/chain/index.ts +++ b/packages/app/src/config/chain/index.ts @@ -354,10 +354,11 @@ export const featureAvailability = (function getFeatureAvailability(): Record< > { // @note: using SUPPORTED_CHAIN instead of Object.values(chainConfig) to maintain chains order, // since chain config members are automatically sorted in js (object key is a number). - const getSupportedChains = (predicate: (config: ChainConfigEntry) => boolean) => - SUPPORTED_CHAINS.map((chain) => chainConfig[chain.id]) + function getSupportedChains(predicate: (config: ChainConfigEntry) => boolean): SupportedChainId[] { + return SUPPORTED_CHAINS.map((chain) => chainConfig[chain.id]) .filter(predicate) .map((config) => config.originChainId) + } return { savings: getSupportedChains((config) => config.savings !== undefined), markets: getSupportedChains((config) => config.markets !== undefined),