11import { css } from '@emotion/react' ;
2- import { FlexibleGeneral } from './FlexibleGeneral' ;
32import {
43 from ,
54 headlineLight50 ,
@@ -10,14 +9,14 @@ import {
109 textSans20 ,
1110 textSansBold34 ,
1211} from '@guardian/source/foundations' ;
12+ import { useState } from 'react' ;
13+ import type { EditionId } from '../lib/edition' ;
1314import { parseTPSGContentToStorylines } from '../model/enhanceAITagPageContent' ;
1415import { palette } from '../palette' ;
15- import { useState } from 'react' ;
16- import type { TreatType } from '../types/front' ;
1716import type { TPSGContent } from '../types/tagPageAIContent' ;
17+ import { FlexibleGeneral } from './FlexibleGeneral' ;
1818import { ScrollableCarousel } from './ScrollableCarousel' ;
1919import { StorylineSection } from './StorylineSection' ;
20- import { EditionId } from '../lib/edition' ;
2120
2221type StorylinesSectionProps = {
2322 url ?: string ;
@@ -112,9 +111,9 @@ function formatDateRangeText(
112111 const format = ( d ?: Date | null ) => {
113112 if ( ! d ) return '' ;
114113 const day = d . getDate ( ) ;
115- const suffix = ( day : number ) => {
116- if ( day > 3 && day < 21 ) return 'th' ;
117- switch ( day % 10 ) {
114+ const suffix = ( dayNum : number ) => {
115+ if ( dayNum > 3 && dayNum < 21 ) return 'th' ;
116+ switch ( dayNum % 10 ) {
118117 case 1 :
119118 return 'st' ;
120119 case 2 :
@@ -186,16 +185,6 @@ export const StorylinesSection = ({
186185 const activeStoryline = parsedStorylines . find (
187186 ( s ) => s . id === activeStorylineId ,
188187 ) ;
189- const AITreat : TreatType = {
190- altText :
191- 'This content has been generated with the assistance of AI technology.' ,
192- links : [
193- {
194- text : 'This section was curated with AI.' ,
195- linkTo : 'https://www.theguardian.com/help/insideguardian/2023/jun/16/the-guardians-approach-to-generative-ai' ,
196- } ,
197- ] ,
198- } ;
199188
200189 /** frontsection with background, title, AI warning on the left,
201190 *
@@ -219,7 +208,6 @@ export const StorylinesSection = ({
219208 toggleable = { false } //maybe set to true if this still works?
220209 // pageId={tagPage.pageId}
221210 editionId = { editionId }
222- treats = { [ AITreat ] }
223211 >
224212 { /* Tab selector */ }
225213 < div css = { tabsContainerStyles } >
@@ -285,24 +273,21 @@ export const StorylinesSection = ({
285273 ) }
286274 { /* Tabs content */ }
287275 < div css = { contentStyles } >
288- { activeStoryline &&
289- activeStoryline . categories . map ( ( category , idx ) => (
290- < div key = { idx } css = { contentCss } >
291- { category . title !== 'Key Stories' && (
292- < h2 css = { categoryTitleCss } >
293- { category . title }
294- </ h2 >
295- ) }
296- < FlexibleGeneral
297- groupedTrails = { category . groupedTrails }
298- imageLoading = { 'eager' }
299- aspectRatio = { '5:4' }
300- collectionId = { 0 }
301- containerLevel = "Secondary"
302- SCStyle = { true }
303- />
304- </ div >
305- ) ) }
276+ { activeStoryline ?. categories . map ( ( category , idx ) => (
277+ < div key = { idx } css = { contentCss } >
278+ { category . title !== 'Key Stories' && (
279+ < h2 css = { categoryTitleCss } > { category . title } </ h2 >
280+ ) }
281+ < FlexibleGeneral
282+ groupedTrails = { category . groupedTrails }
283+ imageLoading = { 'eager' }
284+ aspectRatio = { '5:4' }
285+ collectionId = { 0 }
286+ containerLevel = "Secondary"
287+ SCStyle = { true }
288+ />
289+ </ div >
290+ ) ) }
306291 </ div >
307292 < div css = { articleCountAndDateRangeStyle } >
308293 { `These storylines were curated from articles published ${ formatDateRangeText (
0 commit comments