Skip to content

Commit

Permalink
fix: new regex for short & long de description (#993)
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanGerada3 authored Aug 26, 2024
1 parent 50de06b commit da427fc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
12 changes: 4 additions & 8 deletions src/components/shared/basic/ReleaseProcess/OfferCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,9 @@ export default function OfferCard() {
? getValues().shortDescriptionEN.length
: getValues().shortDescriptionDE.length) + '/120'
}
patternKey="shortDescriptionEN"
patternEN={Patterns.offerCard.shortDescriptionEN}
patternDE={Patterns.offerCard.shortDescriptionDE}
patternKey="shortDescription"
patternEN={Patterns.offerCard.shortDescription}
patternDE={Patterns.offerCard.shortDescription}
isRequired={true}
rules={{
required:
Expand All @@ -471,11 +471,7 @@ export default function OfferCard() {
)}`,
pattern: `${t(
'serviceReleaseForm.validCharactersIncludes'
)} ${
desc === 'shortDescriptionEN'
? 'a-zA-Z0-9 !?@&#\'"()_-=/*.,;:'
: 'a-zA-ZÀ-ÿ0-9 !?@&#\'"()_-=/*.,;:'
}`,
)} ${'a-zA-ZÀ-ÿ0-9 !?@&#\'"()_-=/*.,;:'}`,
maxLength: `${t('serviceReleaseForm.maximum')} 120 ${t(
'serviceReleaseForm.charactersAllowed'
)}`,
Expand Down
10 changes: 3 additions & 7 deletions src/components/shared/basic/ReleaseProcess/OfferPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ export default function OfferPage({
`/${longDescriptionMaxLength}`
}
patternKey="longDescriptionEN"
patternEN={Patterns.offerPage.longDescriptionEN}
patternDE={Patterns.offerPage.longDescriptionDE}
patternEN={Patterns.offerPage.longDescription}
patternDE={Patterns.offerPage.longDescription}
rules={{
maxLength: `${t(
'serviceReleaseForm.maximum'
Expand All @@ -317,11 +317,7 @@ export default function OfferPage({
)}`,
pattern: `${t(
'serviceReleaseForm.validCharactersIncludes'
)} ${
longDesc === 'longDescriptionEN'
? 'a-zA-Z0-9 !?@&#\'"()[]_-+=<>/*.,;:'
: 'a-zA-ZÀ-ÿ0-9 !?@&#\'"()[]_-+=<>/*.,;:'
}`,
)} ${'a-zA-ZÀ-ÿ0-9 !?@&#\'"()[]_-+=<>/*.,;:'}`,
}}
maxLength={longDescriptionMaxLength}
/>
Expand Down
8 changes: 2 additions & 6 deletions src/types/Patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,10 @@ export const Patterns = {
offerCard: {
serviceName: /^[^-\s()'"#@.&](?!.*[%&?,';:!\s-]{2}).{2,200}$/,
serviceType: /^([A-Za-z])$/,
shortDescriptionEN: /^[^-\s()'"#@.&](?!.*[%&?,';:!\s-]{2}).{10,120}$/,
shortDescriptionDE: /^[^-\s()'"#@.&](?!.*[%&?,';:!\s-]{2}).{10,120}$/,
shortDescription: /^.{10,120}$/,
},
offerPage: {
longDescriptionEN:
/^[^ @=<>*\-+#?%&_:;]([a-zA-Z0-9 !?@&#'"()[\]_\-+=<>/*.,;:%\r\n]){9,1999}$/,
longDescriptionDE:
/^[^ @=<>*\-+#?%&_:;]([a-zA-Z0-9 !?@&#'"()[\]_\-+=<>/*.,;:%\r\n]){9,1999}$/,
longDescription: /^.{9,1999}$/,
},
appPage: {
longDescriptionEN:
Expand Down

0 comments on commit da427fc

Please sign in to comment.