Refactor site header, heroes, and design system

This commit is contained in:
MOH
2026-03-08 00:29:51 +01:00
parent a18370d003
commit 0c2b67e378
56 changed files with 2714 additions and 1318 deletions
+55 -17
View File
@@ -25,23 +25,61 @@ export const categoryInputSchema = z.object({
isActive: z.boolean(),
});
export const sectionInputSchema = z.object({
id: z.string().trim().optional(),
type: z.nativeEnum(PortfolioSectionType),
titleAr: requiredText("Section titleAr"),
titleEn: requiredText("Section titleEn"),
titleDe: requiredText("Section titleDe"),
bodyAr: requiredText("Section bodyAr"),
bodyEn: requiredText("Section bodyEn"),
bodyDe: requiredText("Section bodyDe"),
imagePath: optionalTrimmedText,
media: mediaFieldInputSchema.optional(),
linkUrl: optionalTrimmedText.refine(
(value) => value === "" || /^https?:\/\//.test(value) || value.startsWith("/"),
"Section linkUrl must be an absolute URL or start with /.",
),
sortOrder: z.coerce.number().int().min(0).max(9999),
});
export const sectionInputSchema = z
.object({
id: z.string().trim().optional(),
type: z.nativeEnum(PortfolioSectionType),
titleAr: requiredText("Section titleAr"),
titleEn: requiredText("Section titleEn"),
titleDe: requiredText("Section titleDe"),
bodyAr: optionalTrimmedText,
bodyEn: optionalTrimmedText,
bodyDe: optionalTrimmedText,
imagePath: optionalTrimmedText,
media: mediaFieldInputSchema.optional(),
linkUrl: optionalTrimmedText.refine(
(value) => value === "" || /^https?:\/\//.test(value) || value.startsWith("/"),
"Section linkUrl must be an absolute URL or start with /.",
),
sortOrder: z.coerce.number().int().min(0).max(9999),
})
.superRefine((value, context) => {
const hasBody = Boolean(value.bodyAr && value.bodyEn && value.bodyDe);
const hasImage = value.media?.mode === "library"
? Boolean(value.media.assetId)
: value.media?.mode === "upload"
? true
: Boolean(value.imagePath);
if (
(value.type === PortfolioSectionType.RICH_TEXT ||
value.type === PortfolioSectionType.STATS ||
value.type === PortfolioSectionType.DELIVERABLES) &&
!hasBody
) {
context.addIssue({
code: z.ZodIssueCode.custom,
path: ["bodyAr"],
message: "This section type requires body content in all languages.",
});
}
if (value.type === PortfolioSectionType.GALLERY && !hasImage) {
context.addIssue({
code: z.ZodIssueCode.custom,
path: ["media"],
message: "Single image sections require an image.",
});
}
if (value.type === PortfolioSectionType.LINK && !value.linkUrl) {
context.addIssue({
code: z.ZodIssueCode.custom,
path: ["linkUrl"],
message: "Link sections require a link URL.",
});
}
});
export const assetInputSchema = z.object({
id: z.string().trim().optional(),