Implement three divination modes, learn pages, and PM2 deploy on port 3130.

Add liuyao/bazi/combined flows with shared calc and AI infrastructure, 64-gua learn routes, and update Ubuntu PM2 deployment docs for port 3130.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-10 20:19:49 +08:00
parent d141623070
commit fff77dac3f
41 changed files with 2590 additions and 385 deletions
+16
View File
@@ -0,0 +1,16 @@
import Link from "next/link";
import { Button } from "@/components/ui/button";
import { Sparkles } from "lucide-react";
export default function GuaFooter({ guaMark }: { guaMark: string }) {
return (
<div className="mt-8 flex flex-wrap gap-3 border-t pt-6">
<Button asChild size="sm">
<Link href={`/liuyao?gua=${encodeURIComponent(guaMark)}`}>
<Sparkles size={16} className="mr-1" />
</Link>
</Button>
</div>
);
}
+75
View File
@@ -0,0 +1,75 @@
import Link from "next/link";
import Markdown from "react-markdown";
import type { LearnVariant } from "@/lib/content/zhouyi";
function resolveLearnHref(
href: string | undefined,
variant: LearnVariant,
): string | undefined {
if (!href) {
return href;
}
if (href.startsWith("http://") || href.startsWith("https://")) {
return href;
}
const base = variant === "traditional" ? "/learn" : "/learn/other";
if (href === "index.md" || href === "./index.md") {
return base;
}
if (href === "other/index.md") {
return "/learn/other";
}
if (href.endsWith("/index.md")) {
const mark = href.replace(/\/index\.md$/, "").replace(/^\.\//, "");
if (mark.startsWith("other/")) {
return `/learn/other/${mark.slice("other/".length)}`;
}
return `${base}/${mark}`;
}
return href;
}
export default function MarkdownContent({
content,
variant = "traditional",
}: {
content: string;
variant?: LearnVariant;
}) {
return (
<Markdown
className="prose max-w-none dark:prose-invert prose-headings:scroll-mt-20 prose-a:text-primary"
components={{
a: ({ href, children, ...props }) => {
const resolved = resolveLearnHref(href, variant);
if (resolved?.startsWith("/")) {
return (
<Link href={resolved} {...props}>
{children}
</Link>
);
}
return (
<a href={resolved} {...props}>
{children}
</a>
);
},
img: ({ src, alt, ...props }) => {
if (typeof src === "string" && !src.startsWith("http")) {
return (
<span className="my-2 block rounded border border-dashed p-4 text-center text-sm text-muted-foreground">
[{alt || "卦象图片"}]
</span>
);
}
return <img src={src} alt={alt} {...props} />;
},
}}
>
{content}
</Markdown>
);
}