Skip to content

Commit f5441c9

Browse files
committed
Fixed Speaker detail, Added missing details of speaker
1 parent 6cc7714 commit f5441c9

11 files changed

Lines changed: 171 additions & 206 deletions

File tree

.idea/copilotDiffState.xml

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

.idea/workspace.xml

Lines changed: 2 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
736 KB
Loading
106 KB
Loading

src/app/[lang]/speakers/[slug]/page.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { getTranslations } from 'next-intl/server';
22
import SpeakerInfo from '@/components/elements/SpeakerInfo';
33
import { notFound } from 'next/navigation';
4-
import { locales } from '@/i18n';
54

65
export default async function SpeakerPage({ params }) {
76
const { lang, slug } = await params;
@@ -15,21 +14,17 @@ export default async function SpeakerPage({ params }) {
1514

1615
// Get sessions data from translations
1716
const sessions = Array.isArray(s.raw('sessions')) ? s.raw('sessions') : [];
18-
const speakerSessions = sessions.filter((session) =>
19-
session.speakerUUID.includes(speaker?.uuid)
20-
);
17+
const speakerSessions = sessions.filter((session) => session.speakerUUID.includes(speaker?.uuid));
2118

2219
if (!speaker && !speakerSessions) {
2320
notFound();
2421
}
2522

26-
return (
27-
<SpeakerInfo
23+
return (<SpeakerInfo
2824
speaker={speaker}
2925
speakerSessions={speakerSessions}
3026
locale={lang}
31-
/>
32-
);
27+
/>);
3328
}
3429

3530
export async function generateStaticParams({ params }) {
Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use client';
22
import { useTranslations } from 'next-intl';
3+
import PillButton from '@/components/elements/PillButton';
34

45
export const SessionInfo = ({ session, index }) => {
56
// Get schedule data from translations
@@ -13,9 +14,7 @@ export const SessionInfo = ({ session, index }) => {
1314
// Loop through each track (e.g., "The Workshop Hub") in your schedule.
1415
for (const track of tracks) {
1516
// Inside each track, find the session that matches the current session's UUID.
16-
const sessionInTrack = track.sessions.find(
17-
(s) => s.sessionUUID === session.uuid
18-
);
17+
const sessionInTrack = track.sessions.find((s) => s.sessionUUID === session.uuid);
1918

2019
// If a match is found, store its room name and time, then stop looping.
2120
if (sessionInTrack) {
@@ -31,22 +30,26 @@ export const SessionInfo = ({ session, index }) => {
3130
return null;
3231
}
3332

34-
return (
35-
<div key={session.uuid} id="sessionDetails" className="prose">
36-
<h3 className="text-[min(7vw,25px)] leading-[1.3] tracking-tight font-semibold text-[#2480F0] mt-6 mb-0">
37-
{session.title}
38-
</h3>
39-
<div className="flex mb-2">
40-
{/*Temporary comment*/}
41-
<p className="text-gray-600 mt-2 mb-2 text-sm font-semibold ">
42-
{roomName} ({timeString})
43-
</p>
44-
</div>
45-
<div className="prose lg:prose-base">
46-
{session.description.split('\n').map((paragraph, index) => (
47-
<p key={index}>{paragraph}</p>
48-
))}
49-
</div>
33+
return (<div key={session.uuid} id="sessionDetails" className="prose">
34+
<h3 className="text-[min(7vw,25px)] leading-[1.3] tracking-tight font-semibold text-[#2480F0] mt-6 mb-0">
35+
{session.title}
36+
</h3>
37+
<div className="flex mb-2">
38+
{/*Temporary comment*/}
39+
<p className="text-gray-600 mt-2 mb-2 text-sm font-semibold ">
40+
{roomName} ({timeString})
41+
</p>
5042
</div>
51-
);
43+
<div className="prose lg:prose-base">
44+
{session.description.split('\n').map((paragraph, index) => (<p key={index}>{paragraph}</p>))}
45+
</div>
46+
{session.rsvpLink && (<div className="mt-4">
47+
<PillButton
48+
className="my-6 flex no-underline"
49+
label={session.rsvpButtonText}
50+
href={session.rsvpLink}
51+
/>
52+
53+
</div>)}
54+
</div>);
5255
};

src/i18n/request.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,24 @@ export async function loadTranslations(locale, namespaces) {
2626
messages[ns] = data;
2727
} catch (error) {
2828
throw new Error(
29-
`Failed to load translations for locale "${locale}": ${error.message || String(error)}`
29+
`Failed to load translations for locale "${locale}": ${error.message || String(error)}`,
3030
);
3131
}
3232
}
3333
return messages;
3434
}
3535

3636
export default getRequestConfig(async ({ requestLocale }) => {
37-
let locale = requestLocale;
38-
if (!locales.includes(locale)) {
39-
locale = defaultLocale; // Fallback to 'en' if invalid
37+
let locale = await requestLocale;
38+
39+
if (!locale || !locales.includes(locale)) {
40+
locale = defaultLocale;
4041
}
42+
4143
try {
4244
const messages = await loadTranslations(locale, namespaces);
4345

46+
4447
return {
4548
locale,
4649
messages,
@@ -50,10 +53,8 @@ export default getRequestConfig(async ({ requestLocale }) => {
5053
locales,
5154
};
5255
} catch (error) {
53-
// This catches any error (string, object, etc.) and re-throws it
54-
// as a proper Error instance, which fixes the build.
5556
throw new Error(
56-
`Failed to load translations for locale "${locale}": ${error.message || String(error)}`
57+
`Failed to load translations for locale "${locale}": ${error.message || String(error)}`,
5758
);
5859
}
5960
});

0 commit comments

Comments
 (0)