Skip to content

Commit

Permalink
Merge pull request #557 from guardian/ahe/remove-epic-footer
Browse files Browse the repository at this point in the history
Remove footer from Epic model and UI
  • Loading branch information
andrewHEguardian authored Feb 22, 2024
2 parents 85c3d46 + 16d7b76 commit 74c2f71
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 57 deletions.
1 change: 0 additions & 1 deletion app/models/EpicTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ case class EpicVariant(
heading: Option[String],
paragraphs: List[String],
highlightedText: Option[String] = None,
footer: Option[String] = None,
showTicker: Boolean = false, // Deprecated - use tickerSettings instead
tickerSettings: Option[TickerSettings] = None,
image: Option[Image] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,6 @@ const variantFields = {
exclude: ['Header'],
optional: true,
},
footer: {
label: 'Footer',
type: 'string-block',
exclude: ['Header', 'Banner1', 'Banner2'],
optional: true,
},
cta: {
label: 'Main CTA',
type: 'object',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,13 @@ const PARAGRAPHS_MAX_LENGTH = 2000;
const HEADER_DEFAULT_HELPER_TEXT = `Assitive text`;
const BODY_DEFAULT_HELPER_TEXT = `Maximum ${PARAGRAPHS_MAX_LENGTH} characters.`;
const HIGHTLIGHTED_TEXT_DEFAULT_HELPER_TEXT = `Final sentence of body copy.`;
const FOOTER_DEFAULT_HELPER_TEXT = `Bold text below the button.`;

interface FormData {
heading?: string;
paragraphs: string[];
highlightedText?: string;
image?: Image;
bylineWithImage?: BylineWithImage;
footer?: string;
}

interface EpicTestVariantEditorProps {
Expand All @@ -106,7 +104,6 @@ const EpicTestVariantEditor: React.FC<EpicTestVariantEditorProps> = ({
allowMultipleVariants,
allowVariantHeader,
allowVariantHighlightedText,
allowVariantFooter,
allowVariantImageUrl,
allowVariantCustomPrimaryCta,
allowVariantCustomSecondaryCta,
Expand All @@ -130,7 +127,6 @@ const EpicTestVariantEditor: React.FC<EpicTestVariantEditorProps> = ({
highlightedText: variant.highlightedText,
image: variant.image,
bylineWithImage: variant.bylineWithImage,
footer: variant.footer,
};

/**
Expand Down Expand Up @@ -160,7 +156,7 @@ const EpicTestVariantEditor: React.FC<EpicTestVariantEditorProps> = ({
useEffect(() => {
const isValid = Object.keys(errors).length === 0;
onValidationChange(isValid);
}, [errors.heading, errors.paragraphs, errors.highlightedText, errors.image, errors.footer]);
}, [errors.heading, errors.paragraphs, errors.highlightedText, errors.image]);

const noHtml = platform !== 'DOTCOM';
const htmlValidator = noHtml ? noHtmlValidator : () => undefined;
Expand Down Expand Up @@ -335,45 +331,6 @@ const EpicTestVariantEditor: React.FC<EpicTestVariantEditorProps> = ({
/>
)}

{allowVariantFooter && (
<Controller
name="footer"
control={control}
rules={{
validate: lineValidator,
}}
render={data => {
return (
<RichTextEditorSingleLine
error={errors.footer !== undefined}
helperText={
errors.footer
? errors.footer.message || errors.footer.type
: FOOTER_DEFAULT_HELPER_TEXT
}
copyData={data.value}
updateCopy={pars => {
data.onChange(pars);
handleSubmit(setValidatedFields)();
}}
name="footer"
label="Footer"
disabled={!editMode}
rteMenuConstraints={{
noHtml,
noCurrencyTemplate,
noCountryNameTemplate,
noArticleCountTemplate,
noPriceTemplates: true,
noDateTemplate,
noDayTemplate,
}}
/>
);
}}
/>
)}

{(allowVariantImageUrl || allowBylineWithImage) && (
<Typography className={classes.sectionHeader} variant="h4">
Byline copy and/or images
Expand Down
5 changes: 0 additions & 5 deletions public/src/components/channelManagement/helpers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export interface EpicEditorConfig {
allowVariantHeader: boolean;
allowVariantHighlightedText: boolean;
allowVariantImageUrl: boolean;
allowVariantFooter: boolean;
allowVariantCustomPrimaryCta: boolean;
allowVariantCustomSecondaryCta: boolean;
allowVariantSeparateArticleCount: boolean;
Expand All @@ -72,7 +71,6 @@ export const ARTICLE_EPIC_CONFIG: EpicEditorConfig = {
allowVariantHeader: true,
allowVariantHighlightedText: true,
allowVariantImageUrl: true,
allowVariantFooter: true,
allowVariantCustomPrimaryCta: true,
allowVariantCustomSecondaryCta: true,
allowVariantSeparateArticleCount: true,
Expand All @@ -98,7 +96,6 @@ export const LIVEBLOG_EPIC_CONFIG: EpicEditorConfig = {
allowVariantHeader: true,
allowVariantHighlightedText: false,
allowVariantImageUrl: false,
allowVariantFooter: false,
allowVariantCustomPrimaryCta: true,
allowVariantCustomSecondaryCta: true,
allowVariantSeparateArticleCount: false,
Expand All @@ -125,7 +122,6 @@ export const APPLE_NEWS_EPIC_CONFIG: EpicEditorConfig = {
allowVariantHeader: true,
allowVariantHighlightedText: true,
allowVariantImageUrl: false,
allowVariantFooter: false,
allowVariantCustomPrimaryCta: false,
allowVariantCustomSecondaryCta: false,
allowVariantSeparateArticleCount: false,
Expand All @@ -151,7 +147,6 @@ export const AMP_EPIC_CONFIG: EpicEditorConfig = {
allowVariantHeader: true,
allowVariantHighlightedText: true,
allowVariantImageUrl: false,
allowVariantFooter: false,
allowVariantCustomPrimaryCta: true,
allowVariantCustomSecondaryCta: false,
allowVariantSeparateArticleCount: false,
Expand Down
1 change: 0 additions & 1 deletion public/src/models/epic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export interface EpicVariant extends Variant {
heading?: string;
paragraphs: string[];
highlightedText?: string;
footer?: string;
showTicker: boolean;
tickerSettings?: TickerSettings;
image?: Image;
Expand Down

0 comments on commit 74c2f71

Please sign in to comment.