Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@
"react-router-dom": "^6.0.0",
"sharp": "^0.34.4",
"strapi-plugin-multi-select": "^2.1.1",
"strapi-v5-redirects": "^1.0.4",
"strapi-plugin-tagsinput": "^2.0.2",
"strapi-provider-email-brevo": "^1.0.4",
"strapi-v5-redirects": "^1.0.4",
"styled-components": "^6.0.0"
},
"strapi": {
"uuid": "23578308-9b2f-4525-aca3-db1c4f9e3b2d"
},
"devDependencies": {
"@types/qs": "^6.9.16"
"@types/qs": "^6.9.16",
"baseline-browser-mapping": "^2.10.23"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,33 @@
"type": "relation",
"relation": "oneToMany",
"target": "api::tag.tag"
},
"press_release_type": {
"type": "enumeration",
"pluginOptions": {
"i18n": {
"localized": true
}
},
"enum": [
"link",
"file"
]
},
"article_file": {
"type": "media",
"pluginOptions": {
"i18n": {
"localized": true
}
},
"multiple": false,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
}
}
}

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions backend/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,14 @@ export interface ApiPressReleasePressRelease
};
};
attributes: {
article_file: Schema.Attribute.Media<
'images' | 'files' | 'videos' | 'audios'
> &
Schema.Attribute.SetPluginOptions<{
i18n: {
localized: true;
};
}>;
article_link: Schema.Attribute.String &
Schema.Attribute.SetPluginOptions<{
i18n: {
Expand Down Expand Up @@ -1228,6 +1236,12 @@ export interface ApiPressReleasePressRelease
localized: true;
};
}>;
press_release_type: Schema.Attribute.Enumeration<['link', 'file']> &
Schema.Attribute.SetPluginOptions<{
i18n: {
localized: true;
};
}>;
published_date: Schema.Attribute.Date &
Schema.Attribute.SetPluginOptions<{
i18n: {
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/app/[locale]/about/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ function transformTestimonials(
}

function transformFunders(funders: NonNullable<AboutPageData['funders']>) {
return funders.map(partner => ({
id: partner.id,
name: partner.name,
description: partner.description,
image: partner.logo?.url,
link: partner.website_link ?? 'https://www.dataforgood.fr',
return funders.map(funder => ({
id: funder.id,
name: funder.name,
description: funder.description,
image: funder.logo?.url,
link: funder.website_link ?? 'https://www.dataforgood.fr',
}));
}

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/app/[locale]/blog/blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Title, BaseCardsBlock, Pagination, SearchInput } from '@/components';
import { BlogsPageMeta, BlogsPageData } from './page';
import { usePagination } from '@/hooks/usePagination';
import { useState, useEffect } from 'react';
import { getPressReleaseLink } from '@/lib/utils';


function transformBlogsData(resources: NonNullable<BlogsPageData>) {
Expand All @@ -19,7 +20,7 @@ function transformBlogsData(resources: NonNullable<BlogsPageData>) {
rawDate: resource.published_date,
date: new Date(resource.published_date).toLocaleString(undefined, {dateStyle: 'medium'}),
image: element.thumbnail?.url ?? "/images/dataforgood.svg",
link: isBlog ? `/blog/${element.slug}` : element.article_link,
link: isBlog ? `/blog/${element.slug}` : getPressReleaseLink(element as { press_release_type: string; article_link: string; article_file: {url: string;}}),
subInfos: element.tags ? element.tags.map(tag => tag.name) : [],
tags: [new Date(element.published_date).toLocaleDateString(undefined, {dateStyle: 'long'}), element.media_name],
isBlank: true,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/[locale]/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default async function Page({
searchParams: { [key: string]: string | string[] | undefined };
}) {
const page = typeof searchParams.page === 'string' ? Number(searchParams.page) : 1;
const pageSize = 8;
const pageSize = 12;
const response = await fetchBlogsPageData(page, pageSize);

if (!response?.data || !response?.data.meta?.pagination) {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/app/[locale]/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useTranslations } from 'next-intl';
import { ThematicsBlock, ImagesCarousel, ResultsCard, NewsSmallBlock, TalksBlock, Title, TitleProps, HeroBlock } from '@/components';
import { HomepageData } from './page';
import Image from 'next/image'
import { getPressReleaseLink } from '@/lib/utils';

type HomepageProps = {
data: HomepageData;
Expand Down Expand Up @@ -70,7 +71,7 @@ export default function Homepage({ data }: HomepageProps) {
talk: isBlog ? (resource.blog as { title: string })?.title || '' : (resource.press_release as { title: string })?.title || '',
image: isBlog ? resource.blog?.thumbnail?.url || '' : resource.press_release?.thumbnail?.url || '',
ctaText: isBlog ? t('resources.articleCtaText') : t('resources.pressCtaText'),
ctaLink: isBlog ? `/articles/${resource.blog?.slug || ''}` : (resource.press_release as { article_link: string })?.article_link || '',
ctaLink: isBlog ? `/articles/${resource.blog?.slug || ''}` : getPressReleaseLink(resource.press_release as { press_release_type: string; article_link: string; article_file: {url: string;}}) || '',
}
}) ?? [];

Expand Down
5 changes: 3 additions & 2 deletions frontend/src/app/[locale]/positions/positions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { BaseCardsBlock, LargeTextImage } from '@/components';
import Animation from './_partials/Animations';
import { PositionsPageData } from './page';
import { useRef } from 'react';
import { getPressReleaseLink } from '@/lib/utils';

type PositionPageProps = {
data: PositionsPageData
Expand All @@ -15,7 +16,7 @@ function transformPressReleases(press_releases: NonNullable<PositionsPageData['p
title: release.article_name,
tags: [new Date(release.published_date || '').toLocaleString(undefined, { month: 'short', day: 'numeric', year: 'numeric' }), release.media_name],
image: release.thumbnail?.url ?? '/images/dataforgood.svg',
link: release.article_link,
link: getPressReleaseLink(release as { press_release_type: string; article_link: string; article_file: {url: string;}}),
subInfos: release.tags,
isBlank: true,
}))
Expand Down Expand Up @@ -43,7 +44,7 @@ function transformResources(resources: NonNullable<PositionsPageData['resources'
title: isBlog ? (resource.blog as { title: string })?.title || '' : (resource.press_release as { title: string })?.title || '',
tags: isBlog ? [new Date(resource.blog?.published_date || '').toLocaleString(undefined, { month: 'short', day: 'numeric', year: 'numeric' })] : [new Date(resource.press_release?.published_date || '').toLocaleString(undefined, { month: 'short', day: 'numeric', year: 'numeric' }), resource.press_release?.media_name],
image: isBlog ? resource.blog?.thumbnail?.url || '/images/dataforgood.svg' : resource.press_release?.thumbnail?.url || "/images/dataforgood.svg",
link: isBlog ? `/blog/${resource.blog?.slug || ''}` : (resource.press_release as { article_link: string })?.article_link || '',
link: isBlog ? `/blog/${resource.blog?.slug || ''}` : getPressReleaseLink(resource as { press_release_type: string; article_link: string; article_file: {url: string;}}) || '',
subInfos: isBlog ? (resource.blog as { tags: string[] })?.tags?.map((tag) => tag.name) || [] : (resource.press_release as { tags: string[] })?.tags || [],
isBlank: true,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function getNews(project: ProjectPageData) {
title: pressRelease.title,
tag: pressRelease.tags ?? [],
image: pressRelease.thumbnail?.url,
link: pressRelease.article_link,
link: getPressReleaseLink(pressRelease as { press_release_type: string; article_link: string; article_file: {url: string;}}),
date: new Date(pressRelease.published_date || '').toLocaleString(undefined, { month: 'short', day: 'numeric', year: 'numeric'}),
})) || [];
}
Expand Down
Loading
Loading