├── .env.example ├── .eslintrc.json ├── app ├── favicon.ico ├── fonts │ ├── GeistVF.woff │ └── GeistMonoVF.woff ├── _components │ ├── hero-typewriter.tsx │ ├── header.tsx │ └── footer.tsx ├── social-card │ └── page.tsx ├── page.tsx ├── layout.tsx ├── globals.css └── api │ ├── chat │ └── route.ts │ └── prompt │ └── route.ts ├── public ├── logo.png ├── bmc-logo-yellow.png ├── bmc-logo-no-background.png ├── logo.svg └── bmc-logo.svg ├── next.config.mjs ├── nixpacks.toml ├── postcss.config.mjs ├── lib ├── utils.ts └── constants.ts ├── components.json ├── .gitignore ├── tsconfig.json ├── components ├── ui │ ├── input.tsx │ ├── sonner.tsx │ ├── button.tsx │ └── card.tsx ├── fancy │ └── word-rotate.tsx ├── common │ └── icons.tsx ├── PresetTemplateGrid.tsx ├── social-card-generator.tsx └── svg-generator.tsx ├── package.json ├── README.md ├── tailwind.config.ts └── pnpm-lock.yaml /.env.example: -------------------------------------------------------------------------------- 1 | ANTHROPIC_API_KEY="xxx" 2 | ANTHROPIC_API_URL="xxx" -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["next/core-web-vitals", "next/typescript"] 3 | } 4 | -------------------------------------------------------------------------------- /app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyljx/TextWordExplain/HEAD/app/favicon.ico -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyljx/TextWordExplain/HEAD/public/logo.png -------------------------------------------------------------------------------- /app/fonts/GeistVF.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyljx/TextWordExplain/HEAD/app/fonts/GeistVF.woff -------------------------------------------------------------------------------- /app/fonts/GeistMonoVF.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyljx/TextWordExplain/HEAD/app/fonts/GeistMonoVF.woff -------------------------------------------------------------------------------- /public/bmc-logo-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyljx/TextWordExplain/HEAD/public/bmc-logo-yellow.png -------------------------------------------------------------------------------- /next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {}; 3 | 4 | export default nextConfig; 5 | -------------------------------------------------------------------------------- /public/bmc-logo-no-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyljx/TextWordExplain/HEAD/public/bmc-logo-no-background.png -------------------------------------------------------------------------------- /nixpacks.toml: -------------------------------------------------------------------------------- 1 | providers = ["node"] 2 | 3 | [phases.install] 4 | cmds = ["npm install -g corepack", "corepack enable", "corepack prepare pnpm@9.1.0 --activate", "pnpm install"] -------------------------------------------------------------------------------- /postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)) 6 | } 7 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "app/globals.css", 9 | "baseColor": "neutral", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | } 20 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | .env 31 | 32 | # vercel 33 | .vercel 34 | 35 | # typescript 36 | *.tsbuildinfo 37 | next-env.d.ts 38 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "jsx": "preserve", 14 | "incremental": true, 15 | "plugins": [ 16 | { 17 | "name": "next" 18 | } 19 | ], 20 | "paths": { 21 | "@/*": ["./*"] 22 | } 23 | }, 24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 25 | "exclude": ["node_modules"] 26 | } 27 | -------------------------------------------------------------------------------- /app/_components/hero-typewriter.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import React from "react"; 3 | import { TypeAnimation } from "react-type-animation"; 4 | 5 | type Props = { 6 | words: string[]; 7 | }; 8 | 9 | export default function HeroTypewriter({ words }: Props) { 10 | console.log(words); 11 | 12 | return ( 13 | 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /app/social-card/page.tsx: -------------------------------------------------------------------------------- 1 | import SocialCardGenerator from "@/components/social-card-generator"; 2 | import React from "react"; 3 | 4 | export default function SocialCard() { 5 | return ( 6 |
7 | {/* flex flex-col items-center justify-center min-h-[85vh] px-8 font-sans */} 8 |
9 |

生成社交卡片

10 |

11 | 输入简短的介绍,获取一个全新的社交卡片 12 |

13 | 14 | 15 |
16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /components/ui/input.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | export interface InputProps 6 | extends React.InputHTMLAttributes {} 7 | 8 | const Input = React.forwardRef( 9 | ({ className, type, ...props }, ref) => { 10 | return ( 11 | 20 | ) 21 | } 22 | ) 23 | Input.displayName = "Input" 24 | 25 | export { Input } 26 | -------------------------------------------------------------------------------- /app/page.tsx: -------------------------------------------------------------------------------- 1 | import WordRotate from "@/components/fancy/word-rotate"; 2 | import SvgGenerator from "@/components/svg-generator"; 3 | 4 | // import { TypeAnimation } from "react-type-animation"; 5 | 6 | export default function Home() { 7 | return ( 8 |
9 | {/* flex flex-col items-center justify-center min-h-[85vh] px-8 font-sans */} 10 |
11 |

汉语新解

12 |

13 | 输入一个汉语词汇,获取一个全新的解释 14 | 18 |

19 | 20 | 21 |
22 |
23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /components/ui/sonner.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import { useTheme } from "next-themes" 4 | import { Toaster as Sonner } from "sonner" 5 | 6 | type ToasterProps = React.ComponentProps 7 | 8 | const Toaster = ({ ...props }: ToasterProps) => { 9 | const { theme = "system" } = useTheme() 10 | 11 | return ( 12 | 28 | ) 29 | } 30 | 31 | export { Toaster } 32 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "textcard", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "@anthropic-ai/sdk": "^0.27.3", 13 | "@radix-ui/react-icons": "^1.3.0", 14 | "@radix-ui/react-slot": "^1.1.0", 15 | "@tabler/icons-react": "^3.16.0", 16 | "class-variance-authority": "^0.7.0", 17 | "clsx": "^2.1.1", 18 | "framer-motion": "^11.5.4", 19 | "html-to-image": "^1.11.11", 20 | "lucide-react": "^0.439.0", 21 | "next": "14.2.10", 22 | "next-themes": "^0.3.0", 23 | "openai": "^4.59.0", 24 | "react": "^18", 25 | "react-dom": "^18", 26 | "react-toastify": "^10.0.5", 27 | "react-type-animation": "^3.2.0", 28 | "sonner": "^1.5.0", 29 | "tailwind-merge": "^2.5.2", 30 | "tailwindcss-animate": "^1.0.7" 31 | }, 32 | "devDependencies": { 33 | "@types/node": "^20", 34 | "@types/react": "^18", 35 | "@types/react-dom": "^18", 36 | "eslint": "^8", 37 | "eslint-config-next": "14.2.10", 38 | "postcss": "^8", 39 | "tailwindcss": "^3.4.1", 40 | "typescript": "^5" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /components/fancy/word-rotate.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { useEffect, useState } from "react"; 4 | import { AnimatePresence, HTMLMotionProps, motion } from "framer-motion"; 5 | 6 | import { cn } from "@/lib/utils"; 7 | 8 | interface WordRotateProps { 9 | words: string[]; 10 | duration?: number; 11 | framerProps?: HTMLMotionProps<"h1">; 12 | className?: string; 13 | } 14 | 15 | export default function WordRotate({ 16 | words, 17 | duration = 2500, 18 | framerProps = { 19 | initial: { opacity: 0, y: -50 }, 20 | animate: { opacity: 1, y: 0 }, 21 | exit: { opacity: 0, y: 50 }, 22 | transition: { duration: 0.25, ease: "easeOut" }, 23 | }, 24 | className, 25 | }: WordRotateProps) { 26 | const [index, setIndex] = useState(0); 27 | 28 | useEffect(() => { 29 | const interval = setInterval(() => { 30 | setIndex((prevIndex) => (prevIndex + 1) % words.length); 31 | }, duration); 32 | 33 | // Clean up interval on unmount 34 | return () => clearInterval(interval); 35 | }, [words, duration]); 36 | 37 | return ( 38 |
39 | 40 | 45 | {words[index]} 46 | 47 | 48 |
49 | ); 50 | } 51 | -------------------------------------------------------------------------------- /app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import localFont from "next/font/local"; 3 | import "./globals.css"; 4 | import { ToastContainer } from "react-toastify"; 5 | import "react-toastify/dist/ReactToastify.css"; 6 | import { cn } from "@/lib/utils"; 7 | import Header from "./_components/header"; 8 | import Footer from "./_components/footer"; 9 | import Script from "next/script"; 10 | import { Toaster } from "@/components/ui/sonner"; 11 | const geistSans = localFont({ 12 | src: "./fonts/GeistVF.woff", 13 | variable: "--font-geist-sans", 14 | weight: "100 900", 15 | }); 16 | const geistMono = localFont({ 17 | src: "./fonts/GeistMonoVF.woff", 18 | variable: "--font-geist-mono", 19 | weight: "100 900", 20 | }); 21 | 22 | export const metadata: Metadata = { 23 | title: "TextHuman | 汉语新解&编辑", 24 | description: "通过对汉语进行全新的解释", 25 | }; 26 | 27 | export default function RootLayout({ 28 | children, 29 | }: { 30 | children: React.ReactNode; 31 | }) { 32 | return ( 33 | 34 | 40 |
41 | {children} 42 |