mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Make sure studio is running for build
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {ListItemBuilder} from 'sanity/desk'
|
||||
import defineStructure from '../utils/defineStructure'
|
||||
import defineStructure from '../utils/define-structure'
|
||||
|
||||
export default defineStructure<ListItemBuilder>((S) =>
|
||||
S.listItem()
|
@@ -1,9 +1,9 @@
|
||||
import {ListItemBuilder} from 'sanity/desk'
|
||||
import defineStructure from '../utils/defineStructure'
|
||||
import defineStructure from '../utils/define-structure'
|
||||
import Iframe from 'sanity-plugin-iframe-pane'
|
||||
import {SanityDocument} from 'sanity'
|
||||
import {EyeOpenIcon, MasterDetailIcon} from '@sanity/icons'
|
||||
import getPreviewUrl from '../utils/getPreviewUrl'
|
||||
import getPreviewUrl from '../utils/get-preview-url'
|
||||
|
||||
export default defineStructure<ListItemBuilder>((S) =>
|
||||
S.listItem()
|
@@ -1,9 +1,9 @@
|
||||
import {ListItemBuilder} from 'sanity/desk'
|
||||
import defineStructure from '../utils/defineStructure'
|
||||
import defineStructure from '../utils/define-structure'
|
||||
import Iframe from 'sanity-plugin-iframe-pane'
|
||||
import {SanityDocument} from 'sanity'
|
||||
import {EyeOpenIcon, MasterDetailIcon} from '@sanity/icons'
|
||||
import getPreviewUrl from '../utils/getPreviewUrl'
|
||||
import getPreviewUrl from '../utils/get-preview-url'
|
||||
|
||||
export default defineStructure<ListItemBuilder>((S) =>
|
||||
S.listItem()
|
@@ -2,15 +2,15 @@
|
||||
* Desk structure overrides
|
||||
*/
|
||||
import {ListItemBuilder, StructureResolver} from 'sanity/desk'
|
||||
import categories from './categoryStructure'
|
||||
import home from './homeStructure'
|
||||
import pages from './pageStructure'
|
||||
import products from './productStructure'
|
||||
import settings from './settingStructure'
|
||||
import blurbs from './blurbStructure'
|
||||
import sections from './sectionStructure'
|
||||
import usps from './uspStructure'
|
||||
import navigation from './navigationStructure'
|
||||
import categories from './category-structure'
|
||||
import home from './home-structure'
|
||||
import pages from './page-structure'
|
||||
import products from './product-structure'
|
||||
import settings from './settings-structure'
|
||||
import blurbs from './blurb-structure'
|
||||
import sections from './section-structure'
|
||||
import usps from './usp-structure'
|
||||
import navigation from './navigation-structure'
|
||||
|
||||
/**
|
||||
* Desk structure overrides
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import {ListItemBuilder} from 'sanity/desk'
|
||||
import defineStructure from '../utils/defineStructure'
|
||||
import defineStructure from '../utils/define-structure'
|
||||
import {MenuIcon} from '@sanity/icons'
|
||||
|
||||
export default defineStructure<ListItemBuilder>((S) =>
|
@@ -1,10 +1,10 @@
|
||||
import {ListItemBuilder} from 'sanity/desk'
|
||||
import defineStructure from '../utils/defineStructure'
|
||||
import {ListItemBuilder} from 'sanity/desk'
|
||||
import defineStructure from '../utils/define-structure'
|
||||
import {DocumentsIcon} from '@sanity/icons'
|
||||
import Iframe from 'sanity-plugin-iframe-pane'
|
||||
import {SanityDocument} from 'sanity'
|
||||
import {EyeOpenIcon, MasterDetailIcon} from '@sanity/icons'
|
||||
import getPreviewUrl from '../utils/getPreviewUrl'
|
||||
import getPreviewUrl from '../utils/get-preview-url'
|
||||
|
||||
export default defineStructure<ListItemBuilder>((S) =>
|
||||
S.listItem()
|
@@ -1,9 +1,9 @@
|
||||
import {ListItemBuilder} from 'sanity/desk'
|
||||
import defineStructure from '../utils/defineStructure'
|
||||
import defineStructure from '../utils/define-structure'
|
||||
import Iframe from 'sanity-plugin-iframe-pane'
|
||||
import {SanityDocument} from 'sanity'
|
||||
import {EyeOpenIcon, MasterDetailIcon} from '@sanity/icons'
|
||||
import getPreviewUrl from '../utils/getPreviewUrl'
|
||||
import getPreviewUrl from '../utils/get-preview-url'
|
||||
|
||||
export default defineStructure<ListItemBuilder>((S) =>
|
||||
S.listItem()
|
@@ -1,5 +1,5 @@
|
||||
import {ListItemBuilder} from 'sanity/desk'
|
||||
import defineStructure from '../utils/defineStructure'
|
||||
import defineStructure from '../utils/define-structure'
|
||||
|
||||
export default defineStructure<ListItemBuilder>((S) =>
|
||||
S.listItem()
|
@@ -1,5 +1,5 @@
|
||||
import {ListItemBuilder} from 'sanity/desk'
|
||||
import defineStructure from '../utils/defineStructure'
|
||||
import defineStructure from '../utils/define-structure'
|
||||
|
||||
export default defineStructure<ListItemBuilder>((S) =>
|
||||
S.listItem()
|
@@ -1,5 +1,5 @@
|
||||
import {ListItemBuilder} from 'sanity/desk'
|
||||
import defineStructure from '../utils/defineStructure'
|
||||
import defineStructure from '../utils/define-structure'
|
||||
|
||||
export default defineStructure<ListItemBuilder>((S) =>
|
||||
S.listItem()
|
@@ -1,19 +1,19 @@
|
||||
import {PackageIcon} from '@sanity/icons'
|
||||
import {defineField, defineType} from 'sanity'
|
||||
import {slugWithLocalizedType} from './slugWithLocalizedType'
|
||||
import {languages} from '../../languages'
|
||||
import {validateImage} from '../../utils/validation'
|
||||
import { PackageIcon } from '@sanity/icons';
|
||||
import { defineField, defineType } from 'sanity';
|
||||
import { slugWithLocalizedType } from './slugWithLocalizedType';
|
||||
import { languages } from '../../languages';
|
||||
import { validateImage } from '../../utils/validation';
|
||||
|
||||
const GROUPS = [
|
||||
{
|
||||
name: 'editorial',
|
||||
title: 'Editorial',
|
||||
title: 'Editorial'
|
||||
},
|
||||
{
|
||||
name: 'seo',
|
||||
title: 'SEO',
|
||||
},
|
||||
]
|
||||
title: 'SEO'
|
||||
}
|
||||
];
|
||||
|
||||
export default defineType({
|
||||
name: 'product',
|
||||
@@ -27,7 +27,7 @@ export default defineType({
|
||||
name: 'language',
|
||||
type: 'string',
|
||||
readOnly: true,
|
||||
description: 'Language of this document.',
|
||||
description: 'Language of this document.'
|
||||
// hidden: true,
|
||||
}),
|
||||
// ID
|
||||
@@ -35,7 +35,7 @@ export default defineType({
|
||||
name: 'id',
|
||||
title: 'ID',
|
||||
type: 'number',
|
||||
description: 'Unique product ID.',
|
||||
description: 'Unique product ID.'
|
||||
}),
|
||||
// Title
|
||||
defineField({
|
||||
@@ -43,7 +43,7 @@ export default defineType({
|
||||
title: 'Title',
|
||||
type: 'string',
|
||||
description: 'Product title/name.',
|
||||
validation: (Rule) => Rule.required(),
|
||||
validation: (Rule) => Rule.required()
|
||||
}),
|
||||
// Slug
|
||||
slugWithLocalizedType('product', 'title'),
|
||||
@@ -56,16 +56,16 @@ export default defineType({
|
||||
{
|
||||
title: 'Image',
|
||||
type: 'mainImage',
|
||||
validation: (Rule) => validateImage(Rule, true),
|
||||
},
|
||||
validation: (Rule) => validateImage(Rule, true)
|
||||
}
|
||||
],
|
||||
validation: (Rule) => Rule.required().min(1).max(5),
|
||||
validation: (Rule) => Rule.required().min(1).max(5)
|
||||
}),
|
||||
defineField({
|
||||
name: 'description',
|
||||
title: 'Description',
|
||||
type: 'text',
|
||||
description: 'Product description.',
|
||||
description: 'Product description.'
|
||||
}),
|
||||
defineField({
|
||||
name: 'price',
|
||||
@@ -77,7 +77,7 @@ export default defineType({
|
||||
name: 'value',
|
||||
title: 'Value',
|
||||
type: 'number',
|
||||
description: 'Product price.',
|
||||
description: 'Product price.'
|
||||
}),
|
||||
defineField({
|
||||
name: 'currencyCode',
|
||||
@@ -86,82 +86,75 @@ export default defineType({
|
||||
description: 'Product currency code.',
|
||||
options: {
|
||||
list: [
|
||||
{title: 'SEK', value: 'SEK'},
|
||||
{title: 'GBP', value: 'GBP'},
|
||||
{title: 'EUR', value: 'EUR'},
|
||||
{ title: 'SEK', value: 'SEK' },
|
||||
{ title: 'GBP', value: 'GBP' },
|
||||
{ title: 'EUR', value: 'EUR' }
|
||||
],
|
||||
layout: 'radio',
|
||||
layout: 'radio'
|
||||
},
|
||||
initialValue: 'SEK',
|
||||
initialValue: 'SEK'
|
||||
}),
|
||||
defineField({
|
||||
name: 'retailPrice',
|
||||
title: 'Retail price',
|
||||
type: 'number',
|
||||
description: 'Product retail price.',
|
||||
}),
|
||||
],
|
||||
}),
|
||||
defineField({
|
||||
name: 'options',
|
||||
title: 'Product options',
|
||||
type: 'array',
|
||||
description: 'What product options are available?',
|
||||
of: [{type: 'productOptions'}],
|
||||
description: 'Product retail price.'
|
||||
})
|
||||
]
|
||||
}),
|
||||
defineField({
|
||||
name: 'categories',
|
||||
title: 'Categories',
|
||||
type: 'array',
|
||||
description: 'What category/categories does this product belong to?',
|
||||
of: [{type: 'reference', to: {type: 'category'}}],
|
||||
of: [{ type: 'reference', to: { type: 'category' } }]
|
||||
}),
|
||||
defineField({
|
||||
name: 'seo',
|
||||
title: 'SEO',
|
||||
type: 'seo',
|
||||
group: 'seo',
|
||||
}),
|
||||
group: 'seo'
|
||||
})
|
||||
],
|
||||
orderings: [
|
||||
{
|
||||
name: 'titleAsc',
|
||||
title: 'Title (A-Z)',
|
||||
by: [{field: 'title', direction: 'asc'}],
|
||||
by: [{ field: 'title', direction: 'asc' }]
|
||||
},
|
||||
{
|
||||
name: 'titleDesc',
|
||||
title: 'Title (Z-A)',
|
||||
by: [{field: 'title', direction: 'desc'}],
|
||||
by: [{ field: 'title', direction: 'desc' }]
|
||||
},
|
||||
{
|
||||
name: 'priceDesc',
|
||||
title: 'Price (Highest first)',
|
||||
by: [{field: 'price', direction: 'desc'}],
|
||||
by: [{ field: 'price', direction: 'desc' }]
|
||||
},
|
||||
{
|
||||
name: 'priceAsc',
|
||||
title: 'Title (Lowest first)',
|
||||
by: [{field: 'price', direction: 'asc'}],
|
||||
},
|
||||
by: [{ field: 'price', direction: 'asc' }]
|
||||
}
|
||||
],
|
||||
preview: {
|
||||
select: {
|
||||
images: 'images',
|
||||
title: 'title',
|
||||
language: 'language',
|
||||
language: 'language'
|
||||
},
|
||||
prepare(selection) {
|
||||
const {images, title, language} = selection
|
||||
const currentLang = languages.find((lang) => lang.id === language)
|
||||
const { images, title, language } = selection;
|
||||
const currentLang = languages.find((lang) => lang.id === language);
|
||||
|
||||
const firstImage = images[0]
|
||||
const firstImage = images[0];
|
||||
|
||||
return {
|
||||
title,
|
||||
subtitle: `${currentLang ? currentLang.title : ''}`,
|
||||
media: firstImage ? firstImage : PackageIcon,
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
media: firstImage ? firstImage : PackageIcon
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -50,13 +50,9 @@ import banner from './objects/banner'
|
||||
import linkExternal from './objects/linkExternal'
|
||||
import linkInternal from './objects/linkInternal'
|
||||
import hero from './objects/hero'
|
||||
import placeholderString from './objects/placeholderString'
|
||||
import proxyString from './objects/proxyString'
|
||||
import seo from './objects/seo'
|
||||
import mainImage from './objects/mainImage'
|
||||
import slider from './objects/slider'
|
||||
import productOption from './objects/productOption'
|
||||
import productOptions from './objects/productOptions'
|
||||
import blurbSection from './objects/blurbSection'
|
||||
import filteredProductList from './objects/filteredProductList'
|
||||
import uspSection from './objects/uspSection'
|
||||
@@ -67,13 +63,9 @@ const objects = [
|
||||
linkExternal,
|
||||
linkInternal,
|
||||
hero,
|
||||
placeholderString,
|
||||
proxyString,
|
||||
seo,
|
||||
mainImage,
|
||||
slider,
|
||||
productOption,
|
||||
productOptions,
|
||||
filteredProductList,
|
||||
banner,
|
||||
blurbSection,
|
||||
|
@@ -1,25 +0,0 @@
|
||||
import {defineField} from 'sanity'
|
||||
|
||||
export default defineField({
|
||||
name: 'productOption',
|
||||
title: 'Product option',
|
||||
type: 'object',
|
||||
fields: [
|
||||
defineField({
|
||||
name: 'label',
|
||||
title: 'Label',
|
||||
type: 'string',
|
||||
validation: Rule => Rule.required(),
|
||||
description: 'Product option label.'
|
||||
}),
|
||||
defineField({
|
||||
name: 'hexColors',
|
||||
title: 'Color hex code',
|
||||
type: 'color',
|
||||
description: 'Hex color code for product option.',
|
||||
options: {
|
||||
disableAlpha: true
|
||||
}
|
||||
})
|
||||
],
|
||||
})
|
@@ -1,32 +0,0 @@
|
||||
import {defineField} from 'sanity'
|
||||
|
||||
export default defineField({
|
||||
name: 'productOptions',
|
||||
title: 'Product options',
|
||||
type: 'object',
|
||||
fields: [
|
||||
defineField({
|
||||
name: 'id',
|
||||
title: 'ID (string)',
|
||||
type: 'string',
|
||||
validation: Rule => Rule.required(),
|
||||
description: 'Unique product option ID.'
|
||||
}),
|
||||
defineField({
|
||||
name: 'displayName',
|
||||
title: 'Display name',
|
||||
type: 'string',
|
||||
description: 'Name displayed for this collection of product options.',
|
||||
validation: Rule => Rule.required(),
|
||||
}),
|
||||
defineField({
|
||||
name: 'values',
|
||||
title: 'Values',
|
||||
type: 'array',
|
||||
description: 'What kind of values are available?',
|
||||
of: [{type: 'productOption'}],
|
||||
options: {},
|
||||
validation: Rule => Rule.required(),
|
||||
}),
|
||||
],
|
||||
})
|
@@ -1,3 +1,4 @@
|
||||
// @ts-nocheck
|
||||
import {isDev, SanityDocument} from 'sanity'
|
||||
import { localStorefrontPreviewUrl, publicStorefrontPreviewUrl } from '../constants'
|
||||
|
Reference in New Issue
Block a user