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: 5 additions & 0 deletions backend/src/api/about/content-types/about/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
"type": "relation",
"relation": "oneToMany",
"target": "api::volunteer.volunteer"
},
"activity_reports": {
"type": "component",
"component": "file-list-with-dates.file-with-date",
"repeatable": true
}
}
}
26 changes: 26 additions & 0 deletions backend/src/components/file-list-with-dates/file-with-date.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"collectionName": "components_file_list_with_dates_file_with_dates",
"info": {
"displayName": "File-with-date",
"icon": "filePdf"
},
"options": {},
"attributes": {
"date": {
"type": "date",
"required": true
},
"file": {
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
}
},
"config": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"x-generation-date": "2025-10-01T08:09:20.342Z"
"x-generation-date": "2026-02-27T11:12:11.224Z"
},
"x-strapi-config": {
"plugins": [
Expand Down Expand Up @@ -12524,6 +12524,12 @@
"example": "string or id"
}
},
"activity_reports": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FileListWithDatesFileWithDateComponent"
}
},
"locale": {
"type": "string"
},
Expand Down Expand Up @@ -15083,6 +15089,12 @@
}
}
},
"activity_reports": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FileListWithDatesFileWithDateComponent"
}
},
"createdAt": {
"type": "string",
"format": "date-time"
Expand Down Expand Up @@ -15239,6 +15251,12 @@
}
}
},
"activity_reports": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FileListWithDatesFileWithDateComponent"
}
},
"createdAt": {
"type": "string",
"format": "date-time"
Expand Down Expand Up @@ -15764,6 +15782,147 @@
}
}
},
"FileListWithDatesFileWithDateComponent": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"date": {
"type": "string",
"format": "date"
},
"file": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"documentId": {
"type": "string"
},
"name": {
"type": "string"
},
"alternativeText": {
"type": "string"
},
"caption": {
"type": "string"
},
"width": {
"type": "integer"
},
"height": {
"type": "integer"
},
"formats": {},
"hash": {
"type": "string"
},
"ext": {
"type": "string"
},
"mime": {
"type": "string"
},
"size": {
"type": "number",
"format": "float"
},
"url": {
"type": "string"
},
"previewUrl": {
"type": "string"
},
"provider": {
"type": "string"
},
"provider_metadata": {},
"related": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"documentId": {
"type": "string"
}
}
}
},
"folder": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"documentId": {
"type": "string"
}
}
},
"folderPath": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"publishedAt": {
"type": "string",
"format": "date-time"
},
"createdBy": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"documentId": {
"type": "string"
}
}
},
"updatedBy": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"documentId": {
"type": "string"
}
}
},
"locale": {
"type": "string"
},
"localizations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"documentId": {
"type": "string"
}
}
}
}
}
}
}
},
"KpiKpiComponent": {
"type": "object",
"properties": {
Expand Down
14 changes: 14 additions & 0 deletions backend/types/generated/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ export interface EditoEdito extends Struct.ComponentSchema {
};
}

export interface FileListWithDatesFileWithDate extends Struct.ComponentSchema {
collectionName: 'components_file_list_with_dates_file_with_dates';
info: {
displayName: 'File-with-date';
icon: 'filePdf';
};
attributes: {
date: Schema.Attribute.Date & Schema.Attribute.Required;
file: Schema.Attribute.Media<'images' | 'files' | 'videos' | 'audios'> &
Schema.Attribute.Required;
};
}

export interface GoalGoal extends Struct.ComponentSchema {
collectionName: 'components_goal_goals';
info: {
Expand Down Expand Up @@ -157,6 +170,7 @@ declare module '@strapi/strapi' {
'call-to-action.call-to-action': CallToActionCallToAction;
'call-to-action.call-to-action-with-image': CallToActionCallToActionWithImage;
'edito.edito': EditoEdito;
'file-list-with-dates.file-with-date': FileListWithDatesFileWithDate;
'goal.goal': GoalGoal;
'hero.hero': HeroHero;
'information.information-block': InformationInformationBlock;
Expand Down
4 changes: 4 additions & 0 deletions backend/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ export interface ApiAboutAbout extends Struct.SingleTypeSchema {
draftAndPublish: true;
};
attributes: {
activity_reports: Schema.Attribute.Component<
'file-list-with-dates.file-with-date',
true
>;
board_of_directors: Schema.Attribute.Relation<
'oneToMany',
'api::volunteer.volunteer'
Expand Down
23 changes: 23 additions & 0 deletions frontend/src/app/[locale]/about/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
PartnersBlock,
Title,
TestimoniesCarousel,
CtaList,
} from '@/components';
import { IMembers } from '@/lib/types';
import { AboutPageData } from './page';
Expand Down Expand Up @@ -84,6 +85,16 @@ function transformMembers({
];
}

function transformActivityReports(
reports: NonNullable<AboutPageData['activity_reports']>
) {
return reports.map(report => ({
id: report.documentId || report.id,
text: new Date(report.date).getFullYear().toString(),
link: report.file?.url || '#',
}));
}

type AboutProps = {
data: AboutPageData;
};
Expand All @@ -100,6 +111,9 @@ export default function AboutPage({ data }: AboutProps) {
strategic_committee: data.strategic_committee,
division_managers: data.division_managers,
});
const activityReports = data.activity_reports
? transformActivityReports(data.activity_reports)
: [];

return (
<>
Expand Down Expand Up @@ -198,6 +212,15 @@ export default function AboutPage({ data }: AboutProps) {
categories={members}
className="my-lg"
/>

{activityReports.length > 0 && (
<div className="container my-lg">
<Title className="mb-md" level={2} hasSeparator variant="medium">
Rapports d'activités
</Title>
<CtaList items={activityReports} />
</div>
)}
</>
);
}
33 changes: 20 additions & 13 deletions frontend/src/app/[locale]/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import AboutPage from './about';
import client from '@/lib/strapi-client';
import { generateMetadataFromSeo } from '@/lib/utils';
import AboutPage from './about';

export async function generateMetadata({
params: { locale },
Expand Down Expand Up @@ -49,15 +48,22 @@ async function fetchAboutPageData() {
scientific_committee: {
populate: "*"
},
strategic_committee: {
populate: "*"
},
division_managers: {
populate: "*"
},
seo_meta: {
populate: "*"
}
strategic_committee: {
populate: "*"
},
division_managers: {
populate: "*"
},
seo_meta: {
populate: "*"
},
activity_reports: {
populate: {
file: {
populate: '*'
}
}
}
}
}
}
Expand All @@ -68,9 +74,10 @@ export type AboutPageData = NonNullable<NonNullable<Awaited<ReturnType<typeof fe


export default async function Page() {
const { data } = await fetchAboutPageData();
const { data, error } = await fetchAboutPageData();

if (!data?.data) {
if (!data?.data) {
console.error(error);
return null;
}

Expand Down
Loading
Loading