From cac9e593508e3c6172b7c1fa473f0491c54d76d9 Mon Sep 17 00:00:00 2001 From: Fara Woolf Date: Mon, 27 Nov 2023 16:51:40 -0600 Subject: [PATCH] fix: mark ui bugs --- .../components/inscription-text.tsx | 17 ++++++++++------- src/app/components/json.tsx | 8 ++++++++ .../components/bitcoin/inscription-text.tsx | 11 ++--------- .../components/collectible-item.layout.tsx | 3 ++- src/app/features/psbt-signer/psbt-signer.tsx | 1 - .../theme-drawer/theme-list-item-layout.tsx | 3 +-- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/app/components/inscription-preview-card/components/inscription-text.tsx b/src/app/components/inscription-preview-card/components/inscription-text.tsx index 5b72ea79298..a9f657cee47 100644 --- a/src/app/components/inscription-preview-card/components/inscription-text.tsx +++ b/src/app/components/inscription-preview-card/components/inscription-text.tsx @@ -1,6 +1,7 @@ import { sanitize } from 'dompurify'; import { Box } from 'leather-styles/jsx'; +import { parseJson } from '@app/components/json'; import { LoadingSpinner } from '@app/components/loading-spinner'; import { useInscriptionTextContentQuery } from '@app/query/bitcoin/ordinals/inscription-text-content.query'; @@ -16,12 +17,6 @@ export function InscriptionText(props: InscriptionTextProps) { return ( - {sanitize(query.data)} +
{sanitize(parseJson(query.data))}
); } diff --git a/src/app/components/json.tsx b/src/app/components/json.tsx index 2d222736592..ddb68623c14 100644 --- a/src/app/components/json.tsx +++ b/src/app/components/json.tsx @@ -4,6 +4,14 @@ import { Box } from 'leather-styles/jsx'; import { isBigInt, isTypedArray } from '@shared/utils'; +export function parseJson(content: string) { + try { + return JSON.stringify(JSON.parse(content), null, 2); + } catch (e) { + return content; + } +} + function parseJsonReadable(value: any) { if (isBigInt(value)) return value.toString(); if (isTypedArray(value)) return bytesToHex(value); diff --git a/src/app/features/collectibles/components/bitcoin/inscription-text.tsx b/src/app/features/collectibles/components/bitcoin/inscription-text.tsx index ba52de52713..abacdc4984b 100644 --- a/src/app/features/collectibles/components/bitcoin/inscription-text.tsx +++ b/src/app/features/collectibles/components/bitcoin/inscription-text.tsx @@ -1,16 +1,9 @@ +import { parseJson } from '@app/components/json'; import { useInscriptionTextContentQuery } from '@app/query/bitcoin/ordinals/inscription-text-content.query'; import { OrdinalIcon } from '@app/ui/components/icons/ordinal-icon'; import { CollectibleText } from '../_collectible-types/collectible-text'; -function processContent(content: string) { - try { - return JSON.stringify(JSON.parse(content), null, 2); - } catch (e) { - return content; - } -} - interface InscriptionTextProps { contentSrc: string; inscriptionNumber: number; @@ -33,7 +26,7 @@ export function InscriptionText({ key={inscriptionNumber} onClickCallToAction={onClickCallToAction} onClickSend={onClickSend} - content={processContent(query.data)} + content={parseJson(query.data)} subtitle="Ordinal inscription" title={`# ${inscriptionNumber}`} /> diff --git a/src/app/features/collectibles/components/collectible-item.layout.tsx b/src/app/features/collectibles/components/collectible-item.layout.tsx index 54ed3ad8934..636389aeece 100644 --- a/src/app/features/collectibles/components/collectible-item.layout.tsx +++ b/src/app/features/collectibles/components/collectible-item.layout.tsx @@ -89,10 +89,11 @@ export function CollectibleItemLayout({ { e.stopPropagation(); onClickSend(); diff --git a/src/app/features/psbt-signer/psbt-signer.tsx b/src/app/features/psbt-signer/psbt-signer.tsx index 1e087a42889..434d39aa700 100644 --- a/src/app/features/psbt-signer/psbt-signer.tsx +++ b/src/app/features/psbt-signer/psbt-signer.tsx @@ -119,7 +119,6 @@ export function PsbtSigner(props: PsbtSignerProps) { - {isPsbtMutable ? : null} diff --git a/src/app/features/theme-drawer/theme-list-item-layout.tsx b/src/app/features/theme-drawer/theme-list-item-layout.tsx index f82097df228..cb58d155329 100644 --- a/src/app/features/theme-drawer/theme-list-item-layout.tsx +++ b/src/app/features/theme-drawer/theme-list-item-layout.tsx @@ -1,5 +1,4 @@ import { Box, Flex, styled } from 'leather-styles/jsx'; -import { token } from 'leather-styles/tokens'; import { CheckmarkIcon } from '@app/ui/components/icons/checkmark-icon'; @@ -21,7 +20,7 @@ export function ThemeListItemLayout({ isActive ? undefined : { - backgroundColor: token('colors.brown.2'), + backgroundColor: 'accent.component-background-hover', } } px="space.05"