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 SpecialReportAlt card styles #25602

Merged
merged 19 commits into from
Nov 16, 2022
Merged

Conversation

ioannakok
Copy link
Contributor

@ioannakok ioannakok commented Oct 20, 2022

What does this change?

  • Consumes the new SpecialReportAltTheme coming from capi-client
  • Consumes the new SpecialReportAlt CardStyle coming from facia-client
  • Adds SpecialReportAlt card styles
  • Consumes new SpecialReportAltPalette (pending: https://github.com/guardian/interactive-atom-container-colours/pull/4)
  • When there is a campaign connected to a specific tag, if the campaign id is "SpecialReportAlt" facia-press decides that CardStyle will be SpecialReportAlt.

Previous PRs

  1. Adds SpecialReportAltTheme and SpecialReportAlt hashed tag to content-api-scala-client: Add SpecialReportAltTheme to Format content-api-scala-client#371
  2. Adds SpecialReportAltPalette: adds specialReport palette to fronts facia-scala-client#281
  3. Adds SpecialReportAlt to CardStyle: Add SpecialReportAlt to CardStyle facia-scala-client#280
  4. Bump capi and facia client int frontend: Bump content-api-scala-client to 19.0.5 and facia-scala-client to 4.0.3 #25640

Does this change need to be reproduced in dotcom-rendering ?

  • No
  • Yes (please indicate your plans for DCR Implementation)

The following PRs have already been merged:

Screenshots

Standard type

image

Comment type

image

With media type

image

What is the value of this and can you measure success?

Checklist

Does this affect other platforms?

  • AMP
  • Apps
  • Other (please specify)

Does this affect GLabs Paid Content Pages? Should it have support for Paid Content?

  • No
  • Yes (please give details)

Does this change break ad-free?

  • No
  • It did, but tests caught it and I fixed it
  • It did, but there was no test coverage so I added that then fixed it

Does this change update the version of CAPI we're using?

Accessibility test checklist

Tested

  • Locally
  • On CODE (optional)

Tested in CODE and verified these changes don't break any existing card styles.

Further testing: At the moment we have no SpecialReportAlt articles published. Once this gets merged we are planning to do an e2e test "Tools Game" in CODE environment and

  1. create articles of type:
  • Comment
  • Analysis
  • Explainer
  • Immersive
  • Standard

with different pillars to make sure all are being overridden correctly

  1. Create a container using SpecialReportAltPalette and add SpecialReportAlt articles
  2. Create onwards source using SpecialReportAlt articles

val tags = content.tags.map(_.id).toSeq
extractCampaigns(tags) match {
case Nil => CardStyle(content, TrailMetaData.empty)
case campaign:: _ => if(campaign.id.toString.toLowerCase() == "specialReportAlt") SpecialReportAlt else SpecialReport
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
case campaign:: _ => if(campaign.id.toString.toLowerCase() == "specialReportAlt") SpecialReportAlt else SpecialReport
case campaign:: _ => if(campaign.id.toString.toLowerCase() == "specialreportalt") SpecialReportAlt else SpecialReport

@@ -21,6 +22,7 @@ object CardStylePicker {
val tags = FaciaContentUtils.tags(content).map(_.id)
extractCampaigns(tags) match {
case Nil => FaciaContentUtils.cardStyle(content)
case campaign:: _ => if(campaign.id.toString.toLowerCase() == "specialReportAlt") SpecialReportAlt else SpecialReport
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
case campaign:: _ => if(campaign.id.toString.toLowerCase() == "specialReportAlt") SpecialReportAlt else SpecialReport
case campaign:: _ => if(campaign.id.toString.toLowerCase() == "specialreportalt") SpecialReportAlt else SpecialReport

@@ -286,6 +286,7 @@ object ContentFormat {
case "CulturePillar" => CulturePillar
case "LifestylePillar" => LifestylePillar
case "SpecialReportTheme" => SpecialReportTheme
// case "SpecialReportAltTheme" => SpecialReportAltTheme
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
// case "SpecialReportAltTheme" => SpecialReportAltTheme
case "SpecialReportAltTheme" => SpecialReportAltTheme

@ioannakok ioannakok force-pushed the ioanna/cards-special-report-alt branch from c35acc6 to 3af4466 Compare November 8, 2022 11:11
@ioannakok ioannakok changed the base branch from main to update-scala-facia-clients November 8, 2022 13:59
Base automatically changed from update-scala-facia-clients to main November 9, 2022 11:04
@ioannakok ioannakok force-pushed the ioanna/cards-special-report-alt branch from 3621d40 to b7deaa9 Compare November 9, 2022 13:02
val tags = content.tags.map(_.id).toSeq
extractCampaigns(tags) match {
case Nil => CardStyle(content, TrailMetaData.empty)
case _ => SpecialReport
case campaign :: _ =>
if (campaign.id.toString.toLowerCase() == "specialreportalt") SpecialReportAlt else SpecialReport
Copy link
Contributor Author

@ioannakok ioannakok Nov 9, 2022

Choose a reason for hiding this comment

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

The campaign information is coming from extractCampaigns --> CampaignAgent --> targeting-client. There is already a campaign set up with this campaign id in the targeting-tool

}
}

def apply(content: FaciaContent): CardStyle = {
val tags = FaciaContentUtils.tags(content).map(_.id)
extractCampaigns(tags) match {
case Nil => FaciaContentUtils.cardStyle(content)
case _ => SpecialReport
case campaign :: _ =>
if (campaign.id.toString.toLowerCase() == "specialreportalt") SpecialReportAlt else SpecialReport
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above

@@ -13,7 +13,7 @@ object FaciaContentConvert {
def contentToFaciaContent(content: Content): PressedContent = {
val frontendContent = model.Content(content)
val trailMetaData = TrailMetaData.empty
val cardStyle = CardStylePicker(content, trailMetaData)
val cardStyle = CardStylePicker(content)
Copy link
Contributor Author

@ioannakok ioannakok Nov 9, 2022

Choose a reason for hiding this comment

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

This is just removing an unused parameter

@@ -192,6 +194,7 @@ object GetClasses {
BreakingPalette -> "fc-container--breaking-palette",
EventPalette -> "fc-container--event-palette",
EventAltPalette -> "fc-container--event-alt-palette",
SpecialReportAltPalette -> "fc-container--special-report-alt-palette",
Copy link
Contributor Author

@ioannakok ioannakok Nov 9, 2022

Choose a reason for hiding this comment

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

There is a PR to add styles for this class.

@@ -183,7 +197,7 @@ $pillars: (
color: map-get($palette, kicker);
}

&.fc-item--type-immersive.fc-item--has-boosted-title:not(.fc-item--pillar-special-report) .fc-item__standfirst {
&.fc-item--type-immersive.fc-item--has-boosted-title:not(.fc-item--pillar-special-report):not(.fc-item--pillar-special-report-alt) .fc-item__standfirst {
Copy link
Contributor Author

@ioannakok ioannakok Nov 9, 2022

Choose a reason for hiding this comment

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

I tried

:not(.fc-item--pillar-special-report, .fc-item--pillar-special-report-alt)

but didn't work!

background-color: $special-report-alt-faded !important;

.fc-item__container.u-faux-block-link--hover {
background-color: $special-report-alt-faded !important;
Copy link
Contributor Author

@ioannakok ioannakok Nov 9, 2022

Choose a reason for hiding this comment

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

I am sorry I had to add !important to so many places but it wouldn't pick up the right colour for SpecialReportAlt. Given that fronts migration to DCR is in progress I don't think this is a huge problem but happy to discuss if anyone thinks otherwise!

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed!

@ioannakok ioannakok marked this pull request as ready for review November 9, 2022 15:26
@ioannakok ioannakok requested a review from a team as a code owner November 9, 2022 15:26
Copy link
Contributor

@HarryFischer HarryFischer left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@mxdvl mxdvl left a comment

Choose a reason for hiding this comment

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

As you have mentioned, there are a few issues with the CSS styles, mainly the abundant use of !important, but this code base is soon to be legacy, so I believe it’s an acceptable compromise.

background-color: $special-report-alt-faded !important;

.fc-item__container.u-faux-block-link--hover {
background-color: $special-report-alt-faded !important;
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed!

@@ -5,6 +5,8 @@
@import views.support.RenderClasses
@import conf.switches.Switches.AusRegionSelector

@import views.html.fragments.containers.facia_cards.slice
Copy link
Contributor

Choose a reason for hiding this comment

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

are these imports here intentionally? (I couldn't spot any new code that makes use of them)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right! There is existing code that uses them and IntelliJ was complaining about the missing imports although the code was compiling successfully 🤷‍♀️

image

I thought I'd add them just because not having the imports didn't feel right although indeed it doesn't really make a difference!

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

Successfully merging this pull request may close these issues.

6 participants