Skip to content

Commit 0e7ea53

Browse files
committed
🎨 fix old promotion type
1 parent bf8fa99 commit 0e7ea53

5 files changed

Lines changed: 16 additions & 6 deletions

File tree

studio/schemas/objects/promoteV2/promoteExternalLinkV2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export type promoteExternal = {
1010
}
1111

1212
export default {
13-
title: 'Promote external links (v2)',
13+
title: 'Promotion v2 external links (deprecated, use promotions v2)',
1414
name: 'promoteExternalLinkV2',
1515
type: 'object',
1616
fieldsets: [

studio/schemas/objects/promoteV2/promoteTopicsV2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export type promoteTopics = {
9898
}
9999

100100
export default {
101-
title: 'Promote topics (v2)',
101+
title: 'Promotion v2 topics (deprecated, use promotions v2)',
102102
name: 'promoteTopicsV2',
103103
type: 'object',
104104
fieldsets: [

studio/schemas/objects/promoteV2/promotionV2.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export default {
152152
type: 'string',
153153
validation: (Rule: Rule) =>
154154
Rule.custom((value: string, ctx: ValidationContext) => {
155+
//@ts-ignore: todo
155156
if (ctx.parent?.link?.[0]?._type === 'link') {
156157
return value ? true : 'You must add a label'
157158
}
@@ -162,7 +163,7 @@ export default {
162163
name: 'image',
163164
title: 'Image',
164165
type: 'imageWithAlt',
165-
hidden: ({ parent }: DocumentType) => {
166+
hidden: ({ parent }: any) => {
166167
return (
167168
parent?.link?.[0]?._type !== 'link' &&
168169
parent?.link?.[0]?._type !== 'anchorLinkReference'
@@ -171,7 +172,9 @@ export default {
171172
validation: (Rule: Rule) =>
172173
Rule.custom((value: string, ctx: ValidationContext) => {
173174
if (
175+
//@ts-ignore: todo
174176
ctx.parent?.link?.[0]?._type === 'link' ||
177+
//@ts-ignore: todo
175178
ctx.parent?.link?.[0]?._type === 'anchorLinkReference'
176179
) {
177180
return value ? true : 'You must add an image'

web/sanity/queries/common/pageContentFields.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ _type == "keyNumbers" =>{
272272
"label": viewAllLinkLabel,
273273
...links::getLinkFields(viewAllLink),
274274
},
275-
"content": promotion[0]{
275+
promotion[0]{
276276
"id": _key,
277277
"type": _type,
278278
_type == "promoteNews" => {

web/templates/shared/SharedPageContent.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,15 +389,22 @@ export const PageContent = ({ data, heroBackground }: PageContentProps) => {
389389
className={spacingClassName}
390390
/>
391391
)
392-
case 'promotion':
392+
case 'promotion': {
393+
const { promotion, ...restPromo } = c
393394
return (
394395
<PromotionsBlock
395396
key={c.id}
396-
data={c as PromotionsBlockData}
397+
data={
398+
{
399+
...promotion,
400+
...restPromo,
401+
} as PromotionsBlockData
402+
}
397403
anchor={anchorReference}
398404
className={spacingClassName}
399405
/>
400406
)
407+
}
401408
case 'promoteEvents':
402409
return (
403410
<PromotionsBlock

0 commit comments

Comments
 (0)