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
8 changes: 1 addition & 7 deletions demos/ai-chat/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
@import "tw-animate-css";
@import "@btst/stack/plugins/ai-chat/css";
@import "@btst/stack/plugins/route-docs/css";
/* WebContainers workaround: the WASM Tailwind scanner cannot traverse node_modules
* (https://github.com/tailwindlabs/tailwindcss/issues/18418). copy-stack-src.mjs
* (run via predev/prebuild) copies @btst/stack/src outside node_modules so Tailwind
* can scan it. Safe to remove once the upstream bug is fixed. */
/* WebContainers workaround: the WASM Tailwind scanner cannot traverse node_modules (https://github.com/tailwindlabs/tailwindcss/issues/18418). copy-stack-src.mjs (run via dev/build) copies @btst/stack/src outside node_modules so Tailwind can scan it. Safe to remove once the upstream bug is fixed. */
@source "./.btst-stack-src/**/*.{ts,tsx}";
@source "./.btst-stack-ui/**/*.{ts,tsx}";
/* Monorepo fallback: direct source path used in local development */
@source "../../../packages/stack/src/**/*.{ts,tsx}";
@source "../../../packages/ui/src/**/*.{ts,tsx}";

@custom-variant dark (&:is(.dark *));

Expand Down
4 changes: 2 additions & 2 deletions demos/ai-chat/app/pages/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { AiChatPluginOverrides } from "@btst/stack/plugins/ai-chat/client";
import { getOrCreateQueryClient } from "@/lib/query-client";

type PluginOverrides = {
aiChat: AiChatPluginOverrides;
"ai-chat": AiChatPluginOverrides;
};

const hasApiKey =
Expand All @@ -33,7 +33,7 @@ export default function PagesLayout({
<StackProvider<PluginOverrides>
basePath="/pages"
overrides={{
aiChat: {
"ai-chat": {
apiBaseURL: baseURL,
apiBasePath: "/api/data",
mode: "public",
Expand Down
4 changes: 2 additions & 2 deletions demos/ai-chat/copy-stack-src.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { cp, mkdir, rm } from "fs/promises";
import { existsSync } from "fs";

const src = "node_modules/@btst/stack/src";
const dest = ".btst-stack-src";
const dest = "app/.btst-stack-src";

const uiSrc = "node_modules/@btst/stack/dist/packages/ui";
const uiDest = ".btst-stack-ui";
const uiDest = "app/.btst-stack-ui";

if (!existsSync(src)) {
// Likely running in the monorepo where the workspace symlink does not expose
Expand Down
8 changes: 1 addition & 7 deletions demos/blog/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
@import "tw-animate-css";
@import "@btst/stack/plugins/blog/css";
@import "@btst/stack/plugins/route-docs/css";
/* WebContainers workaround: the WASM Tailwind scanner cannot traverse node_modules
* (https://github.com/tailwindlabs/tailwindcss/issues/18418). copy-stack-src.mjs
* (run via predev/prebuild) copies @btst/stack/src outside node_modules so Tailwind
* can scan it. Safe to remove once the upstream bug is fixed. */
/* WebContainers workaround: the WASM Tailwind scanner cannot traverse node_modules (https://github.com/tailwindlabs/tailwindcss/issues/18418). copy-stack-src.mjs (run via dev/build) copies @btst/stack/src outside node_modules so Tailwind can scan it. Safe to remove once the upstream bug is fixed. */
@source "./.btst-stack-src/**/*.{ts,tsx}";
@source "./.btst-stack-ui/**/*.{ts,tsx}";
/* Monorepo fallback: direct source path used in local development */
@source "../../../packages/stack/src/**/*.{ts,tsx}";
@source "../../../packages/ui/src/**/*.{ts,tsx}";

@custom-variant dark (&:is(.dark *));

Expand Down
4 changes: 2 additions & 2 deletions demos/blog/copy-stack-src.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { cp, mkdir, rm } from "fs/promises";
import { existsSync } from "fs";

const src = "node_modules/@btst/stack/src";
const dest = ".btst-stack-src";
const dest = "app/.btst-stack-src";

const uiSrc = "node_modules/@btst/stack/dist/packages/ui";
const uiDest = ".btst-stack-ui";
const uiDest = "app/.btst-stack-ui";

if (!existsSync(src)) {
// Likely running in the monorepo where the workspace symlink does not expose
Expand Down
8 changes: 1 addition & 7 deletions demos/cms/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
@import "tw-animate-css";
@import "@btst/stack/plugins/cms/css";
@import "@btst/stack/plugins/route-docs/css";
/* WebContainers workaround: the WASM Tailwind scanner cannot traverse node_modules
* (https://github.com/tailwindlabs/tailwindcss/issues/18418). copy-stack-src.mjs
* (run via predev/prebuild) copies @btst/stack/src outside node_modules so Tailwind
* can scan it. Safe to remove once the upstream bug is fixed. */
/* WebContainers workaround: the WASM Tailwind scanner cannot traverse node_modules (https://github.com/tailwindlabs/tailwindcss/issues/18418). copy-stack-src.mjs (run via dev/build) copies @btst/stack/src outside node_modules so Tailwind can scan it. Safe to remove once the upstream bug is fixed. */
@source "./.btst-stack-src/**/*.{ts,tsx}";
@source "./.btst-stack-ui/**/*.{ts,tsx}";
/* Monorepo fallback: direct source path used in local development */
@source "../../../packages/stack/src/**/*.{ts,tsx}";
@source "../../../packages/ui/src/**/*.{ts,tsx}";

@custom-variant dark (&:is(.dark *));

Expand Down
82 changes: 82 additions & 0 deletions demos/cms/app/pages/articles/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { myStack } from "@/lib/stack";
import Link from "next/link";
import { notFound } from "next/navigation";
import type { Metadata } from "next";

export const dynamic = "force-dynamic";

type ArticleData = {
title: string;
summary: string;
body: string;
publishedAt?: string;
published: boolean;
};

export async function generateMetadata({
params,
}: {
params: Promise<{ slug: string }>;
}): Promise<Metadata> {
const { slug } = await params;
const item = await myStack.api.cms.getContentItemBySlug("article", slug);
if (!item) return { title: "Not Found" };
const data = item.parsedData as ArticleData;
return {
title: data.title,
description: data.summary,
};
}

export default async function ArticlePage({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
const item = await myStack.api.cms.getContentItemBySlug("article", slug);

if (!item) notFound();

const data = item.parsedData as ArticleData;

return (
<div className="max-w-3xl mx-auto px-4 py-12">
<Link
href="/pages/articles"
className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors mb-10"
>
← All articles
</Link>

<article>
<header className="mb-8">
<h1 className="text-3xl font-bold mb-3">{data.title}</h1>
{data.publishedAt && (
<time className="text-sm text-muted-foreground">
{new Date(data.publishedAt).toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
})}
</time>
)}
</header>

<p className="text-lg text-muted-foreground leading-relaxed border-l-2 pl-4 mb-8">
{data.summary}
</p>

<div className="prose prose-sm max-w-none text-foreground space-y-4">
{data.body.split("\n\n").map((paragraph, i) =>
paragraph.trim() ? (
<p key={i} className="leading-relaxed">
{paragraph.trim()}
</p>
) : null,
)}
</div>
</article>
</div>
);
}
67 changes: 67 additions & 0 deletions demos/cms/app/pages/articles/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { myStack } from "@/lib/stack";
import Link from "next/link";

export const dynamic = "force-dynamic";

type ArticleData = {
title: string;
summary: string;
body: string;
publishedAt?: string;
published: boolean;
};

export default async function ArticlesPage() {
const { items } = await myStack.api.cms.getAllContentItems("article");
const published = items.filter(
(item) => (item.parsedData as ArticleData).published,
);

return (
<div className="max-w-3xl mx-auto px-4 py-12">
<div className="mb-10">
<h1 className="text-3xl font-bold mb-2">Articles</h1>
<p className="text-muted-foreground">
Content managed with the BTST CMS plugin.
</p>
</div>

{published.length === 0 ? (
<p className="text-muted-foreground">No published articles yet.</p>
) : (
<div className="divide-y">
{published.map((item) => {
const data = item.parsedData as ArticleData;
return (
<Link
key={item.id}
href={`/pages/articles/${item.slug}`}
className="block group py-8 first:pt-0"
>
<div className="flex items-start justify-between gap-6">
<div className="min-w-0">
<h2 className="text-xl font-semibold group-hover:underline underline-offset-2 mb-2">
{data.title}
</h2>
<p className="text-muted-foreground text-sm leading-relaxed">
{data.summary}
</p>
</div>
{data.publishedAt && (
<time className="text-xs text-muted-foreground whitespace-nowrap mt-1 shrink-0">
{new Date(data.publishedAt).toLocaleDateString("en-US", {
year: "numeric",
month: "short",
day: "numeric",
})}
</time>
)}
</div>
</Link>
);
})}
</div>
)}
</div>
);
}
6 changes: 6 additions & 0 deletions demos/cms/app/pages/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export default function PagesLayout({
BTST CMS Demo
</Link>
<div className="flex items-center gap-4 text-sm">
<Link
href="/pages/articles"
className="text-muted-foreground hover:text-foreground transition-colors"
>
Articles
</Link>
<Link
href="/pages/cms"
className="text-muted-foreground hover:text-foreground transition-colors"
Expand Down
4 changes: 2 additions & 2 deletions demos/cms/copy-stack-src.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { cp, mkdir, rm } from "fs/promises";
import { existsSync } from "fs";

const src = "node_modules/@btst/stack/src";
const dest = ".btst-stack-src";
const dest = "app/.btst-stack-src";

const uiSrc = "node_modules/@btst/stack/dist/packages/ui";
const uiDest = ".btst-stack-ui";
const uiDest = "app/.btst-stack-ui";

if (!existsSync(src)) {
// Likely running in the monorepo where the workspace symlink does not expose
Expand Down
8 changes: 1 addition & 7 deletions demos/form-builder/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
@import "tw-animate-css";
@import "@btst/stack/plugins/form-builder/css";
@import "@btst/stack/plugins/route-docs/css";
/* WebContainers workaround: the WASM Tailwind scanner cannot traverse node_modules
* (https://github.com/tailwindlabs/tailwindcss/issues/18418). copy-stack-src.mjs
* (run via predev/prebuild) copies @btst/stack/src outside node_modules so Tailwind
* can scan it. Safe to remove once the upstream bug is fixed. */
/* WebContainers workaround: the WASM Tailwind scanner cannot traverse node_modules (https://github.com/tailwindlabs/tailwindcss/issues/18418). copy-stack-src.mjs (run via dev/build) copies @btst/stack/src outside node_modules so Tailwind can scan it. Safe to remove once the upstream bug is fixed. */
@source "./.btst-stack-src/**/*.{ts,tsx}";
@source "./.btst-stack-ui/**/*.{ts,tsx}";
/* Monorepo fallback: direct source path used in local development */
@source "../../../packages/stack/src/**/*.{ts,tsx}";
@source "../../../packages/ui/src/**/*.{ts,tsx}";

@custom-variant dark (&:is(.dark *));

Expand Down
14 changes: 10 additions & 4 deletions demos/form-builder/app/pages/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { StackProvider } from "@btst/stack/context";
import type { FormBuilderPluginOverrides } from "@btst/stack/plugins/form-builder/client";
import { getOrCreateQueryClient } from "@/lib/query-client";

type PluginOverrides = { formBuilder: FormBuilderPluginOverrides };
type PluginOverrides = { "form-builder": FormBuilderPluginOverrides };

export default function PagesLayout({
children,
Expand All @@ -26,7 +26,7 @@ export default function PagesLayout({
<StackProvider<PluginOverrides>
basePath="/pages"
overrides={{
formBuilder: {
"form-builder": {
apiBaseURL: baseURL,
apiBasePath: "/api/data",
navigate: (path) => router.push(path),
Expand All @@ -41,18 +41,24 @@ export default function PagesLayout({
<nav className="border-b bg-background sticky top-0 z-50">
<div className="max-w-5xl mx-auto px-4 h-14 flex items-center justify-between">
<Link
href="/pages/form-builder"
href="/pages/forms"
className="font-semibold text-lg hover:opacity-75 transition-opacity"
>
BTST Form Builder Demo
</Link>
<div className="flex items-center gap-4 text-sm">
<Link
href="/pages/form-builder"
href="/pages/forms"
className="text-muted-foreground hover:text-foreground transition-colors"
>
Forms
</Link>
<Link
href="/submit/contact-us"
className="text-muted-foreground hover:text-foreground transition-colors"
>
Live Demo
</Link>
<a
href="/api/data/reference"
className="text-muted-foreground hover:text-foreground transition-colors"
Expand Down
Loading