paper-ai-release-24-07-21/app/[lng]/page.tsx

80 lines
2.7 KiB
TypeScript
Raw Normal View History

2024-02-08 10:30:58 +08:00
import PaperListButtonWrapper from "@/components/PaperListButtonWrapper";
import AuthButton from "@/components/AuthButton";
2024-01-18 15:46:18 +08:00
import { createClient } from "@/utils/supabase/server";
import ConnectSupabaseSteps from "@/components/ConnectSupabaseSteps";
import SignUpUserSteps from "@/components/SignUpUserSteps";
import Header from "@/components/Header";
import { cookies } from "next/headers";
2024-02-12 15:00:21 +08:00
import QuillWrapper from "@/components/QuillWrapper";
2024-01-21 23:08:25 +08:00
// import TinyEditor from "../components/TinyEditor";
// import SEditor from "../components/SlateEditor";
import SettingsLink from "@/components/SettingsLink";
2024-02-08 10:30:58 +08:00
import PaperManagementWrapper from "@/components/PaperManagementWrapper";
2024-02-12 20:55:14 +08:00
//i18n
import { useTranslation } from "@/app/i18n";
import { IndexProps } from "@/utils/global";
2024-02-03 23:07:02 +08:00
2024-01-22 23:09:16 +08:00
// import Error from "@/app/global-error";
2024-02-12 20:55:14 +08:00
export default async function Index({ params: { lng } }: IndexProps) {
const { t } = await useTranslation(lng);
2024-01-18 15:46:18 +08:00
const cookieStore = cookies();
const canInitSupabaseClient = () => {
// This function is just for the interactive tutorial.
// Feel free to remove it once you have Supabase connected.
try {
createClient(cookieStore);
return true;
} catch (e) {
return false;
}
};
const isSupabaseConnected = canInitSupabaseClient();
return (
2024-02-10 21:53:05 +08:00
<div className="flex-1 w-full flex flex-col gap-5 items-center">
2024-01-18 15:46:18 +08:00
<nav className="w-full flex justify-center border-b border-b-foreground/10 h-16">
<div className="w-full max-w-4xl flex justify-between items-center p-3 text-sm">
2024-02-08 10:30:58 +08:00
{/* <DeployButton /> */}
{/* 用来表示是否显示论文列表页 */}
<PaperListButtonWrapper />
2024-01-18 15:46:18 +08:00
{isSupabaseConnected && <AuthButton />}
2024-01-21 23:08:25 +08:00
<SettingsLink />
2024-01-18 15:46:18 +08:00
</div>
</nav>
2024-02-12 20:55:14 +08:00
<PaperManagementWrapper lng={lng} />
<QuillWrapper lng={lng} />
2024-01-18 15:46:18 +08:00
<footer className="w-full border-t border-t-foreground/10 p-8 flex justify-center text-center text-xs">
<p>
<a
2024-01-21 23:08:25 +08:00
href="https://github.com/14790897/paper-ai"
2024-01-18 15:46:18 +08:00
target="_blank"
className="font-bold hover:underline"
rel="noreferrer"
>
2024-02-12 20:55:14 +08:00
{t("give me a star in GitHub")}
2024-01-18 15:46:18 +08:00
</a>
</p>
</footer>
</div>
);
}
{
/* <div className="animate-in flex-1 flex flex-col gap-20 opacity-0 max-w-4xl px-3">
<Header />
<main className="flex-1 flex flex-col gap-6">
<h2 className="font-bold text-4xl mb-4">Next steps</h2>
{isSupabaseConnected ? <SignUpUserSteps /> : <ConnectSupabaseSteps />}
</main>
</div> */
}
{
/* <div className="animate-in flex-1 flex flex-col gap-20 opacity-0 max-w-4xl px-3"> */
}
{
/*</div> */
}