Skip to content
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

Add article count copy editor field #547

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

andrewHEguardian
Copy link
Contributor

What does this change?

Adds the "copy" property to Epic test models (already exists here) and creates an editor field for it.

How to test

Edit a variant of an epic test - update the "Article count copy" under "Separate article count". Preview and see this copy. Save, reload and see the copy is still there.

How can we measure success?

Have we considered potential risks?

Images

image

Accessibility

import { useForm } from 'react-hook-form';

interface FormData {
copy: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you clear the contents of this field does the tool submit an empty string (rather than null) to the database? I'm wondering what then happens in the epic

Copy link
Contributor Author

@andrewHEguardian andrewHEguardian Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question, yes it does. But the epic logic checks that it contains "%%ARTICLE_COUNT%%" anyway, though arguably we shouldn't rely on this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Perhaps it's worth being defensive and transforming '' to undefined in this component?

@@ -18,6 +24,20 @@ const VariantEditorSeparateArticleCountEditor: React.FC<VariantEditorSeparateArt
updateSeparateArticleCount(Boolean(separateArticleCount) ? undefined : { type: 'above' });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the way this worked before means that the copy will be lost if "Above" is set to false, which I guess is fine?

Copy link
Member

@tomrf1 tomrf1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

@andrewHEguardian andrewHEguardian merged commit 1c7d87a into main Jan 24, 2024
1 check passed
@andrewHEguardian andrewHEguardian deleted the ahe/article-count-copy-editor branch January 24, 2024 10:29
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.

2 participants