Skip to content

Commit 08b0ec5

Browse files
feat: Introduce ChangelogCarousel and UpdatesSection components to display changelog entries and updates, enhancing the home page layout.
1 parent edb3864 commit 08b0ec5

File tree

8 files changed

+202
-8
lines changed

8 files changed

+202
-8
lines changed

apps/docs/components/home/blog-articles-carousel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useEffect, useState } from 'react';
44
import { motion } from 'framer-motion';
55
import { ArrowRight } from 'lucide-react';
66
import { useTranslation } from '@/lib/utils/translation-context';
7-
import { t } from '@/lib/i18n/translations';
7+
import { t, getTranslations } from '@/lib/i18n/translations';
88
import Link from 'next/link';
99
import { playClickSound } from '@/lib/utils/sound';
1010
import type { Post } from '@/lib/sanity/types';
@@ -14,6 +14,7 @@ export function BlogArticlesCarousel() {
1414
const { currentLanguage } = useTranslation();
1515
const [latestPosts, setLatestPosts] = useState<Post[]>([]);
1616
const [hoveredCard, setHoveredCard] = useState<string | null>(null);
17+
const translations = getTranslations(currentLanguage);
1718

1819
useEffect(() => {
1920
const fetchLatestPosts = async () => {
@@ -65,6 +66,7 @@ export function BlogArticlesCarousel() {
6566
<div className="grow flex flex-col">
6667
{post.publishedAt && (
6768
<p className="text-zinc-500 dark:text-zinc-400 text-xs mb-3">
69+
{translations.blog.article} ·{' '}
6870
{new Date(post.publishedAt).toLocaleDateString(
6971
currentLanguage === 'zh'
7072
? 'zh-CN'
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/* @proprietary license */
2+
3+
import { useState } from 'react';
4+
import { motion } from 'framer-motion';
5+
import { useTranslation } from '@/lib/utils/translation-context';
6+
import { getTranslations } from '@/lib/i18n/translations';
7+
import Link from 'next/link';
8+
import { playClickSound } from '@/lib/utils/sound';
9+
10+
interface ChangelogEntry {
11+
date: string;
12+
version: string;
13+
title: string;
14+
changes: string[];
15+
}
16+
17+
interface ChangelogEntryCardProps {
18+
entry: ChangelogEntry;
19+
index: number;
20+
hoveredCard: string | null;
21+
onHover: (id: string | null) => void;
22+
}
23+
24+
function ChangelogEntryCard({
25+
entry,
26+
index,
27+
hoveredCard,
28+
onHover,
29+
}: ChangelogEntryCardProps) {
30+
const { currentLanguage } = useTranslation();
31+
const translations = getTranslations(currentLanguage);
32+
33+
return (
34+
<motion.div
35+
className="w-full"
36+
onMouseEnter={() => onHover(`changelog-${index}`)}
37+
onMouseLeave={() => onHover(null)}
38+
initial={{ opacity: 0, y: 20 }}
39+
animate={{ opacity: 1, y: 0 }}
40+
transition={{ duration: 0.6, delay: index * 0.1 }}
41+
>
42+
<Link
43+
href="/changelog"
44+
className="group flex flex-col h-full"
45+
onMouseDown={playClickSound}
46+
>
47+
<article className="flex flex-col bg-white dark:bg-zinc-900 rounded-sm overflow-hidden shadow-sm hover:shadow-sm transition-all duration-300 border border-zinc-200 dark:border-zinc-800 h-full p-6 min-h-[200px]">
48+
<div className="grow flex flex-col">
49+
{/* Date and Badge in same row */}
50+
<div className="flex justify-between items-center mb-3">
51+
<p className="text-zinc-500 dark:text-zinc-400 text-xs">
52+
{translations.changelog.title} ·{' '}
53+
{new Date(entry.date).toLocaleDateString(
54+
currentLanguage === 'zh'
55+
? 'zh-CN'
56+
: currentLanguage === 'fr'
57+
? 'fr-FR'
58+
: currentLanguage === 'es'
59+
? 'es-ES'
60+
: 'en-US',
61+
{
62+
year: 'numeric',
63+
month: 'short',
64+
day: 'numeric',
65+
},
66+
)}
67+
</p>
68+
<span className="px-2 py-1 text-xs font-normal rounded bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300">
69+
Release
70+
</span>
71+
</div>
72+
73+
{/* Title */}
74+
<h3 className="font-normal leading-tight text-zinc-900 dark:text-white text-lg mb-4 line-clamp-2">
75+
{entry.title}
76+
</h3>
77+
78+
{/* Summary - First change or description */}
79+
<p className="text-zinc-600 dark:text-zinc-400 text-sm mb-6 line-clamp-3 grow">
80+
{entry.changes.length > 0 ? entry.changes[0] : 'New release with improvements and fixes'}
81+
</p>
82+
</div>
83+
84+
{/* Bottom section with read text */}
85+
<div className="mt-auto flex justify-end">
86+
<div className="flex items-center text-primary text-sm font-normal">
87+
<span
88+
className={`transition-all duration-300 ${hoveredCard === `changelog-${index}` ? 'opacity-100' : 'opacity-0'
89+
}`}
90+
>
91+
{translations.changelog.read}
92+
</span>
93+
</div>
94+
</div>
95+
</article>
96+
</Link>
97+
</motion.div>
98+
);
99+
}
100+
101+
export function ChangelogCarousel() {
102+
const { currentLanguage } = useTranslation();
103+
const [hoveredCard, setHoveredCard] = useState<string | null>(null);
104+
105+
const translations = getTranslations(currentLanguage);
106+
const changelogData = translations.changelog as unknown as {
107+
entries?: ChangelogEntry[];
108+
};
109+
const changelogEntries = changelogData?.entries || [];
110+
111+
return (
112+
<div className="w-full mt-8 relative">
113+
{/* Horizontal scrolling for all cards */}
114+
{changelogEntries.length > 0 && (
115+
<div className="overflow-x-auto pb-4 scrollbar-hide">
116+
<div className="flex gap-8" style={{ width: 'max-content' }}>
117+
{changelogEntries.slice(0, 6).map((entry, index) => (
118+
<div key={`changelog-${index}`} className="shrink-0 w-[612px]">
119+
<ChangelogEntryCard
120+
entry={entry}
121+
index={index}
122+
hoveredCard={hoveredCard}
123+
onHover={setHoveredCard}
124+
/>
125+
</div>
126+
))}
127+
</div>
128+
</div>
129+
)}
130+
</div>
131+
);
132+
}

apps/docs/components/home/home-page-client.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import { Hero } from '@/components/home/hero';
66
import { FeaturesSection } from '@/components/home/features-section';
7-
import { CareersSection } from '@/components/home/careers-section';
7+
import { UpdatesSection } from '@/components/home/updates-section';
88
import { AddOns } from '@/components/home/add-ons';
99
import { EarlyMemberPricing } from '@/components/home/early-member-pricing';
1010
import { useHomePageInit } from '@/lib/hooks/use-home-page-init';
@@ -22,7 +22,7 @@ export function HomePageClient() {
2222
/>
2323
<FeaturesSection />
2424
<AddOns />
25-
<CareersSection />
25+
<UpdatesSection />
2626
<EarlyMemberPricing />
2727
</>
2828
);

apps/docs/components/home/careers-section.tsx renamed to apps/docs/components/home/updates-section.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { Section } from '@/components/ui/section';
77
import Link from 'next/link';
88
import { playClickSound } from '@/lib/utils/sound';
99
import { BlogArticlesCarousel } from './blog-articles-carousel';
10+
import { ChangelogCarousel } from './changelog-carousel';
1011

11-
export function CareersSection() {
12+
export function UpdatesSection() {
1213
const { currentLanguage } = useTranslation();
1314

1415
return (
@@ -31,6 +32,9 @@ export function CareersSection() {
3132

3233
{/* Latest Articles Section */}
3334
<BlogArticlesCarousel />
35+
36+
{/* Latest Changelog Section */}
37+
<ChangelogCarousel />
3438
</div>
3539
</Section>
3640
);

apps/docs/lib/i18n/locales/en.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"blog": {
3+
"article": "Article",
34
"backHome": "Back home",
45
"backToBlog": "Back to articles",
56
"byAuthor": "By {author}",
@@ -63,8 +64,21 @@
6364
},
6465
"changelog": {
6566
"description": "Stay updated with all the latest updates, improvements, and fixes to lomi.",
67+
"read": "Read changelog",
6668
"subtitle": "All the latest updates, improvements, and fixes to our products and services.",
67-
"title": "Changelog"
69+
"title": "Changelog",
70+
"entries": [
71+
{
72+
"date": "2024-10-17",
73+
"version": "1.0.0",
74+
"title": "Launch",
75+
"changes": [
76+
"Launched lomi. with core functionality and one single payment method.",
77+
"Implemented user authentication and payment link feature.",
78+
"Made documentation and website open-source."
79+
]
80+
}
81+
]
6882
},
6983
"components": {
7084
"business_outreach": {

apps/docs/lib/i18n/locales/es.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"blog": {
3+
"article": "Artículo",
34
"backHome": "Volver al inicio",
45
"backToBlog": "Volver a artículos",
56
"byAuthor": "Por {author}",
@@ -63,8 +64,21 @@
6364
},
6465
"changelog": {
6566
"description": "Mantente actualizado con todas las últimas actualizaciones, mejoras y correcciones a lomi.",
67+
"read": "Leer changelog",
6668
"subtitle": "Todas las últimas actualizaciones, mejoras y correcciones a nuestros productos y servicios.",
67-
"title": "Changelog"
69+
"title": "Changelog",
70+
"entries": [
71+
{
72+
"date": "2024-10-17",
73+
"version": "1.0.0",
74+
"title": "Lanzamiento",
75+
"changes": [
76+
"Lanzado lomi. con un solo método de pago.",
77+
"Implementado autenticación de usuario y característica de enlace de pago.",
78+
"Hizo la documentación y el sitio web de código abierto."
79+
]
80+
}
81+
]
6882
},
6983
"components": {
7084
"business_outreach": {

apps/docs/lib/i18n/locales/fr.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"blog": {
3+
"article": "Article",
34
"backHome": "Retour à l'accueil",
45
"backToBlog": "Retour au blog",
56
"byAuthor": "Par {author}",
@@ -63,8 +64,21 @@
6364
},
6465
"changelog": {
6566
"description": "Restez à jour avec toutes les dernières mises à jour, améliorations et corrections de lomi.",
67+
"read": "Lire le changelog",
6668
"subtitle": "Toutes les dernières mises à jour, améliorations et corrections de nos produits et services.",
67-
"title": "Changelog"
69+
"title": "Changelog",
70+
"entries": [
71+
{
72+
"date": "2024-10-17",
73+
"version": "1.0.0",
74+
"title": "Lancement",
75+
"changes": [
76+
"Lancé lomi. une seule méthode de paiement.",
77+
"Implémenté auth' et un feature de lien de paiement.",
78+
"Documentation et site web open-source."
79+
]
80+
}
81+
]
6882
},
6983
"components": {
7084
"business_outreach": {

apps/docs/lib/i18n/locales/zh.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"blog": {
3+
"article": "文章",
34
"backHome": "返回首页",
45
"backToBlog": "返回文章",
56
"byAuthor": "作者:{author}",
@@ -63,8 +64,21 @@
6364
},
6465
"changelog": {
6566
"description": "保持更新,了解我们产品的最新更新、改进和修复。",
67+
"read": "阅读更新日志",
6668
"subtitle": "我们产品的最新更新、改进和修复。",
67-
"title": "更新日志"
69+
"title": "更新日志",
70+
"entries": [
71+
{
72+
"date": "2024-10-17",
73+
"version": "1.0.0",
74+
"title": "发布",
75+
"changes": [
76+
"发布 lomi. 核心功能和单一支付方式。",
77+
"实现用户认证和支付链接特性。",
78+
"制作文档和网站开源。"
79+
]
80+
}
81+
]
6882
},
6983
"components": {
7084
"business_outreach": {

0 commit comments

Comments
 (0)