Implement portfolio admin management
This commit is contained in:
@@ -16,7 +16,11 @@ import { AppCard } from "@/components/ui/app-card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { CardContent } from "@/components/ui/card";
|
||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { pickText, portfolioItems, productItems } from "@/lib/site-data";
|
||||
import {
|
||||
getLocalizedValue,
|
||||
getPublishedPortfolioProjects,
|
||||
} from "@/lib/portfolio";
|
||||
import { pickText, productItems } from "@/lib/site-data";
|
||||
|
||||
type HomePageProps = {
|
||||
params: {
|
||||
@@ -24,6 +28,8 @@ type HomePageProps = {
|
||||
};
|
||||
};
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata({
|
||||
params: { locale },
|
||||
}: HomePageProps): Promise<Metadata> {
|
||||
@@ -40,7 +46,7 @@ export async function generateMetadata({
|
||||
|
||||
export default async function HomePage({ params: { locale } }: HomePageProps) {
|
||||
const localeKey = resolveLocale(locale);
|
||||
const featuredProjects = portfolioItems.slice(0, 3);
|
||||
const featuredProjects = (await getPublishedPortfolioProjects()).slice(0, 3);
|
||||
const featuredProducts = productItems.slice(0, 3);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "homepage" });
|
||||
|
||||
@@ -109,13 +115,13 @@ export default async function HomePage({ params: { locale } }: HomePageProps) {
|
||||
className="group block"
|
||||
>
|
||||
<p className="text-sm text-muted-foreground/80">
|
||||
{pickText(item.category, localeKey)} - {item.year}
|
||||
{getLocalizedValue(item.category.name, localeKey)} - {item.projectYear}
|
||||
</p>
|
||||
<h3 className="mt-2 text-lg font-semibold text-foreground">
|
||||
{pickText(item.title, localeKey)}
|
||||
{getLocalizedValue(item.title, localeKey)}
|
||||
</h3>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
{pickText(item.summary, localeKey)}
|
||||
{getLocalizedValue(item.summary, localeKey)}
|
||||
</p>
|
||||
<span className="mt-4 inline-flex items-center gap-2 text-sm font-medium text-foreground/80 group-hover:text-foreground">
|
||||
{t("toPortfolio")}
|
||||
|
||||
Reference in New Issue
Block a user