-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: activité inconnue () * fix: MultChoice * feat: create dedicated pages for modifications
- Loading branch information
Showing
13 changed files
with
192 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { Metadata } from 'next'; | ||
import Breadcrumb from '#components-ui/breadcrumb'; | ||
import ButtonLink from '#components-ui/button'; | ||
import TextWrapper from '#components-ui/text-wrapper'; | ||
import { | ||
allDataToModify, | ||
getDataToModify, | ||
} from '#models/administrations/data-to-modify'; | ||
import { AppRouterProps } from '#utils/server-side-helper/app/extract-params'; | ||
import { redirectFAQPageNotFound } from '#utils/server-side-helper/app/redirect-faq-not-found'; | ||
|
||
type IParams = { | ||
slug: string; | ||
}; | ||
|
||
export default async function FAQArticle(props: AppRouterProps) { | ||
const dataToModify = getDataToModify(props.params.slug); | ||
if (!dataToModify) { | ||
return redirectFAQPageNotFound(props.params.slug); | ||
} | ||
return ( | ||
<> | ||
<TextWrapper> | ||
<Breadcrumb | ||
links={[ | ||
{ href: '/faq', label: 'Questions fréquentes' }, | ||
{ href: '/faq', label: 'Comment modifier ces informations' }, | ||
|
||
{ href: '', label: dataToModify.label }, | ||
]} | ||
/> | ||
<h1> | ||
Comment modifier : “<strong>{dataToModify.label}</strong>” ? | ||
</h1> | ||
<p></p> | ||
<p>Ces informations proviennent de :</p> | ||
<ul> | ||
<li> | ||
Source de la donnée :{' '} | ||
<a href={dataToModify.datagouvLink}>{dataToModify.dataSource}</a> | ||
</li> | ||
<li> | ||
Service responsable :{' '} | ||
<a href={dataToModify.site}>{dataToModify.long}</a>. | ||
</li> | ||
</ul> | ||
{dataToModify.form ? ( | ||
<> | ||
<p>Cette administration propose une démarche en ligne :</p> | ||
<ButtonLink to={dataToModify.form}> | ||
Accéder à la démarche en ligne | ||
</ButtonLink> | ||
</> | ||
) : ( | ||
<> | ||
<br /> | ||
<ButtonLink to={dataToModify.contact}> | ||
Contacter le service ({dataToModify.short}) | ||
</ButtonLink> | ||
</> | ||
)} | ||
|
||
<h2>Vous ne trouvez pas votre réponse ?</h2> | ||
<div className="layout-left"> | ||
<ButtonLink to="/faq" alt small> | ||
Consultez notre FAQ | ||
</ButtonLink> | ||
</div> | ||
</TextWrapper> | ||
</> | ||
); | ||
} | ||
|
||
export async function generateStaticParams(): Promise<Array<IParams>> { | ||
return allDataToModify | ||
.filter(({ slug }) => !!slug) | ||
.map(({ slug }) => { | ||
return { | ||
slug, | ||
}; | ||
}); | ||
} | ||
|
||
export const generateMetadata = function (props: AppRouterProps): Metadata { | ||
const dataToModify = getDataToModify(props.params.slug); | ||
if (!dataToModify) { | ||
return redirectFAQPageNotFound(props.params.slug); | ||
} | ||
return { | ||
title: dataToModify.label, | ||
robots: 'index, follow', | ||
alternates: { | ||
canonical: `https://annuaire-entreprises.data.gouv.fr/faq/modifier/${dataToModify.slug}`, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
app/(header-default)/faq/parcours/_components/parcours-questions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { slugify } from '#utils/helpers'; | ||
import { administrationsMetaData } from '.'; | ||
|
||
const loadDataToModify = () => { | ||
return Object.values(administrationsMetaData).flatMap( | ||
({ dataSources, contact, site, long, short }) => { | ||
return dataSources.flatMap((datasource) => { | ||
return (datasource.data || []).map( | ||
({ label, form = '', targets = [] }) => { | ||
const slug = slugify(label); | ||
return { | ||
label: label, | ||
slug, | ||
dataSource: datasource.label, | ||
datagouvLink: datasource.datagouvLink, | ||
targets, | ||
form, | ||
contact, | ||
site, | ||
long, | ||
short, | ||
}; | ||
} | ||
); | ||
}); | ||
} | ||
); | ||
}; | ||
|
||
export const getDataToModify = (slug: string) => { | ||
return allDataToModify.find((data) => data.slug === slug); | ||
}; | ||
|
||
export const allDataToModify = loadDataToModify(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.