Skip to content

Commit

Permalink
fix content type (#90)
Browse files Browse the repository at this point in the history
* fix content type

* fix: surveyList type
  • Loading branch information
RenauxLeaInsee authored Nov 29, 2024
1 parent 9d880be commit 5c9be1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
13 changes: 4 additions & 9 deletions src/components/SurveyList/SurveyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ import { fr } from "@codegouvfr/react-dsfr";
import content from "resources/content.json";
import { Card } from "@codegouvfr/react-dsfr/Card";
import { List } from "@mui/material";
import { ContentSurvey } from "types/ContentSurvey";

export const SurveysList = () => {
const { t } = useTranslation("SurveyHomepage");

const surveys = content.specifique
.map(survey => {
return {
titleShort: survey.titleShort,
id: survey.id,
disabledOnWelcomePage: survey.disabledOnWelcomePage,
};
})
.filter(survey => survey.disabledOnWelcomePage !== true);
const surveys: ContentSurvey[] = content.specifique.filter(
survey => survey.disabledOnWelcomePage !== true,
);

return (
<div>
Expand Down
4 changes: 3 additions & 1 deletion src/routes/$survey/resultats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ function Results() {
<section className={fr.cx("fr-col-12", "fr-col-md-6", "fr-pr-md-4w")}>
<h3>{t("some results")}</h3>
<h4>{results.title}</h4>
<img src={`/${results["picture-url"]}`} alt={results.legende} width={"100%"} />
{results["picture-url"] && (
<img src={`/${results["picture-url"]}`} alt={results.legende} width={"100%"} />
)}
<Markdown className="fr-text--sm" content={results.legende} />
</section>
);
Expand Down
3 changes: 2 additions & 1 deletion src/types/ContentSurvey.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export type ContentSurvey = {
id: string;
isSurveyOnline: boolean;
disabledOnWelcomePage?: boolean
messageSurveyOffline: string;
messageInfoSurveyOffline: string;
title: string;
Expand All @@ -14,7 +15,7 @@ export type ContentSurvey = {
resultats: {
title: string;
"menu-title": string;
"picture-url": string;
"picture-url"?: string;
legende: string;
"link-url"?: string;
};
Expand Down

0 comments on commit 5c9be1c

Please sign in to comment.