feat: swap the homepage and activities page

This commit is contained in:
DIYgod
2023-06-27 01:32:03 +01:00
parent 54771b00c0
commit 6b010d3bad
8 changed files with 48 additions and 9 deletions
+45 -7
View File
@@ -5,11 +5,14 @@ import { usePathname, useRouter } from "next/navigation"
import { useAccountState, useConnectModal } from "@crossbell/connect-kit"
import { Tabs } from "~/components/ui/Tabs"
import { UniLink } from "~/components/ui/UniLink"
import { Trans, useTranslation } from "~/lib/i18n/client"
export const HomeActivitiesTabs = () => {
const pathname = usePathname()
const connectModal = useConnectModal()
const router = useRouter()
const { t, i18n } = useTranslation("index")
const currentCharacterId = useAccountState(
(s) => s.computed.account?.characterId,
@@ -18,13 +21,13 @@ export const HomeActivitiesTabs = () => {
const tabs = [
{
text: "Latest",
href: "/activities",
active: pathname === "/activities",
href: "/",
active: pathname === "/",
},
{
text: "Hottest",
href: "/activities/hottest",
active: pathname === "/activities/hottest",
href: "/hottest",
active: pathname === "/hottest",
},
{
text: "Following",
@@ -32,12 +35,47 @@ export const HomeActivitiesTabs = () => {
if (!currentCharacterId) {
connectModal.show()
} else {
router.push(`/activities/following`)
router.push(`/following`)
}
},
active: pathname === "/activities/following",
active: pathname === "/following",
},
]
return <Tabs items={tabs} className="border-none text-lg"></Tabs>
const features = ["Write", "Own", "Earn"]
return (
<>
<UniLink
href="/about"
className="block bg-zinc-50/70 py-6 rounded-3xl text-center mb-6 space-y-2"
>
<span className="block text-2xl sm:text-3xl font-bold">
{features.map((feature) => (
<span
key={feature}
className={`text-feature text-feature-${feature.toLocaleLowerCase()} block sm:inline-block sm:mr-1 mb-2`}
>
{t(feature)}
{t(".")}
</span>
))}
</span>
<span className="block text-zinc-800 text-lg sm:text-xl font-light">
<Trans i18n={i18n} i18nKey="description" ns="index">
<strong className="font-medium">xLog</strong> is the best{" "}
<span className="underline decoration-2 text-yellow-400 font-medium">
on-chain
</span>{" "}
and{" "}
<span className="underline decoration-2 text-green-400 font-medium">
open-source
</span>{" "}
blogging community for everyone.
</Trans>
</span>
</UniLink>
<Tabs items={tabs} className="border-none text-lg"></Tabs>
</>
)
}
+2 -2
View File
@@ -15,8 +15,8 @@ const tabs = [
link: "/",
},
{
name: "Activities",
link: "/activities",
name: "About",
link: "/about",
},
{
name: (
+1
View File
@@ -30,6 +30,7 @@
"Showcase": "展示柜",
"Integration": "集成",
"Home": "首页",
"About": "关于",
"Activities": "动态",
"Source Code": "源码",
"Visit": "访问",