Skip to content

Commit

Permalink
Merge pull request #11 from lego37yoon/main
Browse files Browse the repository at this point in the history
주요 연사 추가
  • Loading branch information
sukso96100 authored Jun 20, 2024
2 parents 299d4e7 + 77a0402 commit 84c9b8d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/CommitteeMembers.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Col, Row } from "@canonical/react-components";
<img
src={member.profileImageUrl}
class="p-media-object__image is-round"
alt={member.name}
alt=""
/>
<div class="p-media-object__details">
<h4>{member.name}</h4>
Expand Down
55 changes: 43 additions & 12 deletions src/components/FeaturedSpeakers.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,66 @@ import eventLogo from "@assets/logo.svg";
import { useTranslations, getLangFromUrl } from "@i18n/utils";
const lang = getLangFromUrl(Astro.url);
const t = useTranslations(lang);
const indicoResponse = await fetch(config.featuredSpeakers.indicoExportUrl);
const indicoResJson = await indicoResponse.json();
const sessions = indicoResJson.results
? indicoResJson.results[0].contributions
: null;
const featuredSessions = sessions.filter((session: any) =>
config.featuredSpeakers.contributionIds.includes(session.friendly_id),
config.featuredSpeakers.contributionIds.includes(session.friendly_id)
);
const featuredSpeakers = [];
for (const session of featuredSessions) {
for (const speaker of session.speakers) {
const imgId = config.featuredSpeakers.speakerIds.find(
(user) => speaker.db_id === user.db_id
);
featuredSpeakers.push({
name: speaker.fullName.split(",").join(" "),
profileImg: imgId?.user,
title: session.title,
url: session.url
})
}
}
// Keynote 관련 하드코딩
featuredSpeakers.push({
name: "Utkarsh Gupta",
title: "Keynote",
url: ""
})
---

{featuredSessions.length <= 0 ? "":
{featuredSpeakers.length <= 0 ? "":
<Strip bordered>
<h4>{t("featured.title")}</h4>
<h2 class="p-heading--4">{t("featured.title")}</h2>
<Row>
{
featuredSessions.map((session: any) => (
featuredSpeakers.map((speaker) => (
<Col size={4} medium={3}>
<div class="p-media-object--large">
<img
src={eventLogo.src}
class="p-media-object__image"
src={speaker.profileImg ?
`https://events.canonical.com/user/${speaker.profileImg}/picture-default`
: eventLogo.src
}
onerror={`this.onerror=null;this.src=${eventLogo.src}`}
class="p-media-object__image is-round"
alt=""
loading="lazy"
/>
<div class="p-media-object__details">
<a href={session.url}>
<h4 class="p-media-object__title">
{session.speakers[0].fullName}
</h4>
<a href={speaker.url}>
<h3>
{speaker.name}
</h3>
</a>
<p class="p-media-object__content">
{session.title}
{speaker.title}
</p>
<ul class="p-media-object__meta-list" />
</div>
Expand All @@ -46,7 +75,9 @@ const featuredSessions = sessions.filter((session: any) =>
</Row>
<Row>
<Col size={12}>
<a href="" class="p-button">{t("featured.more")}</a>
<a href="https://events.canonical.com/event/48/contributions/" target="_blank" class="p-button">
{t("featured.more")}
</a>
</Col>
</Row>
</Strip>
Expand Down
3 changes: 2 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export const config = {
},
featuredSpeakers: {
indicoExportUrl: "https://events.canonical.com/export/event/48.json?detail=contributions&occ=yes&pretty=yes",
contributionIds: [22, 5, 19, 16, 8, 4]
contributionIds: [7, 21, 10],
speakerIds: [{ db_id: 562, user: 1624 }, { db_id: 525, user: 2692 }, { db_id: 524, user: 2699 }, { db_id: 526, user: 2658 }]
},
cityBanner: {
title: "cityBanner.title",
Expand Down

0 comments on commit 84c9b8d

Please sign in to comment.