feat: Çözümler bölümü + mobil menü; admin parser düzeltmeleri
- Çözümler: solutions tablosu, /cozumler liste + detay sayfası, anasayfa bölümü, tam admin CRUD (/admin/cozumler), header & footer linkleri, projelerde solution_slug ilişkisi, services-grid genelleştirildi - Mobil menü (hamburger drawer) eklendi — header artık < lg'de gezilebilir - Site ayarları parser: textarea CRLF (\r\n) normalizasyonu — neden biz, süreç adımları, değerler ve SSS blokları artık doğru parçalanıyor - homepage_faq + garanti (title/description/items) saveSiteSettings'e bağlandı (daha önce hiç kaydedilmiyordu)
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { CheckCircle2 } from "lucide-react";
|
||||
import { renderContent } from "@/lib/content-render";
|
||||
import { getSolutionBySlug, getSiteSettings, listProjects } from "@/lib/data";
|
||||
import { buildMetadata } from "@/lib/seo";
|
||||
import { ProjectsGrid } from "@/components/projects-grid";
|
||||
import { SectionTitle } from "@/components/section-title";
|
||||
import { FaqList } from "@/components/faq-list";
|
||||
import { SolutionHero } from "@/components/solution-hero";
|
||||
import { SolutionSidebar } from "@/components/solution-sidebar";
|
||||
import type { FaqItem } from "@/lib/types";
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string }>;
|
||||
}): Promise<Metadata> {
|
||||
const { slug } = await params;
|
||||
const solution = await getSolutionBySlug(slug);
|
||||
if (!solution) return { title: "Çözüm bulunamadı" };
|
||||
return buildMetadata(`/cozumler/${slug}`, {
|
||||
title: solution.title,
|
||||
description: solution.description.slice(0, 160),
|
||||
});
|
||||
}
|
||||
|
||||
function parseFaq(items?: string[] | null): FaqItem[] {
|
||||
if (!items) return [];
|
||||
const out: FaqItem[] = [];
|
||||
for (const raw of items) {
|
||||
try {
|
||||
const obj = JSON.parse(raw) as Partial<FaqItem>;
|
||||
if (obj.q && obj.a) out.push({ q: obj.q, a: obj.a });
|
||||
} catch {
|
||||
const [q, a] = raw.split("|||").map((s) => s.trim());
|
||||
if (q && a) out.push({ q, a });
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export default async function SolutionDetailPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string }>;
|
||||
}) {
|
||||
const { slug } = await params;
|
||||
const solution = await getSolutionBySlug(slug);
|
||||
if (!solution) notFound();
|
||||
|
||||
const [relatedProjects, settings] = await Promise.all([
|
||||
listProjects({ solutionSlug: slug, limit: 6 }),
|
||||
getSiteSettings(),
|
||||
]);
|
||||
|
||||
const faqItems = parseFaq(solution.faq);
|
||||
const html = renderContent(solution.content);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SolutionHero solution={solution} settings={settings} />
|
||||
|
||||
<div className="mx-auto grid max-w-7xl gap-12 px-6 py-16 lg:grid-cols-[1.5fr_1fr]">
|
||||
<div>
|
||||
{solution.features && solution.features.length > 0 && (
|
||||
<section className="mb-12">
|
||||
<h2 className="text-2xl font-bold text-[var(--navy)]">
|
||||
Bu çözüm kapsamında
|
||||
</h2>
|
||||
<ul className="mt-6 grid gap-3 sm:grid-cols-2">
|
||||
{solution.features.map((f) => (
|
||||
<li
|
||||
key={f}
|
||||
className="flex items-start gap-2 rounded-xl border border-[var(--border)] bg-white p-4"
|
||||
>
|
||||
<CheckCircle2 className="mt-0.5 size-5 shrink-0 text-[var(--sky-600)]" />
|
||||
<span className="text-sm text-[var(--foreground)]">{f}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{html && (
|
||||
<article
|
||||
className="prose prose-lg max-w-none text-[var(--foreground)]"
|
||||
dangerouslySetInnerHTML={{ __html: html }}
|
||||
/>
|
||||
)}
|
||||
|
||||
{faqItems.length > 0 && (
|
||||
<section className="mt-12">
|
||||
<h2 className="text-2xl font-bold text-[var(--navy)]">
|
||||
Sıkça sorulan sorular
|
||||
</h2>
|
||||
<div className="mt-6">
|
||||
<FaqList items={faqItems} />
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<SolutionSidebar currentSlug={slug} />
|
||||
</div>
|
||||
|
||||
{relatedProjects.length > 0 && (
|
||||
<section className="border-t border-[var(--border)] bg-[var(--navy-50)]/40 py-20">
|
||||
<div className="mx-auto max-w-7xl px-6">
|
||||
<SectionTitle
|
||||
align="left"
|
||||
eyebrow="Referanslar"
|
||||
title={`${solution.title} alanındaki projelerimiz`}
|
||||
description="Bu çözümde tamamladığımız işlerden seçkiler."
|
||||
/>
|
||||
<div className="mt-10">
|
||||
<ProjectsGrid projects={relatedProjects} />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { Metadata } from "next";
|
||||
import { SectionTitle } from "@/components/section-title";
|
||||
import { ServicesGrid } from "@/components/services-grid";
|
||||
import { listSolutions } from "@/lib/data";
|
||||
import { siteConfig } from "@/lib/site-config";
|
||||
import { buildMetadata } from "@/lib/seo";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
return buildMetadata("/cozumler", {
|
||||
title: "Çözümler",
|
||||
description:
|
||||
"İşletmeniz için uçtan uca dijital çözümler: kurumsal dijitalleşme, online satış altyapısı, CRM ve büyüme paketleri.",
|
||||
});
|
||||
}
|
||||
|
||||
export default async function SolutionsPage() {
|
||||
const solutions = await listSolutions();
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-7xl px-6 py-20">
|
||||
<SectionTitle
|
||||
eyebrow="Çözümlerimiz"
|
||||
title="İşletmenize özel dijital çözümler"
|
||||
description="Tek tek hizmetleri değil, işinizi büyüten bütün paketleri tek elden kuruyoruz."
|
||||
/>
|
||||
<div className="mt-14">
|
||||
<ServicesGrid
|
||||
services={solutions}
|
||||
basePath="/cozumler"
|
||||
fallback={siteConfig.fallbackSolutions}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+38
-6
@@ -18,6 +18,7 @@ import {
|
||||
getSiteSettings,
|
||||
listProjects,
|
||||
listServices,
|
||||
listSolutions,
|
||||
listTestimonials,
|
||||
} from "@/lib/data";
|
||||
import { buildMetadata } from "@/lib/seo";
|
||||
@@ -28,12 +29,14 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
}
|
||||
|
||||
export default async function Home() {
|
||||
const [services, projects, testimonials, settings] = await Promise.all([
|
||||
listServices({ featured: true }),
|
||||
listProjects({ featured: true, limit: 6 }),
|
||||
listTestimonials({ featured: true }),
|
||||
getSiteSettings(),
|
||||
]);
|
||||
const [services, solutions, projects, testimonials, settings] =
|
||||
await Promise.all([
|
||||
listServices({ featured: true }),
|
||||
listSolutions({ featured: true }),
|
||||
listProjects({ featured: true, limit: 6 }),
|
||||
listTestimonials({ featured: true }),
|
||||
getSiteSettings(),
|
||||
]);
|
||||
|
||||
const phoneRaw = settings?.contact_phone_raw ?? siteConfig.contact.phoneRaw;
|
||||
const phone = settings?.contact_phone ?? siteConfig.contact.phone;
|
||||
@@ -118,6 +121,35 @@ export default async function Home() {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="border-b border-[var(--border)] bg-[var(--navy-50)]/40 py-20">
|
||||
<div className="mx-auto max-w-7xl px-6">
|
||||
<SectionTitle
|
||||
eyebrow={settings?.solutions_eyebrow ?? "İşletmeler için"}
|
||||
title={settings?.solutions_title ?? "Hazır dijital çözüm paketleri"}
|
||||
description={
|
||||
settings?.solutions_description ??
|
||||
"Tek tek hizmetleri değil; işinizi büyüten bütün paketleri tek elden kuruyoruz."
|
||||
}
|
||||
/>
|
||||
<div className="mt-12">
|
||||
<ServicesGrid
|
||||
services={solutions}
|
||||
basePath="/cozumler"
|
||||
fallback={siteConfig.fallbackSolutions}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-10 text-center">
|
||||
<Link
|
||||
href="/cozumler"
|
||||
className="inline-flex items-center gap-2 rounded-full border border-[var(--border)] bg-white px-5 py-2.5 text-sm font-semibold text-[var(--navy)] transition hover:border-[var(--sky)] hover:text-[var(--sky-600)]"
|
||||
>
|
||||
Tüm çözümleri gör
|
||||
<ArrowRight className="size-4" />
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<WhyUs settings={settings} />
|
||||
|
||||
<Guarantee settings={settings} />
|
||||
|
||||
Reference in New Issue
Block a user