Skip to content

Commit 5121ff4

Browse files
committed
feat: show community description from speaker info
1 parent 0bff5e4 commit 5121ff4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/components/home/CourseModal.astro

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,17 @@ import type { Course } from "../../types/schedule";
411411
}
412412
if (speakerDescriptionEl) {
413413
speakerDescriptionEl.style.display = "block";
414-
if (course.expo && Array.isArray(course.expo) && course.expo.length > 0) {
415-
const boothList = course.expo.map(booth => `<li>${booth}</li>`).join("");
416-
speakerDescriptionEl.innerHTML = `<ul style="list-style-type: disc; padding-left: 1.5rem; line-height: 1.6;">${boothList}</ul>`;
414+
speakerDescriptionEl.innerHTML = "";
415+
416+
// Get speaker data from the speakers array using speaker IDs
417+
const speakers = course.speakers
418+
?.map(speakerId => scheduleData.speakers.find(speaker => speaker.id === speakerId))
419+
.filter(speaker => speaker !== undefined) as Speaker[];
420+
421+
const speakersWithDesc = speakers?.filter(speaker => speaker.zh.bio && speaker.zh.bio.trim() !== "") || [];
422+
423+
if (speakersWithDesc.length > 0) {
424+
speakerDescriptionEl.innerHTML = renderMarkdown(speakersWithDesc[0].zh.bio);
417425
} else {
418426
speakerDescriptionEl.innerHTML = "暫無攤位資訊";
419427
}

0 commit comments

Comments
 (0)