feat: Hakkımızda sayfası yönetilebilir (site_settings + /admin/site)
Önce hard-coded olan tüm metinler artık /admin/site > 'Hakkımızda sayfası'
bölümünden düzenlenebilir.
site_settings'e 9 yeni alan eklendi:
- about_eyebrow, about_title, about_description (üst hero)
- about_values (string array JSON {title, description}) — 4 değer kartı
- about_hero_image (opsiyonel, boşsa logo gösterilir)
- about_team_eyebrow, about_team_title, about_team_description
- about_stats (string array JSON {value, label}) — alt navy bant
Mevcut WP değerleri default olarak seed edildi.
Hakkımızda sayfası (app/(site)/hakkimizda/page.tsx) artık:
- Tüm metinler settings'ten okunuyor (fallback default'lar var)
- Hero image varsa logo yerine onu gösteriyor
- Stats sıfırdan farklı sayıda olabilir (3 yerine 2/4)
Admin form (/admin/site):
- Yeni 'Hakkımızda sayfası' section
- 4 alt-bölüm: Üst hero / Değerler / Ekip / Stats
- MediaPicker ile hero image
- Markdown benzeri textarea'lar (--- ayırıcı, | seperator)
This commit is contained in:
@@ -363,6 +363,30 @@ export async function saveSiteSettings(formData: FormData) {
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
// Hakkımızda values: blok '---' ile, ilk satır title, kalanı description
|
||||
const aboutValuesRaw = String(formData.get("about_values") ?? "");
|
||||
const aboutValues = aboutValuesRaw
|
||||
.split("\n---\n")
|
||||
.map((block) => {
|
||||
const lines = block.trim().split("\n");
|
||||
const title = lines[0]?.trim();
|
||||
const description = lines.slice(1).join("\n").trim();
|
||||
if (!title || !description) return null;
|
||||
return JSON.stringify({ title, description });
|
||||
})
|
||||
.filter((x): x is string => x !== null);
|
||||
|
||||
// Hakkımızda stats: 'value | label' satırlar
|
||||
const aboutStatsRaw = String(formData.get("about_stats") ?? "");
|
||||
const aboutStats = aboutStatsRaw
|
||||
.split("\n")
|
||||
.map((line) => {
|
||||
const [value, label] = line.split("|").map((s) => s.trim());
|
||||
if (!value || !label) return null;
|
||||
return JSON.stringify({ value, label });
|
||||
})
|
||||
.filter((x): x is string => x !== null);
|
||||
|
||||
const data = {
|
||||
hero_badge: str(formData.get("hero_badge")),
|
||||
hero_title: str(formData.get("hero_title")),
|
||||
@@ -414,6 +438,16 @@ export async function saveSiteSettings(formData: FormData) {
|
||||
google_review_url: str(formData.get("google_review_url")),
|
||||
google_rating: num(formData.get("google_rating")),
|
||||
google_review_count: num(formData.get("google_review_count")),
|
||||
|
||||
about_eyebrow: str(formData.get("about_eyebrow")),
|
||||
about_title: str(formData.get("about_title")),
|
||||
about_description: str(formData.get("about_description")),
|
||||
about_values: aboutValues.length > 0 ? aboutValues : null,
|
||||
about_hero_image: str(formData.get("about_hero_image")),
|
||||
about_team_eyebrow: str(formData.get("about_team_eyebrow")),
|
||||
about_team_title: str(formData.get("about_team_title")),
|
||||
about_team_description: str(formData.get("about_team_description")),
|
||||
about_stats: aboutStats.length > 0 ? aboutStats : null,
|
||||
};
|
||||
|
||||
try {
|
||||
|
||||
@@ -148,6 +148,22 @@ export interface SiteSettingsRow extends AwRow {
|
||||
guarantee_title?: string | null;
|
||||
guarantee_description?: string | null;
|
||||
guarantee_items?: string[] | null;
|
||||
|
||||
// Hakkımızda sayfası
|
||||
about_eyebrow?: string | null;
|
||||
about_title?: string | null;
|
||||
about_description?: string | null;
|
||||
about_values?: string[] | null; // JSON {"title","description"}
|
||||
about_hero_image?: string | null;
|
||||
about_team_eyebrow?: string | null;
|
||||
about_team_title?: string | null;
|
||||
about_team_description?: string | null;
|
||||
about_stats?: string[] | null; // JSON {"value","label"}
|
||||
}
|
||||
|
||||
export interface AboutValue {
|
||||
title: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface TeamMemberRow extends AwRow {
|
||||
|
||||
Reference in New Issue
Block a user