phase 1-2 done
This commit is contained in:
25
sanity/schemas/author.ts
Normal file
25
sanity/schemas/author.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { defineField, defineType } from "sanity";
|
||||
|
||||
export const author = defineType({
|
||||
name: "author",
|
||||
title: "Author",
|
||||
type: "document",
|
||||
fields: [
|
||||
defineField({ name: "name", title: "نام", type: "string", validation: (r) => r.required() }),
|
||||
defineField({ name: "bio", title: "بیوگرافی", type: "text" }),
|
||||
defineField({ name: "image", title: "تصویر", type: "image", options: { hotspot: true } }),
|
||||
defineField({
|
||||
name: "socialLinks",
|
||||
title: "لینکهای اجتماعی",
|
||||
type: "object",
|
||||
fields: [
|
||||
defineField({ name: "github", type: "url", title: "GitHub" }),
|
||||
defineField({ name: "linkedin", type: "url", title: "LinkedIn" }),
|
||||
defineField({ name: "twitter", type: "url", title: "Twitter/X" }),
|
||||
defineField({ name: "telegram", type: "url", title: "Telegram" }),
|
||||
defineField({ name: "instagram", type: "url", title: "Instagram" }),
|
||||
],
|
||||
}),
|
||||
],
|
||||
preview: { select: { title: "name", media: "image" } },
|
||||
});
|
||||
14
sanity/schemas/category.ts
Normal file
14
sanity/schemas/category.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { defineField, defineType } from "sanity";
|
||||
|
||||
export const category = defineType({
|
||||
name: "category",
|
||||
title: "Category",
|
||||
type: "document",
|
||||
fields: [
|
||||
defineField({ name: "title", title: "عنوان", type: "string", validation: (r) => r.required() }),
|
||||
defineField({ name: "slug", title: "Slug", type: "slug", options: { source: "title" }, validation: (r) => r.required() }),
|
||||
defineField({ name: "description", title: "توضیح", type: "text" }),
|
||||
defineField({ name: "icon", title: "آیکون (emoji)", type: "string" }),
|
||||
],
|
||||
preview: { select: { title: "title", subtitle: "description" } },
|
||||
});
|
||||
9
sanity/schemas/index.ts
Normal file
9
sanity/schemas/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export { post } from "./post";
|
||||
export { project } from "./project";
|
||||
export { product } from "./product";
|
||||
export { author } from "./author";
|
||||
export { category } from "./category";
|
||||
export { tag } from "./tag";
|
||||
export { siteSettings } from "./siteSettings";
|
||||
export { timelineEvent } from "./timelineEvent";
|
||||
export { usesItem } from "./usesItem";
|
||||
56
sanity/schemas/post.ts
Normal file
56
sanity/schemas/post.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { defineField, defineType } from "sanity";
|
||||
|
||||
export const post = defineType({
|
||||
name: "post",
|
||||
title: "Post",
|
||||
type: "document",
|
||||
fields: [
|
||||
defineField({ name: "title", title: "عنوان", type: "string", validation: (r) => r.required() }),
|
||||
defineField({ name: "slug", title: "Slug", type: "slug", options: { source: "title" }, validation: (r) => r.required() }),
|
||||
defineField({
|
||||
name: "locale",
|
||||
title: "زبان",
|
||||
type: "string",
|
||||
options: { list: [{ value: "fa", title: "فارسی" }, { value: "en", title: "English" }] },
|
||||
initialValue: "fa",
|
||||
validation: (r) => r.required(),
|
||||
}),
|
||||
defineField({
|
||||
name: "category",
|
||||
title: "دستهبندی",
|
||||
type: "string",
|
||||
options: {
|
||||
list: [
|
||||
{ value: "founder-notes", title: "یادداشتهای بنیانگذار" },
|
||||
{ value: "marketing-branding", title: "بازاریابی و برندینگ" },
|
||||
{ value: "product-thinking", title: "تفکر محصول" },
|
||||
{ value: "tech-builds", title: "ساختهای فنی" },
|
||||
{ value: "business-experiments", title: "آزمایشهای کسبوکار" },
|
||||
{ value: "systems-productivity", title: "سیستمها و بهرهوری" },
|
||||
],
|
||||
},
|
||||
validation: (r) => r.required(),
|
||||
}),
|
||||
defineField({ name: "excerpt", title: "خلاصه", type: "text", rows: 3 }),
|
||||
defineField({ name: "coverImage", title: "تصویر کاور", type: "image", options: { hotspot: true }, fields: [defineField({ name: "alt", type: "string", title: "Alt text" })] }),
|
||||
defineField({ name: "body", title: "متن", type: "array", of: [{ type: "block" }, { type: "image", options: { hotspot: true } }, { type: "code" }] }),
|
||||
defineField({ name: "tags", title: "تگها", type: "array", of: [{ type: "reference", to: [{ type: "tag" }] }] }),
|
||||
defineField({ name: "author", title: "نویسنده", type: "reference", to: [{ type: "author" }] }),
|
||||
defineField({ name: "publishedAt", title: "تاریخ انتشار", type: "datetime" }),
|
||||
defineField({ name: "featured", title: "برگزیده", type: "boolean", initialValue: false }),
|
||||
defineField({
|
||||
name: "seo",
|
||||
title: "SEO",
|
||||
type: "object",
|
||||
fields: [
|
||||
defineField({ name: "title", type: "string", title: "عنوان SEO" }),
|
||||
defineField({ name: "description", type: "text", title: "توضیحات", rows: 2 }),
|
||||
defineField({ name: "ogImage", type: "image", title: "تصویر OG" }),
|
||||
],
|
||||
}),
|
||||
],
|
||||
preview: {
|
||||
select: { title: "title", subtitle: "category", media: "coverImage" },
|
||||
},
|
||||
orderings: [{ title: "تاریخ انتشار", name: "publishedAtDesc", by: [{ field: "publishedAt", direction: "desc" }] }],
|
||||
});
|
||||
29
sanity/schemas/product.ts
Normal file
29
sanity/schemas/product.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { defineField, defineType } from "sanity";
|
||||
|
||||
export const product = defineType({
|
||||
name: "product",
|
||||
title: "Product",
|
||||
type: "document",
|
||||
fields: [
|
||||
defineField({ name: "title", title: "عنوان", type: "string", validation: (r) => r.required() }),
|
||||
defineField({ name: "slug", title: "Slug", type: "slug", options: { source: "title" }, validation: (r) => r.required() }),
|
||||
defineField({ name: "locale", title: "زبان", type: "string", options: { list: [{ value: "fa", title: "فارسی" }, { value: "en", title: "English" }] }, initialValue: "fa" }),
|
||||
defineField({ name: "description", title: "توضیح", type: "text", rows: 3 }),
|
||||
defineField({ name: "price", title: "قیمت", type: "number" }),
|
||||
defineField({ name: "currency", title: "واحد پول", type: "string", options: { list: [{ value: "IRR", title: "تومان" }, { value: "USD", title: "دلار" }] }, initialValue: "IRR" }),
|
||||
defineField({ name: "coverImage", title: "تصویر", type: "image", options: { hotspot: true } }),
|
||||
defineField({ name: "purchaseUrl", title: "لینک خرید", type: "url" }),
|
||||
defineField({ name: "productType", title: "نوع محصول", type: "string", options: { list: [{ value: "digital", title: "دیجیتال" }, { value: "node-product", title: "محصول NODE" }] } }),
|
||||
defineField({ name: "featured", title: "برگزیده", type: "boolean", initialValue: false }),
|
||||
defineField({
|
||||
name: "seo",
|
||||
title: "SEO",
|
||||
type: "object",
|
||||
fields: [
|
||||
defineField({ name: "title", type: "string", title: "عنوان SEO" }),
|
||||
defineField({ name: "description", type: "text", title: "توضیحات", rows: 2 }),
|
||||
],
|
||||
}),
|
||||
],
|
||||
preview: { select: { title: "title", subtitle: "productType", media: "coverImage" } },
|
||||
});
|
||||
51
sanity/schemas/project.ts
Normal file
51
sanity/schemas/project.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { defineField, defineType } from "sanity";
|
||||
|
||||
export const project = defineType({
|
||||
name: "project",
|
||||
title: "Project",
|
||||
type: "document",
|
||||
fields: [
|
||||
defineField({ name: "title", title: "عنوان", type: "string", validation: (r) => r.required() }),
|
||||
defineField({ name: "slug", title: "Slug", type: "slug", options: { source: "title" }, validation: (r) => r.required() }),
|
||||
defineField({ name: "locale", title: "زبان", type: "string", options: { list: [{ value: "fa", title: "فارسی" }, { value: "en", title: "English" }] }, initialValue: "fa" }),
|
||||
defineField({
|
||||
name: "projectType",
|
||||
title: "نوع پروژه",
|
||||
type: "string",
|
||||
options: {
|
||||
list: [
|
||||
{ value: "product", title: "محصول" },
|
||||
{ value: "brand-system", title: "سیستم برند" },
|
||||
{ value: "open-source", title: "متنباز" },
|
||||
{ value: "creative-work", title: "اثر خلاقانه" },
|
||||
],
|
||||
},
|
||||
validation: (r) => r.required(),
|
||||
}),
|
||||
defineField({ name: "description", title: "توضیح کوتاه", type: "text", rows: 2 }),
|
||||
defineField({ name: "coverImage", title: "تصویر کاور", type: "image", options: { hotspot: true }, fields: [defineField({ name: "alt", type: "string", title: "Alt text" })] }),
|
||||
defineField({ name: "gallery", title: "گالری", type: "array", of: [{ type: "image", options: { hotspot: true }, fields: [defineField({ name: "alt", type: "string", title: "Alt text" })] }] }),
|
||||
defineField({
|
||||
name: "body",
|
||||
title: "محتوا",
|
||||
type: "array",
|
||||
of: [{ type: "block" }, { type: "image", options: { hotspot: true } }],
|
||||
}),
|
||||
defineField({ name: "techStack", title: "تکنولوژیها", type: "array", of: [{ type: "string" }] }),
|
||||
defineField({ name: "toolsUsed", title: "ابزارها", type: "array", of: [{ type: "string" }] }),
|
||||
defineField({ name: "liveUrl", title: "لینک زنده", type: "url" }),
|
||||
defineField({ name: "githubUrl", title: "GitHub", type: "url" }),
|
||||
defineField({ name: "featured", title: "برگزیده", type: "boolean", initialValue: false }),
|
||||
defineField({
|
||||
name: "seo",
|
||||
title: "SEO",
|
||||
type: "object",
|
||||
fields: [
|
||||
defineField({ name: "title", type: "string", title: "عنوان SEO" }),
|
||||
defineField({ name: "description", type: "text", title: "توضیحات", rows: 2 }),
|
||||
defineField({ name: "ogImage", type: "image", title: "تصویر OG" }),
|
||||
],
|
||||
}),
|
||||
],
|
||||
preview: { select: { title: "title", subtitle: "projectType", media: "coverImage" } },
|
||||
});
|
||||
27
sanity/schemas/siteSettings.ts
Normal file
27
sanity/schemas/siteSettings.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { defineField, defineType } from "sanity";
|
||||
|
||||
export const siteSettings = defineType({
|
||||
name: "siteSettings",
|
||||
title: "تنظیمات سایت",
|
||||
type: "document",
|
||||
fields: [
|
||||
defineField({ name: "siteTitle", title: "عنوان سایت", type: "string" }),
|
||||
defineField({ name: "description", title: "توضیح", type: "text" }),
|
||||
defineField({ name: "currentStatus", title: "وضعیت فعلی (در حال کار روی...)", type: "string" }),
|
||||
defineField({ name: "telegramChannel", title: "کانال تلگرام", type: "url" }),
|
||||
defineField({ name: "defaultOgImage", title: "تصویر OG پیشفرض", type: "image" }),
|
||||
defineField({
|
||||
name: "socialLinks",
|
||||
title: "لینکهای اجتماعی",
|
||||
type: "object",
|
||||
fields: [
|
||||
defineField({ name: "github", type: "url", title: "GitHub" }),
|
||||
defineField({ name: "linkedin", type: "url", title: "LinkedIn" }),
|
||||
defineField({ name: "twitter", type: "url", title: "Twitter/X" }),
|
||||
defineField({ name: "telegram", type: "url", title: "Telegram" }),
|
||||
defineField({ name: "instagram", type: "url", title: "Instagram" }),
|
||||
],
|
||||
}),
|
||||
],
|
||||
preview: { select: { title: "siteTitle" } },
|
||||
});
|
||||
12
sanity/schemas/tag.ts
Normal file
12
sanity/schemas/tag.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { defineField, defineType } from "sanity";
|
||||
|
||||
export const tag = defineType({
|
||||
name: "tag",
|
||||
title: "Tag",
|
||||
type: "document",
|
||||
fields: [
|
||||
defineField({ name: "title", title: "عنوان", type: "string", validation: (r) => r.required() }),
|
||||
defineField({ name: "slug", title: "Slug", type: "slug", options: { source: "title" }, validation: (r) => r.required() }),
|
||||
],
|
||||
preview: { select: { title: "title" } },
|
||||
});
|
||||
21
sanity/schemas/timelineEvent.ts
Normal file
21
sanity/schemas/timelineEvent.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { defineField, defineType } from "sanity";
|
||||
|
||||
export const timelineEvent = defineType({
|
||||
name: "timelineEvent",
|
||||
title: "Timeline Event",
|
||||
type: "document",
|
||||
fields: [
|
||||
defineField({ name: "title", title: "عنوان", type: "string", validation: (r) => r.required() }),
|
||||
defineField({ name: "date", title: "تاریخ", type: "date" }),
|
||||
defineField({ name: "description", title: "توضیح", type: "text" }),
|
||||
defineField({ name: "icon", title: "آیکون (emoji)", type: "string" }),
|
||||
defineField({
|
||||
name: "category",
|
||||
title: "دسته",
|
||||
type: "string",
|
||||
options: { list: [{ value: "career", title: "کار" }, { value: "product", title: "محصول" }, { value: "personal", title: "شخصی" }] },
|
||||
}),
|
||||
],
|
||||
orderings: [{ title: "تاریخ", name: "dateDesc", by: [{ field: "date", direction: "desc" }] }],
|
||||
preview: { select: { title: "title", subtitle: "date" } },
|
||||
});
|
||||
29
sanity/schemas/usesItem.ts
Normal file
29
sanity/schemas/usesItem.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { defineField, defineType } from "sanity";
|
||||
|
||||
export const usesItem = defineType({
|
||||
name: "usesItem",
|
||||
title: "Uses Item",
|
||||
type: "document",
|
||||
fields: [
|
||||
defineField({ name: "title", title: "عنوان", type: "string", validation: (r) => r.required() }),
|
||||
defineField({ name: "description", title: "توضیح", type: "text" }),
|
||||
defineField({
|
||||
name: "category",
|
||||
title: "دسته",
|
||||
type: "string",
|
||||
options: {
|
||||
list: [
|
||||
{ value: "development", title: "توسعه" },
|
||||
{ value: "design", title: "طراحی" },
|
||||
{ value: "marketing", title: "بازاریابی" },
|
||||
{ value: "productivity", title: "بهرهوری" },
|
||||
{ value: "hardware", title: "سختافزار" },
|
||||
],
|
||||
},
|
||||
validation: (r) => r.required(),
|
||||
}),
|
||||
defineField({ name: "url", title: "لینک", type: "url" }),
|
||||
defineField({ name: "image", title: "تصویر", type: "image" }),
|
||||
],
|
||||
preview: { select: { title: "title", subtitle: "category" } },
|
||||
});
|
||||
Reference in New Issue
Block a user