Skip to content

Commit

Permalink
fix: #252: fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
VanishMax committed Jan 8, 2025
1 parent d25eb6b commit e0a0aaa
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 19 deletions.
13 changes: 12 additions & 1 deletion apps/extension/src/routes/popup/home/assets-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { ValueViewComponent } from '@repo/ui/components/ui/value';
import { ValueView } from '@penumbra-zone/protobuf/penumbra/core/asset/v1/asset_pb';
import { getDisplayDenomFromView, getEquivalentValues } from '@penumbra-zone/getters/value-view';
import { getMetadataFromBalancesResponse } from '@penumbra-zone/getters/balances-response';
import { asValueView } from '@penumbra-zone/getters/equivalent-value';
import { useQuery } from '@tanstack/react-query';
import { viewClient } from '../../../clients';
Expand Down Expand Up @@ -44,7 +45,17 @@ export const AssetsTable = ({ account }: AssetsTableProps) => {
queryKey: ['balances', account],
staleTime: Infinity,
queryFn: async () => {
return Array.fromAsync(viewClient.balances({ accountFilter: { account } }));
try {
const balances = await Array.fromAsync(viewClient.balances({ accountFilter: { account } }));
balances.sort((a, b) => {
const aScore = getMetadataFromBalancesResponse.optional(a)?.priorityScore ?? 0n;
const bScore = getMetadataFromBalancesResponse.optional(b)?.priorityScore ?? 0n;
return Number(bScore - aScore);
});
return balances;
} catch (_) {
return [];
}
},
});

Expand Down
35 changes: 20 additions & 15 deletions apps/extension/src/routes/popup/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,31 @@ export const PopupIndex = () => {

return (
<>
<BlockSync />
<div className='fixed inset-0 h-full bg-logoImg bg-[left_-180px] bg-no-repeat pointer-events-none' />
<div className='fixed inset-0 h-full bg-logo pointer-events-none' />

<div className='flex h-full grow flex-col items-stretch gap-[15px] bg-logo bg-[left_-180px] px-[15px] pb-[15px]'>
<IndexHeader />
<div className='z-[1] flex flex-col h-full'>
<BlockSync />

<div className='flex flex-col gap-4'>
{activeWallet && (
<SelectAccount
index={index}
setIndex={setIndex}
getAddrByIndex={getAddrByIndex(activeWallet)}
/>
)}
</div>
<div className='flex h-full grow flex-col items-stretch gap-[15px] px-[15px] pb-[15px]'>
<IndexHeader />

<div className='flex flex-col gap-4'>
{activeWallet && (
<SelectAccount
index={index}
setIndex={setIndex}
getAddrByIndex={getAddrByIndex(activeWallet)}
/>
)}
</div>

<ValidateAddress />
<ValidateAddress />

<FrontendLink />
<FrontendLink />

<AssetsTable account={index} />
<AssetsTable account={index} />
</div>
</div>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/routes/popup/popup-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const PopupLayout = () => {
usePopupReady();

return (
<div className='flex grow flex-col bg-card-radial'>
<div className='relative flex grow flex-col bg-card-radial'>
<Outlet />
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/tailwind-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ export default {
linear-gradient(
color-mix(in srgb, var(--charcoal) 80%, transparent),
color-mix(in srgb, var(--charcoal) 80%, transparent)
),
url('penumbra-logo.svg')
)
`,
logoImg: `url('penumbra-logo.svg')`,
},
},
},
Expand Down

0 comments on commit e0a0aaa

Please sign in to comment.