69 lines
5.5 KiB
TypeScript
69 lines
5.5 KiB
TypeScript
import { englishPortfolioContent } from "@/data/portfolio/en";
|
||
import { arabicPortfolioContent } from "@/data/portfolio/ar";
|
||
import { sharedProfile, resumeFile } from "@/data/portfolio/shared";
|
||
import { sectionKeys, type CmsContent, type CmsDictionary, type CmsProject } from "./cms-types";
|
||
import type { Language, PortfolioDictionary } from "@/data/portfolio/types";
|
||
|
||
function page(language: Language, source: PortfolioDictionary): CmsDictionary {
|
||
const { projects: _projects, ...featured } = source.featured;
|
||
const ar = language === "ar";
|
||
return { ...source, featured, display: {
|
||
headline: ar ? "مساحات تُلهم." : "Spaces that", headlineAccent: ar ? "وتفاصيل تصنع الفرق." : "inspire.",
|
||
eyebrow: ar ? "عمارة وتصميم" : "ARCHITECTURE & DESIGN",
|
||
footnote: ar ? "من دمشق، برؤية تتجاوز المكان." : "Rooted in Damascus. Designed with a wider perspective.",
|
||
imageCaption: ar ? "تصميم معماري" : "Architectural design", imageLabel: "GS / ARCHITECTURE",
|
||
heroAlt: ar ? "منظور خارجي لبرج ماروتا سيتي S160 من أعمال غريس سلمون" : "Exterior perspective of Marota City S160 by Grace Salmoun",
|
||
brandSubtitle: ar ? "عمارة · تصميم · رؤية" : "ARCHITECTURE · DESIGN · VISION",
|
||
projectsTitle: ar ? "أعمال تتحدث عن نفسها." : "A selection of perspectives.",
|
||
aboutTitle: ar ? "بين الفكرة والمكان، تتشكّل الحكاية." : "Between an idea and a place, a story takes shape.",
|
||
servicesTitle: ar ? "رؤية متكاملة. تفاصيل مدروسة." : "A complete vision. Every detail considered.",
|
||
contactButton: ar ? "لنتحدث عن مشروعك" : "Let’s discuss your project",
|
||
disciplines: ar ? ["العمارة", "التصميم العمراني", "تنسيق المواقع", "الإظهار المعماري"] : ["Architecture", "Urban design", "Landscape", "Visualization"],
|
||
} };
|
||
}
|
||
export function blankProject(): CmsProject {
|
||
return { id: "", titleEn: "", titleAr: "", locationEn: "", locationAr: "", year: "", areaEn: "", areaAr: "", roleEn: "", roleAr: "", descriptionEn: "", descriptionAr: "", highlightsEn: [], highlightsAr: [], coverImage: "", sheetImage: "", additionalSheetImages: [], imageAltAr: "", imageAltEn: "", orientation: "landscape", visible: true };
|
||
}
|
||
export function initialContent(): CmsContent {
|
||
return {
|
||
profile: {
|
||
nameEn: sharedProfile.founderNameEn, nameAr: sharedProfile.founderNameAr,
|
||
professionEn: englishPortfolioContent.ui.architectureEngineer, professionAr: arabicPortfolioContent.ui.architectureEngineer,
|
||
introEn: englishPortfolioContent.hero.intro, introAr: arabicPortfolioContent.hero.intro,
|
||
aboutEn: englishPortfolioContent.about.description, aboutAr: arabicPortfolioContent.about.description,
|
||
profileImage: "", heroImage: "", phone: sharedProfile.phone, email: sharedProfile.email,
|
||
whatsapp: sharedProfile.whatsappHref, facebook: sharedProfile.facebookHref,
|
||
addressEn: sharedProfile.address, addressAr: sharedProfile.addressAr,
|
||
logoImage: sharedProfile.logoImage, locationHref: sharedProfile.locationHref, facebookLabel: sharedProfile.facebook,
|
||
},
|
||
projects: englishPortfolioContent.featured.projects.map((p, i) => {
|
||
const ar = arabicPortfolioContent.featured.projects[i] ?? p;
|
||
return { ...blankProject(), id: p.id, titleEn: p.title, titleAr: ar.title, locationEn: p.location, locationAr: ar.location,
|
||
year: p.year, areaEn: p.area, areaAr: ar.area, roleEn: p.role, roleAr: ar.role,
|
||
descriptionEn: p.description, descriptionAr: ar.description, highlightsEn: p.highlights, highlightsAr: ar.highlights,
|
||
coverImage: p.coverImage ?? p.image, sheetImage: p.sheetImage ?? p.image, orientation: p.coverOrientation ?? "landscape",
|
||
additionalSheetImages: p.additionalSheetImages ?? [], imageAltAr: ar.imageAlt, imageAltEn: p.imageAlt };
|
||
}),
|
||
pages: { en: page("en", englishPortfolioContent), ar: page("ar", arabicPortfolioContent) },
|
||
settings: { resumeUrl: resumeFile.href, resumeAvailable: resumeFile.available, accentColor: "#087eaf", sections: Object.fromEntries(sectionKeys.map(key => [key, true])) as CmsContent["settings"]["sections"] },
|
||
updatedAt: new Date(0).toISOString(),
|
||
};
|
||
}
|
||
export function managedPortfolio(cms: CmsContent, language: Language): PortfolioDictionary {
|
||
const base = cms.pages[language];
|
||
const ar = language === "ar";
|
||
return { ...base,
|
||
ui: { ...base.ui, architectureEngineer: ar ? cms.profile.professionAr : cms.profile.professionEn },
|
||
hero: { ...base.hero, intro: ar ? cms.profile.introAr : cms.profile.introEn },
|
||
about: { ...base.about, description: ar ? cms.profile.aboutAr : cms.profile.aboutEn },
|
||
featured: { ...base.featured, projects: cms.projects.filter(p => p.visible).map(p => ({
|
||
id: p.id, title: ar ? p.titleAr : p.titleEn, location: ar ? p.locationAr : p.locationEn,
|
||
year: p.year, area: ar ? p.areaAr : p.areaEn, role: ar ? p.roleAr : p.roleEn,
|
||
description: ar ? p.descriptionAr : p.descriptionEn, highlights: ar ? p.highlightsAr : p.highlightsEn,
|
||
image: p.coverImage || "/images/site/grace-hero-fallback.webp", coverImage: p.coverImage || "/images/site/grace-hero-fallback.webp",
|
||
sheetImage: p.sheetImage || p.coverImage || "/images/site/grace-hero-fallback.webp", additionalSheetImages: p.additionalSheetImages,
|
||
coverOrientation: p.orientation, imageAlt: (ar ? p.imageAltAr : p.imageAltEn) || (ar ? p.titleAr : p.titleEn),
|
||
})) },
|
||
};
|
||
}
|