feat: update stats text

This commit is contained in:
DIYgod
2023-04-28 01:28:24 +01:00
parent 1e4f4f4698
commit 2e0d2d836b
3 changed files with 33 additions and 20 deletions
+5 -5
View File
@@ -8,11 +8,11 @@
"Events": "活动",
"New Events": "新活动",
"Site Stats": "站点统计",
"Total Posts": "文章总数",
"Total Comments": "评论总数",
"Total Followers": "关注者总数",
"Total Views": "浏览总数",
"Total Tip": "打赏总额",
"Published posts": "发布的文章",
"Received comments": "收到的评论",
"Followers": "关注者",
"Viewed": "浏览量",
"Received tips": "收到的打赏",
"Site Duration": "站点运行时间",
"days": "天",
"Deleted!": "已删除!",
+1
View File
@@ -539,6 +539,7 @@ export async function getStat({ characterId }: { characterId: string }) {
return {
viewsCount: stat.viewNoteCount,
createdAt: site?.createdAt,
createTx: site?.transactionHash,
subscriptionCount: subscriptions?.count,
commentsCount: comments?.count,
notesCount: notes?.count,
+27 -15
View File
@@ -10,7 +10,7 @@ import { DashboardMain } from "~/components/dashboard/DashboardMain"
import { Image } from "~/components/ui/Image"
import { UniLink } from "~/components/ui/UniLink"
import { useDate } from "~/hooks/useDate"
import { DISCORD_LINK, GITHUB_LINK, TWITTER_LINK } from "~/lib/env"
import { CSB_SCAN, DISCORD_LINK, GITHUB_LINK, TWITTER_LINK } from "~/lib/env"
import { getSiteLink } from "~/lib/helpers"
import { serverSidePropsHandler } from "~/lib/server-side-props"
import { cn } from "~/lib/utils"
@@ -52,23 +52,41 @@ export default function SubdomainIndex() {
const statMap = [
{
icon: "i-mingcute:news-line",
name: "Total Posts",
name: "Published posts",
value: stat.data?.notesCount,
url: `/dashboard/${subdomain}/posts`,
},
{
icon: "i-mingcute:comment-line",
name: "Total Comments",
name: "Received comments",
value: stat.data?.commentsCount,
url: `/dashboard/${subdomain}/comments`,
},
{
icon: "i-mingcute:heart-line",
name: "Received tips",
value: `${
tips.data?.pages?.[0]?.list
?.map((i) => +i.amount)
.reduce((acr, cur) => acr + cur) || 0
} MIRA`,
url: `/dashboard/${subdomain}/tokens`,
},
{
icon: "i-mingcute:user-follow-line",
name: "Total Followers",
name: "Followers",
value: stat.data?.subscriptionCount,
url: getSiteLink({
subdomain,
}),
},
{
icon: "i-mingcute:eye-line",
name: "Total Views",
name: "Viewed",
value: stat.data?.viewsCount,
url: getSiteLink({
subdomain,
}),
},
{
icon: "i-mingcute:history-line",
@@ -77,14 +95,7 @@ export default function SubdomainIndex() {
date.dayjs().diff(date.dayjs(stat.data?.createdAt), "day") +
" " +
t("days"),
},
{
icon: "i-mingcute:heart-line",
name: "Total Tip",
value:
tips.data?.pages?.[0]?.list
?.map((i) => +i.amount)
.reduce((acr, cur) => acr + cur) || 0,
url: `${CSB_SCAN}/tx/${stat.data?.createTx}`,
},
]
@@ -102,7 +113,8 @@ export default function SubdomainIndex() {
<div className="flex-1 space-y-8">
<div className="grid gap-4 sm:grid-cols-3 grid-cols-2">
{statMap.map((item) => (
<div
<UniLink
href={item.url}
key={item.name}
className="bg-slate-100 rounded-lg flex justify-center flex-col py-4 px-6"
>
@@ -116,7 +128,7 @@ export default function SubdomainIndex() {
<span className="align-middle">{t(item.name)}</span>
</span>
<span className="font-bold text-2xl">{item.value}</span>
</div>
</UniLink>
))}
</div>
<div className="prose p-6 bg-slate-50 rounded-lg relative">