Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKheops committed Dec 11, 2024
1 parent 982abc5 commit 69c584a
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,5 @@ export const PortfolioAssetHeader = () => {
// no chart to display, use default header
if (!tokenIds.length) return <DashboardPortfolioHeader />

return <AssetPriceChart tokenIds={tokenIds} className="h-[19.2rem]" variant="large" />
return <AssetPriceChart tokenIds={tokenIds} variant="large" />
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const PageContent = ({ balances, symbol }: { balances: Balances; symbol: string
<div className="shrink-0">{symbol}</div>
<div className="flex grow items-center justify-end gap-3">
<div className="text-body-secondary text-sm">{t("Total")}</div>
<Fiat amount={total} isBalance className="" />
<Fiat amount={total} isBalance />
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/ui/domains/Asset/AssetPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const [useDisplayAssetPrice] = bind((tokenId: TokenId | null | undefined) =>
}).format(rate.change24h / 100)
: undefined

// exclude +0.0% and -0.0%, display nothing in that case
// we dont want a sign (which is used for color check) if change displays as +0.0% or -0.0%
const change24h = rawChange24h?.length
? rawChange24h.slice(1) === "0.0%"
? "0.0%" // we dont want a sign if it's +0.0% or -0.0%
? "0.0%"
: rawChange24h
: undefined

Expand Down
7 changes: 3 additions & 4 deletions apps/extension/src/ui/domains/Asset/AssetPriceChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export const AssetPriceChart: FC<{
{formattedHoveredValue ?? <AssetPrice tokenId={selectedTokenId} noChange />}
</div>
)}

<IconButton onClick={handleCoingeckoClick} className="text-base">
<ExternalLinkIcon />
</IconButton>
Expand Down Expand Up @@ -350,7 +349,7 @@ const Chart: FC<{
mode: "index",
intersect: false,
displayColors: false,
backgroundColor: "#2E3221", // #474E34", // "#616F37",
backgroundColor: "#2E3221",
titleColor: "#d5ff5c",
titleFont: {
size: variant === "large" ? 14 : 12,
Expand Down Expand Up @@ -506,7 +505,7 @@ const TokenSelect: FC<{
</button>
</PopoverTrigger>
<PopoverContent>
<div className="bg-grey-900 rounded p-4">
<div className="bg-grey-900 flex w-full flex-col gap-2 rounded p-4">
{tokens.map((t) => (
<TokenSelectOption
key={t.id}
Expand All @@ -521,7 +520,7 @@ const TokenSelect: FC<{
)
}

export const TokenSelectOption: FC<{ token: Token; selected: boolean; onClick: () => void }> = ({
const TokenSelectOption: FC<{ token: Token; selected: boolean; onClick: () => void }> = ({
token,
selected,
onClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,13 @@ export const DashboardAssetDetails: FC<{ balances: Balances; symbol: string }> =
balances,
symbol,
}) => {
const { balancesByToken: rows } = useAssetDetails(balances)
const { balancesByToken } = useAssetDetails(balances)

if (rows.length === 0) return <NoTokensMessage symbol={symbol} />
if (balancesByToken.length === 0) return <NoTokensMessage symbol={symbol} />

return (
<div className="text-body-secondary">
{rows.map(([tokenId, bal]) => (
{balancesByToken.map(([tokenId, bal]) => (
<TokenBalances key={tokenId} tokenId={tokenId} balances={bal} />
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ import { useAssetDetails } from "./useAssetDetails"
import { BalanceDetailRow, useTokenBalances } from "./useTokenBalances"
import { useUniswapV2BalancePair } from "./useUniswapV2BalancePair"

const ChainTokenBalances: FC<{ tokenId: TokenId; balances: Balances }> = ({
tokenId,
balances,
}) => {
const TokenBalances: FC<{ tokenId: TokenId; balances: Balances }> = ({ tokenId, balances }) => {
const { chainOrNetwork, summary, token, detailRows, status, networkType } = useTokenBalances({
tokenId,
balances,
Expand Down Expand Up @@ -91,7 +88,7 @@ const ChainTokenBalances: FC<{ tokenId: TokenId; balances: Balances }> = ({
balances.sorted
.filter((balance) => balance.total.planck > 0n)
.map((balance, i, balances) => (
<ChainTokenBalancesUniswapV2Row
<TokenBalancesUniswapV2Row
key={balance.id}
balance={balance}
isLastBalance={balances.length === i + 1}
Expand All @@ -102,7 +99,7 @@ const ChainTokenBalances: FC<{ tokenId: TokenId; balances: Balances }> = ({
detailRows
.filter((row) => row.tokens.gt(0))
.map((row, i, rows) => (
<ChainTokenBalancesDetailRow
<TokenBalancesDetailRow
key={row.key}
row={row}
isLastRow={rows.length === i + 1}
Expand All @@ -115,7 +112,7 @@ const ChainTokenBalances: FC<{ tokenId: TokenId; balances: Balances }> = ({
)
}

const ChainTokenBalancesUniswapV2Row = ({
const TokenBalancesUniswapV2Row = ({
balance,
isLastBalance,
status,
Expand Down Expand Up @@ -184,7 +181,7 @@ const ChainTokenBalancesUniswapV2Row = ({
)
}

const ChainTokenBalancesDetailRow = ({
const TokenBalancesDetailRow = ({
row,
isLastRow,
status,
Expand All @@ -195,7 +192,7 @@ const ChainTokenBalancesDetailRow = ({
isLastRow?: boolean
status: BalancesStatus
symbol: string
tokenId?: TokenId // unsafe, there could be multiple aggregated here
tokenId?: TokenId
}) => (
<div
className={classNames(
Expand Down Expand Up @@ -381,7 +378,7 @@ export const PopupAssetDetails: FC<{
<FadeIn>
<div className="flex flex-col gap-8">
{rows.map(([tokenId, bal]) => (
<ChainTokenBalances key={tokenId} tokenId={tokenId} balances={bal} />
<TokenBalances key={tokenId} tokenId={tokenId} balances={bal} />
))}
</div>
</FadeIn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { db } from "../../../db"
import { Migration, MigrationFunction } from "../../../libs/migrations/types"

export const migrateTokenRates: Migration = {
forward: new MigrationFunction(async (_context) => {
await db.tokenRates.clear()
}),
forward: new MigrationFunction(() => db.tokenRates.clear()),
// no way back
}

0 comments on commit 69c584a

Please sign in to comment.