diff --git a/src/components/HomePage.tsx b/src/components/HomePage.tsx index 64eaf95..d74c530 100644 --- a/src/components/HomePage.tsx +++ b/src/components/HomePage.tsx @@ -22,53 +22,74 @@ export type PostPreview = { title: string; description: string; pubDate: string; - category: 'technical' | 'company'; + category: "technical" | "company"; emoji?: string; readTime: number; }; +export type HomeTranslations = { + heroDesc1: string; + heroDesc2: string; + latestPostsTitle: string; + viewAll: string; + minRead: string; + dateLocale: string; +}; + const CATEGORY_STYLE = { company: { - thumb: 'from-primary/20 to-primary/40', - tag: 'text-primary bg-primary/10', - defaultEmoji: '🔥', + thumb: "from-primary/20 to-primary/40", + tag: "text-primary bg-primary/10", + defaultEmoji: "🔥", }, technical: { - thumb: 'from-secondary/50 to-secondary/70', - tag: 'text-secondary-foreground bg-secondary/40', - defaultEmoji: '⚙️', + thumb: "from-secondary/50 to-secondary/70", + tag: "text-secondary-foreground bg-secondary/40", + defaultEmoji: "⚙️", }, } as const; -const LatestPosts = ({ posts }: { posts: PostPreview[] }) => { +const LatestPosts = ({ + posts, + t, + locale, +}: { + posts: PostPreview[]; + t: HomeTranslations; + locale: string; +}) => { + const blogBase = locale === "zh-cn" ? "/zh-cn/blog" : "/blog"; if (posts.length === 0) return null; return (

- Latest from the Blog + {t.latestPostsTitle}

- View all → + {t.viewAll}
{posts.map((post, idx) => { const style = CATEGORY_STYLE[post.category]; const emoji = post.emoji ?? style.defaultEmoji; - const date = new Date(post.pubDate).toLocaleDateString('en-US', { - year: 'numeric', - month: 'long', - day: 'numeric', - }); + const date = new Date(post.pubDate).toLocaleDateString( + t.dateLocale, + { + year: "numeric", + month: "long", + day: "numeric", + }, + ); return ( { {post.description}

- {date} · {post.readTime} min read + {date} · {post.readTime} {t.minRead}

@@ -106,7 +127,7 @@ const LatestPosts = ({ posts }: { posts: PostPreview[] }) => { ); }; -const Hero = () => { +const Hero = ({ t }: { t: HomeTranslations }) => { const bodyRef = useRef(null); useEffect(() => { if (!bodyRef.current) return; @@ -144,14 +165,10 @@ const Hero = () => { Ignis Network

- We're a startup company that builds resilient digital infrastructure - designed to endure, with AI applied where it meaningfully adds - strength and insight. + {t.heroDesc1}

- We focus on stability, clarity, and long-term reliability — creating - systems that smartly carry what matters, support growth over time, - and let everything else move forward with confidence. + {t.heroDesc2}

- - + + ); }