Skip to content

Open source CapCut alternative.

TypeScript

feat(site): blog editor in Write and Details tabs, with shadcn pickers

David Leb2727119e211
diff --git a/site/package-lock.json b/site/package-lock.json
index e91d9d2c..578050e8 100644
--- a/site/package-lock.json
+++ b/site/package-lock.json
@@ -45,6 +45,8 @@
"browser-use-sdk": "^3.8.4",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
+ "cn": "^0.2.6",
+ "date-fns": "^4.4.0",
"defuddle": "^0.18.1",
"hls.js": "^1.6.16",
"lexical": "^0.48.0",
@@ -59,6 +61,7 @@
"pg": "^8.20.0",
"posthog-js": "^1.428.5",
"react": "19.2.4",
+ "react-day-picker": "^10.0.1",
"react-dom": "19.2.4",
"react-email": "^6.9.1",
"react-markdown": "^10.1.0",
@@ -1858,6 +1861,12 @@
"w3c-keyname": "^2.2.4"
}
},
+ "node_modules/@date-fns/tz": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@date-fns/tz/-/tz-1.5.0.tgz",
+ "integrity": "sha512-lwYN/vDPeNRULcepoE/LO2Pgx+7/RV+S9ARfbc9lr2DtGkOD7pAiruHvbR1RX3Qyf6ja47EWJDMsNK5vK08DJg==",
+ "license": "MIT"
+ },
"node_modules/@donkeycut/abexp": {
"resolved": "packages/abexp",
"link": true
@@ -11802,6 +11811,18 @@
"@lezer/highlight": "^1.0.0"
}
},
+ "node_modules/cn": {
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/cn/-/cn-0.2.6.tgz",
+ "integrity": "sha512-+i4L0zUGgRcEnhsxueVrP7iBGxBx5iD0WOTYg1MwFEu2ZyCmH5Ov2V1cul2Ht5UchRQQgftCf4be/RxspuW6QQ==",
+ "license": "MIT",
+ "bin": {
+ "cn": "bin/cn.mjs"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
"node_modules/code-block-writer": {
"version": "13.0.3",
"resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-13.0.3.tgz",
@@ -12344,6 +12365,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/date-fns": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.4.0.tgz",
+ "integrity": "sha512-+1UMbeh68lH1SegH83CGWwpb6OHHbpSgr3+s5Eww5M4CAgswBpoWS0AjTOfEJ33HiYKz1hdj/KTFprzXHmq/6w==",
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/kossnocorp"
+ }
+ },
"node_modules/debounce": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/debounce/-/debounce-2.2.0.tgz",
@@ -19883,6 +19914,32 @@
"node": ">=0.10.0"
}
},
+ "node_modules/react-day-picker": {
+ "version": "10.0.1",
+ "resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-10.0.1.tgz",
+ "integrity": "sha512-eNh6BlwcYInWaJtRv18mXQ06Ys/H6rdTZAnTaSdOYJuTpwP1JMCHNd1FDRadA+gbeinq+psdULN5Xnowy9mV8w==",
+ "license": "MIT",
+ "dependencies": {
+ "@date-fns/tz": "^1.4.1",
+ "date-fns": "^4.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/sponsors/gpbl"
+ },
+ "peerDependencies": {
+ "@types/react": ">=16.8.0",
+ "react": ">=16.8.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
"node_modules/react-dom": {
"version": "19.2.4",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz",
diff --git a/site/package.json b/site/package.json
index fead35ee..90fcc502 100644
--- a/site/package.json
+++ b/site/package.json
@@ -68,6 +68,8 @@
"browser-use-sdk": "^3.8.4",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
+ "cn": "^0.2.6",
+ "date-fns": "^4.4.0",
"defuddle": "^0.18.1",
"hls.js": "^1.6.16",
"lexical": "^0.48.0",
@@ -82,6 +84,7 @@
"pg": "^8.20.0",
"posthog-js": "^1.428.5",
"react": "19.2.4",
+ "react-day-picker": "^10.0.1",
"react-dom": "19.2.4",
"react-email": "^6.9.1",
"react-markdown": "^10.1.0",
diff --git a/site/src/app/api/su/blog/posts/[id]/publish/route.ts b/site/src/app/api/su/blog/posts/[id]/publish/route.ts
index 79339cbe..4bda1a0a 100644
--- a/site/src/app/api/su/blog/posts/[id]/publish/route.ts
+++ b/site/src/app/api/su/blog/posts/[id]/publish/route.ts
@@ -4,34 +4,27 @@ import { z } from "zod";
import { adminPost } from "@/lib/blog/admin";
import { readBody } from "@/lib/blog/read";
import { revalidateBlog } from "@/lib/blog/revalidate";
-import { publishIssues } from "@/lib/blog/schema";
import { notFoundResponse, withSuperUser } from "@/lib/donkey-api-auth";
import { prisma } from "@/lib/prisma";
type Params = { params: Promise<{ id: string }> };
const idSchema = z.string().trim().min(1);
-// Publishing holds the post to the full contract, then dates it if the editor
-// left the date empty. One featured post at a time: featuring this one clears
-// the others.
+// Publishing puts the post on the site as it is, dated now if the editor
+// left the date empty; a date in the future is the one thing it refuses. One
+// featured post at a time: featuring this one clears the others.
export const POST = withSuperUser(async (_request, { params }: Params) => {
const id = idSchema.safeParse((await params).id);
if (!id.success) return notFoundResponse();
const existing = await prisma.blogPost.findUnique({ where: { id: id.data } });
if (!existing) return notFoundResponse();
- const body = await readBody(existing.id);
- const issues = publishIssues({
- title: existing.title,
- excerpt: existing.excerpt,
- summary: existing.summary,
- headerKey: existing.headerKey,
- thumbnailKey: existing.thumbnailKey,
- publishedAt: existing.publishedAt?.toISOString() ?? null,
- body,
- });
- if (issues.length > 0) {
- return NextResponse.json({ error: "Not ready to publish", issues }, { status: 400 });
+ if (existing.publishedAt && existing.publishedAt.getTime() > Date.now()) {
+ return NextResponse.json(
+ { error: "Not ready to publish", issues: [{ path: "publishedAt", message: "The publish date cannot be in the future." }] },
+ { status: 400 },
+ );
}
+ const body = await readBody(existing.id);
const [row] = await prisma.$transaction([
prisma.blogPost.update({
where: { id: id.data },
diff --git a/site/src/app/su/blog/[id]/DateTimeField.tsx b/site/src/app/su/blog/[id]/DateTimeField.tsx
new file mode 100644
index 00000000..ac6102e2
--- /dev/null
+++ b/site/src/app/su/blog/[id]/DateTimeField.tsx
@@ -0,0 +1,94 @@
+"use client";
+
+import { CalendarIcon } from "lucide-react";
+import { useState } from "react";
+
+import { Button, buttonVariants } from "@/components/ui/button";
+import { Calendar } from "@/components/ui/calendar";
+import { Input } from "@/components/ui/input";
+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+import { cn } from "@/lib/utils";
+
+const pad = (n: number) => String(n).padStart(2, "0");
+const timeOf = (date: Date | null) => (date ? `${pad(date.getHours())}:${pad(date.getMinutes())}` : "");
+
+// The chosen day at the time already set, or at the current time when none was.
+function dayAt(day: Date, current: Date | null): string {
+ const base = current ?? new Date();
+ const next = new Date(day);
+ next.setHours(base.getHours(), base.getMinutes(), 0, 0);
+ return next.toISOString();
+}
+
+// The day already set (today when none was) at the typed time.
+function timeAt(time: string, current: Date | null): string | null {
+ const [hours, minutes] = time.split(":").map(Number);
+ if (!Number.isFinite(hours) || !Number.isFinite(minutes)) return null;
+ const next = current ? new Date(current) : new Date();
+ next.setHours(hours, minutes, 0, 0);
+ return next.toISOString();
+}
+
+// A day and a time, kept as one instant. The calendar picks the day, the time
+// box the wall-clock time in the editor's zone; either alone starts from now.
+export function DateTimeField({
+ id,
+ value,
+ onChange,
+}: {
+ id: string;
+ value: string | null;
+ onChange: (iso: string | null) => void;
+}) {
+ const [open, setOpen] = useState(false);
+ const date = value ? new Date(value) : null;
+
+ return (
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger
+ id={id}
+ className={cn(
+ buttonVariants({ variant: "outline" }),
+ "w-full justify-start gap-2 font-normal",
+ !date && "text-muted-foreground",
+ )}
+ >
+ <CalendarIcon className="size-4" />
+ {date ? date.toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short" }) : "Pick a date"}
+ </PopoverTrigger>
+ <PopoverContent align="start" className="w-auto p-0">
+ <Calendar
+ mode="single"
+ selected={date ?? undefined}
+ onSelect={(day) => onChange(day ? dayAt(day, date) : null)}
+ captionLayout="dropdown"
+ />
+ <div className="flex items-center gap-2 border-t p-2">
+ <Input
+ type="time"
+ aria-label="Time"
+ value={timeOf(date)}
+ onChange={(event) => {
+ const next = timeAt(event.target.value, date);
+ if (next) onChange(next);
+ }}
+ className="w-auto"
+ />
+ <Button
+ type="button"
+ size="sm"
+ variant="ghost"
+ className="ml-auto"
+ disabled={!date}
+ onClick={() => {
+ onChange(null);
+ setOpen(false);
+ }}
+ >
+ Clear
+ </Button>
+ </div>
+ </PopoverContent>
+ </Popover>
+ );
+}
diff --git a/site/src/app/su/blog/[id]/ImageUpload.tsx b/site/src/app/su/blog/[id]/ImageUpload.tsx
index e928d297..8cd70a66 100644
--- a/site/src/app/su/blog/[id]/ImageUpload.tsx
+++ b/site/src/app/su/blog/[id]/ImageUpload.tsx
@@ -1,55 +1,111 @@
"use client";
-import { useRef } from "react";
+import { ImagePlus, Trash2, Upload } from "lucide-react";
+import { useRef, useState, type ReactNode } from "react";
import { Button } from "@/components/ui/button";
import type { BlogImageKind } from "@/lib/blog/images";
+import { cn } from "@/lib/utils";
import { useRemoveBlogImage, useUploadBlogImage } from "@/queries/blog";
export const BLOG_IMAGE_ACCEPT = "image/png,image/jpeg,image/webp,image/gif,image/avif";
-// Upload, replace and remove for the header or the thumbnail. The bytes go
-// straight to storage and come back encoded; the row is updated by the route,
-// so the preview the caller draws follows the query.
+// The image box is the upload: empty, it takes a click or a dropped file;
+// filled, it draws the image (or whatever the caller puts there, such as the
+// focus picker) with replace and remove on hover. The bytes go straight to
+// storage and come back encoded; the route updates the row, so the caller's
+// image follows the query.
export function ImageUpload({
postId,
kind,
- hasImage,
- onUploaded,
+ url,
+ label,
+ className,
+ children,
}: {
postId: string;
kind: Exclude<BlogImageKind, "inline">;
- hasImage: boolean;
- onUploaded?: () => void;
+ url: string | null;
+ label: string;
+ className?: string;
+ children?: ReactNode;
}) {
const upload = useUploadBlogImage(postId);
const remove = useRemoveBlogImage(postId);
const input = useRef<HTMLInputElement>(null);
+ const [over, setOver] = useState(false);
const busy = upload.isPending || remove.isPending;
+ const take = (file: File | undefined) => {
+ if (file && file.type.startsWith("image/")) upload.mutate({ file, kind });
+ };
+
return (
- <div className="flex flex-wrap items-center gap-2">
- <input
- ref={input}
- type="file"
- accept={BLOG_IMAGE_ACCEPT}
- className="hidden"
- onChange={(event) => {
- const file = event.target.files?.[0];
- event.target.value = "";
- if (file) upload.mutate({ file, kind }, { onSuccess: () => onUploaded?.() });
+ <div className="space-y-1.5">
+ <div
+ className={cn("group relative overflow-hidden rounded-2xl", className)}
+ onDragOver={(event) => {
+ event.preventDefault();
+ setOver(true);
+ }}
+ onDragLeave={() => setOver(false)}
+ onDrop={(event) => {
+ event.preventDefault();
+ setOver(false);
+ take(event.dataTransfer.files[0]);
}}
- />
- <Button type="button" size="sm" variant="outline" disabled={busy} onClick={() => input.current?.click()}>
- {upload.isPending ? "Uploading…" : hasImage ? "Replace" : "Upload"}
- </Button>
- {hasImage ? (
- <Button type="button" size="sm" variant="ghost" disabled={busy} onClick={() => remove.mutate(kind)}>
- {remove.isPending ? "Removing…" : "Remove"}
- </Button>
- ) : null}
- {upload.isError ? <span className="text-xs text-destructive">{upload.error.message}</span> : null}
- {remove.isError ? <span className="text-xs text-destructive">{remove.error.message}</span> : null}
+ >
+ <input
+ ref={input}
+ type="file"
+ accept={BLOG_IMAGE_ACCEPT}
+ className="hidden"
+ onChange={(event) => {
+ take(event.target.files?.[0]);
+ event.target.value = "";
+ }}
+ />
+ {url ? (
+ <>
+ {children ?? <img src={url} alt="" className="size-full object-cover" />}
+ <div className="absolute top-2 right-2 flex gap-1.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100">
+ <Button type="button" size="sm" variant="secondary" disabled={busy} onClick={() => input.current?.click()}>
+ <Upload />
+ Replace
+ </Button>
+ <Button type="button" size="sm" variant="secondary" disabled={busy} onClick={() => remove.mutate(kind)}>
+ <Trash2 />
+ Remove
+ </Button>
+ </div>
+ </>
+ ) : (
+ <button
+ type="button"
+ disabled={busy}
+ onClick={() => input.current?.click()}
+ className={cn(
+ "flex size-full flex-col items-center justify-center gap-2 rounded-2xl border-2 border-dashed text-sm text-muted-foreground transition-colors hover:border-foreground/40 hover:text-foreground",
+ over && "border-foreground/60 bg-muted text-foreground",
+ )}
+ >
+ <ImagePlus className="size-5" />
+ <span>{label}</span>
+ <span className="text-xs">Click or drop an image</span>
+ </button>
+ )}
+ {busy ? (
+ <div className="absolute inset-0 flex items-center justify-center bg-background/70 text-sm">
+ {upload.isPending ? "Uploading…" : "Removing…"}
+ </div>
+ ) : over && url ? (
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center bg-background/70 text-sm">
+ Drop to replace
+ </div>
+ ) : null}
+ </div>
+ {upload.isError ? <p className="text-xs text-destructive">{upload.error.message}</p> : null}
+ {remove.isError ? <p className="text-xs text-destructive">{remove.error.message}</p> : null}
</div>
);
}
diff --git a/site/src/app/su/blog/[id]/PostEditorPage.tsx b/site/src/app/su/blog/[id]/PostEditorPage.tsx
index 76f2e44d..8fe87a7a 100644
--- a/site/src/app/su/blog/[id]/PostEditorPage.tsx
+++ b/site/src/app/su/blog/[id]/PostEditorPage.tsx
@@ -4,6 +4,7 @@ import Link from "next/link";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { BlogEditor } from "@/app/su/blog/[id]/BlogEditor";
+import { DateTimeField } from "@/app/su/blog/[id]/DateTimeField";
import { HeaderFocusPicker } from "@/app/su/blog/[id]/HeaderFocusPicker";
import { ImageUpload } from "@/app/su/blog/[id]/ImageUpload";
import { TagInput } from "@/app/su/blog/[id]/TagInput";
@@ -14,6 +15,7 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Textarea } from "@/components/ui/textarea";
import { SU_APP_ORIGIN } from "@/cut/lib/hosts";
import {
@@ -36,9 +38,9 @@ import {
type BlogPostAdminWithBody,
} from "@/queries/blog";
-// One post: the body on the left, everything the page and the search result
-// are built from on the right. Save writes the whole draft; Publish holds the
-// saved post to the contract in publishIssues and puts it on the site.
+// One post in two tabs: the writing (title and article) and the details the
+// page and the search result are built from. Save writes the whole draft;
+// Publish saves first, then puts the post on the site.
export function PostEditorPage({ id }: { id: string }) {
const post = useBlogPost(id);
@@ -74,20 +76,6 @@ const inputOf = (post: BlogPostAdminWithBody): BlogPostInput => ({
body: post.body,
});
-// datetime-local speaks local wall time without a zone; the row keeps an
-// instant.
-const toLocalInput = (iso: string | null): string => {
- if (!iso) return "";
- const date = new Date(iso);
- const pad = (n: number) => String(n).padStart(2, "0");
- return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
-};
-const fromLocalInput = (value: string): string | null => {
- if (!value) return null;
- const date = new Date(value);
- return Number.isNaN(date.getTime()) ? null : date.toISOString();
-};
-
const issuesByPath = (error: unknown): Record<string, string> => {
const map: Record<string, string> = {};
if (error instanceof ApiError) {
@@ -106,6 +94,17 @@ function Count({ value, max, min = 0 }: { value: string; max: number; min?: numb
);
}
+function CountedLabel({ htmlFor, children, value, max, min }: { htmlFor: string; children: string; value: string; max: number; min?: number }) {
+ return (
+ <div className="flex items-baseline justify-between">
+ <Label htmlFor={htmlFor} className="text-xs text-muted-foreground">
+ {children}
+ </Label>
+ <Count value={value} max={max} min={min} />
+ </div>
+ );
+}
+
function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
const posts = useBlogPosts();
const save = useSaveBlogPost(post.id);
@@ -134,36 +133,40 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
const patch = (next: Partial<BlogPostInput>) => setDraft((current) => ({ ...current, ...next }));
- const doSave = useCallback(() => {
+ const fail = (error: Error) => {
+ setIssues(issuesByPath(error));
+ setNotice(error.message);
+ };
+
+ // Writes the draft; resolves true when it landed.
+ const doSave = useCallback(async () => {
const submitted = draftRef.current;
- if (save.isPending) return;
setIssues({});
setNotice(null);
- save.mutate(submitted, {
- onSuccess: ({ post: row }) => {
- const next = inputOf(row);
- setSaved(next);
- // Keep what was typed during the save; otherwise take the row's
- // normalized values so the form shows exactly what is stored.
- setDraft((current) => (current === submitted ? next : current));
- },
- onError: (error) => {
- setIssues(issuesByPath(error));
- setNotice(error.message);
- },
- });
+ try {
+ const { post: row } = await save.mutateAsync(submitted);
+ const next = inputOf(row);
+ setSaved(next);
+ // Keep what was typed during the save; otherwise take the row's
+ // normalized values so the form shows exactly what is stored.
+ setDraft((current) => (current === submitted ? next : current));
+ return true;
+ } catch (error) {
+ fail(error as Error);
+ return false;
+ }
}, [save]);
useEffect(() => {
const onKey = (event: KeyboardEvent) => {
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "s") {
event.preventDefault();
- doSave();
+ if (!save.isPending) void doSave();
}
};
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
- }, [doSave]);
+ }, [doSave, save.isPending]);
useEffect(() => {
if (!dirty) return;
@@ -174,7 +177,8 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
return () => window.removeEventListener("beforeunload", warn);
}, [dirty]);
- const doPublish = () => {
+ const doPublish = async () => {
+ if (dirty && !(await doSave())) return;
setIssues({});
setNotice(null);
publish.mutate(undefined, {
@@ -184,10 +188,7 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
setDraft((current) => ({ ...current, publishedAt: next.publishedAt }));
setSlugTouched(true);
},
- onError: (error) => {
- setIssues(issuesByPath(error));
- setNotice(error.message);
- },
+ onError: fail,
});
};
@@ -196,12 +197,17 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
unpublish.mutate(undefined, { onError: (error) => setNotice(error.message) });
};
+ const openPreview = async () => {
+ if (dirty && !(await doSave())) return;
+ window.open(`${SU_APP_ORIGIN}/api/blog/preview?id=${encodeURIComponent(post.id)}`, "_blank", "noopener");
+ };
+
const uploadInline = useCallback(
async (file: File) => (await uploadBlogImage(post.id, file, "inline")).image.url,
[post.id],
);
- const checklist = publishIssues({
+ const suggestions = publishIssues({
title: draft.title,
excerpt: draft.excerpt,
summary: draft.summary,
@@ -226,12 +232,16 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
) : null;
return (
- <div className="space-y-6 pb-9">
+ <Tabs defaultValue="write" className="gap-6 pb-9">
<div className="flex flex-wrap items-center gap-2">
<Button variant="ghost" size="sm" nativeButton={false} render={<Link href="/blog" />}>
← Posts
</Button>
<Badge variant={published ? "default" : "outline"}>{published ? "Published" : "Draft"}</Badge>
+ <TabsList variant="line">
+ <TabsTrigger value="write">Write</TabsTrigger>
+ <TabsTrigger value="details">Details</TabsTrigger>
+ </TabsList>
{dirty ? <span className="text-xs text-muted-foreground">Unsaved changes</span> : null}
{notice ? (
<span role="alert" className="text-xs text-destructive">
@@ -239,15 +249,7 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
</span>
) : null}
<div className="ml-auto flex flex-wrap items-center gap-2">
- <Button
- size="sm"
- variant="outline"
- disabled={dirty}
- title={dirty ? "Save to preview" : undefined}
- onClick={() =>
- window.open(`${SU_APP_ORIGIN}/api/blog/preview?id=${encodeURIComponent(post.id)}`, "_blank", "noopener")
- }
- >
+ <Button size="sm" variant="outline" disabled={busy} onClick={() => void openPreview()}>
Preview
</Button>
{published ? (
@@ -260,7 +262,7 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
View
</Button>
) : null}
- <Button size="sm" variant={dirty ? "default" : "outline"} disabled={busy || !dirty} onClick={doSave}>
+ <Button size="sm" variant={dirty ? "default" : "outline"} disabled={busy || !dirty} onClick={() => void doSave()}>
{save.isPending ? "Saving…" : "Save"}
</Button>
{published ? (
@@ -268,21 +270,38 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
{unpublish.isPending ? "Unpublishing…" : "Unpublish"}
</Button>
) : (
- <Button
- size="sm"
- disabled={busy || dirty || checklist.length > 0}
- title={dirty ? "Save to publish" : checklist.length > 0 ? "See the checklist" : undefined}
- onClick={doPublish}
- >
+ <Button size="sm" disabled={busy} onClick={() => void doPublish()}>
{publish.isPending ? "Publishing…" : "Publish"}
</Button>
)}
</div>
</div>
- <div className="grid gap-8 lg:grid-cols-[minmax(0,1fr)_320px]">
- <div className="min-w-0 space-y-5">
- <div className="space-y-2">
+ <TabsContent value="write" className="space-y-4">
+ <div className="space-y-1.5">
+ <CountedLabel htmlFor="title" value={draft.title} max={BLOG_TITLE_MAX}>
+ Title
+ </CountedLabel>
+ <Input
+ id="title"
+ value={draft.title}
+ placeholder="Post title"
+ className="h-12 text-xl font-semibold md:text-xl"
+ onChange={(e) => {
+ const title = e.target.value;
+ patch(slugTouched ? { title } : { title, slug: slugFromTitle(title) || draftRef.current.slug });
+ }}
+ />
+ {error("title")}
+ </div>
+ <BlogEditor markdown={saved.body} diffMarkdown={saved.body} onChange={(body) => patch({ body })} uploadImage={uploadInline} />
+ {error("body")}
+ </TabsContent>
+
+ <TabsContent value="details" className="space-y-8">
+ <section className="space-y-3">
+ <h2 className="text-sm font-semibold">Header image</h2>
+ <ImageUpload postId={post.id} kind="header" url={post.headerUrl} label="Header, 1080×240 on the page" className="h-60 w-full">
{post.headerUrl ? (
<HeaderFocusPicker
src={post.headerUrl}
@@ -290,119 +309,42 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
focus={draft.headerFocus}
onChange={(focus) => patch({ headerFocus: focus })}
/>
- ) : (
- <div className="flex h-60 items-center justify-center rounded-2xl border-2 border-dashed text-sm text-muted-foreground">
- Header image, shown 1080×240 on the page
- </div>
- )}
- <div className="flex flex-wrap items-center gap-3">
- <ImageUpload postId={post.id} kind="header" hasImage={Boolean(post.headerUrl)} />
- {post.headerUrl ? (
- <span className="text-xs text-muted-foreground">Click or drag on the image to set what stays in frame.</span>
- ) : null}
- </div>
- {error("header")}
- {post.headerUrl ? (
- <Field label="Header alt text" htmlFor="headerAlt">
+ ) : null}
+ </ImageUpload>
+ {post.headerUrl ? (
+ <>
+ <p className="text-xs text-muted-foreground">Click or drag on the image to set what stays in frame.</p>
+ <Field label="Alt text" htmlFor="headerAlt">
<Input id="headerAlt" value={draft.headerAlt} onChange={(e) => patch({ headerAlt: e.target.value })} />
{error("headerAlt")}
</Field>
- ) : null}
- </div>
-
- <div className="space-y-1.5">
- <div className="flex items-baseline justify-between">
- <Label htmlFor="title" className="text-xs text-muted-foreground">
- Title
- </Label>
- <Count value={draft.title} max={BLOG_TITLE_MAX} />
- </div>
- <Input
- id="title"
- value={draft.title}
- placeholder="Post title"
- className="h-11 text-lg font-semibold"
- onChange={(e) => {
- const title = e.target.value;
- patch(slugTouched ? { title } : { title, slug: slugFromTitle(title) || draftRef.current.slug });
- }}
- />
- {error("title")}
- </div>
-
- <Field label="Address" htmlFor="slug">
- <div className="flex items-center gap-1">
- <span className="shrink-0 text-sm text-muted-foreground">donkeycut.com/blog/</span>
- <Input
- id="slug"
- value={draft.slug}
- onChange={(e) => {
- setSlugTouched(true);
- patch({ slug: e.target.value.toLowerCase() });
- }}
- />
- </div>
- {error("slug")}
- </Field>
-
- <div className="space-y-1.5">
- <div className="flex items-baseline justify-between">
- <Label htmlFor="summary" className="text-xs text-muted-foreground">
- Summary, the answer-first line under the title
- </Label>
- <Count value={draft.summary} max={BLOG_DESCRIPTION_MAX} min={BLOG_DESCRIPTION_MIN} />
- </div>
- <Textarea id="summary" rows={2} value={draft.summary} onChange={(e) => patch({ summary: e.target.value })} />
- {error("summary")}
- </div>
-
- <div className="space-y-1.5">
- <Label className="text-xs text-muted-foreground">Article</Label>
- <BlogEditor
- markdown={saved.body}
- diffMarkdown={saved.body}
- onChange={(body) => patch({ body })}
- uploadImage={uploadInline}
- />
- {error("body")}
- </div>
- </div>
+ </>
+ ) : null}
+ </section>
- <aside className="space-y-8">
+ <div className="grid gap-8 md:grid-cols-2">
<section className="space-y-4">
- <h2 className="text-sm font-semibold">Publishing</h2>
- {checklist.length > 0 ? (
- <ul className="space-y-1 text-xs text-muted-foreground">
- {checklist.map((issue) => (
- <li key={issue.path}>· {issue.message}</li>
- ))}
- </ul>
- ) : (
- <p className="text-xs text-muted-foreground">{published ? "Live on the site." : "Ready to publish."}</p>
- )}
- <Field label="Publish date" htmlFor="publishedAt">
- <Input
- id="publishedAt"
- type="datetime-local"
- value={toLocalInput(draft.publishedAt)}
- onChange={(e) => patch({ publishedAt: fromLocalInput(e.target.value) })}
- />
- {error("publishedAt")}
- </Field>
- <Field label="Revised date" htmlFor="revisedAt">
- <Input
- id="revisedAt"
- type="datetime-local"
- value={toLocalInput(draft.revisedAt)}
- onChange={(e) => patch({ revisedAt: fromLocalInput(e.target.value) })}
- />
- {error("revisedAt")}
+ <h2 className="text-sm font-semibold">Page</h2>
+ <Field label="Address" htmlFor="slug">
+ <div className="flex items-center gap-1">
+ <span className="shrink-0 text-sm text-muted-foreground">donkeycut.com/blog/</span>
+ <Input
+ id="slug"
+ value={draft.slug}
+ onChange={(e) => {
+ setSlugTouched(true);
+ patch({ slug: e.target.value.toLowerCase() });
+ }}
+ />
+ </div>
+ {error("slug")}
</Field>
- <div className="flex items-center justify-between gap-3">
- <Label htmlFor="featured" className="text-xs text-muted-foreground">
- Featured on the index
- </Label>
- <Switch id="featured" checked={draft.featured} onCheckedChange={(featured) => patch({ featured })} />
+ <div className="space-y-1.5">
+ <CountedLabel htmlFor="summary" value={draft.summary} max={BLOG_DESCRIPTION_MAX} min={BLOG_DESCRIPTION_MIN}>
+ Summary, the answer-first line under the title
+ </CountedLabel>
+ <Textarea id="summary" rows={3} value={draft.summary} onChange={(e) => patch({ summary: e.target.value })} />
+ {error("summary")}
</div>
<Field label="Tags" htmlFor="tags">
<TagInput
@@ -415,31 +357,38 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
/>
{error("tags")}
</Field>
- </section>
-
- <section className="space-y-3">
- <h2 className="text-sm font-semibold">Thumbnail</h2>
- {post.thumbnailUrl ? (
- // eslint-disable-next-line @next/next/no-img-element -- pre-encoded AVIF from the media host, not Next-optimizable
- <img src={post.thumbnailUrl} alt="" className="aspect-[8/5] w-full rounded-xl border-2 border-ink object-cover" />
- ) : (
- <div className="flex aspect-[8/5] w-full items-center justify-center rounded-xl border-2 border-dashed text-xs text-muted-foreground">
- 800×500 on the index
- </div>
- )}
- <ImageUpload postId={post.id} kind="thumbnail" hasImage={Boolean(post.thumbnailUrl)} />
- {error("thumbnail")}
+ <div className="flex items-center justify-between gap-3">
+ <Label htmlFor="featured" className="text-xs text-muted-foreground">
+ Featured on the index
+ </Label>
+ <Switch id="featured" checked={draft.featured} onCheckedChange={(featured) => patch({ featured })} />
+ </div>
+ <Field label="Publish date" htmlFor="publishedAt">
+ <DateTimeField id="publishedAt" value={draft.publishedAt} onChange={(publishedAt) => patch({ publishedAt })} />
+ {error("publishedAt")}
+ </Field>
+ <Field label="Revised date" htmlFor="revisedAt">
+ <DateTimeField id="revisedAt" value={draft.revisedAt} onChange={(revisedAt) => patch({ revisedAt })} />
+ {error("revisedAt")}
+ </Field>
+ <div className="space-y-2">
+ <h3 className="text-xs font-medium text-muted-foreground">Thumbnail</h3>
+ <ImageUpload
+ postId={post.id}
+ kind="thumbnail"
+ url={post.thumbnailUrl}
+ label="Thumbnail, 800×500 on the index"
+ className="aspect-[8/5] w-full max-w-sm"
+ />
+ </div>
</section>
<section className="space-y-4">
<h2 className="text-sm font-semibold">Search</h2>
<div className="space-y-1.5">
- <div className="flex items-baseline justify-between">
- <Label htmlFor="seoTitle" className="text-xs text-muted-foreground">
- Meta title
- </Label>
- <Count value={draft.seoTitle} max={BLOG_SEO_TITLE_MAX} />
- </div>
+ <CountedLabel htmlFor="seoTitle" value={draft.seoTitle} max={BLOG_SEO_TITLE_MAX}>
+ Meta title
+ </CountedLabel>
<Input
id="seoTitle"
value={draft.seoTitle}
@@ -449,12 +398,9 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
{error("seoTitle")}
</div>
<div className="space-y-1.5">
- <div className="flex items-baseline justify-between">
- <Label htmlFor="excerpt" className="text-xs text-muted-foreground">
- Meta description
- </Label>
- <Count value={draft.excerpt} max={BLOG_DESCRIPTION_MAX} min={BLOG_DESCRIPTION_MIN} />
- </div>
+ <CountedLabel htmlFor="excerpt" value={draft.excerpt} max={BLOG_DESCRIPTION_MAX} min={BLOG_DESCRIPTION_MIN}>
+ Meta description
+ </CountedLabel>
<Textarea id="excerpt" rows={3} value={draft.excerpt} onChange={(e) => patch({ excerpt: e.target.value })} />
{error("excerpt")}
</div>
@@ -484,9 +430,19 @@ function PostEditor({ post }: { post: BlogPostAdminWithBody }) {
</Label>
<Switch id="noIndex" checked={draft.noIndex} onCheckedChange={(noIndex) => patch({ noIndex })} />
</div>
+ {suggestions.length > 0 ? (
+ <div className="space-y-1">
+ <h3 className="text-xs font-medium text-muted-foreground">Suggested before publishing</h3>
+ <ul className="space-y-1 text-xs text-muted-foreground">
+ {suggestions.map((issue) => (
+ <li key={issue.path}>· {issue.message}</li>
+ ))}
+ </ul>
+ </div>
+ ) : null}
</section>
- </aside>
- </div>
- </div>
+ </div>
+ </TabsContent>
+ </Tabs>
);
}
diff --git a/site/src/app/su/blog/[id]/TagInput.tsx b/site/src/app/su/blog/[id]/TagInput.tsx
index c8971a26..7a1e507f 100644
--- a/site/src/app/su/blog/[id]/TagInput.tsx
+++ b/site/src/app/su/blog/[id]/TagInput.tsx
@@ -3,6 +3,7 @@
import { X } from "lucide-react";
import { useId, useState } from "react";
+import { Badge } from "@/components/ui/badge";
import { Input } from "@/components/ui/input";
// A list of words as chips. Enter or a comma adds what is typed, Backspace on
@@ -40,20 +41,17 @@ export function TagInput({
{value.length > 0 ? (
<div className="flex flex-wrap gap-1.5">
{value.map((word) => (
- <span
- key={word}
- className="inline-flex items-center gap-1 rounded-full border bg-muted px-2.5 py-0.5 text-xs font-medium"
- >
+ <Badge key={word} variant="secondary" className="gap-1 pr-1">
{word}
<button
type="button"
aria-label={`Remove ${word}`}
- className="-mr-1 rounded-full p-0.5 text-muted-foreground hover:text-foreground"
+ className="rounded-full p-0.5 text-muted-foreground hover:text-foreground"
onClick={() => onChange(value.filter((other) => other !== word))}
>
<X className="size-3" />
</button>
- </span>
+ </Badge>
))}
</div>
) : null}
diff --git a/site/src/components/ui/calendar.tsx b/site/src/components/ui/calendar.tsx
new file mode 100644
index 00000000..f42ade05
--- /dev/null
+++ b/site/src/components/ui/calendar.tsx
@@ -0,0 +1,221 @@
+"use client"
+
+import * as React from "react"
+import { cn } from "@/lib/utils"
+import {
+ DayPicker,
+ getDefaultClassNames,
+ type DayButton,
+ type Locale,
+} from "react-day-picker"
+
+import { Button, buttonVariants } from "@/components/ui/button"
+import { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from "lucide-react"
+
+function Calendar({
+ className,
+ classNames,
+ showOutsideDays = true,
+ captionLayout = "label",
+ buttonVariant = "ghost",
+ locale,
+ formatters,
+ components,
+ ...props
+}: React.ComponentProps<typeof DayPicker> & {
+ buttonVariant?: React.ComponentProps<typeof Button>["variant"]
+}) {
+ const defaultClassNames = getDefaultClassNames()
+
+ return (
+ <DayPicker
+ showOutsideDays={showOutsideDays}
+ className={cn(
+ "group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
+ className
+ )}
+ captionLayout={captionLayout}
+ locale={locale}
+ formatters={{
+ formatMonthDropdown: (date) =>
+ date.toLocaleString(locale?.code, { month: "short" }),
+ ...formatters,
+ }}
+ classNames={{
+ root: cn("w-fit", defaultClassNames.root),
+ months: cn(
+ "relative flex flex-col gap-4 md:flex-row",
+ defaultClassNames.months
+ ),
+ month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
+ nav: cn(
+ "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
+ defaultClassNames.nav
+ ),
+ button_previous: cn(
+ buttonVariants({ variant: buttonVariant }),
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
+ defaultClassNames.button_previous
+ ),
+ button_next: cn(
+ buttonVariants({ variant: buttonVariant }),
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
+ defaultClassNames.button_next
+ ),
+ month_caption: cn(
+ "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
+ defaultClassNames.month_caption
+ ),
+ dropdowns: cn(
+ "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
+ defaultClassNames.dropdowns
+ ),
+ dropdown_root: cn(
+ "relative rounded-(--cell-radius)",
+ defaultClassNames.dropdown_root
+ ),
+ dropdown: cn(
+ "absolute inset-0 bg-popover opacity-0",
+ defaultClassNames.dropdown
+ ),
+ caption_label: cn(
+ "font-medium select-none",
+ captionLayout === "label"
+ ? "text-sm"
+ : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
+ defaultClassNames.caption_label
+ ),
+ month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
+ weekdays: cn("flex", defaultClassNames.weekdays),
+ weekday: cn(
+ "flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",
+ defaultClassNames.weekday
+ ),
+ week: cn("mt-2 flex w-full", defaultClassNames.week),
+ week_number_header: cn(
+ "w-(--cell-size) select-none",
+ defaultClassNames.week_number_header
+ ),
+ week_number: cn(
+ "text-[0.8rem] text-muted-foreground select-none",
+ defaultClassNames.week_number
+ ),
+ day: cn(
+ "group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
+ props.showWeekNumber
+ ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)"
+ : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
+ defaultClassNames.day
+ ),
+ range_start: cn(
+ "relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
+ defaultClassNames.range_start
+ ),
+ range_middle: cn("rounded-none", defaultClassNames.range_middle),
+ range_end: cn(
+ "relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
+ defaultClassNames.range_end
+ ),
+ today: cn(
+ "rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
+ defaultClassNames.today
+ ),
+ outside: cn(
+ "text-muted-foreground aria-selected:text-muted-foreground",
+ defaultClassNames.outside
+ ),
+ disabled: cn(
+ "text-muted-foreground opacity-50",
+ defaultClassNames.disabled
+ ),
+ hidden: cn("invisible", defaultClassNames.hidden),
+ ...classNames,
+ }}
+ components={{
+ Root: ({ className, rootRef, ...props }) => {
+ return (
+ <div
+ data-slot="calendar"
+ ref={rootRef}
+ className={cn(className)}
+ {...props}
+ />
+ )
+ },
+ Chevron: ({ className, orientation, ...props }) => {
+ if (orientation === "left") {
+ return (
+ <ChevronLeftIcon className={cn("size-4", className)} {...props} />
+ )
+ }
+
+ if (orientation === "right") {
+ return (
+ <ChevronRightIcon className={cn("size-4", className)} {...props} />
+ )
+ }
+
+ return (
+ <ChevronDownIcon className={cn("size-4", className)} {...props} />
+ )
+ },
+ DayButton: ({ ...props }) => (
+ <CalendarDayButton locale={locale} {...props} />
+ ),
+ WeekNumber: ({ children, ...props }) => {
+ return (
+ <td {...props}>
+ <div className="flex size-(--cell-size) items-center justify-center text-center">
+ {children}
+ </div>
+ </td>
+ )
+ },
+ ...components,
+ }}
+ {...props}
+ />
+ )
+}
+
+function CalendarDayButton({
+ className,
+ day,
+ modifiers,
+ locale,
+ ...props
+}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {
+ const defaultClassNames = getDefaultClassNames()
+
+ const ref = React.useRef<HTMLButtonElement>(null)
+ React.useEffect(() => {
+ if (modifiers.focused) ref.current?.focus()
+ }, [modifiers.focused])
+
+ return (
+ <Button
+ variant="ghost"
+ size="icon"
+ data-day={day.date.toLocaleDateString(locale?.code)}
+ data-selected-single={
+ modifiers.selected &&
+ !modifiers.range_start &&
+ !modifiers.range_end &&
+ !modifiers.range_middle
+ }
+ data-range-start={modifiers.range_start}
+ data-range-end={modifiers.range_end}
+ data-range-middle={modifiers.range_middle}
+ className={cn(
+ "relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70",
+ defaultClassNames.day,
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+export { Calendar, CalendarDayButton }
diff --git a/site/src/components/ui/tabs.tsx b/site/src/components/ui/tabs.tsx
new file mode 100644
index 00000000..8e384957
--- /dev/null
+++ b/site/src/components/ui/tabs.tsx
@@ -0,0 +1,81 @@
+"use client"
+
+import { Tabs as TabsPrimitive } from "@base-ui/react/tabs"
+import { cva, type VariantProps } from "class-variance-authority"
+import { cn } from "@/lib/utils"
+
+function Tabs({
+ className,
+ orientation = "horizontal",
+ ...props
+}: TabsPrimitive.Root.Props) {
+ return (
+ <TabsPrimitive.Root
+ data-slot="tabs"
+ data-orientation={orientation}
+ className={cn(
+ "group/tabs flex gap-2 data-horizontal:flex-col",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+const tabsListVariants = cva(
+ "group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
+ {
+ variants: {
+ variant: {
+ default: "bg-muted",
+ line: "gap-1 bg-transparent",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ }
+)
+
+function TabsList({
+ className,
+ variant = "default",
+ ...props
+}: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {
+ return (
+ <TabsPrimitive.List
+ data-slot="tabs-list"
+ data-variant={variant}
+ className={cn(tabsListVariants({ variant }), className)}
+ {...props}
+ />
+ )
+}
+
+function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
+ return (
+ <TabsPrimitive.Tab
+ data-slot="tabs-trigger"
+ className={cn(
+ "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
+ "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
+ "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {
+ return (
+ <TabsPrimitive.Panel
+ data-slot="tabs-content"
+ className={cn("flex-1 text-sm outline-none", className)}
+ {...props}
+ />
+ )
+}
+
+export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
diff --git a/site/src/lib/blog/schema.ts b/site/src/lib/blog/schema.ts
index dda375cc..5b9bf1f3 100644
--- a/site/src/lib/blog/schema.ts
+++ b/site/src/lib/blog/schema.ts
@@ -57,8 +57,8 @@ export type BlogPostInput = z.infer<typeof blogPostInputSchema>;
export type BlogPublishIssue = { path: string; message: string };
-// What has to be true before a post goes live. The same list drives the
-// editor's checklist and the publish route's refusal.
+// What a finished post has. The editor lists what is still missing as
+// suggestions; publishing does not wait for them.
export function publishIssues(post: {
title: string;
excerpt: string;