Files
tootaio.com/content.config.ts
xiaomai ccfd268682 feat(webDev): add inquiry modal for pricing plans
This commit introduces a 'Contact Sales' modal on the web development page, allowing users to inquire about specific service plans.

- The pricing plan buttons now trigger this modal, pre-filled with the selected plan's details.
- Users can add custom remarks to their inquiry.
- On submission, a pre-formatted message is generated and opened in WhatsApp using a new `useWhatsAppMsgSender` composable.
- Adds `NUXT_PUBLIC_WHATSAPP_NUMBER` to the runtime configuration.
- Refactors content validation by introducing Zod schemas for `PricingPlan` and `Button` props to improve type safety.
- Adds new i18n keys for the modal interface and message templates.
2025-11-07 11:04:14 +08:00

87 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineContentConfig, defineCollection, z } from "@nuxt/content";
import { PricingPlanPropsSchema } from "./app/schemas/PricingPlanSchema";
const defineIndexSchema = () =>
z.object({
capabilities: z.object({
title: z.string(),
features: z.array(
z.object({
title: z.string(),
description: z.string(),
icon: z.string(),
})
),
}),
featuredProjects: z.object({
title: z.string(),
projects: z.array(
z.object({
title: z.string(),
description: z.string(),
image: z.string(),
demoLink: z.string(),
highlight: z.boolean(),
spotlight: z.boolean(),
})
),
}),
techStack: z.object({
title: z.string(),
}),
whyChooseUs: z.object({
title: z.string(),
features: z.array(
z.object({
title: z.string(),
description: z.string(),
icon: z.string(),
})
),
}),
});
const defineWebDevSchema = () =>
z.object({
remarks: z.string(),
services: z.array(
z.object({
id: z.string().min(1),
label: z.string().min(1),
icon: z.string().optional(), // 比如 "lucide:mouse-pointer-click"
// 你原结构里通过 createService 包装,但最终是一个对象
plans: z
.array(PricingPlanPropsSchema)
.min(1),
// 预留扩展字段例如category、tags、hidden 等)
category: z.string().optional(),
tags: z.array(z.string()).optional(),
})
),
});
export default defineContentConfig({
collections: {
index_en: defineCollection({
type: "page",
source: "en-US/index.yml",
schema: defineIndexSchema(),
}),
index_zh: defineCollection({
type: "page",
source: "zh-CN/index.yml",
schema: defineIndexSchema(),
}),
webDev_en: defineCollection({
type: "page",
source: "en-US/webDev.yml",
schema: defineWebDevSchema(),
}),
webDev_zh: defineCollection({
type: "page",
source: "zh-CN/webDev.yml",
schema: defineWebDevSchema(),
}),
},
});