diff --git a/apps/explorer/src/app/components/info-panel/info-panel.tsx b/apps/explorer/src/app/components/info-panel/info-panel.tsx index 125fb7476..be3cc8f0a 100644 --- a/apps/explorer/src/app/components/info-panel/info-panel.tsx +++ b/apps/explorer/src/app/components/info-panel/info-panel.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import type { ReactNode } from 'react'; import { Panel } from '../panel'; import { @@ -8,6 +8,8 @@ import { Lozenge, Tooltip, } from '@vegaprotocol/ui-toolkit'; +import { TruncateInline } from '../truncate/truncate'; +import { useScreenDimensions } from '@vegaprotocol/react-helpers'; interface InfoPanelProps { children?: ReactNode | ReactNode[]; @@ -24,32 +26,56 @@ export const InfoPanel = ({ type, copy = true, }: InfoPanelProps) => { + const { screenSize } = useScreenDimensions(); + const isTruncated = useMemo( + () => ['xs', 'sm', 'md', 'lg'].includes(screenSize), + [screenSize] + ); + const isDesktop = useMemo(() => ['lg'].includes(screenSize), [screenSize]); + const visibleChars = useMemo(() => (isDesktop ? 20 : 10), [isDesktop]); return ( -
-

{title}

-

- {id} -

- {type && ( - - - {type} - - - )} +
+
+
+

{title}

+ {isTruncated ? ( + + ) : ( +

+ {id} +

+ )} + + {type && ( + + + {type} + + + )} +
+
{children}
+
{copy && ( - )}
- {children} ); }; diff --git a/apps/explorer/src/app/components/panel/panel.tsx b/apps/explorer/src/app/components/panel/panel.tsx index 8566f6d99..9bab0c695 100644 --- a/apps/explorer/src/app/components/panel/panel.tsx +++ b/apps/explorer/src/app/components/panel/panel.tsx @@ -6,5 +6,12 @@ interface PanelProps { className?: string; } export const Panel = ({ children, className }: PanelProps) => ( -
{children}
+
+ {children} +
); diff --git a/apps/explorer/src/app/components/txs/txs-stats-info.tsx b/apps/explorer/src/app/components/txs/txs-stats-info.tsx index e46e8d3ea..cc3054f5b 100644 --- a/apps/explorer/src/app/components/txs/txs-stats-info.tsx +++ b/apps/explorer/src/app/components/txs/txs-stats-info.tsx @@ -2,8 +2,8 @@ import { gql, useQuery } from '@apollo/client'; import { t } from '@vegaprotocol/react-helpers'; import { useEffect } from 'react'; import { InfoBlock } from '../../components/info-block'; +import { Panel } from '../../components/panel'; import type { TxsStats, TxsStats_statistics } from './__generated__/TxsStats'; -import classNames from 'classnames'; const STATS_QUERY = gql` query TxsStats { @@ -63,17 +63,18 @@ export const TxsStatsInfo = ({ className }: TxsStatsInfoProps) => { const gridStyles = 'grid grid-rows-2 gap-4 grid-cols-2 xl:gap-8 xl:grid-rows-1 xl:grid-cols-4'; - const containerStyles = 'p-5 border rounded-lg border-zinc-500'; return ( - + +
+ {TXS_STATS_MAP.map((field) => ( + + ))} +
+
); }; diff --git a/apps/explorer/src/app/routes/parties/id/index.tsx b/apps/explorer/src/app/routes/parties/id/index.tsx index 8b191d30b..b44e3da42 100644 --- a/apps/explorer/src/app/routes/parties/id/index.tsx +++ b/apps/explorer/src/app/routes/parties/id/index.tsx @@ -4,16 +4,21 @@ import { t, useFetch, addDecimalsFormatNumber, + useScreenDimensions, } from '@vegaprotocol/react-helpers'; -import { AccountTypeMapping } from '@vegaprotocol/types'; -import React from 'react'; +import React, { useMemo } from 'react'; import { useParams } from 'react-router-dom'; -import { RouteTitle } from '../../../components/route-title'; import { SubHeading } from '../../../components/sub-heading'; -import { AsyncRenderer, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; +import { + CopyWithTooltip, + Icon, + SyntaxHighlighter, + AsyncRenderer, +} from '@vegaprotocol/ui-toolkit'; import { Panel } from '../../../components/panel'; import { InfoPanel } from '../../../components/info-panel'; import { toNonHex } from '../../../components/search/detect-search'; +import { TruncateInline } from '../../../components/truncate/truncate'; import { DATA_SOURCES } from '../../../config'; import type { PartyAssetsQuery, @@ -61,6 +66,8 @@ const PARTY_ASSETS_QUERY = gql` const Party = () => { const { party } = useParams<{ party: string }>(); const partyId = party ? toNonHex(party) : ''; + const { isMobile } = useScreenDimensions(); + const visibleChars = useMemo(() => (isMobile ? 10 : 14), [isMobile]); const filters = `filters[tx.submitter]=${partyId}`; const { hasMoreTxs, loadTxs, error, txsData, loading } = useTxsData({ limit: 10, @@ -84,11 +91,19 @@ const Party = () => { ); const header = data?.party?.id ? ( - +
+ + + + +
) : (

No party found for key {party}

@@ -100,17 +115,13 @@ const Party = () => { {data?.party?.accounts?.length ? ( data.party.accounts.map((account) => { return ( - +
-
-
+
+
{t('Balance')} ({account.asset.symbol})
-
+
{addDecimalsFormatNumber( account.balance, account.asset.decimals @@ -135,7 +146,6 @@ const Party = () => { ) : ( @@ -148,7 +158,12 @@ const Party = () => { return (
- {t('Party')} +

+ {t('Party')} +

{data ? ( <> {header} @@ -156,12 +171,16 @@ const Party = () => { {accounts} {t('Staking')} {staking} - {t('Transactions')} + {t('JSON')} +
+ +
+ {t('Transactions')} { className="mb-28" /> - {t('JSON')} -
- -
) : null} diff --git a/apps/explorer/src/app/routes/txs/home/index.tsx b/apps/explorer/src/app/routes/txs/home/index.tsx index 413c958d7..57622c602 100644 --- a/apps/explorer/src/app/routes/txs/home/index.tsx +++ b/apps/explorer/src/app/routes/txs/home/index.tsx @@ -13,7 +13,7 @@ export const TxsList = () => {
{t('Transactions')} - +