Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/.env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ BETTER_AUTH_URL=http://localhost:3000
# SENTRY_AUTH_TOKEN=

NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_API_KEY=
NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_BASE_URL=
NEXT_PUBLIC_BLOCKNOTE_AI_SERVER_BASE_URL=

TURNSTILE_SECRET_KEY=
4 changes: 4 additions & 0 deletions docs/app/demo/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export default function DemoPage() {
</h1>
</div>
<DemoEditor />
<script
async
src="https://heyo.so/embed/script?projectId=6982d5659ff7b5fcebeeff26"
></script>
</main>
);
}
4 changes: 4 additions & 0 deletions docs/app/pricing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ export default function Pricing() {
{/* FAQ */}
<FAQ />
</div>
<script
async
src="https://heyo.so/embed/script?projectId=6982d5659ff7b5fcebeeff26"
></script>
</div>
);
}
19 changes: 17 additions & 2 deletions docs/components/AuthenticationPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";

import { authClient, signIn, signUp } from "@/lib/auth-client";
import { Turnstile } from "@marsidev/react-turnstile";
import * as Sentry from "@sentry/nextjs";
import { track } from "@vercel/analytics";
import { useRouter, useSearchParams } from "next/navigation";
Expand Down Expand Up @@ -53,6 +54,7 @@ function AuthenticationBox(props: {
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [turnstileToken, setTurnstileToken] = useState("");

const [signingInState, setSigningInState] = useState<
| { state: "init" }
Expand Down Expand Up @@ -130,7 +132,7 @@ function AuthenticationBox(props: {
},
},
);
} else {
} else if (props.variant === "register") {
track("click-sign-up", { type: "email" });
Sentry.captureEvent({
message: "click-sign-up",
Expand All @@ -147,6 +149,9 @@ function AuthenticationBox(props: {
callbackURL: "/pricing",
},
{
headers: {
"x-captcha-response": turnstileToken,
},
onSuccess() {
setSigningInState({
state: "done",
Expand All @@ -172,6 +177,9 @@ function AuthenticationBox(props: {
},
},
);
} else {
const variant = props.variant satisfies never;
throw new Error("Invalid authentication variant " + variant);
}
};

Expand Down Expand Up @@ -213,6 +221,13 @@ function AuthenticationBox(props: {
onChange={(e) => setPassword(e.target.value)}
/>
)}
{props.variant === "register" && (
<Turnstile
// siteKey="1x00000000000000000000AA" testing key
siteKey="0x4AAAAAACYDIU6NEdlm_V7J"
onSuccess={setTurnstileToken}
/>
)}
<button
type="submit"
disabled={signingInState.state === "loading"}
Expand Down Expand Up @@ -416,7 +431,7 @@ export default function AuthenticationPage(props: {
</h2>
</div>

<div className="mt-10 sm:mx-auto sm:w-full sm:max-w-[480px]">
<div className="mb-10 mt-10 sm:mx-auto sm:w-full sm:max-w-[480px]">
<div className="bg-fd-accent px-6 py-12 shadow sm:rounded-lg sm:px-12">
<AuthenticationBox variant={props.variant} />
</div>
Expand Down
28 changes: 20 additions & 8 deletions docs/components/fumadocs/layout/home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
import type { ComponentProps } from 'react';
import { cn } from '../../../../lib/fumadocs/cn';
import { type BaseLayoutProps, type NavOptions } from '../shared';
import { Header } from './client';
import type { ComponentProps } from "react";
import { cn } from "../../../../lib/fumadocs/cn";
import { type BaseLayoutProps, type NavOptions } from "../shared";
import { Header } from "./client";

export interface HomeLayoutProps extends BaseLayoutProps {
nav?: Partial<NavOptions>;
}

export function HomeLayout(props: HomeLayoutProps & ComponentProps<'main'>) {
const { nav = {}, links, githubUrl, i18n, themeSwitch = {}, searchToggle, ...rest } = props;
export function HomeLayout(props: HomeLayoutProps & ComponentProps<"main">) {
const {
nav = {},
links,
githubUrl,
i18n,
themeSwitch = {},
searchToggle,
children,
...rest
} = props;

return (
<main
id="nd-home-layout"
{...rest}
className={cn('flex flex-1 flex-col [--fd-layout-width:1400px]', rest.className)}
className={cn(
"flex flex-1 flex-col [--fd-layout-width:1400px]",
rest.className,
)}
>
{nav.enabled !== false &&
(nav.component ?? (
Expand All @@ -27,7 +39,7 @@ export function HomeLayout(props: HomeLayoutProps & ComponentProps<'main'>) {
githubUrl={githubUrl}
/>
))}
{props.children}
{children}
</main>
);
}
20 changes: 13 additions & 7 deletions docs/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Polar } from "@polar-sh/sdk";
import * as Sentry from "@sentry/nextjs";
import { betterAuth } from "better-auth";
import {
captcha,
createAuthMiddleware,
customSession,
magicLink,
Expand Down Expand Up @@ -138,6 +139,11 @@ export const auth = betterAuth({
})
: new Database("./sqlite.db"),
plugins: [
captcha({
provider: "cloudflare-turnstile",
secretKey: process.env.TURNSTILE_SECRET_KEY!,
endpoints: ["/sign-up/email"],
}),
customSession(
async ({ user, session }) => {
// If they are a GitHub sponsor, use that plan type
Expand Down Expand Up @@ -273,13 +279,13 @@ export const auth = betterAuth({
// no need to send welcome email
return false;
}
await sendEmail({
to: newSession.user.email,
template: "welcome",
props: {
name: newSession.user.name,
},
});
// await sendEmail({
// to: newSession.user.email,
// template: "welcome",
// props: {
// name: newSession.user.name,
// },
// });
return;
}
}
Expand Down
13 changes: 7 additions & 6 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dev:email": "next dev",
"prebuild:site": "nx run @blocknote/dev-scripts:gen",
"build:site": "fumadocs-mdx && next build",
"start": "serve out",
"start": "next start",
"types:check": "fumadocs-mdx && next typegen && tsc --noEmit",
"postinstall": "fumadocs-mdx",
"lint": "eslint",
Expand All @@ -33,7 +33,7 @@
"@blocknote/xl-multi-column": "workspace:*",
"@blocknote/xl-odt-exporter": "workspace:*",
"@blocknote/xl-pdf-exporter": "workspace:*",
"@fumadocs/base-ui": "^16.4.7",
"@fumadocs/base-ui": "16.5.0",
"@liveblocks/client": "3.7.1-tiptap3",
"@liveblocks/react": "3.7.1-tiptap3",
"@liveblocks/react-blocknote": "3.7.1-tiptap3",
Expand All @@ -42,6 +42,7 @@
"@mantine/core": "^8.3.11",
"@mantine/hooks": "^8.3.11",
"@mantine/utils": "^6.0.22",
"@marsidev/react-turnstile": "^1.4.2",
"@mui/icons-material": "^5.16.1",
"@mui/material": "^5.16.1",
"@orama/orama": "^3.1.18",
Expand Down Expand Up @@ -75,11 +76,11 @@
"better-sqlite3": "^12.6.2",
"class-variance-authority": "^0.7.1",
"framer-motion": "^12.26.2",
"fumadocs-core": "16.4.7",
"fumadocs-mdx": "14.2.5",
"fumadocs-core": "16.5.0",
"fumadocs-mdx": "^14.2.6",
"fumadocs-twoslash": "^3.1.12",
"fumadocs-typescript": "^5.0.1",
"fumadocs-ui": "npm:@fumadocs/base-ui@latest",
"fumadocs-typescript": "^5.1.1",
"fumadocs-ui": "npm:@fumadocs/base-ui@16.5.0",
"lucide-react": "^0.562.0",
"motion": "^12.28.1",
"next": "^16.1.5",
Expand Down
Loading
Loading