Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

Derive SpecialReport ColourScheme #4

Open
JamieB-gu opened this issue Mar 2, 2020 · 4 comments
Open

Derive SpecialReport ColourScheme #4

JamieB-gu opened this issue Mar 2, 2020 · 4 comments

Comments

@JamieB-gu
Copy link
Contributor

I don't know what the best way to go about this is. Does it get derived from tags? @oliverlloyd @gtrufitt @SiAdcock.

@JamieB-gu JamieB-gu added this to the Derive ColourScheme milestone Mar 2, 2020
@gtrufitt
Copy link

gtrufitt commented Mar 2, 2020

@rcrphillips How is a special report defined on an article, you did this the other day, right? Is a tag added to the targeting tool or something?

@rcrphillips
Copy link

Yep, you have to add a campaign type of report in targeting.gutools.co.uk

This is locked down to a few individuals. In this case the This is Europe tag was given that treatment.

No idea how frontend stores that information though.

@JamieB-gu
Copy link
Contributor Author

JamieB-gu commented Mar 2, 2020

Ok, so presumably the application (frontend, MAPI etc.) has a way to read from that tool?

I think we could solve this using something like the following:

type CampaignType = 'report' | 'otherCampaign';

type Campaign = {
    tagId: string,
    type: CampaignType,
}

const isSpecialReport = (campaigns: Campaign[], tags: Tag[]): boolean =>
    tags.some(tag => campaigns.includes({ tagId: tag.id, type: 'report' })); 

This function could live in the types repo, and the applications just have to pass in the campaign and tag information they have. I don't know what the actual campaign data looks like, but we should be able to tailor this code to fit.

@JamieB-gu
Copy link
Contributor Author

Coming back to this, I wonder if we're starting to stretch the name of this repo too far? Should we split it into:

  • @guardian/editorial-format: which manages the Format type and associated functions to derive it from CAPI data
  • @guardian/types: useful data types like Option and their associated functions

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

No branches or pull requests

3 participants