- Dynamic canonical URLs and alternates for all pages (SEO fix) - Shared seo.ts utility for canonical path generation - Improved duplicate detection: standalone > aggregator priority, forks/created_at tie-breakers - browseReadyFilter now includes unique aggregator skills - Stats aligned with browseReadyFilter (was showing 16k instead of 62k+) - Re-review mechanism: content_hash changes trigger needs-re-review - review_status field added to skills schema - Batch security scan and quality score scripts - Indexer Dockerfile updated for curation deps - Removed roadmap from README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
91 lines
2.7 KiB
TypeScript
91 lines
2.7 KiB
TypeScript
import { getTranslations, setRequestLocale } from 'next-intl/server';
|
|
import { Heart } from 'lucide-react';
|
|
import { auth } from '@/lib/auth';
|
|
import { Header } from '@/components/Header';
|
|
import { Footer } from '@/components/Footer';
|
|
import { FavoritesList } from '@/components/FavoritesList';
|
|
import { FavoritesSignIn } from '@/components/FavoritesSignIn';
|
|
import { createDb, userQueries } from '@skillhub/db';
|
|
import { getPageAlternates } from '@/lib/seo';
|
|
|
|
|
|
// Force dynamic rendering
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
interface FavoritesPageProps {
|
|
params: Promise<{ locale: string }>;
|
|
}
|
|
|
|
|
|
export async function generateMetadata({
|
|
params,
|
|
}: {
|
|
params: Promise<{ locale: string }>;
|
|
}) {
|
|
const { locale } = await params;
|
|
return {
|
|
alternates: getPageAlternates(locale, '/favorites'),
|
|
};
|
|
}
|
|
|
|
export default async function FavoritesPage({ params }: FavoritesPageProps) {
|
|
const { locale } = await params;
|
|
setRequestLocale(locale);
|
|
const t = await getTranslations('favorites');
|
|
const tCommon = await getTranslations('common');
|
|
|
|
const session = await auth();
|
|
|
|
const isLoggedIn = !!session?.user?.githubId;
|
|
|
|
// Get favorites only if logged in
|
|
let favorites: Awaited<ReturnType<typeof userQueries.getFavorites>> = [];
|
|
if (isLoggedIn) {
|
|
const db = createDb();
|
|
const dbUser = await userQueries.getByGithubId(db, session.user.githubId!);
|
|
favorites = dbUser ? await userQueries.getFavorites(db, dbUser.id) : [];
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen flex flex-col bg-surface-muted">
|
|
<Header />
|
|
|
|
<main className="flex-1">
|
|
<div className="bg-surface border-b border-border">
|
|
<div className="container-main py-8">
|
|
<div className="flex items-center gap-3 mb-2">
|
|
<Heart className="w-8 h-8 text-red-500 fill-red-500" />
|
|
<h1 className="text-3xl font-bold text-text-primary">{t('title')}</h1>
|
|
</div>
|
|
<p className="text-text-secondary">{t('subtitle')}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="container-main py-8">
|
|
{isLoggedIn ? (
|
|
<FavoritesList
|
|
initialFavorites={favorites}
|
|
locale={locale}
|
|
translations={{
|
|
verified: tCommon('verified'),
|
|
emptyTitle: t('empty.title'),
|
|
emptyDescription: t('empty.description'),
|
|
emptyCta: t('empty.cta'),
|
|
}}
|
|
/>
|
|
) : (
|
|
<FavoritesSignIn
|
|
translations={{
|
|
loginRequired: t('loginRequired'),
|
|
signIn: t('signIn'),
|
|
}}
|
|
/>
|
|
)}
|
|
</div>
|
|
</main>
|
|
|
|
<Footer />
|
|
</div>
|
|
);
|
|
}
|