Skip to content

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

Open
wants to merge 98 commits into
base: feat/clevercloud
Choose a base branch
from
Open

Conversation

ClementNumericite
Copy link
Collaborator

No description provided.

Comment on lines 76 to 88
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])
Copy link
Collaborator Author

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 ?

Comment on lines 50 to 67
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);
})
);

Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants