[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
fix: adjust graphql updates
Browse files Browse the repository at this point in the history
  • Loading branch information
thebiggianthead committed Jun 2, 2023
1 parent 5607405 commit 03e7756
Show file tree
Hide file tree
Showing 35 changed files with 356 additions and 382 deletions.
2 changes: 1 addition & 1 deletion components/inputs/PlaceholderString.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const PlaceholderStringInput = (props: Props) => {

return props.renderDefault({
...props,
elementProps: {placeholder: proxyValue, ...props.elementProps},
elementProps: {...props.elementProps, placeholder: proxyValue},
})
}

Expand Down
496 changes: 240 additions & 256 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"sanity": "^3.9.1",
"sanity": "^3.11.5",
"sanity-plugin-hotspot-array": "^1.0.1",
"sanity-plugin-media": "^2.0.5",
"slug": "^8.2.2",
Expand Down
56 changes: 28 additions & 28 deletions schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ import productVariant from './documents/productVariant'
const documents = [collection, colorTheme, page, product, productVariant]

// Singleton document types
import footer from './singletons/footer'
import home from './singletons/home'
import links from './singletons/links'
import menu from './singletons/menu'
import seo from './singletons/seo'
import settings from './singletons/settings'

const singletons = [footer, home, links, menu, seo, settings]
const singletons = [home, settings]

// Block content
import body from './blocks/body'
Expand All @@ -37,16 +33,16 @@ const blocks = [body]

// Object types
import customProductOptionColor from './objects/customProductOption/color'
import customProductOptionHeight from './objects/customProductOption/height'
import customProductOptionColorObject from './objects/customProductOption/colorObject'
import customProductOptionSize from './objects/customProductOption/size'
import customProductOptionSizeObject from './objects/customProductOption/sizeObject'
import customProductOptionTitle from './objects/customProductOption/title'
import customProductOptionWidth from './objects/customProductOption/width'
import imageWithProductHotspots from './objects/imageWithProductHotspots'
import inventory from './objects/inventory'
import linkExternal from './objects/linkExternal'
import linkInternal from './objects/linkInternal'
import notFoundPage from './objects/notFoundPage'
import footer from './objects/global/footer'
import imageWithProductHotspots from './objects/hotspot/imageWithProductHotspots'
import inventory from './objects/shopify/inventory'
import linkExternal from './objects/global/linkExternal'
import linkInternal from './objects/global/linkInternal'
import links from './objects/global/links'
import notFoundPage from './objects/global/notFoundPage'
import heroCollection from './objects/hero/collection'
import heroHome from './objects/hero/home'
import heroPage from './objects/hero/page'
Expand All @@ -59,41 +55,43 @@ import moduleCallToAction from './objects/module/callToAction'
import moduleCollection from './objects/module/collection'
import moduleGrid from './objects/module/grid'
import gridItems from './objects/module/gridItems'
import menu from './objects/global/menu'
import moduleImage from './objects/module/image'
import moduleImageAction from './objects/module/imageCallToAction'
import moduleImages from './objects/module/images'
import moduleInstagram from './objects/module/instagram'
import moduleProduct from './objects/module/product'
import moduleProducts from './objects/module/products'
import placeholderString from './objects/placeholderString'
import priceRange from './objects/priceRange'
import spot from './objects/spot'
import productHotspots from './objects/productHotspots'
import productOption from './objects/productOption'
import productWithVariant from './objects/productWithVariant'
import proxyString from './objects/proxyString'
import placeholderString from './objects/shopify/placeholderString'
import priceRange from './objects/shopify/priceRange'
import spot from './objects/hotspot/spot'
import productHotspots from './objects/hotspot/productHotspots'
import option from './objects/shopify/option'
import productWithVariant from './objects/shopify/productWithVariant'
import proxyString from './objects/shopify/proxyString'
import seo from './objects/seo/seo'
import seoHome from './objects/seo/home'
import seoPage from './objects/seo/page'
import seoDescription from './objects/seo/description'
import seoShopify from './objects/seo/shopify'
import shopifyCollection from './objects/shopifyCollection'
import shopifyCollectionRule from './objects/shopifyCollectionRule'
import shopifyProduct from './objects/shopifyProduct'
import shopifyProductVariant from './objects/shopifyProductVariant'
import shopifyCollection from './objects/shopify/shopifyCollection'
import shopifyCollectionRule from './objects/shopify/shopifyCollectionRule'
import shopifyProduct from './objects/shopify/shopifyProduct'
import shopifyProductVariant from './objects/shopify/shopifyProductVariant'

// Collections
import collectionGroup from './objects/collection/group'
import collectionLinks from './objects/collection/links'

const objects = [
customProductOptionColor,
customProductOptionHeight,
customProductOptionColorObject,
customProductOptionSize,
customProductOptionSizeObject,
customProductOptionTitle,
customProductOptionWidth,
footer,
imageWithProductHotspots,
inventory,
links,
linkExternal,
linkInternal,
notFoundPage,
Expand All @@ -104,6 +102,7 @@ const objects = [
accordionBody,
accordionGroup,
accordionObject,
menu,
moduleCallout,
moduleCallToAction,
moduleCollection,
Expand All @@ -119,9 +118,10 @@ const objects = [
priceRange,
spot,
productHotspots,
productOption,
option,
productWithVariant,
proxyString,
seo,
seoHome,
seoPage,
seoDescription,
Expand Down
49 changes: 1 addition & 48 deletions schemas/objects/customProductOption/color.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
import React from 'react'
import pluralize from 'pluralize-esm'
import {defineField} from 'sanity'

interface ColorOption {
title: string
}

const ColorPreview = ({color}: {color: string}) => {
return (
<div
style={{
backgroundColor: color,
borderRadius: 'inherit',
display: 'flex',
height: '100%',
width: '100%',
}}
/>
)
}

export default defineField({
name: 'customProductOption.color',
title: 'Color',
Expand All @@ -41,39 +26,7 @@ export default defineField({
type: 'array',
of: [
{
name: 'color',
title: 'Color',
type: 'object',
fields: [
defineField({
name: 'title',
title: 'Title',
type: 'string',
description: 'Shopify product option value (case sensitive)',
validation: (Rule) => Rule.required(),
}),
defineField({
name: 'color',
title: 'Color',
type: 'color',
options: {disableAlpha: true},
validation: (Rule) => Rule.required(),
}),
],
preview: {
select: {
color: 'color.hex',
title: 'title',
},
prepare(selection) {
const {color, title} = selection
return {
media: <ColorPreview color={color} />,
subtitle: color,
title,
}
},
},
type: 'customProductOption.colorObject',
},
],
validation: (Rule) =>
Expand Down
52 changes: 52 additions & 0 deletions schemas/objects/customProductOption/colorObject.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react'
import {defineField} from 'sanity'

const ColorPreview = ({color}: {color: string}) => {
return (
<div
style={{
backgroundColor: color,
borderRadius: 'inherit',
display: 'flex',
height: '100%',
width: '100%',
}}
/>
)
}

export default defineField({
name: 'customProductOption.colorObject',
title: 'Color',
type: 'object',
fields: [
defineField({
name: 'title',
title: 'Title',
type: 'string',
description: 'Shopify product option value (case sensitive)',
validation: (Rule) => Rule.required(),
}),
defineField({
name: 'color',
title: 'Color',
type: 'color',
options: {disableAlpha: true},
validation: (Rule) => Rule.required(),
}),
],
preview: {
select: {
color: 'color.hex',
title: 'title',
},
prepare(selection) {
const {color, title} = selection
return {
media: <ColorPreview color={color} />,
subtitle: color,
title,
}
},
},
})
9 changes: 0 additions & 9 deletions schemas/objects/customProductOption/height.ts

This file was deleted.

12 changes: 9 additions & 3 deletions schemas/objects/customProductOption/sizeObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ export default defineField({
defineField({
name: 'title',
title: 'Title',
type: 'customProductOption.title',
type: 'string',
description: 'Shopify product option value (case sensitive)',
validation: (Rule) => Rule.required(),
}),
defineField({
name: 'width',
title: 'Width',
type: 'customProductOption.width',
type: 'number',
description: 'In mm',
validation: (Rule) => Rule.required().precision(2),
}),
defineField({
name: 'height',
title: 'Height',
type: 'customProductOption.height',
type: 'number',
description: 'In mm',
validation: (Rule) => Rule.required().precision(2),
}),
],
preview: {
Expand Down
9 changes: 0 additions & 9 deletions schemas/objects/customProductOption/title.ts

This file was deleted.

9 changes: 0 additions & 9 deletions schemas/objects/customProductOption/width.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default defineField({
name: 'footerSettings',
title: 'Footer',
type: 'object',
group: 'navigation',
options: {
collapsed: false,
collapsible: true,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {LinkIcon} from '@sanity/icons'
import {defineField} from 'sanity'

import {PAGE_REFERENCES} from '../../constants'
import {getPriceRange} from '../../utils/getPriceRange'
import {PAGE_REFERENCES} from '../../../constants'
import {getPriceRange} from '../../../utils/getPriceRange'

export default defineField({
title: 'Internal Link',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default defineField({
name: 'menuSettings',
title: 'Menu',
type: 'object',
group: 'navigation',
options: {
collapsed: false,
collapsible: true,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {defineField} from 'sanity'

import ProductTooltip from '../../components/hotspots/ProductTooltip'
import ProductTooltip from '../../../components/hotspots/ProductTooltip'

export default defineField({
name: 'productHotspots',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react'
import {defineField} from 'sanity'

import ShopifyDocumentStatus from '../../components/media/ShopifyDocumentStatus'
import ShopifyDocumentStatus from '../../../components/media/ShopifyDocumentStatus'

export default defineField({
name: 'spot',
title: 'Spot',
type: 'object',
fieldsets: [{name: 'position', options: {columns: 2}}],
fields: [
Expand Down
10 changes: 7 additions & 3 deletions schemas/objects/module/accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,23 @@ export default defineField({
defineField({
name: 'groups',
title: 'Groups',
type: 'accordionBody',
type: 'array',
of: [
{
type: 'accordionObject',
},
],
}),
],
preview: {
select: {
groups: 'groups',
url: 'url',
},
prepare(selection) {
const {groups} = selection
return {
subtitle: 'Accordion',
title: groups.length > 0 ? pluralize('group', groups.length, true) : 'No groups',
title: groups?.length > 0 ? pluralize('group', groups.length, true) : 'No groups',
}
},
},
Expand Down
1 change: 1 addition & 0 deletions schemas/objects/module/accordionObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import blocksToText from '../../../utils/blocksToText'

export default defineField({
name: 'accordionObject',
title: 'Object',
type: 'object',
icon: false,
fields: [
Expand Down
Loading

0 comments on commit 03e7756

Please sign in to comment.