feat: add policy pages
This commit is contained in:
@@ -0,0 +1,65 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Suspense } from "react";
|
||||||
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
|
import { AuthCard, AuthFooterLink } from "@/components/auth/auth-card";
|
||||||
|
import { LoginForm } from "@/components/auth/login-form";
|
||||||
|
|
||||||
|
function LoginContent() {
|
||||||
|
const router = useRouter();
|
||||||
|
const params = useSearchParams();
|
||||||
|
const next = params.get("next") ?? "/u/me";
|
||||||
|
const oauthError = params.get("oauth_error");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AuthCard
|
||||||
|
title="Welcome back"
|
||||||
|
description="Log in to access your bookmarks, notes, and collections."
|
||||||
|
footer={
|
||||||
|
<AuthFooterLink prefix="No account?" href="/signup" label="Create one" />
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{oauthError ? (
|
||||||
|
<p className="text-sm text-destructive">
|
||||||
|
{oauthErrorMessage(oauthError)}
|
||||||
|
</p>
|
||||||
|
) : null}
|
||||||
|
<LoginForm
|
||||||
|
oauthNext={next}
|
||||||
|
onSuccess={() => {
|
||||||
|
router.push(next);
|
||||||
|
router.refresh();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</AuthCard>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function oauthErrorMessage(code: string): string {
|
||||||
|
switch (code) {
|
||||||
|
case "email_required":
|
||||||
|
return "We couldn't sign you in because the provider didn't share an email. Please use the email/password form below.";
|
||||||
|
case "invalid_state":
|
||||||
|
case "missing_state":
|
||||||
|
return "Your sign-in link expired. Please try again.";
|
||||||
|
case "exchange_failed":
|
||||||
|
case "profile_failed":
|
||||||
|
return "Sign-in failed while talking to the provider. Please try again.";
|
||||||
|
case "unknown_provider":
|
||||||
|
return "That sign-in provider isn't configured. Please use email or another method.";
|
||||||
|
case "unavailable":
|
||||||
|
return "Social sign-in is temporarily unavailable. Please use email/password.";
|
||||||
|
case "server":
|
||||||
|
return "Something went wrong on our side. Please try again in a moment.";
|
||||||
|
default:
|
||||||
|
return "Sign-in failed. Please try again.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function LoginPage() {
|
||||||
|
return (
|
||||||
|
<Suspense fallback={null}>
|
||||||
|
<LoginContent />
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ export default function SignUpPage() {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<SignUpForm
|
<SignUpForm
|
||||||
|
oauthNext="/u/me"
|
||||||
onSuccess={() => {
|
onSuccess={() => {
|
||||||
router.push("/u/me");
|
router.push("/u/me");
|
||||||
router.refresh();
|
router.refresh();
|
||||||
+1
-1
@@ -3,7 +3,7 @@ import Link from "next/link";
|
|||||||
import { PageHeader } from "@/components/page-header";
|
import { PageHeader } from "@/components/page-header";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { getBookMeta, getSingleVerse, getChapterVerseIndex } from "@/lib/api";
|
import { getBookMeta, getSingleVerse, getChapterVerseIndex } from "@/lib/api";
|
||||||
import { ChapterViewer } from "@/app/books/chapter-viewer";
|
import { ChapterViewer } from "@/app/(app)/books/chapter-viewer";
|
||||||
import type { MobileNavGroup } from "@/components/mobile-nav";
|
import type { MobileNavGroup } from "@/components/mobile-nav";
|
||||||
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
||||||
|
|
||||||
+1
-1
@@ -11,7 +11,7 @@ import {
|
|||||||
type VerseIndexEntry,
|
type VerseIndexEntry,
|
||||||
type VerseRecord,
|
type VerseRecord,
|
||||||
} from "@/lib/api";
|
} from "@/lib/api";
|
||||||
import { ChapterViewer } from "@/app/books/chapter-viewer";
|
import { ChapterViewer } from "@/app/(app)/books/chapter-viewer";
|
||||||
import type { MobileNavGroup } from "@/components/mobile-nav";
|
import type { MobileNavGroup } from "@/components/mobile-nav";
|
||||||
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
||||||
|
|
||||||
+1
-1
@@ -5,7 +5,7 @@ import Link from "next/link";
|
|||||||
import { PageHeader } from "@/components/page-header";
|
import { PageHeader } from "@/components/page-header";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { getBookMeta, getSingleVerse, getChapterVerseIndex } from "@/lib/api";
|
import { getBookMeta, getSingleVerse, getChapterVerseIndex } from "@/lib/api";
|
||||||
import { ChapterViewer } from "@/app/books/chapter-viewer";
|
import { ChapterViewer } from "@/app/(app)/books/chapter-viewer";
|
||||||
import type { MobileNavGroup } from "@/components/mobile-nav";
|
import type { MobileNavGroup } from "@/components/mobile-nav";
|
||||||
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
||||||
|
|
||||||
+1
-1
@@ -10,7 +10,7 @@ import {
|
|||||||
type VerseIndexEntry,
|
type VerseIndexEntry,
|
||||||
type VerseRecord,
|
type VerseRecord,
|
||||||
} from "@/lib/api";
|
} from "@/lib/api";
|
||||||
import { ChapterViewer } from "@/app/books/chapter-viewer";
|
import { ChapterViewer } from "@/app/(app)/books/chapter-viewer";
|
||||||
import type { MobileNavGroup } from "@/components/mobile-nav";
|
import type { MobileNavGroup } from "@/components/mobile-nav";
|
||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
||||||
+1
-1
@@ -14,7 +14,7 @@ import {
|
|||||||
type VerseRecord,
|
type VerseRecord,
|
||||||
} from "@/lib/api";
|
} from "@/lib/api";
|
||||||
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
||||||
import { ChapterViewer } from "@/app/books/chapter-viewer";
|
import { ChapterViewer } from "@/app/(app)/books/chapter-viewer";
|
||||||
import type { MobileNavGroup } from "@/components/mobile-nav";
|
import type { MobileNavGroup } from "@/components/mobile-nav";
|
||||||
|
|
||||||
type NbsMeta = {
|
type NbsMeta = {
|
||||||
+1
-1
@@ -5,7 +5,7 @@ import Link from "next/link";
|
|||||||
import { PageHeader } from "@/components/page-header";
|
import { PageHeader } from "@/components/page-header";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { getBookMeta, getSingleVerse, getChapterVerseIndex } from "@/lib/api";
|
import { getBookMeta, getSingleVerse, getChapterVerseIndex } from "@/lib/api";
|
||||||
import { ChapterViewer } from "@/app/books/chapter-viewer";
|
import { ChapterViewer } from "@/app/(app)/books/chapter-viewer";
|
||||||
import type { MobileNavGroup } from "@/components/mobile-nav";
|
import type { MobileNavGroup } from "@/components/mobile-nav";
|
||||||
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
||||||
|
|
||||||
+1
-1
@@ -3,7 +3,7 @@ import Link from "next/link";
|
|||||||
import { PageHeader } from "@/components/page-header";
|
import { PageHeader } from "@/components/page-header";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { getBookMeta, getSingleVerse, getChapterVerseIndex } from "@/lib/api";
|
import { getBookMeta, getSingleVerse, getChapterVerseIndex } from "@/lib/api";
|
||||||
import { ChapterViewer } from "@/app/books/chapter-viewer";
|
import { ChapterViewer } from "@/app/(app)/books/chapter-viewer";
|
||||||
import type { MobileNavGroup } from "@/components/mobile-nav";
|
import type { MobileNavGroup } from "@/components/mobile-nav";
|
||||||
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
import { ogForVerse, extractQuoteFromHl, buildOgMeta } from "@/lib/og";
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user