Skip to content

Commit 4032a5c

Browse files
authored
fix: better display long history agent ID in history node (#247)
* feat: redesign Wallet and History Main page modules; add the link to MyNearWallet; change modules border colors (issue#211) * feat: Display total reward amount in the app (issue#233) * fix: revenue alignment * Revert "fix: revenue alignment" This reverts commit 5982b7b. * Revert "Merge pull request #238 from dapplets/233-display-total-reward-amount-in-the-app-claim-functionality" This reverts commit a61040c, reversing changes made to 00545b3. * fix: long history agent ID in history node
1 parent 7d4b57c commit 4032a5c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

apps/xen-tg-app/src/components/HistoryNote.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
import { AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'
22
import { formatNearAmount } from '@/lib/utils'
3-
import { FC } from 'react'
3+
import { FC, useMemo } from 'react'
44
import { THistoryNote } from '../types'
55

66
export const HistoryCard: FC<{ note: THistoryNote }> = ({ note }) => {
7-
const amountInNear = formatNearAmount(note.amount)
8-
const amountInNearRounded = amountInNear.slice(0, amountInNear.indexOf('.') + 4)
7+
const amountInNearRounded = useMemo(() => {
8+
const amountInNear = formatNearAmount(note.amount)
9+
return amountInNear.slice(0, amountInNear.indexOf('.') + 4)
10+
}, [note.amount])
11+
912
return (
1013
<div className="flex items-center justify-between gap-2.5">
1114
<div className="flex w-max min-w-12 shrink-0 flex-col items-start gap-0.5">
1215
{note.isFree ? (
13-
<div className="flex py-0.25 text-[12px]/[100%] font-normal text-(--color-my-primary)">
16+
<div className="flex py-0.25 text-xs/[100%] font-normal text-(--color-my-primary)">
1417
FREE
1518
</div>
1619
) : null}
17-
<div className="flex w-max shrink-0 py-0.25 text-[14px]/[150%] font-semibold">
20+
<div className="flex w-max shrink-0 py-0.25 text-[14px] font-semibold">
1821
{(note.operationType === 'income' ? '+ ' : '- ') + amountInNearRounded}
1922
</div>
2023
</div>
2124
<div className="flex flex-col gap-0.5">
22-
<div className="flex py-0.25 text-[12px]/[100%] font-normal text-(--color-gray-text)">
25+
<div className="flex py-0.25 text-xs/[100%] font-normal text-(--color-gray-text)">
2326
{new Date(note.createdAt).toLocaleString()}
2427
</div>
25-
<div className="flex py-0.25 text-[14px]/[150%] font-semibold wrap-anywhere">
28+
<div className="flex py-0.25 text-[14px]/4 font-semibold break-all">
2629
{note.capabilityName}
2730
</div>
2831
</div>

0 commit comments

Comments
 (0)