Skip to content

Commit b7c68f5

Browse files
committed
feat: include hardcoded speaker
Victor Rentea
1 parent 23ecfdb commit b7c68f5

File tree

1 file changed

+102
-79
lines changed

1 file changed

+102
-79
lines changed

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

Lines changed: 102 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -10,98 +10,121 @@ import conferenceData from "../../../../data/2025.json";
1010
import {ROUTE_SPEAKER_DETAIL} from "../../../../constants/routes";
1111
import {useFetchSpeakers} from "../../../Speakers/UseFetchSpeakers";
1212
import * as Sentry from "@sentry/react";
13+
import {ISpeaker} from "../../../../types/speakers";
1314

1415
const StyledSlideImage = styled.img`
15-
display: block;
16-
width: 100%;
17-
aspect-ratio: 1/1;
18-
border-radius: 10px;
16+
display: block;
17+
width: 100%;
18+
aspect-ratio: 1/1;
19+
border-radius: 10px;
1920
`;
2021

2122
const StyledSlideContain = styled.div`
22-
position: absolute;
23-
bottom: 0;
24-
background: ${Color.MAGENTA};
25-
background: linear-gradient(
26-
to bottom,
27-
rgba(255, 0, 0, 0),
28-
${Color.DARK_BLUE}
29-
);
30-
padding: 0.5rem 0.25rem;
31-
min-width: 100%;
23+
position: absolute;
24+
bottom: 0;
25+
background: ${Color.MAGENTA};
26+
background: linear-gradient(
27+
to bottom,
28+
rgba(255, 0, 0, 0),
29+
${Color.DARK_BLUE}
30+
);
31+
padding: 0.5rem 0.25rem;
32+
min-width: 100%;
3233
`;
3334

3435
const StyledSlideText = styled.p`
35-
font-size: 0.875rem;
36-
color: white;
36+
font-size: 0.875rem;
37+
color: white;
3738
`;
3839
const SpeakerSwiper: FC<React.PropsWithChildren<unknown>> = () => {
39-
const { isLoading, data, error } = useFetchSpeakers();
40+
const {isLoading, data, error} = useFetchSpeakers();
4041

41-
const cachedSpeakers = React.useMemo(()=>data?.sort(() => 0.5 - Math.random()).slice(0, 20), [data]);
42+
const victorRentea: ISpeaker = {
43+
id: "1f247b87-4af0-4f70-be44-f139bf3f726a",
44+
fullName: "Victor Rentea",
45+
bio: "Java Champion from Bucharest",
46+
speakerImage: "https://sessionize.com/image/3031-0o0o0-a3r6JkTgm9aUHJXBhbvnWQ.jpg?download=victor-rentea.jpg",
47+
linkedInUrl: {
48+
url: "https://x.com/victorrentea",
49+
linkType: "LinkedIn",
50+
title: "LinkedIn"
51+
},
52+
sessions: [],
53+
twitterUrl: {
54+
url: "https://www.linkedin.com/in/victor-rentea-trainer",
55+
linkType: "Twitter",
56+
title: "Twitter"
57+
},
58+
tagLine: "Java Champion from Bucharest",
59+
};
4260

43-
if (error) {
44-
Sentry.captureException(error);
45-
}
61+
const cachedSpeakers = React.useMemo(() => {
62+
const allSpeakers = data ? [...data, victorRentea] : [victorRentea];
63+
return allSpeakers.sort(() => 0.5 - Math.random()).slice(0, 20);
64+
}, [data]);
4665

47-
return (
48-
<>
49-
{isLoading && <p>Loading</p>}
50-
{conferenceData.carrousel.enabled && cachedSpeakers && (
51-
<Swiper
52-
/*autoplay={{
53-
delay: 5000,
54-
disableOnInteraction: true,
55-
}}*/
56-
slidesPerView={1}
57-
spaceBetween={10}
58-
speed={5000}
59-
parallax={true}
60-
//loop={true}
61-
grabCursor={true}
62-
breakpoints={{
63-
340: {
64-
width: 640,
65-
slidesPerView: 3,
66-
spaceBetween: 10,
67-
},
68-
768: {
69-
width: 768,
70-
slidesPerView: 3,
71-
spaceBetween: 10,
72-
},
73-
1024: {
74-
width: 1024,
75-
slidesPerView: 5,
76-
centeredSlides: true,
77-
spaceBetween: 30,
78-
autoHeight: true,
79-
},
80-
}}
81-
centeredSlides={true}
82-
modules={[/*Autoplay,*/ Parallax]}
83-
className="mySwiper"
84-
>
85-
{cachedSpeakers.map((speaker) => (
86-
<SwiperSlide key={speaker.id}>
87-
<Link
88-
to={`${ROUTE_SPEAKER_DETAIL}/${speaker.id}`}
89-
style={{ textDecoration: "none" }}
90-
>
91-
<StyledSlideImage
92-
src={speaker.speakerImage}
93-
alt={speaker.fullName}
94-
/>
95-
<StyledSlideContain>
96-
<StyledSlideText>{speaker.fullName}</StyledSlideText>
97-
</StyledSlideContain>
98-
</Link>
99-
</SwiperSlide>
100-
))}
101-
</Swiper>
102-
)}
103-
</>
104-
);
66+
if (error) {
67+
Sentry.captureException(error);
68+
}
69+
70+
return (
71+
<>
72+
{isLoading && <p>Loading</p>}
73+
{conferenceData.carrousel.enabled && cachedSpeakers && (
74+
<Swiper
75+
/*autoplay={{
76+
delay: 5000,
77+
disableOnInteraction: true,
78+
}}*/
79+
slidesPerView={1}
80+
spaceBetween={10}
81+
speed={5000}
82+
parallax={true}
83+
//loop={true}
84+
grabCursor={true}
85+
breakpoints={{
86+
340: {
87+
width: 640,
88+
slidesPerView: 3,
89+
spaceBetween: 10,
90+
},
91+
768: {
92+
width: 768,
93+
slidesPerView: 3,
94+
spaceBetween: 10,
95+
},
96+
1024: {
97+
width: 1024,
98+
slidesPerView: 5,
99+
centeredSlides: true,
100+
spaceBetween: 30,
101+
autoHeight: true,
102+
},
103+
}}
104+
centeredSlides={true}
105+
modules={[/*Autoplay,*/ Parallax]}
106+
className="mySwiper"
107+
>
108+
{cachedSpeakers.map((speaker) => (
109+
<SwiperSlide key={speaker.id}>
110+
<Link
111+
to={`${ROUTE_SPEAKER_DETAIL}/${speaker.id}`}
112+
style={{textDecoration: "none"}}
113+
>
114+
<StyledSlideImage
115+
src={speaker.speakerImage}
116+
alt={speaker.fullName}
117+
/>
118+
<StyledSlideContain>
119+
<StyledSlideText>{speaker.fullName}</StyledSlideText>
120+
</StyledSlideContain>
121+
</Link>
122+
</SwiperSlide>
123+
))}
124+
</Swiper>
125+
)}
126+
</>
127+
);
105128
};
106129

107130
export default SpeakerSwiper;

0 commit comments

Comments
 (0)