update site footer

This commit is contained in:
EGOIST
2022-05-25 00:35:40 +08:00
parent 4c2b83273c
commit bb6d3471ea
7 changed files with 78 additions and 13 deletions
+43 -11
View File
@@ -1,23 +1,30 @@
import Link from "next/link"
import { Icon } from "@iconify/react"
import discordIcon from "@iconify/icons-mdi/discord"
import githubIcon from "@iconify/icons-mdi/github"
import { logout } from "~/lib/auth.client"
import { APP_DESCRIPTION, APP_NAME } from "~/lib/env"
import { APP_DESCRIPTION, APP_NAME, GITHUB_LINK, OUR_DOMAIN } from "~/lib/env"
import { useStore } from "~/lib/store"
import { truthy } from "~/lib/utils"
import { SEOHead } from "../common/SEOHead"
import { UniLink } from "../ui/UniLink"
export function MainLayout({
isLoggedIn,
children,
region,
title,
}: {
isLoggedIn: boolean
children?: React.ReactNode
region: string | null
title?: string
}) {
const setLoginModalOpened = useStore((store) => store.setLoginModalOpened)
const docsDomain = `docs.${OUR_DOMAIN}`
const discordLink = `https://${OUR_DOMAIN}/discord`
const companyLinks = [
{ text: "Blog", href: `https://blog.${OUR_DOMAIN}` },
{ text: "Changelog", href: `https://changelog.${OUR_DOMAIN}` },
{ text: "Privacy", href: `https://${docsDomain}/privacy.html` },
{ text: "Terms", href: `https://${docsDomain}/terms.html` },
]
return (
<>
@@ -64,12 +71,37 @@ export function MainLayout({
</header>
{children}
<footer className="mt-10 text-sm font-medium text-zinc-500">
<div className="max-w-screen-md px-5 mx-auto">
<span>&copy; {APP_NAME}</span>
<span className="mx-3">·</span>
<span>
Region: <span className="uppercase">{region}</span>
</span>
<div className="max-w-screen-md px-5 mx-auto flex justify-between">
<div>
<span>&copy; {APP_NAME}</span>
<div className="text-zinc-400 mt-2 flex items-center space-x-1">
<UniLink href={discordLink}>
<Icon
icon={discordIcon}
className="w-5 h-5 hover:text-indigo-500"
/>
</UniLink>
{GITHUB_LINK && (
<UniLink href={GITHUB_LINK}>
<Icon
icon={githubIcon}
className="w-5 h-5 hover:text-zinc-900"
/>
</UniLink>
)}
</div>
</div>
<ul className="text-right text-zinc-400 transition-colors">
{companyLinks.map((link) => {
return (
<li key={link.text}>
<UniLink href={link.href} className="hover:text-indigo-500">
{link.text}
</UniLink>
</li>
)
})}
</ul>
</div>
</footer>
</>
+2
View File
@@ -5,3 +5,5 @@ export const OUR_DOMAIN = process.env.NEXT_PUBLIC_OUR_DOMAIN
export const SITE_URL = `${IS_PROD ? "https" : "http"}://${OUR_DOMAIN}`
export const R2_URL = process.env.NEXT_PUBLIC_R2_URL
export const APP_DESCRIPTION = process.env.APP_DESCRIPTION
export const DISCORD_LINK = process.env.NEXT_PUBLIC_DISCORD_LINK
export const GITHUB_LINK = process.env.NEXT_PUBLIC_GITHUB_LINK
+5
View File
@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from "next/server"
import { IS_PROD } from "~/lib/constants"
import { DISCORD_LINK } from "~/lib/env"
import { FLY_REGION, IS_PRIMARY_REGION, PRIMARY_REGION } from "~/lib/env.server"
import { getTenant } from "~/lib/tenant.server"
@@ -39,5 +40,9 @@ export default function middleware(req: NextRequest) {
return NextResponse.rewrite(url)
}
if (DISCORD_LINK && pathname === "/discord") {
return NextResponse.redirect(DISCORD_LINK)
}
return NextResponse.next()
}
+6 -1
View File
@@ -1,4 +1,5 @@
import { GetServerSideProps } from "next"
import { useEffect } from "react"
import { DashboardIcon } from "~/components/icons/DashboardIcon"
import { MainLayout } from "~/components/main/MainLayout"
import { UniLink } from "~/components/ui/UniLink"
@@ -27,8 +28,12 @@ export default function Home({
}) {
const setLoginModalOpened = useStore((store) => store.setLoginModalOpened)
useEffect(() => {
console.log("-> region", region)
}, [region])
return (
<MainLayout isLoggedIn={isLoggedIn} region={region}>
<MainLayout isLoggedIn={isLoggedIn}>
<section>
<div className="max-w-screen-md px-5 mx-auto">
<div className="bg-zinc-50 rounded-xl p-10">