@@ -36,6 +31,7 @@ export function HomeTransactions() {
from="0x123123123123123123123123123123"
to="0x2139847192384719234"
updatedAt={new Date().getTime()}
+ newTransaction={item.newTransaction}
/>
))}
diff --git a/view/Transactions/TransactionBriefRow.tsx b/view/Transactions/TransactionBriefRow.tsx
index f3162a75..1cfcb37c 100644
--- a/view/Transactions/TransactionBriefRow.tsx
+++ b/view/Transactions/TransactionBriefRow.tsx
@@ -1,5 +1,6 @@
import { CryptoIcon, Typography as TypographyUI } from '@astraprotocol/astra-ui'
import clsx from 'clsx'
+import RowShowAnimation from 'components/Animation/RowShowAnimation'
import Timer from 'components/Timer'
import Typography from 'components/Typography'
import Image from 'next/image'
@@ -15,41 +16,51 @@ type TransactionBriefRowProps = {
token?: string
}
updatedAt: number | string
+ newTransaction?: boolean
}
-export default function TransactionBriefRow({ hash, from, to, balance, updatedAt }: TransactionBriefRowProps) {
+export default function TransactionBriefRow({
+ hash,
+ from,
+ to,
+ balance,
+ updatedAt,
+ newTransaction
+}: TransactionBriefRowProps) {
return (
-
-
-
-
-
-
-
-
Hash
-
+
+
+
+
+
+
+
+ Hash
+
+
+
}
+ currency={balance.token}
+ size="sm"
+ value={balance?.value}
/>
-
}
- currency={balance.token}
- size="sm"
- value={balance?.value}
- />
-
-
-
-
From
-
{ellipseBetweenText(from, 6, 6)}
-
To
-
{ellipseBetweenText(to, 6, 6)}
+
+
+ From
+ {ellipseBetweenText(from, 6, 6)}
+ To
+ {ellipseBetweenText(to, 6, 6)}
+
+
-
-
+
)
}
diff --git a/view/Transactions/hook/useTransaction.ts b/view/Transactions/hook/useTransaction.ts
new file mode 100644
index 00000000..548098ea
--- /dev/null
+++ b/view/Transactions/hook/useTransaction.ts
@@ -0,0 +1,33 @@
+import API_LIST from 'api/api_list'
+import { differenceWith, isEmpty } from 'lodash'
+import { useEffect, useState } from 'react'
+import useSWR from 'swr'
+
+export default function useTransaction() {
+ const [_items, setState] = useState()
+
+ const _fetchCondition = () => {
+ return [API_LIST.ALL_TRANSACTIONS]
+ }
+ const { data } = useSWR(_fetchCondition(), {
+ refreshInterval: parseInt(process.env.NEXT_PUBLIC_TRANSACTION_INTERVAL)
+ })
+ useEffect(() => {
+ if (data?.items) {
+ if (isEmpty(_items)) {
+ setState(data?.items)
+ } else {
+ const items = differenceWith(data.items, _items, (a, b) => {
+ return a.hash === b.hash
+ })
+ console.log(items.map(item => item.hash))
+ items.map(item => (item.newTransaction = true))
+ setState(data?.items)
+ }
+ }
+ }, [data])
+ return {
+ top10: _items?.slice(0, 10),
+ fullPageData: _items
+ }
+}