|
1 | 1 | import { AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion' |
2 | 2 | import { formatNearAmount } from '@/lib/utils' |
3 | | -import { FC } from 'react' |
| 3 | +import { FC, useMemo } from 'react' |
4 | 4 | import { THistoryNote } from '../types' |
5 | 5 |
|
6 | 6 | 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 | + |
9 | 12 | return ( |
10 | 13 | <div className="flex items-center justify-between gap-2.5"> |
11 | 14 | <div className="flex w-max min-w-12 shrink-0 flex-col items-start gap-0.5"> |
12 | 15 | {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)"> |
14 | 17 | FREE |
15 | 18 | </div> |
16 | 19 | ) : 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"> |
18 | 21 | {(note.operationType === 'income' ? '+ ' : '- ') + amountInNearRounded} |
19 | 22 | </div> |
20 | 23 | </div> |
21 | 24 | <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)"> |
23 | 26 | {new Date(note.createdAt).toLocaleString()} |
24 | 27 | </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"> |
26 | 29 | {note.capabilityName} |
27 | 30 | </div> |
28 | 31 | </div> |
|
0 commit comments