Skip to content

Commit 65f8d97

Browse files
bjlaapaulsouche
andauthored
🔖 Release 2.28.0 (#1253)
Co-authored-by: Paul Souche <paul@bettercallpaul.fr> Co-authored-by: Benjamin Arias <12382534+bjlaa@users.noreply.github.com>
1 parent 0164f99 commit 65f8d97

File tree

26 files changed

+308
-185
lines changed

26 files changed

+308
-185
lines changed

‎public/scripts/iframeSimulation.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ if (!currentParams.has('iframe') && !currentParams.has('integratorUrl')) {
3737
url.pathname = `/${lang ? lang + '/' : ''}simulateur/bilan`
3838
}
3939

40-
url.searchParams.append('lang', lang)
4140
url.searchParams.append('iframe', 'true')
4241
url.searchParams.append('integratorUrl', integratorUrl)
4342

‎src/adapters/cmsClient.ts‎

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export type ArticleType = {
113113
headings: HeadingType[]
114114
slug: string
115115
image?: ImageType | null
116-
category?: CategoryType | null
116+
blogCategory?: BlogCategoryType | null
117117
author?: AuthorType | null
118118
pageMetadata?: PageMetadataType
119119
} & DefaultAttributesType
@@ -134,7 +134,7 @@ export type PopulatedAuthorType<K extends OptionalKeys<AuthorType>> = Populate<
134134
K
135135
>
136136

137-
export type CategoryType = {
137+
export type BlogCategoryType = {
138138
slug: string
139139
title: string
140140
description: string
@@ -144,25 +144,32 @@ export type CategoryType = {
144144
htmlTitle: string
145145
image?: ImageType | null
146146
articles?: ArticleType[] | null
147-
questions?: QuestionType[] | null
147+
faq?: FAQType | null
148148
pageMetadata?: PageMetadataType
149149
mainArticle?: ArticleType | null
150150
} & DefaultAttributesType
151151

152-
export type PopulatedCategoryType<K extends OptionalKeys<CategoryType>> =
153-
Populate<CategoryType, K>
152+
export type PopulatedBlogCategoryType<
153+
K extends OptionalKeys<BlogCategoryType>,
154+
> = Populate<BlogCategoryType, K>
154155

155156
export type QuestionType = {
156157
question: string
157158
answer: string
158159
htmlAnswer: string
159160
order: number
160-
category?: CategoryType | null
161+
blogCategory?: BlogCategoryType | null
161162
} & DefaultAttributesType
162163

163164
export type ArticleItemType = Pick<
164-
PopulatedArticleType<'image' | 'category'>,
165-
'id' | 'documentId' | 'title' | 'description' | 'slug' | 'image' | 'category'
165+
PopulatedArticleType<'image' | 'blogCategory'>,
166+
| 'id'
167+
| 'documentId'
168+
| 'title'
169+
| 'description'
170+
| 'slug'
171+
| 'image'
172+
| 'blogCategory'
166173
>
167174

168175
export type BannerType = {
@@ -202,15 +209,11 @@ export type PartnerCampaignType = {
202209
image?: ImageType | null
203210
logo: ImageType
204211
backgroundColor?: string
205-
questions?: {
206-
question: string
207-
answer: string
208-
htmlAnswer: string
209-
}[]
212+
faq?: FAQType | null
210213
}
211214

212215
export type FAQType = {
213-
category: string
216+
title: string
214217
order: number
215218
questions: QuestionType[]
216219
subTitle?: string
@@ -249,7 +252,7 @@ export type ThematicLandingPage = {
249252
block4?: CarouselItemType[]
250253
block5?: TitleImageListDescriptionWithHTML
251254
block6?: TitleImageListDescriptionWithHTML
252-
articlesList?: ArticleType[]
255+
articles?: ArticleType[]
253256
articlesCTALabel?: string
254257
articlesCTALink?: string
255258
block7?: TitleImageListDescriptionWithHTML

‎src/app/[locale]/(narrow-layout)/(pages-statiques)/questions-frequentes/page.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ export default async function FAQPage({
9898
<ul className="-mt-8 pb-4 md:-mt-16">
9999
{faqCategories
100100
.sort((a, b) => a.order - b.order)
101-
.map(({ category, questions }) => {
101+
.map(({ title, questions }) => {
102102
return (
103-
<li key={category} className="list-none">
104-
<h2 className="mt-8 capitalize">{category}</h2>
103+
<li key={title} className="list-none">
104+
<h2 className="mt-8 capitalize">{title}</h2>
105105
<ul className="pl-2">
106106
{questions.map(({ question, htmlAnswer, id }) => {
107107
return (

‎src/app/[locale]/(thematic-landing-pages)/[landingPageSlug]/page.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default async function ThematicLandingPage({
8080
block5,
8181
block6,
8282
block7,
83-
articlesList,
83+
articles,
8484
articlesCTALink,
8585
articlesCTALabel,
8686
faq,
@@ -238,11 +238,11 @@ export default async function ThematicLandingPage({
238238
title={block6.title}
239239
description={block6.htmlDescription}
240240
posts={
241-
articlesList?.map(({ category, title, slug, image }) => ({
242-
category: category?.title ?? '',
241+
articles?.map(({ blogCategory, title, slug, image }) => ({
242+
category: blogCategory?.title ?? '',
243243
title,
244244
href: getArticleHref({
245-
categorySlug: category?.slug ?? '',
245+
categorySlug: blogCategory?.slug ?? '',
246246
articleSlug: slug,
247247
}),
248248
imageSrc: image?.url ?? '',

‎src/app/[locale]/_components/DecryptChallenges.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default async function DecryptChallenges({
1313
params: {
1414
sort: 'createdAt:desc',
1515
'populate[0]': 'image',
16-
'populate[1]': 'category',
16+
'populate[1]': 'blogCategory',
1717
'pagination[limit]': '3',
1818
},
1919
locale,
@@ -28,13 +28,13 @@ export default async function DecryptChallenges({
2828
title={
2929
<Trans locale={locale}>Décryptez les défis environnementaux</Trans>
3030
}
31-
posts={articles.map(({ title, category, image, slug }) => ({
31+
posts={articles.map(({ title, blogCategory, image, slug }) => ({
3232
title,
33-
category: category?.title ?? '',
33+
category: blogCategory?.title ?? '',
3434
imageSrc: image?.url ?? '',
3535
imageAlt: image?.alternativeText ?? '',
3636
href: getArticleHref({
37-
categorySlug: category?.slug ?? '',
37+
categorySlug: blogCategory?.slug ?? '',
3838
articleSlug: slug,
3939
}),
4040
}))}

‎src/app/[locale]/blog/[category]/[article]/__tests__/page.test.tsx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('ArticlePage', () => {
5353
createdAt: '2023-01-01T00:00:00.000Z',
5454
updatedAt: '2023-01-01T00:00:00.000Z',
5555
publishedAt: '2023-01-01T00:00:00.000Z',
56-
category: {
56+
blogCategory: {
5757
id: 'cat-1',
5858
documentId: 'doc-cat-1',
5959
title: 'Category Title',
@@ -96,7 +96,7 @@ describe('ArticlePage', () => {
9696
createdAt: '2023-01-01T00:00:00.000Z',
9797
updatedAt: '2023-01-01T00:00:00.000Z',
9898
publishedAt: '2023-01-01T00:00:00.000Z',
99-
category: {
99+
blogCategory: {
100100
id: 'cat-2',
101101
documentId: 'doc-cat-2',
102102
title: 'Category 2',
@@ -200,7 +200,7 @@ describe('ArticlePage', () => {
200200
createdAt: '2023-01-01T00:00:00.000Z',
201201
updatedAt: '2023-01-01T00:00:00.000Z',
202202
publishedAt: '2023-01-01T00:00:00.000Z',
203-
category: null,
203+
blogCategory: null,
204204
author: {
205205
name: 'Author Name',
206206
description: 'Author Bio',
@@ -242,7 +242,7 @@ describe('ArticlePage', () => {
242242
createdAt: '2023-01-01T00:00:00.000Z',
243243
updatedAt: '2023-01-01T00:00:00.000Z',
244244
publishedAt: '2023-01-01T00:00:00.000Z',
245-
category: {
245+
blogCategory: {
246246
id: 'cat-1',
247247
documentId: 'doc-cat-1',
248248
title: 'Category Title',
@@ -294,7 +294,7 @@ describe('ArticlePage', () => {
294294
createdAt: '2023-01-01T00:00:00.000Z',
295295
updatedAt: '2023-01-01T00:00:00.000Z',
296296
publishedAt: '2023-01-01T00:00:00.000Z',
297-
category: {
297+
blogCategory: {
298298
id: 'cat-1',
299299
documentId: 'doc-cat-1',
300300
title: 'Category Title',
@@ -349,7 +349,7 @@ describe('ArticlePage', () => {
349349
createdAt: '2023-01-01T00:00:00.000Z',
350350
updatedAt: '2023-01-01T00:00:00.000Z',
351351
publishedAt: '2023-01-01T00:00:00.000Z',
352-
category: {
352+
blogCategory: {
353353
id: 'cat-1',
354354
documentId: 'doc-cat-1',
355355
title: 'Category Title',

‎src/app/[locale]/blog/[category]/[article]/_components/OtherArticles.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export default function OtherArticles({
2525
title={article.title}
2626
imageSrc={article.image?.url ?? ''}
2727
imageAlt={article.image?.alternativeText ?? ''}
28-
href={`/blog/${article.category?.slug}/${article.slug}`}
28+
href={`/blog/${article.blogCategory?.slug}/${article.slug}`}
2929
trackingEvent={['blog', 'other-articles']}
30-
category={article.category?.title ?? ''}
30+
category={article.blogCategory?.title ?? ''}
3131
className="bg-white"
3232
/>
3333
))}

‎src/app/[locale]/blog/[category]/[article]/page.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ export default async function ArticlePage({
8686
categorySlug={category}
8787
articleSlug={articleSlug}
8888
articleTitle={article.title}
89-
categoryTitle={article.category?.title ?? ''}
89+
categoryTitle={article.blogCategory?.title ?? ''}
9090
/>
9191

9292
<div className="mb-16 flex flex-col items-start gap-8 md:flex-row md:justify-between">
9393
<div className="flex flex-col items-start md:w-8/12">
9494
<Badge className="mb-4" size="sm">
95-
{article.category?.title ?? ''}
95+
{article.blogCategory?.title ?? ''}
9696
</Badge>
9797

9898
<h1 className="mb-6 text-3xl font-bold md:text-5xl">

‎src/app/[locale]/blog/[category]/__tests__/page.test.tsx‎

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe('CategoryPage', () => {
6767
url: 'article-1-image.jpg',
6868
alternativeText: 'Article 1 Image',
6969
},
70-
category: {
70+
blogCategory: {
7171
id: 'cat-2',
7272
documentId: 'doc-cat-2',
7373
title: 'Category 1',
@@ -84,19 +84,23 @@ describe('CategoryPage', () => {
8484
},
8585
],
8686
pageCount: 3,
87-
questions: [
88-
{
89-
id: 'q1',
90-
documentId: 'doc-q1',
91-
question: 'Q1',
92-
htmlAnswer: 'A1',
93-
answer: 'A1',
94-
order: 1,
95-
createdAt: '2023-01-01T00:00:00.000Z',
96-
updatedAt: '2023-01-01T00:00:00.000Z',
97-
publishedAt: '2023-01-01T00:00:00.000Z',
98-
},
99-
],
87+
faq: {
88+
title: 'FAQ Title',
89+
order: 0,
90+
questions: [
91+
{
92+
id: 'q1',
93+
documentId: 'doc-q1',
94+
question: 'Q1',
95+
htmlAnswer: 'A1',
96+
answer: 'A1',
97+
order: 1,
98+
createdAt: '2023-01-01T00:00:00.000Z',
99+
updatedAt: '2023-01-01T00:00:00.000Z',
100+
publishedAt: '2023-01-01T00:00:00.000Z',
101+
},
102+
],
103+
},
100104
faqDescription: 'FAQ desc',
101105
additionalContent: 'Some content',
102106
image: { url: 'img.jpg', alternativeText: 'img' },

‎src/app/[locale]/blog/[category]/page.tsx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default async function CategoryPage({
6464
mainArticle,
6565
articles,
6666
pageCount,
67-
questions,
67+
faq,
6868
faqDescription,
6969
additionalContent,
7070
image,
@@ -93,12 +93,14 @@ export default async function CategoryPage({
9393
return redirect(NOT_FOUND_PATH)
9494
}
9595

96+
const questions = faq?.questions ?? []
97+
9698
return (
9799
<>
98100
<div className="-mt-12">
99101
<CategoryJSONLD
100102
title={title}
101-
questions={questions ?? []}
103+
questions={questions}
102104
categorySlug={category}
103105
/>
104106

@@ -127,7 +129,7 @@ export default async function CategoryPage({
127129
)}
128130
</ContentLarge>
129131

130-
{questions && questions.length > 0 && (
132+
{questions.length > 0 && (
131133
<FAQ
132134
className="pb-10!"
133135
questions={questions.map((question) => ({

0 commit comments

Comments
 (0)