Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
feat(articles-redesign): Refactored dateToUse, adjusted queries to ma…
Browse files Browse the repository at this point in the history
…tch new type for mainCategory.
  • Loading branch information
APW26 committed Jul 6, 2023
1 parent f1e357a commit c1a4fbd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ArticleMainCategory, ArticlePublishedDate, ArticleUpdatedDate } from '~/types/cms';

export const getDateToUse = (publishedDate: ArticlePublishedDate, updatedDate: ArticleUpdatedDate, mainCategory: ArticleMainCategory | null) => {
if (!updatedDate)
if (!updatedDate || mainCategory === 'news') {
return {
publishedOrUpdatedDate: publishedDate,
isUpdatedAfterPublishing: false,
};
}

const dateOfUpdate = new Date(updatedDate);
const dateOfPublishing = new Date(publishedDate);
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/pages/artikelen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const getStaticProps = createGetStaticProps(
"asset": cover.asset->
},
publicationDate,
mainCategory[0],
mainCategory,
updatedDate,
}`;
})
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/queries/get-page-parts-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const getPagePartsQuery = (pageIdentifier: PageIdentifier) => {
_type,
pageDataKind,
(_type == 'pageArticles') => {
articles[]->{_id, title, slug, summary, intro, "cover": {"asset": cover.asset->}, mainCategory[0], publicationDate, updatedDate},
articles[]->{_id, title, slug, summary, intro, "cover": {"asset": cover.asset->}, mainCategory, publicationDate, updatedDate},
sectionTitle
},
(_type == 'pageFAQs') => {
Expand Down

0 comments on commit c1a4fbd

Please sign in to comment.