Skip to content

Commit

Permalink
fix(senate): render params (#1345)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimakorzhovnik authored Nov 8, 2024
1 parent 085ae8e commit bff00dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/containers/governance/proposalsDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useGovParam } from 'src/hooks/governance/params/useGovParams';
import ReactMarkdown from 'react-markdown';
import rehypeSanitize from 'rehype-sanitize';
import remarkGfm from 'remark-gfm';
import { stringifyJson } from 'src/utils/json';
import styles from './proposalsDetail.module.scss';
import useGetPropById from './hooks/useGetPropById';
import ProposalsDetailProgressBar from './proposalsDetailProgressBar';
Expand Down Expand Up @@ -125,7 +126,7 @@ function ProposalsDetail() {
<Pane className={styles.containerDescription}>
{Object.entries(proposals.changes).map(([key, value]) => (
<Pane key={key}>
{key}: {value}
{key}: {JSON.stringify(value, stringifyJson)}
</Pane>
))}
</Pane>
Expand Down
6 changes: 6 additions & 0 deletions src/utils/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ export const downloadJson = (jsonData: any, fileName: string): void => {
document.body.removeChild(a);
URL.revokeObjectURL(url);
};

export const stringifyJson = (_, value) =>
typeof value === 'bigint' ? `${value}n` : value;

export const parseJson = (_, value) =>
/(-?\d+)n/.test(value) ? BigInt(value.replace('n', '')) : value;

0 comments on commit bff00dc

Please sign in to comment.