Skip to content

Commit

Permalink
feat: tax tips
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Oct 20, 2024
1 parent e6a665a commit c1582f9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
25 changes: 23 additions & 2 deletions apps/renderer/src/modules/power/transaction-section/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState } from "react"
import { useTranslation } from "react-i18next"

import { useServerConfigs } from "~/atoms/server-configs"
import { useWhoami } from "~/atoms/user"
import { Logo } from "~/components/icons/logo"
import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar"
Expand Down Expand Up @@ -40,11 +41,18 @@ export const TransactionsSection: Component = ({ className }) => {
type: type === "all" ? undefined : type,
})

const serverConfigs = useServerConfigs()

if (!myWallet) return null

return (
<div className="relative flex min-w-0 grow flex-col">
<SettingSectionTitle title={t("wallet.transactions.title")} />
<p className="mb-4 text-sm">
{t("wallet.transactions.description", {
percentage: Number.parseInt(serverConfigs?.TAX_POINT || "0") / 100,
})}
</p>
<Tabs value={type} onValueChange={(val) => setType(val)}>
<TabsList className="relative -ml-2 border-b-transparent">
{tabs.map((tab) => (
Expand Down Expand Up @@ -93,7 +101,11 @@ export const TransactionsSection: Component = ({ className }) => {
<TableCell align="left" size="sm">
<Tooltip>
<TooltipTrigger>
<a target="_blank" href={`https://scan.rss3.io/tx/${row.hash}`}>
<a
target="_blank"
href={`https://scan.rss3.io/tx/${row.hash}`}
className="underline"
>
{row.hash.slice(0, 10)}...
</a>
</TooltipTrigger>
Expand All @@ -107,8 +119,17 @@ export const TransactionsSection: Component = ({ className }) => {
</TableBody>
</Table>
</div>
{!!transactions.data?.length && (
<a
className="my-2 w-full text-sm text-zinc-400 underline"
href={`https://scan.rss3.io/address/${myWallet.address}`}
target="_blank"
>
{t("wallet.transactions.more")}
</a>
)}
{!transactions.data?.length && (
<div className="my-2 w-full text-center text-sm text-zinc-400">
<div className="my-2 w-full text-sm text-zinc-400">
{t("wallet.transactions.noTransactions")}
</div>
)}
Expand Down
2 changes: 2 additions & 0 deletions locales/settings/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@
"wallet.sidebar_title": "Power",
"wallet.transactions.amount": "Amount",
"wallet.transactions.date": "Date",
"wallet.transactions.description": "Certain transactions incur a {{percentage}}% platform fee to support Follow go further. For details, please refer to the blockchain transaction.",
"wallet.transactions.from": "From",
"wallet.transactions.more": "View more through the blockchain explorer.",
"wallet.transactions.noTransactions": "No transactions",
"wallet.transactions.title": "Transactions",
"wallet.transactions.to": "To",
Expand Down

0 comments on commit c1582f9

Please sign in to comment.