From a4f155a7174b802e310baaeb2e8ed14d2f5735b2 Mon Sep 17 00:00:00 2001 From: Innei Date: Wed, 31 Jul 2024 21:11:53 +0800 Subject: [PATCH] fix: setting wallet style update Signed-off-by: Innei --- .../my-wallet-section/create-wallet.tsx | 29 ++-- .../tabs/wallet/my-wallet-section/index.tsx | 130 +++++++++--------- .../tabs/wallet/transaction-section/index.tsx | 35 +++-- 3 files changed, 105 insertions(+), 89 deletions(-) diff --git a/src/renderer/src/modules/settings/tabs/wallet/my-wallet-section/create-wallet.tsx b/src/renderer/src/modules/settings/tabs/wallet/my-wallet-section/create-wallet.tsx index 589e87252..a47b0f454 100644 --- a/src/renderer/src/modules/settings/tabs/wallet/my-wallet-section/create-wallet.tsx +++ b/src/renderer/src/modules/settings/tabs/wallet/my-wallet-section/create-wallet.tsx @@ -6,22 +6,25 @@ export const CreateWallet = () => { return (
- mutation.mutate()} - > - Create Wallet - - -

+

Create a free wallet to receive {" "} - Power - , which can - be used to reward creators and also get rewarded for your content - contributions. + + + Power + + , which can be used to + reward creators and also get rewarded for your content contributions.

+
+ mutation.mutate()} + > + Create Wallet + +
) } diff --git a/src/renderer/src/modules/settings/tabs/wallet/my-wallet-section/index.tsx b/src/renderer/src/modules/settings/tabs/wallet/my-wallet-section/index.tsx index 01b4ab35c..89f29d037 100644 --- a/src/renderer/src/modules/settings/tabs/wallet/my-wallet-section/index.tsx +++ b/src/renderer/src/modules/settings/tabs/wallet/my-wallet-section/index.tsx @@ -19,76 +19,72 @@ export const MyWalletSection = () => { const wallet = useWallet({ userId: user?.id }) const myWallet = wallet.data?.[0] + if (wallet.isPending) { + return ( +
+ +
+ ) + } + + if (!myWallet) { + return + } return ( -
- {wallet.isPending ? ( -
- +
+
+ +
+ + {BigInt(myWallet.dailyPowerToken || 0n) + + BigInt(myWallet.cashablePowerToken || 0n)} + +
- ) : !myWallet ? - ( - - ) : - ( -
-
- -
- - {BigInt(myWallet.dailyPowerToken || 0n) + - BigInt(myWallet.cashablePowerToken || 0n)} - - -
- - - -
- - Daily Power - - - {myWallet.dailyPowerToken} - -
-
- - -

1. Daily Power can only be used for tips.

-

- 2. It comes from the Power you claim for free every day.. -

-
-
-
- - -
- - Cashable Power - {" "} - - - - {myWallet.cashablePowerToken} -
-
- - -

- 1. You can transfer Cashable Power to your wallet and trade - freely. -

-

- 2. It comes from the Power you recharge and the tips you - receive. -

-
-
-
-
+ + + +
+ + Daily Power + + + {myWallet.dailyPowerToken}
- )} +
+ + +

1. Daily Power can only be used for tips.

+

2. It comes from the Power you claim for free every day..

+
+
+
+ + +
+ + Cashable Power + {" "} + + + + {myWallet.cashablePowerToken} +
+
+ + +

+ 1. You can transfer Cashable Power to your wallet and trade + freely. +

+

+ 2. It comes from the Power you recharge and the tips you + receive. +

+
+
+
+
) } diff --git a/src/renderer/src/modules/settings/tabs/wallet/transaction-section/index.tsx b/src/renderer/src/modules/settings/tabs/wallet/transaction-section/index.tsx index f34706d5d..18929f24d 100644 --- a/src/renderer/src/modules/settings/tabs/wallet/transaction-section/index.tsx +++ b/src/renderer/src/modules/settings/tabs/wallet/transaction-section/index.tsx @@ -5,6 +5,8 @@ import { AvatarFallback, AvatarImage, } from "@renderer/components/ui/avatar" +import { RelativeTime } from "@renderer/components/ui/datetime" +import { LoadingCircle } from "@renderer/components/ui/loading" import { Table, TableBody, @@ -17,7 +19,6 @@ import { Balance } from "@renderer/components/ui/wallet/balance" import { cn } from "@renderer/lib/utils" import { SettingSectionTitle } from "@renderer/modules/settings/section" import { useWallet, useWalletTransactions } from "@renderer/queries/wallet" -import dayjs from "dayjs" export const TransactionsSection = () => { const user = useMe() @@ -26,9 +27,15 @@ export const TransactionsSection = () => { const transactions = useWalletTransactions({ fromOrToUserId: user?.id }) - if (!myWallet) return + if (!myWallet) return null - if (transactions.isLoading) { return
Loading...
} + if (transactions.isLoading) { + return ( +
+ +
+ ) + } // if (transactions.data?.length === 0) return
No transactions
@@ -40,11 +47,21 @@ export const TransactionsSection = () => { - Type - Amount - From - To - Date + + Type + + + Amount + + + From + + + To + + + Date + @@ -67,7 +84,7 @@ export const TransactionsSection = () => { {/* */} - {dayjs(row.createdAt).fromNow()} + ))}