www: add login on layout and fixes browse

This commit is contained in:
2023-10-18 19:52:03 +02:00
committed by Mathieu Virbel
parent 81dc9458ae
commit 220b9811af
3 changed files with 63 additions and 51 deletions

View File

@@ -12,18 +12,16 @@ export default function UserInfo() {
return !isAuthenticated ? (
<span className="hover:underline focus-within:underline underline-offset-2 decoration-[.5px] font-light px-2">
<Link href="/login" className="outline-none">
Log in or create account
Log in
</Link>
</span>
) : (
<span className="font-light px-2">
{userinfo?.email} (
<span className="hover:underline focus-within:underline underline-offset-2 decoration-[.5px]">
<Link href="/logout" className="outline-none">
Log out
</Link>
</span>
)
</span>
);
}

View File

@@ -57,20 +57,27 @@ export default function TranscriptBrowser() {
/>
</div>
<div /** center and max 900px wide */ className="mx-auto max-w-[900px]">
<div className="grid grid-cols-1 gap-2 lg:gap-4 h-full">
{isLoading ? (
{isLoading && (
<div className="full-screen flex flex-col items-center justify-center">
<FontAwesomeIcon
icon={faGear}
className="animate-spin-slow h-14 w-14 md:h-20 md:w-20"
/>
) : (
<>
{results === null ? (
<div className="text-gray-500">No transcripts found.</div>
</div>
)}
{!isLoading && !results ? (
<div className="text-gray-500">
No transcripts found, but you can&nbsp;
<Link href="/transcripts/new" className="underline">
record a meeting
</Link>
&nbsp;to get started.
</div>
) : (
<></>
)}
<div /** center and max 900px wide */ className="mx-auto max-w-[900px]">
<div className="grid grid-cols-1 gap-2 lg:gap-4 h-full">
{results?.items.map((item: GetTranscript) => (
<div
key={item.id}
@@ -108,8 +115,6 @@ export default function TranscriptBrowser() {
</div>
</div>
))}
</>
)}
</div>
</div>
</div>

View File

@@ -9,7 +9,7 @@ import Image from "next/image";
import Link from "next/link";
import About from "./(aboutAndPrivacy)/about";
import Privacy from "./(aboutAndPrivacy)/privacy";
import { featPrivacy } from "./lib/utils";
import { featPrivacy, featRequireLogin } from "./lib/utils";
const poppins = Poppins({ subsets: ["latin"], weight: ["200", "400", "600"] });
@@ -60,6 +60,7 @@ export const metadata: Metadata = {
};
export default function RootLayout({ children }) {
const requireLogin = featRequireLogin();
return (
<html lang="en">
<body className={poppins.className + " h-screen relative"}>
@@ -117,6 +118,14 @@ export default function RootLayout({ children }) {
) : (
<></>
)}
{requireLogin ? (
<>
&nbsp;·&nbsp;
<UserInfo />
</>
) : (
<></>
)}
</div>
</header>