-
Notifications
You must be signed in to change notification settings - Fork 0
feat: form config #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/clevercloud
Are you sure you want to change the base?
feat: form config #306
Conversation
a0f6174
to
76e9eb7
Compare
const [nbrModified, setNbrModified] = useState( | ||
configHelper.displays.filter( | ||
d => d.kind === 'blockOption' && block.id === d.parent_id && d.hidden | ||
).length | ||
); | ||
|
||
useEffect(() => { | ||
setNbrModified( | ||
configHelper.displays.filter( | ||
d => d.kind === 'blockOption' && step.form_template_blocks.map(b => b.id).includes(d.parent_id) && d.hidden | ||
).length | ||
) | ||
}, [configHelper]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pas mieux de faire une const pour éviter tout ce code ?
const [isModified, setIsModified] = useState( | ||
configHelper.displays.some( | ||
d => d.kind === 'blockOption' && step.form_template_blocks.map(b => b.id).includes(d.parent_id) && d.hidden | ||
) || configHelper.labels.some(d => { | ||
if (d.kind !== 'block') return false; | ||
|
||
const isInCorrectBlock = step.form_template_blocks.map(b => b.id).includes(d.parent_id); | ||
|
||
const paragraphContent = step.form_template_blocks.find(b => b.type_bloc === 'paragraph')?.content; | ||
if (!paragraphContent) return false; | ||
|
||
const replacedContent = paragraphContent.replace('{{title}}', form.product.title); | ||
|
||
return isInCorrectBlock && | ||
normalizeHtml(d.label) !== normalizeHtml(replacedContent); | ||
}) | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
faut qu'on pense a une implem différente
à mon avis il faudrait répéter l'id de la step dans les configs, ça éviterai d'avoir a faire tout ça à chaque fois
…to render a table as rows of scales to adapt design, removed option 'no answer' from seeding
No description provided.