-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into multi-fees-max
- Loading branch information
Showing
19 changed files
with
145 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'minifront': patch | ||
--- | ||
|
||
Combine active + upcoming auctions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'minifront': patch | ||
--- | ||
|
||
Fix issue where the connect page wasn't rendered right on some routes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 32 additions & 24 deletions
56
apps/minifront/src/components/shared/selectors/balance-item.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,64 @@ | ||
import { BalanceOrMetadata, isBalance, isMetadata } from './helpers'; | ||
import { getAddressIndex } from '@penumbra-zone/getters/address-view'; | ||
import { getMetadataFromBalancesResponseOptional } from '@penumbra-zone/getters/balances-response'; | ||
import { | ||
getMetadataFromBalancesResponse, | ||
getMetadataFromBalancesResponseOptional, | ||
} from '@penumbra-zone/getters/balances-response'; | ||
import { useMemo } from 'react'; | ||
import { DialogClose } from '@repo/ui/components/ui/dialog'; | ||
import { cn } from '@repo/ui/lib/utils'; | ||
import { AssetIcon } from '@repo/ui/components/ui/asset-icon'; | ||
import { ValueViewComponent } from '@repo/ui/components/ui/value'; | ||
import { TableCell, TableRow } from '@repo/ui/components/ui/table'; | ||
import { BalancesResponse } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/view/v1/view_pb'; | ||
|
||
interface BalanceItemProps { | ||
asset: BalanceOrMetadata; | ||
value?: BalanceOrMetadata; | ||
value?: BalancesResponse; | ||
onSelect: (value: BalanceOrMetadata) => void; | ||
} | ||
|
||
export const BalanceItem = ({ asset, value, onSelect }: BalanceItemProps) => { | ||
const account = isBalance(asset) ? getAddressIndex(asset.accountAddress).account : undefined; | ||
const metadata = isMetadata(asset) ? asset : getMetadataFromBalancesResponseOptional(asset); | ||
const metadataFromAsset = isMetadata(asset) | ||
? asset | ||
: getMetadataFromBalancesResponseOptional(asset); | ||
const metadataFromValue = getMetadataFromBalancesResponse.optional()(value); | ||
|
||
const isSelected = useMemo(() => { | ||
if (!value) return false; | ||
if (isMetadata(value) && isMetadata(asset)) { | ||
return value.equals(asset); | ||
} | ||
if (isBalance(value) && isBalance(asset)) { | ||
return value.equals(asset); | ||
} | ||
if (isBalance(asset)) return value.equals(asset); | ||
if (isMetadata(asset)) return metadataFromValue?.equals(metadataFromAsset); | ||
return false; | ||
}, [asset, value]); | ||
|
||
return ( | ||
<div className='flex flex-col'> | ||
<DialogClose onClick={() => onSelect(asset)}> | ||
<div | ||
className={cn( | ||
'grid grid-cols-5 py-[10px] gap-3 cursor-pointer hover:bg-light-brown hover:px-4 hover:-mx-4 font-bold text-muted-foreground', | ||
isSelected && 'bg-light-brown px-4 -mx-4', | ||
)} | ||
> | ||
<DialogClose asChild onClick={() => onSelect(asset)}> | ||
<TableRow | ||
className={cn( | ||
'cursor-pointer hover:bg-light-brown font-bold text-muted-foreground', | ||
isSelected && 'bg-light-brown', | ||
)} | ||
> | ||
<TableCell>{account}</TableCell> | ||
|
||
<TableCell> | ||
<div className='col-span-2 flex items-center justify-start gap-1'> | ||
<AssetIcon metadata={metadata} /> | ||
<p className='truncate'>{metadata?.symbol ? metadata.symbol : 'Unknown asset'}</p> | ||
<AssetIcon metadata={metadataFromAsset} /> | ||
<p className='truncate'> | ||
{metadataFromAsset?.symbol ? metadataFromAsset.symbol : 'Unknown asset'} | ||
</p> | ||
</div> | ||
</TableCell> | ||
|
||
<TableCell> | ||
<div className='col-span-2 flex justify-end'> | ||
{isBalance(asset) && ( | ||
<ValueViewComponent showIcon={false} showDenom={false} view={asset.balanceView} /> | ||
)} | ||
</div> | ||
|
||
<p className='flex justify-center'>{account}</p> | ||
</div> | ||
</DialogClose> | ||
</div> | ||
</TableCell> | ||
</TableRow> | ||
</DialogClose> | ||
); | ||
}; |
Oops, something went wrong.