Skip to content

Commit 8ba5836

Browse files
committed
feat: enable dynamic year-specific Code of Conduct pages and routing.
1 parent 70b48fd commit 8ba5836

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/config/routeConfig.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ export const generateYearRoutes = (year: string): RouteConfig[] => {
7474
if (yearConfig.sponsorship) {
7575
routesList.push({ path: `/${year}/sponsorship`, component: yearConfig.sponsorship });
7676
}
77+
if (yearConfig.codeOfConduct) {
78+
routesList.push({ path: `/${year}/codeOfConduct`, component: yearConfig.codeOfConduct });
79+
}
7780

7881
return routesList;
7982
};

src/config/yearRoutes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export interface YearRouteComponents {
2121
attendee?: LazyExoticComponent<ComponentType<any>>;
2222
communities?: LazyExoticComponent<ComponentType<any>>;
2323
sponsorship?: LazyExoticComponent<ComponentType<any>>;
24+
codeOfConduct?: LazyExoticComponent<ComponentType<any>>;
2425
}
2526

2627
/**
@@ -41,6 +42,7 @@ export const yearRouteConfigs: Record<string, YearRouteComponents> = {
4142
speakerDetail: LazyComponents.SpeakerDetailContainer2026,
4243
talkDetail: LazyComponents.TalkDetailContainer2026,
4344
sponsorship: LazyComponents.Sponsorship,
45+
codeOfConduct: LazyComponents.CodeOfConduct,
4446
},
4547
"2025": {
4648
home: LazyComponents.HomeWrapper2025,
@@ -58,6 +60,7 @@ export const yearRouteConfigs: Record<string, YearRouteComponents> = {
5860
attendee: LazyComponents.AttendeeInformation2025,
5961
communities: LazyComponents.Communities2025,
6062
sponsorship: LazyComponents.Sponsorship,
63+
codeOfConduct: LazyComponents.CodeOfConduct,
6164
},
6265
"2024": {
6366
home: LazyComponents.HomeWrapper2024,
@@ -75,6 +78,7 @@ export const yearRouteConfigs: Record<string, YearRouteComponents> = {
7578
attendee: LazyComponents.AttendeeInformation2023,
7679
communities: LazyComponents.Communities2023,
7780
sponsorship: LazyComponents.Sponsorship,
81+
codeOfConduct: LazyComponents.CodeOfConduct,
7882
},
7983
"2023": {
8084
home: LazyComponents.Home2023Wrapper,
@@ -92,6 +96,7 @@ export const yearRouteConfigs: Record<string, YearRouteComponents> = {
9296
communities: LazyComponents.Communities2023,
9397
speakerInfo: LazyComponents.SpeakerInformation2023,
9498
sponsorship: LazyComponents.Sponsorship,
99+
codeOfConduct: LazyComponents.CodeOfConduct,
95100
},
96101
};
97102

src/views/CodeOfConduct/CodeOfConduct.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,20 @@ import {
1515
StyledSpeakersSection,
1616
} from "../Speakers/Speakers.style";
1717
import { StyledMarginBottom, StyledTagsWrapper } from "../Talks/Talks.style";
18-
import data from "@data/2024.json";
1918
import { format } from "date-fns";
2019
import { useDocumentTitleUpdater } from "@hooks/useDocumentTitleUpdate";
20+
import { useParams } from "react-router";
21+
import data2023 from "@data/2023.json";
22+
import data2024 from "@data/2024.json";
23+
import data2025 from "@data/2025.json";
24+
import data2026 from "@data/2026.json";
25+
26+
const editions: Record<string, typeof data2026> = {
27+
"2023": data2023,
28+
"2024": data2024,
29+
"2025": data2025,
30+
"2026": data2026,
31+
};
2132

2233
const StyledWaveContainer = styled.div`
2334
background: ${Color.DARK_BLUE};
@@ -78,6 +89,9 @@ const StyleMoreIcon = styled.img`
7889

7990
const CodeOfConduct: FC<React.PropsWithChildren> = () => {
8091
const { width } = useWindowSize();
92+
const { id } = useParams<{ id: string }>();
93+
const edition = id || "2026";
94+
const data = editions[edition] || editions["2026"];
8195

8296
useDocumentTitleUpdater("Code of Conduct", data.edition);
8397

0 commit comments

Comments
 (0)