diff --git a/public/locales/zh/dashboard.json b/public/locales/zh/dashboard.json index da9d3a6d..90307b41 100644 --- a/public/locales/zh/dashboard.json +++ b/public/locales/zh/dashboard.json @@ -35,8 +35,9 @@ "Import markdown file with front matter supported": "导入 Markdown 文件(支持 Front Matter)", "View Site": "查看站点", "hello" : { - "welcome" : "

你好,

欢迎使用xLog!

以下是一些有用的链接,帮助你开始使用 xLog:

", - "community": "

加入我们的社区,认识新朋友或共同建设xLog:

" + "welcome" : "

👋 你好哇,

欢迎使用 xLog!

以下是一些有用的链接,帮助你开始使用 xLog:

", + "hidden": "👋 你好哇", + "community": "

加入我们的社区,认识新朋友或共同建设 xLog:

" }, "Edit": "编辑", "Convert to Page": "转换为页面", @@ -117,5 +118,8 @@ "Warning": "警告", "Operators have permissions to enter your dashboard, change your settings(excluding xLog subdomain) and post, modify, delete contents on your site.": "影子授权可以进入你的仪表盘,更改你的设置(不包括 xLog 子域名)并在你的站点上发布、修改、删除内容。", - "Add": "添加" + "Add": "添加", + "xLog News": "xLog 新鲜事", + "More": "更多", + "Meet New Friends": "认识新朋友" } \ No newline at end of file diff --git a/public/locales/zh/index.json b/public/locales/zh/index.json index 767bcb63..04ea81be 100644 --- a/public/locales/zh/index.json +++ b/public/locales/zh/index.json @@ -14,9 +14,9 @@ }, "Own": { "subtitle": "在区块链上拥有自己的内容", - "description": "通过在 Crossbell 区块链上发布来拥有自己的内容。 xLog 不会存储任何数据,xLog 也无法剥夺或修改您的权利和内容,即使 xLog 想这样做。 了解 Crossbell 是如何工作的。", + "description": "通过在 Crossbell 区块链上发布来拥有自己的内容。 xLog 不会存储任何数据,也无法剥夺或修改你的权利和内容,即使 xLog 想这样做。 了解 Crossbell 是如何工作的。", "extra": { - "title": "不要相信,要验证", + "title": "不要相信,去验证", "description": "在互联网上不轻信任何人是一个好习惯,包括 xLog。因此,我们强烈建议你浏览 xLog 上的任何站点,检查页面底部的交易历史,阅读区块链合约代码,看看实情是否与 xLog 所声称的一致。", "button": "去验证" } @@ -32,7 +32,7 @@ "Source Code": "源码", "Visit": "访问", "Easy to get started": "简单上手", - "Easy to get started text": "xLog 支持 web3 钱包电子邮件连接,使您能够快速创建一个定制的博客,具有自定义域名、订阅、评论、NFT 铸造、RSS 订阅和 AI 增强等功能,仅需 5 分钟即可完成,无需申请或费用。", + "Easy to get started text": "xLog 支持 web3 钱包电子邮件连接,使你能够快速创建一个定制的博客,具有自定义域名、订阅、评论、NFT 铸造、RSS 订阅和 AI 增强等功能,仅需 5 分钟即可完成,无需申请或费用。", "Safe": "安全", "Safe text": "所有博客数据,包括配置、文章、订阅、评论等,都由你自己签名并安全地存储在区块链上,只有你持有的私钥才能进行控制和访问。包括 xLog 在内的任何人都无法进行更改。", "Fast": "快速", diff --git a/src/components/dashboard/DashboardLayout.tsx b/src/components/dashboard/DashboardLayout.tsx index 9433e779..d3f9a835 100644 --- a/src/components/dashboard/DashboardLayout.tsx +++ b/src/components/dashboard/DashboardLayout.tsx @@ -19,6 +19,7 @@ import { import { useUserRole } from "~/hooks/useUserRole" import { useAccountState, useConnectModal } from "@crossbell/connect-kit" import { useTranslation } from "react-i18next" +import { Logo } from "~/components/common/Logo" export function DashboardLayout({ children, @@ -105,7 +106,7 @@ export function DashboardLayout({ return ready ? ( hasPermission ? ( <> - + {site?.data?.css && ( {(isOpen) => ( <> +
+
+ +
+ {isOpen && "xLog"} +
{userSite.data?.[0]?.username && subdomain && userSite.data[0].username !== subdomain && (
-
You are operating
+
+ {isOpen && "You are operating"} +
- - {site.data?.name} - - @{site.data?.username} + {isOpen && ( + + {site.data?.name} + + @{site.data?.username} + - + )}
)}
@@ -162,7 +178,7 @@ export function DashboardLayout({ className={cn( `flex px-4 h-12 items-center rounded-md space-x-2 w-full transition-colors`, active - ? `bg-slate-200 font-medium text-slate-800` + ? `bg-slate-200 font-medium text-accent` : `hover:bg-slate-200 hover:bg-opacity-50`, !isOpen && "justify-center", )} diff --git a/src/components/dashboard/DashboardMain.tsx b/src/components/dashboard/DashboardMain.tsx index 0d7d6a89..b809cda0 100644 --- a/src/components/dashboard/DashboardMain.tsx +++ b/src/components/dashboard/DashboardMain.tsx @@ -1,9 +1,13 @@ import { cn } from "~/lib/utils" +import { useTranslation } from "next-i18next" export const DashboardMain: React.FC<{ children: React.ReactNode fullWidth?: boolean -}> = ({ children, fullWidth }) => { + title?: string +}> = ({ children, fullWidth, title }) => { + const { t } = useTranslation("dashboard") + return (
+ {title &&

{t(title)}

} {children}
diff --git a/src/pages/dashboard/[subdomain]/index.tsx b/src/pages/dashboard/[subdomain]/index.tsx index 22d1d634..536d5e36 100644 --- a/src/pages/dashboard/[subdomain]/index.tsx +++ b/src/pages/dashboard/[subdomain]/index.tsx @@ -2,7 +2,7 @@ import { useRouter } from "next/router" import { DashboardLayout } from "~/components/dashboard/DashboardLayout" import { DashboardMain } from "~/components/dashboard/DashboardMain" import { UniLink } from "~/components/ui/UniLink" -import Image from "next/image" +import { Image } from "~/components/ui/Image" import { DISCORD_LINK, TWITTER_LINK, GITHUB_LINK, APP_NAME } from "~/lib/env" import { getSiteLink } from "~/lib/helpers" import type { ReactElement } from "react" @@ -12,7 +12,14 @@ import { useTranslation, Trans } from "next-i18next" import { getServerSideProps as getLayoutServerSideProps } from "~/components/dashboard/DashboardLayout.server" import { GetServerSideProps } from "next" import { serverSidePropsHandler } from "~/lib/server-side-props" -import { Logo } from "~/components/common/Logo" +import { getStorage, setStorage } from "~/lib/storage" +import { useState } from "react" +import { ChevronDownIcon } from "@heroicons/react/20/solid" +import { cn } from "~/lib/utils" +import { useGetPagesBySite } from "~/queries/page" +import showcase from "../../../../showcase.json" +import { useGetSites } from "~/queries/site" +import { CharacterFloatCard } from "~/components/common/CharacterFloatCard" export const getServerSideProps: GetServerSideProps = serverSidePropsHandler( async (ctx) => { @@ -62,103 +69,172 @@ export default function SubdomainIndex() { }, ] + const pages = useGetPagesBySite({ + type: "post", + site: "xlog", + take: 4, + }) + + const showcaseSites = useGetSites(showcase) + return ( - -
-
- + +
+
+
+ {statMap.map((item) => ( +
+ {t(item.name)} + + {item.value} + +
+ ))} +
+
+ , + }} + ns="dashboard" + /> +
    +
  • + + Create a Post + +
  • +
  • + + Change Site Name or Icon + +
  • +
+ , + }} + ns="dashboard" + /> +
    +
  • + + Join {APP_NAME} + {`'`}s Discord channel + +
  • +
  • + + Follow {APP_NAME} + {`'`}s xLog + +
  • +
  • + + Participate in the development of xLog + +
  • +
  • + + Follow {APP_NAME} + {`'`}s Twitter + +
  • +
+
+
-

{t("Site Stats")}

-
- {statMap.map((item) => ( -
+
+ - {t(item.name)} - - {item.value} - +
+ {t("More")} +
+
+

+ {t("xLog News")} +

+
+ {pages.data?.pages[0]?.list.map((item) => ( + + {item.cover && ( +
+ cover +
+ )} + + {item.title} + +
+ ))}
- ))} +
+
+

+ {t("Meet New Friends")} +

+
    + {showcaseSites.data.slice(0, 6)?.map((site: any) => ( +
  • + + + + {site.handle} + + + + + {site.metadata.content?.name} + + {site.metadata.content?.bio && ( + + {site.metadata.content?.bio} + + )} + + +
  • + ))} +
+
- , - }} - ns="dashboard" - /> -
    -
  • - - Create a Post - -
  • -
  • - - Change Site Name or Icon - -
  • -
  • - Subscribe the{" "} - - posts feed - {" "} - and{" "} - - notifications feed - {" "} - via RSS Reader -
  • -
- , - }} - ns="dashboard" - /> -
    -
  • - - Join {APP_NAME} - {`'`}s Discord channel - -
  • -
  • - - Follow {APP_NAME} - {`'`}s xLog - -
  • -
  • - - View {APP_NAME} - {`'`}s source code or participate in its development - -
  • -
  • - - Follow {APP_NAME} - {`'`}s Twitter - -
  • -
)