-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RAB-4] Separate transactions into TransactionHistory
- Loading branch information
Marek Miklaszewski
committed
Apr 26, 2023
1 parent
62774e3
commit 2c0481d
Showing
5 changed files
with
48 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
apps/next-app/src/shared/components/subscriptions/TransactionHistory/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { TransactionHistory } from './transactionHistory.component'; |
39 changes: 39 additions & 0 deletions
39
...p/src/shared/components/subscriptions/TransactionHistory/transactionHistory.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { format, fromUnixTime } from 'date-fns'; | ||
import { Checkmark } from 'shared/components/Checkmark'; | ||
import { Crossmark } from 'shared/components/Crossmark'; | ||
import { getSubscriptionPrice } from 'utils/getSubscriptionPrice'; | ||
|
||
interface TransactionHistoryProps { | ||
transactions: any; | ||
} | ||
|
||
export const TransactionHistory = ({ | ||
transactions, | ||
}: TransactionHistoryProps) => { | ||
return ( | ||
<div className="max-w-xl w-full"> | ||
<h2 className="mt-8 text-2xl">Transaction history</h2> | ||
<div className="flex flex-col"> | ||
{transactions.charges.data.map( | ||
({ id, created, description, amount, currency, status }: any) => ( | ||
<div | ||
key={id} | ||
className="flex justify-between w-full border-b-2 border-slate-800 py-6" | ||
> | ||
<div> | ||
{description}{' '} | ||
<span className="text-slate-400"> | ||
({format(fromUnixTime(created), 'Pp')}) | ||
</span> | ||
</div> | ||
<div> | ||
{getSubscriptionPrice(amount)} {currency.toUpperCase()} | ||
</div> | ||
{status === 'succeeded' ? <Checkmark /> : <Crossmark isError />} | ||
</div> | ||
) | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.