initialize sanity but studio on localhost not wokring

This commit is contained in:
2025-10-01 10:04:16 -04:00
parent f016b39e5c
commit 07f29c9bb6
53 changed files with 15704 additions and 41 deletions

View File

@@ -0,0 +1,51 @@
export default {
name: 'blockContent',
title: 'Body',
type: 'array',
of: [
{
title: 'Block',
type: 'block',
styles: [
{title: 'Normal', value: 'normal'},
{title: 'H1', value: 'h1'},
{title: 'H2', value: 'h2'},
{title: 'H3', value: 'h3'},
{title: 'H4', value: 'h4'},
{title: 'Quote', value: 'blockquote'},
],
lists: [{title: 'Bullet', value: 'bullet'}],
// Marks let you mark up inline text in the block editor.
marks: {
// Decorators usually describe a single property e.g. a typographic
// preference or highlighting by editors.
decorators: [
{title: 'Strong', value: 'strong'},
{title: 'Emphasis', value: 'em'},
],
// Annotations can be any object structure e.g. a link or a footnote.
annotations: [
{
title: 'URL',
name: 'link',
type: 'object',
fields: [
{
title: 'URL',
name: 'href',
type: 'url',
},
],
},
],
},
},
{
title: 'Image',
type: 'image'
},
{
type: 'code'
}
],
}

View File

@@ -0,0 +1,43 @@
export default {
name: 'contact',
title: 'Contact Info',
type: 'object',
fields: [
{
name: 'email',
title: 'Main Email',
type: 'string',
validation: (Rule: any) =>
Rule.regex(
/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,
{
name: 'Email',
invert: false
}
)
},
{
name: 'phone',
title: 'Main Phone Number',
type: 'string',
validation: (Rule: any) =>
Rule.regex(
/^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/,
{
name: 'Phone',
invert: false
}
)
},
{
name: 'socials',
title: 'Socials',
type: 'array',
of: [
{name: 'facebook', title: 'Facebook', type: 'url'},
{name: 'twitter', title: 'Twitter', type: 'url'},
{name: 'instagram', title: 'Instagram', type: 'url'},
]
}
],
}

View File

@@ -0,0 +1,25 @@
import { defineField, defineType } from 'sanity';
export const cta = defineType({
name: 'cta',
title: 'Call to Action',
type: 'object',
fields: [
defineField({
name: 'title',
title: 'Title',
type: 'string',
validation: Rule => Rule.max(30).error('Keep this short')
}),
defineField({
name: 'link',
title: 'Link',
type: 'reference',
to: [
{type: 'pages'},
{type: 'projects'}
],
description: 'Keep your CTA to an internal page for SEO best practices'
})
],
})

View File

@@ -0,0 +1,17 @@
import { defineField, defineType } from 'sanity';
export const launchDate = defineType({
name: 'launchDate',
title: 'Launch Date',
type: 'object',
fields: [
defineField({
name: 'launchAt',
title: 'Launch At',
type: 'datetime'
})
],
options: {
collapsed: true
}
})

View File

@@ -0,0 +1,33 @@
import { defineField, defineType } from 'sanity';
export const newsData = defineType({
name: 'newsData',
title: 'News',
type: 'object',
fields: [
defineField({
name: 'nav',
title: 'Navigation',
type: 'array',
of: [
{type: 'string'}
]
}),
defineField({
name: 'posts',
title: 'Posts',
type: 'array',
of: [
{
type: 'reference',
to: [
{type: 'newsPost'}
]
}
]
})
],
options: {
collapsed: true
}
})

View File

@@ -0,0 +1,67 @@
import { defineField, defineType } from 'sanity';
import MyPreviewComponent from '../../../../src/lib/components/MyPreviewComponent';
export const productInfo = defineType({
name: 'productInfo',
title: 'Product Info',
type: 'object',
fields: [
defineField({
name: 'title',
title: 'Title',
type: 'string'
}),
defineField({
name: 'mobileImage',
type: 'reference',
to: {
type: 'media',
components: {
preview: MyPreviewComponent
}
},
}),
defineField({
name: 'deskImage',
type: 'reference',
to: {
type: 'media',
components: {
preview: MyPreviewComponent
}
},
}),
defineField({
name: 'price',
title: 'Price',
type: 'object',
fields: [
defineField({
name: 'ogPrice',
title: 'Original Price',
type: 'number'
}),
defineField({
name: 'newPrice',
title: 'New Price',
type: 'number'
}),
]
}),
defineField({
name: 'category',
title: 'Category',
type: 'string'
// I would make this a reference if there was more products
}),
defineField({
name: 'desc',
title: 'Description',
type: 'text'
})
],
options: {
collapsed: true
}
})

View File

@@ -0,0 +1,38 @@
import { defineField, defineType } from 'sanity';
import MyPreviewComponent from '../../../../src/lib/components/MyPreviewComponent';
export const qrCode = defineType({
name: 'qrCode',
title: 'QR Code',
type: 'object',
fields: [
defineField({
name: 'image',
type: 'reference',
to: {
type: 'media',
components: {
preview: MyPreviewComponent
}
},
}),
defineField({
name: 'text',
type: 'object',
fields: [
defineField({
name: 'title',
type: 'string',
}),
defineField({
name: 'subtitle',
type: 'string',
}),
]
})
],
options: {
collapsed: true
}
})

View File

@@ -0,0 +1,52 @@
import { defineField, defineType } from 'sanity';
export const resultsSum = defineType({
name: 'resultsSum',
title: 'Results Summary',
type: 'object',
fields: [
defineField({
name: 'allResults',
title: 'Results',
type: 'object',
fields: [
defineField({
name: 'resultArr',
type: 'array',
of: [
{
type: 'scores'
}
]
})
]
}),
defineField({
name: 'reaction',
title: 'Reaction',
type: 'number',
validation: Rule => Rule.max(100)
}),
defineField({
name: 'memory',
title: 'Memory',
type: 'number',
validation: Rule => Rule.max(100)
}),
defineField({
name: 'verbal',
title: 'Verbal',
type: 'number',
validation: Rule => Rule.max(100)
}),
defineField({
name: 'visual',
title: 'Visual',
type: 'number',
validation: Rule => Rule.max(100)
}),
],
options: {
collapsed: true
}
})

View File

@@ -0,0 +1,29 @@
import { defineField, defineType } from 'sanity';
export const scores = defineType({
name: 'scores',
title: 'Scores',
type: 'object',
fields: [
defineField({
name: 'title',
title: 'Title',
type: 'string'
}),
defineField({
name: 'score',
title: 'Score',
type: 'number',
validation: Rule => Rule.max(100)
})
],
options: {
columns: 2
},
preview: {
select: {
title: 'score',
subtitle: 'title'
}
}
})

View File

@@ -0,0 +1,30 @@
import { defineField, defineType } from "sanity";
export const seo = defineType({
name: 'seo',
title: 'SEO',
type: 'object',
fields: [
defineField({
name: 'title',
title: 'Meta Title',
type: 'string'
}),
defineField({
name: 'description',
title: 'Meta Description',
type: 'text'
}),
defineField({
name: 'keywords',
title: 'Keywords',
type: 'array',
of: [{type: 'string'}]
}),
defineField({
name: 'image',
title: 'Preview Image',
type: 'image'
})
]
})

View File

@@ -0,0 +1,28 @@
import { defineField, defineType } from 'sanity';
export const stats = defineType({
name: 'stats',
title: 'Statistics',
type: 'object',
fields: [
defineField({
name: 'number',
title: 'Number',
type: 'number'
}),
defineField({
name: 'title',
title: 'Title',
type: 'string'
}),
],
options: {
columns: 2
},
preview: {
select: {
title: 'number',
subtitle: 'title'
}
}
})