+
+
+
+
-
- {label}
-
-
- {value}
-
-
- );
-}
-
-interface TransactionDetailsProps {
- sender?: string;
- checkpoint?: string | null;
- executedEpoch?: string;
- timestamp?: string | null;
-}
-
-export function TransactionDetailCard({
- sender,
- checkpoint,
- executedEpoch,
- timestamp,
-}: TransactionDetailsProps): JSX.Element {
- const md = useBreakpoint('md');
- const { data: domainName } = useResolveIotaNSName(sender);
-
- return (
-
-
-
- {timestamp && (
-
- {formatDate(Number(timestamp))}
-
- )}
-
- {sender && (
- }
- />
- )}
- {checkpoint && (
-
- }
- />
- )}
- {executedEpoch && (
- }
- />
- )}
-
-
-
-
- );
-}
diff --git a/apps/explorer/src/pages/transaction-result/transaction-summary/TransactionDetails.tsx b/apps/explorer/src/pages/transaction-result/transaction-summary/TransactionDetails.tsx
new file mode 100644
index 00000000000..a90d9f1cd3c
--- /dev/null
+++ b/apps/explorer/src/pages/transaction-result/transaction-summary/TransactionDetails.tsx
@@ -0,0 +1,51 @@
+// Copyright (c) Mysten Labs, Inc.
+// Modifications Copyright (c) 2024 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+import { DisplayStats } from '@iota/apps-ui-kit';
+import { formatDate, useResolveIotaNSName } from '@iota/core';
+
+interface TransactionDetailsProps {
+ sender?: string;
+ checkpoint?: string | null;
+ executedEpoch?: string;
+ timestamp?: string | null;
+}
+
+export function TransactionDetails({
+ sender,
+ checkpoint,
+ executedEpoch,
+ timestamp,
+}: TransactionDetailsProps): JSX.Element {
+ const { data: domainName } = useResolveIotaNSName(sender);
+
+ return (
+
+ {sender && (
+
+ )}
+ {checkpoint && (
+
+ )}
+ {executedEpoch && (
+
+ )}
+
+ {timestamp && }
+
+ );
+}
diff --git a/apps/ui-kit/src/lib/components/molecules/display-stats/DisplayStats.tsx b/apps/ui-kit/src/lib/components/molecules/display-stats/DisplayStats.tsx
index 8293aa9a0dd..a33f350c637 100644
--- a/apps/ui-kit/src/lib/components/molecules/display-stats/DisplayStats.tsx
+++ b/apps/ui-kit/src/lib/components/molecules/display-stats/DisplayStats.tsx
@@ -56,6 +56,10 @@ interface DisplayStatsProps {
* The value link is external.
*/
isExternalLink?: boolean;
+ /**
+ * The value is truncated
+ */
+ isTruncated?: boolean;
}
export function DisplayStats({
@@ -69,6 +73,7 @@ export function DisplayStats({
icon,
valueLink,
isExternalLink = false,
+ isTruncated = false,
}: DisplayStatsProps): React.JSX.Element {
const backgroundClass = BACKGROUND_CLASSES[type];
const sizeClass = SIZE_CLASSES[size];
@@ -76,6 +81,11 @@ export function DisplayStats({
const valueTextClass = VALUE_TEXT_CLASSES[size];
const labelTextClass = LABEL_TEXT_CLASSES[size];
const supportingLabelTextClass = SUPPORTING_LABEL_TEXT_CLASSES[size];
+ function truncate(value: string, startLength: number, endLength: number): string {
+ return value.length > startLength + endLength && isTruncated
+ ? `${value.slice(0, startLength)}...${value.slice(-endLength)}`
+ : value;
+ }
return (
{icon && {icon}}
-
+
{valueLink ? (
- {value}
+ {truncate(value, 6, 6)}
) : (
<>
-
{value}
+
{truncate(value, 6, 6)}
{supportingLabel && (
{supportingLabel}
diff --git a/apps/ui-kit/src/storybook/stories/molecules/DisplayStats.stories.tsx b/apps/ui-kit/src/storybook/stories/molecules/DisplayStats.stories.tsx
index 690c9c7a2cc..18a1c6a2c9b 100644
--- a/apps/ui-kit/src/storybook/stories/molecules/DisplayStats.stories.tsx
+++ b/apps/ui-kit/src/storybook/stories/molecules/DisplayStats.stories.tsx
@@ -66,5 +66,8 @@ export const Default: Story = {
isExternalLink: {
control: 'boolean',
},
+ isTruncated: {
+ control: 'boolean',
+ },
},
};