import Image from "next/image"; import { Link } from "@/i18n/routing"; import { Icon } from "@iconify/react"; import { Badge, Button, ButtonIcon, ButtonLabel, Card, Typography, } from "poyraz-ui/atoms"; import { StaggerContainer, StaggerItem } from "@/components/motion-wrapper"; import { ProjectCardWithPopover } from "@/components/project-card-with-popover"; import { EXTENSIONS, FIGMA_TEMPLATES, MOBILE_APPS, WEB_APPS, type ProjectItem, } from "@/data/projects"; import { getGithubRepos, getNpmPackages } from "@/lib/project-feeds"; import { getTranslations, getLocale } from "next-intl/server"; import { getLocalizedValue } from "@/lib/locale"; function getLanguageMeta(language: string) { const key = language.toLowerCase(); if (key.includes("typescript")) { return { icon: "vscode-icons:file-type-typescript-official", color: "text-blue-600", }; } if (key.includes("javascript")) { return { icon: "vscode-icons:file-type-js-official", color: "text-amber-500", }; } if (key.includes("python")) { return { icon: "vscode-icons:file-type-python", color: "text-yellow-600" }; } if (key.includes("go")) { return { icon: "vscode-icons:file-type-go", color: "text-cyan-600" }; } if (key.includes("rust")) { return { icon: "vscode-icons:file-type-rust", color: "text-orange-600" }; } if (key.includes("java")) { return { icon: "vscode-icons:file-type-java", color: "text-red-600" }; } if (key.includes("html")) { return { icon: "vscode-icons:file-type-html", color: "text-orange-500" }; } if (key.includes("css")) { return { icon: "vscode-icons:file-type-css", color: "text-blue-500" }; } return { icon: "mdi:code-tags", color: "text-zinc-500" }; } type LocalizedProjectItem = { id: string; title: string; description: string; image: string; technologies: string[]; architecture: string; badge?: string; href?: string; caseStudySlug?: string; }; function ProjectSection({ title, items, technologiesLabel, architectureLabel, caseStudyLabel, }: { title: string; items: LocalizedProjectItem[]; technologiesLabel: string; architectureLabel: string; caseStudyLabel: string; }) { return ( {title} {items.map((item) => ( ))} ); } export async function ProjectsContent() { const t = await getTranslations("Projects"); const locale = await getLocale(); const [repos, npmPackages] = await Promise.all([ getGithubRepos(), getNpmPackages(), ]); const localizeItems = (items: ProjectItem[]): LocalizedProjectItem[] => { return items.map((item) => ({ ...item, title: getLocalizedValue(item.title, locale), description: getLocalizedValue(item.description, locale), architecture: getLocalizedValue(item.architecture, locale), badge: item.badge ? getLocalizedValue(item.badge, locale) : undefined, })); }; return ( {t("sections.npmPackages")} {t("viewNpmPackages")} {npmPackages.length === 0 ? ( {t("emptyNpm")} ) : ( npmPackages.map((pkg) => ( {pkg.name} {pkg.description} v{pkg.version} )) )} {t("sections.githubRepos")} {t("visitGithub")} {repos.length === 0 ? ( {t("emptyGithub")} ) : ( repos.map((repo) => { const languageMeta = getLanguageMeta(repo.language); return ( {repo.name} {repo.description} {repo.language} {repo.stars} ); }) )} ); }