Skip to content

Commit af09576

Browse files
committed
Dashboard: Fix contract overpage page overflow when there are too many events in single tx (#6700)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on enhancing the `ContractOverviewPage` and `LatestEvents` components in a React application by adding overflow handling and improving the display of event data. ### Detailed summary - Added `overflow-hidden` class to the `div` in `ContractOverviewPage.tsx`. - Refactored the mapping of `allEvents` in `LatestEvents.tsx` to use a block structure for better readability. - Limited the displayed events to 3 and added a button to show additional events if more than 3 exist. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 316cef1 commit af09576

File tree

2 files changed

+45
-33
lines changed

2 files changed

+45
-33
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/ContractOverviewPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
3939
}) => {
4040
return (
4141
<div className="flex flex-col gap-10 lg:flex-row lg:gap-8">
42-
<div className="flex grow flex-col gap-10">
42+
<div className="flex grow flex-col gap-10 overflow-hidden">
4343
<ContractChecklist
4444
isErc721={isErc721}
4545
isErc1155={isErc1155}

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/LatestEvents.tsx

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export function LatestEventsUI(props: {
4848
trackingCategory: string;
4949
}) {
5050
const { allEvents, autoUpdate, eventsHref } = props;
51-
5251
return (
5352
<div className="rounded-lg border bg-card">
5453
{/* header */}
@@ -93,37 +92,50 @@ export function LatestEventsUI(props: {
9392
</TableHeader>
9493

9594
<TableBody>
96-
{allEvents.slice(0, 3).map((transaction) => (
97-
<TableRow key={transaction.transactionHash}>
98-
<TableCell>
99-
<CopyTextButton
100-
textToShow={shortenString(transaction.transactionHash)}
101-
textToCopy={transaction.transactionHash}
102-
tooltip="Copy transaction hash"
103-
copyIconPosition="left"
104-
variant="ghost"
105-
className="-translate-x-2 font-mono"
106-
/>
107-
</TableCell>
108-
<TableCell>
109-
<div className="flex w-max flex-wrap gap-2">
110-
{transaction.events.map((e) => (
111-
<Button
112-
key={e.logIndex + e.address + e.eventName}
113-
variant="outline"
114-
size="sm"
115-
className="h-auto rounded-full py-1"
116-
asChild
117-
>
118-
<Link href={`${eventsHref}?event=${e.eventName}`}>
119-
{e.eventName}
120-
</Link>
121-
</Button>
122-
))}
123-
</div>
124-
</TableCell>
125-
</TableRow>
126-
))}
95+
{allEvents.slice(0, 3).map((transaction) => {
96+
return (
97+
<TableRow key={transaction.transactionHash}>
98+
<TableCell>
99+
<CopyTextButton
100+
textToShow={shortenString(transaction.transactionHash)}
101+
textToCopy={transaction.transactionHash}
102+
tooltip="Copy transaction hash"
103+
copyIconPosition="left"
104+
variant="ghost"
105+
className="-translate-x-2 font-mono"
106+
/>
107+
</TableCell>
108+
<TableCell>
109+
<div className="flex w-max flex-wrap gap-2">
110+
{transaction.events.slice(0, 3).map((e) => (
111+
<Button
112+
key={e.logIndex + e.address + e.eventName}
113+
variant="outline"
114+
size="sm"
115+
className="h-auto rounded-full py-1"
116+
asChild
117+
>
118+
<Link href={`${eventsHref}?event=${e.eventName}`}>
119+
{e.eventName}
120+
</Link>
121+
</Button>
122+
))}
123+
124+
{transaction.events.length > 3 && (
125+
<Button
126+
variant="outline"
127+
size="sm"
128+
className="h-auto rounded-full py-1 hover:bg-transparent"
129+
asChild
130+
>
131+
<div>+ {transaction.events.length - 3}</div>
132+
</Button>
133+
)}
134+
</div>
135+
</TableCell>
136+
</TableRow>
137+
);
138+
})}
127139
</TableBody>
128140
</Table>
129141
</TableContainer>

0 commit comments

Comments
 (0)