refactor: 优化组件国际化实现

- 将客户端组件改为服务端组件,使用 getTranslations
- LocaleSwitcher 简化为接收 switchUrl prop
- ProjectCard/ProjectList/ExternalLinkCard 等组件支持 i18n
- 优化 webhook 去重查询,关联 links 数据
- 移除 ProjectDetail 中的客户端交互逻辑(ShareButtons 暂时禁用)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-29 19:58:23 +08:00
co-authored by Claude
parent 6303fd7ae6
commit 3869bb23bb
10 changed files with 143 additions and 93 deletions
+6 -1
View File
@@ -12,6 +12,7 @@ interface HomePageProps {
export default async function HomePage({ params }: HomePageProps) {
const { locale } = await params
const t = await getTranslations('home')
const tCommon = await getTranslations('common')
const [projectsData, tags] = await Promise.all([
getProjects({ limit: 6 }),
@@ -33,7 +34,11 @@ export default async function HomePage({ params }: HomePageProps) {
Discover and explore high-quality AI projects from across the web. Curated for developers and enthusiasts.
</p>
<Suspense fallback={<div className="h-16"></div>}>
<SearchBar locale={locale} />
<SearchBar
locale={locale}
searchPlaceholder={t('searchPlaceholder')}
searchLabel={tCommon('search')}
/>
</Suspense>
</section>
+6 -1
View File
@@ -15,6 +15,7 @@ export default async function ProjectsPage({
searchParams,
}: ProjectsPageProps) {
const t = await getTranslations('home')
const tCommon = await getTranslations('common')
const [resolvedParams, resolvedSearchParams] = await Promise.all([params, searchParams])
const { locale } = resolvedParams
@@ -47,7 +48,11 @@ export default async function ProjectsPage({
{/* Search and Filter Section */}
<div className="bg-surface-light dark:bg-surface-dark border-2 border-black dark:border-white/20 p-6 md:p-8 mb-12 shadow-neo dark:shadow-none">
<Suspense fallback={<div className="h-20"></div>}>
<SearchBar locale={locale} />
<SearchBar
locale={locale}
searchPlaceholder={t('searchPlaceholder')}
searchLabel={tCommon('search')}
/>
</Suspense>
<div className="border-t-2 border-gray-100 dark:border-gray-800 pt-6 mt-8">
+13 -2
View File
@@ -28,7 +28,11 @@ async function findExistingProject(projectData: ProjectInput) {
url: githubLink.url,
},
include: {
project: true,
project: {
include: {
links: true,
},
},
},
})
@@ -51,7 +55,11 @@ async function findExistingProject(projectData: ProjectInput) {
url: websiteLink.url,
},
include: {
project: true,
project: {
include: {
links: true,
},
},
},
})
@@ -70,6 +78,9 @@ async function findExistingProject(projectData: ProjectInput) {
const existingBySlug = await prisma.project.findUnique({
where: { slug },
include: {
links: true,
},
})
if (existingBySlug) {