fix: use priceStr for order payment currency in ListingDetail
This commit is contained in:
@@ -7,7 +7,7 @@ import { useOrdersForListing } from '@/hooks/useOrdersForListing'
|
|||||||
import { Badge, STATUS_COLORS } from '@/components/ui/Badge'
|
import { Badge, STATUS_COLORS } from '@/components/ui/Badge'
|
||||||
import { FieldRow, MonoChip } from '@/components/ui/FieldRow'
|
import { FieldRow, MonoChip } from '@/components/ui/FieldRow'
|
||||||
import { Button } from '@/components/ui/Button'
|
import { Button } from '@/components/ui/Button'
|
||||||
import { abbrev, fmtSol, fmtTok } from '@/lib/format'
|
import { abbrev, fmtSol, fmtTok, priceStr } from '@/lib/format'
|
||||||
import type { Address } from '@solisting/sdk'
|
import type { Address } from '@solisting/sdk'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -36,7 +36,7 @@ export function ListingDetail({ pk, walletAddress, onUpdate, onClose, onPlaceOrd
|
|||||||
const canPlace = !isSeller && d.isActive && avail > 0 && walletAddress
|
const canPlace = !isSeller && d.isActive && avail > 0 && walletAddress
|
||||||
const canonicalOracleAddr = isSome(d.canonicalOracle) ? d.canonicalOracle.value : null
|
const canonicalOracleAddr = isSome(d.canonicalOracle) ? d.canonicalOracle.value : null
|
||||||
|
|
||||||
function priceStr() {
|
function fmtListingPrice() {
|
||||||
const cur = d.canonicalCurrency
|
const cur = d.canonicalCurrency
|
||||||
if (cur.__kind === 'Sol') return fmtSol(d.price)
|
if (cur.__kind === 'Sol') return fmtSol(d.price)
|
||||||
return fmtTok(d.price, cur.decimals, 'SPL')
|
return fmtTok(d.price, cur.decimals, 'SPL')
|
||||||
@@ -66,7 +66,7 @@ export function ListingDetail({ pk, walletAddress, onUpdate, onClose, onPlaceOrd
|
|||||||
<div style={{ fontSize: 11, letterSpacing: '.13em', color: 'var(--mut)', fontWeight: 600, padding: '14px 0 4px' }}>ACCOUNT FIELDS</div>
|
<div style={{ fontSize: 11, letterSpacing: '.13em', color: 'var(--mut)', fontWeight: 600, padding: '14px 0 4px' }}>ACCOUNT FIELDS</div>
|
||||||
<FieldRow label="Listing ID"><span style={{ fontSize: 13.5, fontWeight: 600 }}>#{String(d.listingId)}</span></FieldRow>
|
<FieldRow label="Listing ID"><span style={{ fontSize: 13.5, fontWeight: 600 }}>#{String(d.listingId)}</span></FieldRow>
|
||||||
<FieldRow label="Seller"><MonoChip value={abbrev(d.seller)} onCopy={() => navigator.clipboard.writeText(d.seller)} onClick={() => router.push(`/search?q=${d.seller}`)} /></FieldRow>
|
<FieldRow label="Seller"><MonoChip value={abbrev(d.seller)} onCopy={() => navigator.clipboard.writeText(d.seller)} onClick={() => router.push(`/search?q=${d.seller}`)} /></FieldRow>
|
||||||
<FieldRow label="Price"><span style={{ fontSize: 13.5, fontWeight: 600 }}>{priceStr()}</span></FieldRow>
|
<FieldRow label="Price"><span style={{ fontSize: 13.5, fontWeight: 600 }}>{fmtListingPrice()}</span></FieldRow>
|
||||||
<FieldRow label="Currency">
|
<FieldRow label="Currency">
|
||||||
<span style={{ fontFamily: 'var(--font-mono)', fontSize: 12.5 }}>
|
<span style={{ fontFamily: 'var(--font-mono)', fontSize: 12.5 }}>
|
||||||
{d.canonicalCurrency.__kind === 'Sol' ? 'SOL (native)' : `SPL · ${abbrev((d.canonicalCurrency as { mint: string }).mint)}`}
|
{d.canonicalCurrency.__kind === 'Sol' ? 'SOL (native)' : `SPL · ${abbrev((d.canonicalCurrency as { mint: string }).mint)}`}
|
||||||
@@ -159,7 +159,7 @@ export function ListingDetail({ pk, walletAddress, onUpdate, onClose, onPlaceOrd
|
|||||||
>
|
>
|
||||||
<div style={{ fontFamily: 'var(--font-mono)', fontSize: 12.5, color: 'var(--acc2light)' }}>{abbrev(o.address)}</div>
|
<div style={{ fontFamily: 'var(--font-mono)', fontSize: 12.5, color: 'var(--acc2light)' }}>{abbrev(o.address)}</div>
|
||||||
<div style={{ fontFamily: 'var(--font-mono)', fontSize: 12, color: 'var(--mut)' }}>{abbrev(o.data.buyer)}</div>
|
<div style={{ fontFamily: 'var(--font-mono)', fontSize: 12, color: 'var(--mut)' }}>{abbrev(o.data.buyer)}</div>
|
||||||
<div style={{ fontWeight: 600, fontSize: 13 }}>{fmtSol(o.data.amount)}</div>
|
<div style={{ fontWeight: 600, fontSize: 13 }}>{priceStr(o.data.paymentCurrency, o.data.amount)}</div>
|
||||||
<div style={{ fontFamily: 'var(--font-mono)', fontSize: 12, color: 'var(--mut)' }}>#{String(o.data.orderId)}</div>
|
<div style={{ fontFamily: 'var(--font-mono)', fontSize: 12, color: 'var(--mut)' }}>#{String(o.data.orderId)}</div>
|
||||||
<div style={{ textAlign: 'right', fontFamily: 'var(--font-mono)', fontSize: 12, color: 'var(--mut)' }}>#{String(o.data.escrowId)}</div>
|
<div style={{ textAlign: 'right', fontFamily: 'var(--font-mono)', fontSize: 12, color: 'var(--mut)' }}>#{String(o.data.escrowId)}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user