Hold /privacy behind a flag until counsel reads it, and fix leftover legal and email copy.
This commit is contained in:
1 parent
ead6c8f716
commit
072e5362f5
43 files changed
+548
-191
No files matched your search
@@ -6,6 +6,7 @@ import { MessagesProvider } from "../contexts/MessagesContext";
|
||||
import { AuthModalProvider } from "../contexts/AuthModalContext";
|
||||
import messages from "../../messages/en/index";
|
||||
import { MAIN_CONTENT_ID } from "../../lib/mainContent";
|
||||
import { isPrivacyPolicyEnabled } from "../../lib/privacyPolicyEnabled";
|
||||
import { NO_INDEX_ROBOTS } from "../../lib/siteMetadata";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
@@ -21,7 +22,7 @@ export const metadata: Metadata = {
|
||||
export default function AdminLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<MessagesProvider messages={messages}>
|
||||
<AuthModalProvider>
|
||||
<AuthModalProvider privacyEnabled={isPrivacyPolicyEnabled()}>
|
||||
<SkipToContent />
|
||||
<Suspense fallback={null}>
|
||||
<ConditionalNavigation />
|
||||
|
||||
@@ -6,6 +6,7 @@ import { MessagesProvider } from "../contexts/MessagesContext";
|
||||
import { AuthModalProvider } from "../contexts/AuthModalContext";
|
||||
import messages from "../../messages/en/index";
|
||||
import { MAIN_CONTENT_ID } from "../../lib/mainContent";
|
||||
import { isPrivacyPolicyEnabled } from "../../lib/privacyPolicyEnabled";
|
||||
import { NO_INDEX_ROBOTS } from "../../lib/siteMetadata";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
@@ -28,7 +29,7 @@ export const metadata: Metadata = {
|
||||
export default function AppLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<MessagesProvider messages={messages}>
|
||||
<AuthModalProvider>
|
||||
<AuthModalProvider privacyEnabled={isPrivacyPolicyEnabled()}>
|
||||
<SkipToContent />
|
||||
<Suspense fallback={null}>
|
||||
<ConditionalNavigation />
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useTranslation } from "../../contexts/MessagesContext";
|
||||
import Login from "../../components/modals/Login";
|
||||
import LoginForm from "../../components/modals/Login/LoginForm";
|
||||
|
||||
const loginPageBgClass =
|
||||
"min-h-[100dvh] bg-[var(--color-surface-invert-brand-primary)]";
|
||||
|
||||
function LoginLoadingFallback() {
|
||||
const t = useTranslation("pages.login");
|
||||
return (
|
||||
<div className={`${loginPageBgClass} flex items-center justify-center`}>
|
||||
<p className="text-[14px] text-[var(--color-content-default-primary)]">
|
||||
{t("loadingFallback")}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LoginWithSearchParams({
|
||||
privacyEnabled,
|
||||
}: {
|
||||
privacyEnabled: boolean;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const t = useTranslation("pages.login");
|
||||
const closeToHome = () => {
|
||||
router.push("/");
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={loginPageBgClass}>
|
||||
<Login
|
||||
isOpen
|
||||
usePortal={false}
|
||||
backdropVariant="solid"
|
||||
onClose={closeToHome}
|
||||
ariaLabelledBy="login-modal-heading"
|
||||
belowCard={
|
||||
<Link
|
||||
href="/"
|
||||
className="text-small-paragraph text-[var(--color-content-invert-tertiary,#2d2d2d)] text-center hover:opacity-90"
|
||||
>
|
||||
{t("backToHome")}
|
||||
</Link>
|
||||
}
|
||||
>
|
||||
<LoginForm privacyEnabled={privacyEnabled} onClose={closeToHome} />
|
||||
</Login>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Full-page login shell for magic-link **error redirects** (`?error=*`) and direct `/login` visits.
|
||||
* Header **Log in** uses `AuthModalProvider` instead; this route stays for verify failures and bookmarks.
|
||||
*/
|
||||
export default function LoginPageClient({
|
||||
privacyEnabled,
|
||||
}: {
|
||||
privacyEnabled: boolean;
|
||||
}) {
|
||||
return (
|
||||
<Suspense fallback={<LoginLoadingFallback />}>
|
||||
<LoginWithSearchParams privacyEnabled={privacyEnabled} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
@@ -1,64 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useTranslation } from "../../contexts/MessagesContext";
|
||||
import Login from "../../components/modals/Login";
|
||||
import LoginForm from "../../components/modals/Login/LoginForm";
|
||||
|
||||
const loginPageBgClass =
|
||||
"min-h-[100dvh] bg-[var(--color-surface-invert-brand-primary)]";
|
||||
|
||||
function LoginLoadingFallback() {
|
||||
const t = useTranslation("pages.login");
|
||||
return (
|
||||
<div className={`${loginPageBgClass} flex items-center justify-center`}>
|
||||
<p className="text-[14px] text-[var(--color-content-default-primary)]">
|
||||
{t("loadingFallback")}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Full-page login shell for magic-link **error redirects** (`?error=*`) and direct `/login` visits.
|
||||
* Header **Log in** uses `AuthModalProvider` instead; this route stays for verify failures and bookmarks.
|
||||
*/
|
||||
function LoginWithSearchParams() {
|
||||
const router = useRouter();
|
||||
const t = useTranslation("pages.login");
|
||||
const closeToHome = () => {
|
||||
router.push("/");
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={loginPageBgClass}>
|
||||
<Login
|
||||
isOpen
|
||||
usePortal={false}
|
||||
backdropVariant="solid"
|
||||
onClose={closeToHome}
|
||||
ariaLabelledBy="login-modal-heading"
|
||||
belowCard={
|
||||
<Link
|
||||
href="/"
|
||||
className="text-small-paragraph text-[var(--color-content-invert-tertiary,#2d2d2d)] text-center hover:opacity-90"
|
||||
>
|
||||
{t("backToHome")}
|
||||
</Link>
|
||||
}
|
||||
>
|
||||
<LoginForm onClose={closeToHome} />
|
||||
</Login>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
import { isPrivacyPolicyEnabled } from "../../../lib/privacyPolicyEnabled";
|
||||
import LoginPageClient from "./LoginPageClient";
|
||||
|
||||
export default function LoginPage() {
|
||||
return (
|
||||
<Suspense fallback={<LoginLoadingFallback />}>
|
||||
<LoginWithSearchParams />
|
||||
</Suspense>
|
||||
);
|
||||
return <LoginPageClient privacyEnabled={isPrivacyPolicyEnabled()} />;
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { MessagesProvider } from "../contexts/MessagesContext";
|
||||
import { AuthModalProvider } from "../contexts/AuthModalContext";
|
||||
import messages from "../../messages/en/index";
|
||||
import { MAIN_CONTENT_ID } from "../../lib/mainContent";
|
||||
import { isPrivacyPolicyEnabled } from "../../lib/privacyPolicyEnabled";
|
||||
import { NO_INDEX_ROBOTS } from "../../lib/siteMetadata";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
@@ -18,7 +19,7 @@ export default function DevLayout({ children }: { children: ReactNode }) {
|
||||
}
|
||||
return (
|
||||
<MessagesProvider messages={messages}>
|
||||
<AuthModalProvider>
|
||||
<AuthModalProvider privacyEnabled={isPrivacyPolicyEnabled()}>
|
||||
<main
|
||||
id={MAIN_CONTENT_ID}
|
||||
tabIndex={-1}
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
} from "../../../lib/legalSyntheticPost";
|
||||
import { getRequestSiteOrigin } from "../../../lib/requestSiteOrigin";
|
||||
import { absoluteSiteUrl } from "../../../lib/siteMetadata";
|
||||
import { isPrivacyPolicyEnabled } from "../../../lib/privacyPolicyEnabled";
|
||||
import ContentBanner from "../../components/sections/ContentBanner";
|
||||
|
||||
type LegalDocumentPageProps = {
|
||||
@@ -45,7 +46,9 @@ function LegalInlineText({ text }: { text: string }) {
|
||||
|
||||
const label = match[1];
|
||||
const href = match[2];
|
||||
if (isSafeHref(href)) {
|
||||
if (href === "/privacy" && !isPrivacyPolicyEnabled()) {
|
||||
nodes.push(label);
|
||||
} else if (isSafeHref(href)) {
|
||||
const isInternal = href.startsWith("/") && !href.startsWith("//");
|
||||
nodes.push(
|
||||
isInternal ? (
|
||||
|
||||
@@ -5,12 +5,13 @@ import SkipToContent from "../components/navigation/SkipToContent";
|
||||
import { MessagesProvider } from "../contexts/MessagesContext";
|
||||
import { AuthModalProvider } from "../contexts/AuthModalContext";
|
||||
import { MAIN_CONTENT_ID } from "../../lib/mainContent";
|
||||
import { isPrivacyPolicyEnabled } from "../../lib/privacyPolicyEnabled";
|
||||
import marketingMessages from "../../messages/en/marketing";
|
||||
|
||||
export default function MarketingLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<MessagesProvider messages={marketingMessages}>
|
||||
<AuthModalProvider>
|
||||
<AuthModalProvider privacyEnabled={isPrivacyPolicyEnabled()}>
|
||||
{/*
|
||||
* Same session-aware shell as `(app)` / `(admin)`: `ConditionalNavigation`
|
||||
* reads the cookie behind Suspense so the static page shell can prerender
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
* https://www.figma.com/design/agv0VBLiBlcnSAaiAORgPR/Community-Rule-System?node-id=19003-23305
|
||||
*/
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import messages from "../../../messages/en/index";
|
||||
import { legalPathForSlug } from "../../../lib/legalSyntheticPost";
|
||||
import { isPrivacyPolicyEnabled } from "../../../lib/privacyPolicyEnabled";
|
||||
import { routeMetadata } from "../../../lib/siteMetadata";
|
||||
import LegalDocumentPage, {
|
||||
legalPageMetadata,
|
||||
@@ -14,6 +16,7 @@ const SLUG = "privacy" as const;
|
||||
const PATH = legalPathForSlug(SLUG);
|
||||
|
||||
export function generateMetadata(): Metadata {
|
||||
if (!isPrivacyPolicyEnabled()) notFound();
|
||||
return routeMetadata(
|
||||
PATH,
|
||||
legalPageMetadata(messages.metadata.privacy, messages.pages.privacy),
|
||||
@@ -21,6 +24,7 @@ export function generateMetadata(): Metadata {
|
||||
}
|
||||
|
||||
export default function PrivacyPage() {
|
||||
if (!isPrivacyPolicyEnabled()) notFound();
|
||||
return (
|
||||
<LegalDocumentPage
|
||||
slug={SLUG}
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
|
||||
import { MessagesProvider } from "../contexts/MessagesContext";
|
||||
import { AuthModalProvider } from "../contexts/AuthModalContext";
|
||||
import { MAIN_CONTENT_ID } from "../../lib/mainContent";
|
||||
import { isPrivacyPolicyEnabled } from "../../lib/privacyPolicyEnabled";
|
||||
import marketingMessages from "../../messages/en/marketing";
|
||||
|
||||
/** Full-viewport case-study surfaces (completed rule demos) — no marketing footer. */
|
||||
@@ -12,7 +13,7 @@ export default function MarketingCaseStudyLayout({
|
||||
}) {
|
||||
return (
|
||||
<MessagesProvider messages={marketingMessages}>
|
||||
<AuthModalProvider>
|
||||
<AuthModalProvider privacyEnabled={isPrivacyPolicyEnabled()}>
|
||||
<main
|
||||
id={MAIN_CONTENT_ID}
|
||||
tabIndex={-1}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { sendOrganizerInquiryNotification } from "../../../lib/server/mail";
|
||||
import {
|
||||
resolveMailFrom,
|
||||
sendOrganizerInquiryNotification,
|
||||
} from "../../../lib/server/mail";
|
||||
import { rateLimitKey } from "../../../lib/server/rateLimit";
|
||||
import {
|
||||
errorJson,
|
||||
@@ -66,7 +69,7 @@ export const POST = apiRoute(SCOPE, async (request: NextRequest, _ctx, { request
|
||||
return serverMisconfigured("ORGANIZER_INQUIRY_TO is not configured");
|
||||
}
|
||||
|
||||
const from = process.env.SMTP_FROM ?? "noreply@localhost";
|
||||
const from = resolveMailFrom();
|
||||
|
||||
try {
|
||||
await sendOrganizerInquiryNotification({
|
||||
|
||||
@@ -120,7 +120,7 @@ export const POST = apiRoute(SCOPE, async (request: NextRequest, _ctx, { request
|
||||
const verifyUrl = `${origin}/api/user/email-change/verify?token=${encodeURIComponent(token)}`;
|
||||
|
||||
try {
|
||||
await sendEmailChangeEmail(newEmail, verifyUrl);
|
||||
await sendEmailChangeEmail(newEmail, verifyUrl, origin);
|
||||
} catch (err) {
|
||||
logRouteError(SCOPE, requestId, err, { phase: "sendEmailChangeEmail" });
|
||||
await prisma.emailChangeToken.deleteMany({ where: { userId: user.id } });
|
||||
|
||||
@@ -111,6 +111,8 @@ export type LoginFormProps = {
|
||||
variant?: LoginFormVariant;
|
||||
/** Overrides URL `next` for `requestMagicLink` (e.g. create-flow exit modal). */
|
||||
magicLinkNextPath?: string;
|
||||
/** When false, the login legal line links terms only. */
|
||||
privacyEnabled?: boolean;
|
||||
/** `keepRule`: Continue without saving. */
|
||||
onDismiss?: () => void;
|
||||
/** Sent-state Close, and the dialog chrome close. */
|
||||
@@ -120,6 +122,7 @@ export type LoginFormProps = {
|
||||
export default function LoginForm({
|
||||
variant = "default",
|
||||
magicLinkNextPath,
|
||||
privacyEnabled = false,
|
||||
onDismiss,
|
||||
onClose,
|
||||
}: LoginFormProps) {
|
||||
@@ -365,13 +368,17 @@ export default function LoginForm({
|
||||
>
|
||||
{tFooter("legal.termsOfService")}
|
||||
</Link>
|
||||
{t("legalAnd")}
|
||||
<Link
|
||||
href={tFooter("legal.privacyPolicyHref")}
|
||||
className="text-[var(--color-content-default-tertiary)] underline decoration-solid underline-offset-2"
|
||||
>
|
||||
{tFooter("legal.privacyPolicy")}
|
||||
</Link>
|
||||
{privacyEnabled ? (
|
||||
<>
|
||||
{t("legalAnd")}
|
||||
<Link
|
||||
href={tFooter("legal.privacyPolicyHref")}
|
||||
className="text-[var(--color-content-default-tertiary)] underline decoration-solid underline-offset-2"
|
||||
>
|
||||
{tFooter("legal.privacyPolicy")}
|
||||
</Link>
|
||||
</>
|
||||
) : null}
|
||||
{t("legalSuffix")}
|
||||
</p>
|
||||
</>
|
||||
|
||||
@@ -13,7 +13,13 @@ import { PRODUCTION_SITE_ORIGIN } from "../../../lib/siteMetadata";
|
||||
* Tiers: smallest viewports (below `md`), `md` through `lg`, `lg` and up.
|
||||
* Matches `--breakpoint-md: 640px`, `--breakpoint-lg: 1024px` in `app/tailwind.css`.
|
||||
*/
|
||||
const Footer = memo(({ siteOrigin = PRODUCTION_SITE_ORIGIN }: { siteOrigin?: string }) => {
|
||||
const Footer = memo(({
|
||||
siteOrigin = PRODUCTION_SITE_ORIGIN,
|
||||
privacyEnabled = false,
|
||||
}: {
|
||||
siteOrigin?: string;
|
||||
privacyEnabled?: boolean;
|
||||
}) => {
|
||||
const t = useTranslation("footer");
|
||||
const tChrome = useTranslation("controlsChrome");
|
||||
|
||||
@@ -213,9 +219,11 @@ const Footer = memo(({ siteOrigin = PRODUCTION_SITE_ORIGIN }: { siteOrigin?: str
|
||||
<Link href={t("takeawayHref")} className={legalLinkClass}>
|
||||
{t("takeaway")}
|
||||
</Link>
|
||||
<Link href={t("legal.privacyPolicyHref")} className={legalLinkClass}>
|
||||
{t("legal.privacyPolicy")}
|
||||
</Link>
|
||||
{privacyEnabled ? (
|
||||
<Link href={t("legal.privacyPolicyHref")} className={legalLinkClass}>
|
||||
{t("legal.privacyPolicy")}
|
||||
</Link>
|
||||
) : null}
|
||||
<Link href={t("legal.termsOfServiceHref")} className={legalLinkClass}>
|
||||
{t("legal.termsOfService")}
|
||||
</Link>
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import Footer from "./Footer";
|
||||
import { isPrivacyPolicyEnabled } from "../../../lib/privacyPolicyEnabled";
|
||||
import { getRequestSiteOrigin } from "../../../lib/requestSiteOrigin";
|
||||
|
||||
/** Footer JSON-LD uses the request origin, same host as the page canonical. */
|
||||
export default async function FooterWithOrigin() {
|
||||
const siteOrigin = await getRequestSiteOrigin();
|
||||
return <Footer siteOrigin={siteOrigin} />;
|
||||
return (
|
||||
<Footer
|
||||
siteOrigin={siteOrigin}
|
||||
privacyEnabled={isPrivacyPolicyEnabled()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -39,7 +39,13 @@ type AuthModalContextValue = {
|
||||
|
||||
const AuthModalContext = createContext<AuthModalContextValue | null>(null);
|
||||
|
||||
export function AuthModalProvider({ children }: { children: ReactNode }) {
|
||||
export function AuthModalProvider({
|
||||
children,
|
||||
privacyEnabled = false,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
privacyEnabled?: boolean;
|
||||
}) {
|
||||
const tLogin = useTranslation("pages.login");
|
||||
const [open, setOpen] = useState(false);
|
||||
const [opts, setOpts] = useState<OpenLoginOptions>({});
|
||||
@@ -93,6 +99,7 @@ export function AuthModalProvider({ children }: { children: ReactNode }) {
|
||||
<LoginForm
|
||||
variant={opts.variant ?? "default"}
|
||||
magicLinkNextPath={opts.nextPath}
|
||||
privacyEnabled={privacyEnabled}
|
||||
onDismiss={keepRuleDismiss}
|
||||
onClose={closeLogin}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user