Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mark ui bugs #4578

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -16,12 +17,6 @@ export function InscriptionText(props: InscriptionTextProps) {

return (
<Box
height="100%"
color="white"
p="20px"
position="relative"
overflow="hidden"
textAlign="left"
_after={{
content: '""',
position: 'absolute',
Expand All @@ -31,8 +26,16 @@ export function InscriptionText(props: InscriptionTextProps) {
width: '100%',
backgroundImage: 'linear-gradient(rgba(0,0,0,0), rgba(0,0,0,1))',
}}
color="white"
fontSize="9px"
height="100%"
p="space.03"
position="relative"
overflow="hidden"
textAlign="left"
width="100%"
>
{sanitize(query.data)}
<pre>{sanitize(parseJson(query.data))}</pre>
</Box>
);
}
8 changes: 8 additions & 0 deletions src/app/components/json.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import { Box } from 'leather-styles/jsx';

import { isBigInt, isTypedArray } from '@shared/utils';

export function parseJson(content: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor 👍

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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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}`}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ export function CollectibleItemLayout({
<Box p="space.02">
<styled.button
_focus={{ clipPath: 'none', outline: 'focus' }}
_hover={{ bg: 'accent.background-primary', fontWeight: 500 }}
_hover={{ bg: 'accent.background-primary' }}
bg="accent.background-primary"
borderRadius="sm"
clipPath={isHovered ? 'none' : 'circle(0%)'}
fontWeight={500}
onClick={e => {
e.stopPropagation();
onClickSend();
Expand Down
1 change: 0 additions & 1 deletion src/app/features/psbt-signer/psbt-signer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export function PsbtSigner(props: PsbtSignerProps) {
<PsbtSignerLayout>
<PsbtRequestHeader name={name} origin={origin} />
<PsbtRequestDetailsLayout>
<PsbtRequestSighashWarningLabel />
{isPsbtMutable ? <PsbtRequestSighashWarningLabel /> : null}
<PsbtRequestDetailsHeader />
<PsbtInputsOutputsTotals />
Expand Down
3 changes: 1 addition & 2 deletions src/app/features/theme-drawer/theme-list-item-layout.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -21,7 +20,7 @@ export function ThemeListItemLayout({
isActive
? undefined
: {
backgroundColor: token('colors.brown.2'),
backgroundColor: 'accent.component-background-hover',
}
}
px="space.05"
Expand Down
Loading