Skip to content

Commit

Permalink
🎨 filter out crude oil
Browse files Browse the repository at this point in the history
  • Loading branch information
BorghildSelle committed Nov 8, 2024
1 parent 75c6558 commit b976fec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions web/templates/newsroom/sanity/NewsroomSanity.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { forwardRef, useRef, useState } from 'react'
import Blocks from '../../../pageComponents/shared/portableText/Blocks'
import type { NewsRoomPageType } from '../../../types'
import type { NewsRoomNewsItem, NewsRoomPageType } from '../../../types'
import { Heading, Typography } from '@core/Typography'
import { ResourceLink } from '@core/Link'
import Seo from '../../../pageComponents/shared/Seo'
Expand Down Expand Up @@ -51,11 +51,13 @@ const NewsRoomTemplateSanity = forwardRef<HTMLElement, NewsRoomTemplateProps>(fu
newsArticles?.[newsArticles?.length - 1]?.publishDateTime ??
null,
)

const [newsList, setNewsList] = useState(newsArticles ?? [])
const filterCrudeAssays = (list: NewsRoomNewsItem[]) => {
return list?.filter((item: NewsRoomNewsItem) => item?.tags?.some((tag: any) => tag.key !== 'crude-oil-assays'))
}
const [newsList, setNewsList] = useState(filterCrudeAssays(newsArticles) ?? [])

const setSearchStates = (filteredNews: any) => {
setNewsList(filteredNews)
setNewsList(filterCrudeAssays(filteredNews))
setFirstId(filteredNews?.length > 0 ? filteredNews[0].id : null)
setLastId(filteredNews?.length > 0 ? filteredNews[filteredNews.length - 1].id : null)
setFirstPublished(
Expand Down

0 comments on commit b976fec

Please sign in to comment.