Skip to content

Commit

Permalink
perf(studio): deactivate requiring rule for the time of developing
Browse files Browse the repository at this point in the history
  • Loading branch information
mheob committed Aug 30, 2024
1 parent a1827f3 commit d49e52d
Show file tree
Hide file tree
Showing 27 changed files with 122 additions and 114 deletions.
2 changes: 1 addition & 1 deletion apps/studio/schemas/documents/author.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const author = defineType({
description: 'Der Jobtitel bzw. Rolle oder Funktion des Autors.',
group: 'additionalInformation',
validation: rule => [
rule.required().min(5).error('Der Jobtitel muss mindestens 5 Zeichen lang sein.'),
// rule.required().min(5).error('Der Jobtitel muss mindestens 5 Zeichen lang sein.'),
rule.max(64).warning('Der Jobtitel sollte maximal 64 Zeichen lang sein.'),
],
}),
Expand Down
16 changes: 12 additions & 4 deletions apps/studio/schemas/documents/group.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RiTeamLine } from 'react-icons/ri';
import { defineField, defineType } from 'sanity';

import { getMaxLengthRule, getMinLengthRule, getRequiredRule } from '@/shared/validation-rules';
import { maxLengthRule } from '@/shared/validation-rules';

const group = defineType({
title: 'Gruppe / Mannschaft',
Expand All @@ -14,11 +14,19 @@ const group = defineType({
name: 'title',
type: 'string',
validation: rule => [
getMinLengthRule(rule, 2, 'Bitte einen Namen eingeben.'),
getMaxLengthRule(rule, 64, 'Der Name darf maximal 64 Zeichen lang sein.'),
// minLengthRule(rule, 2, 'Der Name'),
maxLengthRule(rule, 64, 'Der Name'),
],
}),

defineField({
title: 'Beschreibung',
name: 'description',
type: 'simpleBlockContent',
description: 'Eine Beschreibung der Gruppe / Mannschaft.',
// validation: rule => [requiredRule(rule, 'Die Beschreibung')],
}),

defineField({
title: 'Ist eine Sportgruppe',
name: 'isSportGroup',
Expand Down Expand Up @@ -51,7 +59,7 @@ const group = defineType({
{ title: 'Layout Spalte Zeile', value: 'RiLayoutColumnLine' },
],
},
validation: rule => [getRequiredRule(rule, '"Icon"')],
// validation: rule => [requiredRule(rule, 'Das Icon')],
}),

defineField({
Expand Down
10 changes: 5 additions & 5 deletions apps/studio/schemas/documents/person.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineField, defineType } from 'sanity';
import { additionalInformation, contact, personal } from '@/shared/field-groups';
import { emailField, phoneField } from '@/shared/fields/contact';
import { firstNameField, lastNameField, portraitPictureField } from '@/shared/fields/personal';
import { getMaxLengthRule, getMinLengthRule, getRequiredRule } from '@/shared/validation-rules';
import { maxLengthRule } from '@/shared/validation-rules';

const person = defineType({
title: 'Ansprechpartner',
Expand Down Expand Up @@ -39,7 +39,7 @@ const person = defineType({
type: 'reference',
to: [{ type: 'group' }],
description: 'Die Gruppe oder Abteilung der Person.',
validation: rule => [getRequiredRule(rule, 'Rolle oder Funktion')],
// validation: rule => [requiredRule(rule, 'Die Rolle oder Funktion')],
}),

defineField({
Expand All @@ -48,7 +48,7 @@ const person = defineType({
type: 'reference',
to: [{ type: 'role' }],
description: 'Die Rolle oder Funktion der Person (z.B. Vorstand Finanzen).',
validation: rule => [getRequiredRule(rule, 'Rolle oder Funktion')],
// validation: rule => [requiredRule(rule, 'Die Rolle oder Funktion')],
}),

defineField({
Expand All @@ -57,8 +57,8 @@ const person = defineType({
type: 'text',
description: 'Eine kurze Beschreibung der Person.',
validation: rule => [
getMinLengthRule(rule, 32, 'Die Beschreibung (Vision)'),
getMaxLengthRule(rule, 200, 'Die Beschreibung (Vision)'),
// minLengthRule(rule, 32, 'Die Beschreibung (Vision)'),
maxLengthRule(rule, 200, 'Die Beschreibung (Vision)'),
],
}),
],
Expand Down
6 changes: 3 additions & 3 deletions apps/studio/schemas/documents/role.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RiTeamLine } from 'react-icons/ri';
import { defineField, defineType } from 'sanity';

import { getMaxLengthRule, getMinLengthRule } from '@/shared/validation-rules';
import { maxLengthRule } from '@/shared/validation-rules';

const role = defineType({
title: 'Rolle / Funktion',
Expand All @@ -16,8 +16,8 @@ const role = defineType({
description:
'Die Rolle oder Funktion der Person (z.B. Vorstand Finanzen oder Übungsleiterin).',
validation: rule => [
getMinLengthRule(rule, 2, 'Bitte einen Namen eingeben.'),
getMaxLengthRule(rule, 64, 'Der Name darf maximal 64 Zeichen lang sein.'),
// minLengthRule(rule, 2, 'Der Name'),
maxLengthRule(rule, 64, 'Der Name'),
],
}),
],
Expand Down
4 changes: 2 additions & 2 deletions apps/studio/schemas/documents/testimonial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const testimonial = defineType({
description: 'Die Rolle oder Funktion des Zitierenden.',
group: 'personal',
validation: rule => [
rule.required().min(5).error('Die Rolle muss mindestens 5 Zeichen lang sein.'),
// rule.required().min(5).error('Die Rolle muss mindestens 5 Zeichen lang sein.'),
rule.max(64).warning('Die Rolle sollte maximal 64 Zeichen lang sein.'),
],
},
Expand All @@ -35,7 +35,7 @@ const testimonial = defineType({
description: 'Das Zitat über die TSG.',
group: 'quote',
validation: rule => [
rule.required().min(64).error('Das muss mindestens 64 Zeichen lang sein.'),
// rule.required().min(64).error('Das muss mindestens 64 Zeichen lang sein.'),
rule.max(256).warning('Das sollte maximal 256 Zeichen lang sein.'),
],
}),
Expand Down
39 changes: 18 additions & 21 deletions apps/studio/schemas/documents/venue.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { RiMap2Line } from 'react-icons/ri';
import { defineField, defineType } from 'sanity';

import {
getExactLengthRule,
getMaxLengthRule,
getMinLengthRule,
getRequiredRule,
} from '@/shared/validation-rules';
import { maxLengthRule } from '@/shared/validation-rules';

const venue = defineType({
title: 'Sportstätte',
Expand All @@ -19,8 +14,8 @@ const venue = defineType({
name: 'title',
type: 'string',
validation: rule => [
getMinLengthRule(rule, 2, 'Bitte einen Namen eingeben.'),
getMaxLengthRule(rule, 64, 'Der Name darf maximal 64 Zeichen lang sein.'),
// minLengthRule(rule, 3, 'Der Name'),
maxLengthRule(rule, 64, 'Der Name'),
],
}),

Expand All @@ -29,7 +24,7 @@ const venue = defineType({
name: 'description',
type: 'simpleBlockContent',
description: 'Eine kurze Beschreibung der Sportstätte.',
validation: rule => [getRequiredRule(rule, '"Beschreibung"')],
// validation: rule => [requiredRule(rule, 'Die Beschreibung')],
}),

defineField({
Expand All @@ -48,7 +43,7 @@ const venue = defineType({
{ title: 'Rasenplatz', value: 'grass' },
],
},
validation: rule => [getRequiredRule(rule, '"Art"')],
// validation: rule => [requiredRule(rule, 'Die Art')],
}),

defineField({
Expand All @@ -62,8 +57,8 @@ const venue = defineType({
name: 'name',
type: 'string',
validation: rule => [
getMinLengthRule(rule, 2, 'Bitte einen Name des Standortes eingeben.'),
getMaxLengthRule(rule, 64, 'Der Name darf maximal 64 Zeichen lang sein.'),
// minLengthRule(rule, 2, 'Der Name'),
maxLengthRule(rule, 64, 'Der Name'),
],
}),

Expand All @@ -72,8 +67,8 @@ const venue = defineType({
name: 'street',
type: 'string',
validation: rule => [
getMinLengthRule(rule, 2, 'Bitte den Straßennamen eingeben.'),
getMaxLengthRule(rule, 128, 'Die Straße darf maximal 128 Zeichen lang sein.'),
// minLengthRule(rule, 2, 'Die Straße'),
maxLengthRule(rule, 128, 'Die Straße'),
],
}),

Expand All @@ -82,27 +77,29 @@ const venue = defineType({
name: 'houseNumber',
type: 'string',
validation: rule => [
getMinLengthRule(rule, 1, 'Bitte die Hausnummer eingeben.'),
getMaxLengthRule(rule, 8, 'Die Hausnummer darf maximal 16 Zeichen lang sein.'),
// minLengthRule(rule, 1, 'Die Hausnummer'),
maxLengthRule(rule, 8, 'Die Hausnummer'),
],
}),

defineField({
title: 'Postleitzahl',
name: 'zipCode',
type: 'string',
validation: rule => [
getExactLengthRule(rule, 5, 'Die Postleitzahl muss genau 5 Zeichen lang sein.'),
],
// validation: rule => [
// exactLengthRule(rule, 5, 'Die Postleitzahl muss genau 5 Zeichen lang sein.', {
// type: 'error',
// }),
// ],
}),

defineField({
title: 'Stadt',
name: 'city',
type: 'string',
validation: rule => [
getMinLengthRule(rule, 2, 'Bitte den Stadtname eingeben.'),
getMaxLengthRule(rule, 64, 'Die Stadt darf maximal 64 Zeichen lang sein.'),
// minLengthRule(rule, 3, 'Die Stadt'),
maxLengthRule(rule, 64, 'Die Stadt'),
],
}),
],
Expand Down
6 changes: 2 additions & 4 deletions apps/studio/schemas/objects/contact-to.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { RiLinksLine } from 'react-icons/ri';
import { defineField } from 'sanity';

import { getRequiredRule } from '@/shared/validation-rules';

const contactTo = defineField({
title: 'Kontakt zu',
name: 'contactNameMail',
Expand All @@ -13,13 +11,13 @@ const contactTo = defineField({
title: 'Name',
name: 'name',
type: 'string',
validation: rule => [getRequiredRule(rule, 'Name')],
// validation: rule => [requiredRule(rule, 'Der Name')],
},
{
title: 'E-Mail',
name: 'email',
type: 'email',
validation: rule => [getRequiredRule(rule, 'E-Mail')],
// validation: rule => [requiredRule(rule, 'Die E-Mail')],
},
],
});
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/schemas/objects/extended-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const extendedImage = defineField({
name: 'alt',
type: 'string',
description: 'Beschreibe, was auf dem Bild zu sehen ist (für SEO und Barrierefreiheit).',
validation: rule => rule.required().error('Du musst den Alt-Text ausfüllen.'),
// validation: rule => rule.required().error('Du musst den Alt-Text ausfüllen.'),
},
],
options: {
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/schemas/objects/external-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const externalLink = defineField({
title: 'Title',
name: 'title',
type: 'string',
validation: rule => rule.required(),
// validation: rule => rule.required(),
},
{
title: 'URL',
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/schemas/objects/internal-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const internalLink = defineField({
title: 'Title',
name: 'title',
type: 'string',
validation: rule => rule.required(),
// validation: rule => rule.required(),
},
{
title: 'Link',
Expand Down
8 changes: 4 additions & 4 deletions apps/studio/schemas/objects/stats.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RiLinksLine } from 'react-icons/ri';
import { defineField } from 'sanity';

import { getMaxLengthRule, getMinLengthRule, getRequiredRule } from '@/shared/validation-rules';
import { maxLengthRule } from '@/shared/validation-rules';

const stats = defineField({
title: 'Statistiken',
Expand All @@ -14,15 +14,15 @@ const stats = defineField({
name: 'title',
type: 'string',
validation: rule => [
getMinLengthRule(rule, 2, 'Beschriftung'),
getMaxLengthRule(rule, 25, 'Beschriftung'),
// minLengthRule(rule, 2, 'Die Beschriftung'),
maxLengthRule(rule, 25, 'Die Beschriftung'),
],
},
{
title: 'Wert',
name: 'value',
type: 'string',
validation: rule => [getRequiredRule(rule, 'Wert')],
// validation: rule => [requiredRule(rule, 'Der Wert')],
},
],
});
Expand Down
7 changes: 3 additions & 4 deletions apps/studio/schemas/single-pages/about-us/gallery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { RiLinksLine } from 'react-icons/ri';
import { defineField } from 'sanity';

import { getDefaultPageFieldsWithGroup } from '@/shared/fields/general';
import { getExactLengthRule } from '@/shared/validation-rules';

export const galleryField = defineField({
title: 'Galerie',
Expand All @@ -19,9 +18,9 @@ export const galleryField = defineField({
type: 'array',
of: [{ type: 'extendedImage' }],
description: 'Diese gewählten Bilder werden in der gewünschten Reihenfolge angezeigt.',
validation: rule => [
getExactLengthRule(rule, 3, 'Es müssen genau 3 Bilder ausgewählt werden.'),
],
// validation: rule => [
// exactLengthRule(rule, 3, 'Es sollten genau 3 Bilder ausgewählt werden.'),
// ],
}),
],
});
3 changes: 1 addition & 2 deletions apps/studio/schemas/single-pages/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { content, general, meta } from '@/shared/field-groups';
import { contactPersonsField } from '@/shared/fields/content';
import { defaultPageFields, getHiddenSlugField } from '@/shared/fields/general';
import { metaField } from '@/shared/fields/meta';
import { getRequiredRule } from '@/shared/validation-rules';

const contactPage = defineType({
title: 'Kontakt',
Expand All @@ -32,7 +31,7 @@ const contactPage = defineType({
of: [{ type: 'contactNameMail' }],
description: 'Personen oder Bereiche, die im Kontaktformular kontaktiert werden können.',
group: 'content',
validation: rule => [getRequiredRule(rule, '"Kontakt zu"')],
// validation: rule => [requiredRule(rule, 'Das Feld "Kontakt zu")],
}),

contactPersonsField,
Expand Down
6 changes: 3 additions & 3 deletions apps/studio/schemas/single-pages/home/testimonial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { RiLinksLine } from 'react-icons/ri';
import { defineField } from 'sanity';

import { subTitleField, titleField } from '@/shared/fields/general';
import { getMaxLengthRule, getMinLengthRule } from '@/shared/validation-rules';
import { maxLengthRule } from '@/shared/validation-rules';

export const testimonialField = defineField({
title: 'Zeugnis / Referenz',
Expand All @@ -20,8 +20,8 @@ export const testimonialField = defineField({
type: 'array',
of: [{ type: 'reference', to: { type: 'testimonial' } }],
validation: rule => [
getMinLengthRule(rule, 4, '"Zeugnis / Referenz"'),
getMaxLengthRule(rule, 8, '"Zeugnis / Referenz"'),
// minLengthRule(rule, 4, 'Das Zeugnis bzw. die Referenz'),
maxLengthRule(rule, 8, 'Das Zeugnis bzw. die Referenz'),
],
}),
],
Expand Down
Loading

0 comments on commit d49e52d

Please sign in to comment.