Skip to content

Commit 9aca883

Browse files
committed
refactor: remove duplicated code. Home wrapper
1 parent 39d3559 commit 9aca883

File tree

16 files changed

+107
-580
lines changed

16 files changed

+107
-580
lines changed

package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"react-cookie-consent": "^9.0.0",
2626
"react-countdown": "^2.3.6",
2727
"react-dom": "^18.3.1",
28+
"react-error-boundary": "^5.0.0",
2829
"react-query": "^3.39.2",
2930
"react-router-dom": "^7.3.0",
3031
"react-scripts": "5.0.1",

src/2023/Home/Home2023Wrapper.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { BIG_BREAKPOINT } from "../../constants/BreakPoints";
22
import React, { FC } from "react";
33
import Faqs from "./components/Faqs/Faqs";
44
import Home from "./components/Home/Home";
5-
import SpeakersCarousel from "./components/SpeakersCarousel/SpeakersCarousel";
65
import Sponsors from "./components/Sponsors/Sponsors";
76
import styled from "styled-components";
87
import data from "../../data/2023.json";
98
import { useLocation } from "react-router";
109
import { useDocumentTitleUpdater } from "../../services/useDocumentTitleUpdate";
10+
import SpeakersCarousel from "../../components/Swiper/SpeakersCarousel";
11+
import {ROUTE_2023_SPEAKERS} from "../../constants/routes";
1112

1213
const StyledContainer = styled.div`
1314
padding-bottom: 10rem;
@@ -32,7 +33,7 @@ export const Home2023Wrapper: FC<React.PropsWithChildren<unknown>> = () => {
3233
<StyledContainer id="home-wrapper">
3334
<Home />
3435
<Faqs />
35-
<SpeakersCarousel />
36+
<SpeakersCarousel speakersLink={ROUTE_2023_SPEAKERS} sessionizeUrl={data.sessionizeUrl} />
3637
<Sponsors />
3738
</StyledContainer>
3839
);

src/2023/Home/components/SpeakersCarousel/SpeakerSwiper.tsx

Lines changed: 0 additions & 130 deletions
This file was deleted.

src/2023/Workshops/Workshops2023.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import LessThanDarkBlueIcon from "../../assets/images/LessThanDarkBlueIcon.svg";
1212
import TitleSection from "../../components/SectionTitle/TitleSection";
1313
import MoreThanBlueIcon from "../../assets/images/MoreThanBlueIcon.svg";
1414
import { useFetchTalks } from "../Talks/UseFetchTalks";
15-
import { TalkCard } from "../Talks/components/TalkCard";
1615
import conferenceData from "../../data/2023.json";
1716
import styled from "styled-components";
1817
import { BIG_BREAKPOINT } from "../../constants/BreakPoints";
1918
import { useSentryErrorReport } from "../../services/useSentryErrorReport";
2019
import { useDocumentTitleUpdater } from "../../services/useDocumentTitleUpdate";
20+
import {TalkCard} from "../../components/Talk/TalkCard";
2121

2222
const StyledSection = styled.section`
2323
{

src/2024/HomeWrapper2024.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
import React, { FC, useState } from "react";
1+
import React, { FC } from "react";
22
import styled from "styled-components";
33

44
import { useLocation } from "react-router";
55
import { BIG_BREAKPOINT } from "../constants/BreakPoints";
6-
7-
import { useEventEdition } from "../views/Home/UseEventEdition";
6+
import conferenceData from "../data/2024.json";
87
import Faqs from "../views/Home/components/Faqs/Faqs";
98

109
import Home from "./Home/Home";
11-
import SpeakersCarousel from "./SpeakersCarousel/SpeakersCarousel";
1210
import Sponsors from "./Sponsors/Sponsors";
13-
14-
import { Edition } from "../types/types";
1511
import { useDocumentTitleUpdater } from "../services/useDocumentTitleUpdate";
12+
import SpeakersCarousel from "../components/Swiper/SpeakersCarousel";
13+
import { ROUTE_2024_SPEAKERS } from "../constants/routes";
1614

1715
const StyledContainer = styled.div`
1816
padding-bottom: 10rem;
@@ -24,23 +22,24 @@ const StyledContainer = styled.div`
2422

2523
export const HomeWrapper2024: FC<React.PropsWithChildren<unknown>> = () => {
2624
const { hash } = useLocation();
27-
const [edition, setEdition] = useState<Edition>();
2825

29-
useEventEdition(setEdition);
3026
React.useEffect(() => {
3127
if (hash != null && hash !== "") {
3228
const scroll = document.getElementById(hash.substring(1));
3329
scroll?.scrollIntoView();
3430
}
35-
}, [hash, edition]);
31+
}, [hash]);
3632

37-
useDocumentTitleUpdater("Home", edition?.edition ?? "2024");
33+
useDocumentTitleUpdater("Home", conferenceData.edition);
3834

3935
return (
4036
<StyledContainer id="home-wrapper">
4137
<Home />
4238
<Faqs />
43-
<SpeakersCarousel />
39+
<SpeakersCarousel
40+
speakersLink={ROUTE_2024_SPEAKERS}
41+
sessionizeUrl={conferenceData.sessionizeUrl}
42+
/>
4443
<Sponsors />
4544
</StyledContainer>
4645
);

0 commit comments

Comments
 (0)