11import { getCurrentYear } from "~/modules/domain" ;
22import { api , HydrateClient } from "~/trpc/server" ;
33
4- import { ActiveYearForm } from "./ActiveYearForm" ;
54import { CampaignDeadlinesForm } from "./CampaignDeadlinesForm" ;
65
76/**
8- * Backoffice page to edit global platform variables: active campaign year
9- * and per-year campaign deadlines (GIP publication, campaign start, CSE and
10- * declaration deadlines) .
7+ * Backoffice page to edit per-year campaign deadlines (GIP publication,
8+ * campaign start, CSE and declaration deadlines). The active campaign year is
9+ * now deduced from the `campaignStartDate` field and no longer edited here .
1110 */
1211export async function AdminSettingsPage ( ) {
1312 const overview = await api . adminSettings . getOverview ( ) ;
14- const fallbackYear = getCurrentYear ( ) ;
15- const initialYear = overview . activeCampaignYear ?? fallbackYear ;
13+ const initialYear = overview . configuredYears . at ( - 1 ) ?? getCurrentYear ( ) ;
1614
1715 return (
1816 < HydrateClient >
@@ -22,17 +20,7 @@ export async function AdminSettingsPage() {
2220 les campagnes de déclaration.
2321 </ p >
2422
25- < section aria-labelledby = "active-year-heading" className = "fr-mt-4w" >
26- < h2 className = "fr-h3" id = "active-year-heading" >
27- Année de campagne active
28- </ h2 >
29- < ActiveYearForm
30- fallbackYear = { fallbackYear }
31- initialActiveYear = { overview . activeCampaignYear }
32- />
33- </ section >
34-
35- < section aria-labelledby = "deadlines-heading" className = "fr-mt-6w" >
23+ < section aria-labelledby = "deadlines-heading" className = "fr-mt-4w" >
3624 < h2 className = "fr-h3" id = "deadlines-heading" >
3725 Échéances de campagne
3826 </ h2 >
0 commit comments