Skip to content

Commit 2a8b98a

Browse files
committed
Merge branch '173-connect-backend-to-the-payments-and-usage-page' into xen-tg-app
2 parents dd97959 + 029f594 commit 2a8b98a

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

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

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,32 @@ import { formatNearAmount } from '@/lib/utils'
88
import { FC } from 'react'
99
import { THistoryNote } from '../types'
1010

11-
export const HistoryCard: FC<{ note: THistoryNote }> = ({ note }) => (
12-
<div className="flex items-center justify-between gap-2.5">
13-
<div className="flex min-w-12 flex-col items-center gap-0.5">
14-
{note.isFree ? (
15-
<div className="flex py-0.25 text-[12px]/[100%] font-normal text-(--color-my-primary)">
16-
FREE
11+
export const HistoryCard: FC<{ note: THistoryNote }> = ({ note }) => {
12+
const amountInNear = formatNearAmount(note.amount)
13+
const amountInNearRounded = amountInNear.slice(0, amountInNear.indexOf('.') + 4)
14+
return (
15+
<div className="flex items-center justify-between gap-2.5">
16+
<div className="flex w-max min-w-12 shrink-0 flex-col items-start gap-0.5">
17+
{note.isFree ? (
18+
<div className="flex py-0.25 text-[12px]/[100%] font-normal text-(--color-my-primary)">
19+
FREE
20+
</div>
21+
) : null}
22+
<div className="flex w-max shrink-0 py-0.25 text-[14px]/[150%] font-semibold">
23+
{(note.operationType === 'income' ? '+ ' : '- ') + amountInNearRounded}
1724
</div>
18-
) : null}
19-
<div className="flex py-0.25 text-[14px]/[150%] font-semibold">
20-
{(note.operationType === 'income' ? '+ ' : '- ') +
21-
Math.round(+formatNearAmount(note.amount) * 1000) / 1000}
2225
</div>
23-
</div>
24-
<div className="flex flex-col gap-0.5">
25-
<div className="flex py-0.25 text-[12px]/[100%] font-normal text-(--color-gray-text)">
26-
{new Date(note.createdAt).toLocaleString()}
26+
<div className="flex flex-col gap-0.5">
27+
<div className="flex py-0.25 text-[12px]/[100%] font-normal text-(--color-gray-text)">
28+
{new Date(note.createdAt).toLocaleString()}
29+
</div>
30+
<div className="flex py-0.25 text-[14px]/[150%] font-semibold wrap-anywhere">
31+
{note.capabilityName}
32+
</div>
2733
</div>
28-
<div className="flex py-0.25 text-[14px]/[150%] font-semibold">{note.capabilityName}</div>
2934
</div>
30-
</div>
31-
)
35+
)
36+
}
3237

3338
type THistoryNoteProps = {
3439
note: THistoryNote

0 commit comments

Comments
 (0)