diff --git a/frontend/src/app/[lang]/page.tsx b/frontend/src/app/[lang]/page.tsx
index deb6ab0..a68c76c 100644
--- a/frontend/src/app/[lang]/page.tsx
+++ b/frontend/src/app/[lang]/page.tsx
@@ -365,9 +365,11 @@ export default function DashboardPage() {
)}
- {/* Latest blocks + transactions */}
+ {/* Latest blocks + transactions: side by side they show one-line rows and the columns that
+ fit half the page (View, Fee and Height are on /blocks and /transactions), so the two
+ cards line up row for row (one row height) and end at the same height. */}
-
diff --git a/frontend/src/components/Tables.tsx b/frontend/src/components/Tables.tsx
index 3782836..440abbc 100644
--- a/frontend/src/components/Tables.tsx
+++ b/frontend/src/components/Tables.tsx
@@ -13,7 +13,12 @@ import type { BlockSummary, TokenInfo, TransactionSummary } from '@/types';
type TFn = ReturnType['t'];
-export function blockColumns(t: TFn, fmt: Fmt): Column[] {
+/** Hash lengths: `compact` is for a table sharing the row with another (the home page). */
+const HASH = { start: 8, end: 6 };
+const HASH_COMPACT = { start: 6, end: 4 };
+
+export function blockColumns(t: TFn, fmt: Fmt, compact = false): Column[] {
+ const h = compact ? HASH_COMPACT : HASH;
return [
{
key: 'height',
@@ -27,13 +32,18 @@ export function blockColumns(t: TFn, fmt: Fmt): Column[] {
{
key: 'hash',
header: t('components.tables.blocks.hash'),
- render: (block) => ,
+ render: (block) => ,
},
{
key: 'proposer',
header: t('components.tables.blocks.proposer'),
render: (block) => (
-
+
),
},
{
@@ -62,14 +72,27 @@ interface BlocksTableProps {
blocks: BlockSummary[];
isLoading?: boolean;
emptyMessage?: string;
+ /** Drop columns that are redundant in the surrounding context. */
+ hideColumns?: string[];
+ /** Shorter hashes, for a table that shares the row with another. */
+ compact?: boolean;
+ className?: string;
}
-export function BlocksTable({ blocks, isLoading, emptyMessage }: BlocksTableProps) {
+export function BlocksTable({
+ blocks,
+ isLoading,
+ emptyMessage,
+ hideColumns = [],
+ compact = false,
+ className,
+}: BlocksTableProps) {
const { t } = useT();
const fmt = useFmt();
return (
!hideColumns.includes(column.key))}
+ className={className}
data={blocks}
keyExtractor={(block) => block.hash}
isLoading={isLoading}
@@ -88,11 +111,12 @@ export function BlocksTable({ blocks, isLoading, emptyMessage }: BlocksTableProp
* nothing, by design — its asset is private, and `tokens` (the cached registry) resolves an RPL
* amount's index to its symbol ("12.50 zUSD") rather than a bare unit count.
*/
-function actionCell(tx: TransactionSummary, t: TFn, fmt: Fmt, tokens?: TokenInfo[]) {
+function actionCell(tx: TransactionSummary, t: TFn, fmt: Fmt, tokens?: TokenInfo[], compact = false) {
const parts: React.ReactNode[] = [];
+ const n = compact ? 4 : 6;
if (tx.program) {
parts.push(
-
+
);
}
if (tx.validator) {
@@ -101,8 +125,8 @@ function actionCell(tx: TransactionSummary, t: TFn, fmt: Fmt, tokens?: TokenInfo
key="validator"
value={tx.validator}
href={`/validators/${tx.validator}`}
- start={6}
- end={6}
+ start={n}
+ end={n}
/>
);
}
@@ -120,19 +144,21 @@ function actionCell(tx: TransactionSummary, t: TFn, fmt: Fmt, tokens?: TokenInfo
);
}
- return {parts};
+ return {parts};
}
export function transactionColumns(
t: TFn,
fmt: Fmt,
- tokens?: TokenInfo[]
+ tokens?: TokenInfo[],
+ compact = false
): Column[] {
+ const h = compact ? HASH_COMPACT : HASH;
return [
{
key: 'hash',
header: t('components.tables.txs.hash'),
- render: (tx) => ,
+ render: (tx) => ,
},
{
key: 'kind',
@@ -151,7 +177,7 @@ export function transactionColumns(
{
key: 'action',
header: t('components.tables.txs.action'),
- render: (tx) => actionCell(tx, t, fmt, tokens),
+ render: (tx) => actionCell(tx, t, fmt, tokens, compact),
},
{
key: 'fee',
@@ -183,6 +209,9 @@ interface TransactionsTableProps {
emptyMessage?: string;
/** Drop columns that are redundant in the surrounding context. */
hideColumns?: string[];
+ /** Shorter hashes, for a table that shares the row with another. */
+ compact?: boolean;
+ className?: string;
}
export function TransactionsTable({
@@ -190,17 +219,20 @@ export function TransactionsTable({
isLoading,
emptyMessage,
hideColumns = [],
+ compact = false,
+ className,
}: TransactionsTableProps) {
const { data: tokenList } = useTokens();
const { t } = useT();
const fmt = useFmt();
- const columns = transactionColumns(t, fmt, tokenList?.tokens).filter((column) => !hideColumns.includes(column.key));
+ const columns = transactionColumns(t, fmt, tokenList?.tokens, compact).filter((column) => !hideColumns.includes(column.key));
return (
tx.hash}
+ className={className}
isLoading={isLoading}
emptyMessage={emptyMessage ?? t('components.tables.txs.empty')}
/>