Skip to content

Commit

Permalink
feat: using stream modifier to show title
Browse files Browse the repository at this point in the history
  • Loading branch information
martinheidegger committed Oct 25, 2024
1 parent a1ac2aa commit e35e99d
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 10 deletions.
42 changes: 40 additions & 2 deletions 2024/src/data/talks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@
startsAt: "10:00"
endsAt: "10:10"
track: B
kind: OPENING_TALK_STREAM
kind: STREAM
stream: A
youtube: ""
- date: day1
startsAt: "10:00"
endsAt: "10:10"
track: C
kind: OPENING_TALK_STREAM
kind: STREAM
stream: A
youtube: ""
- uuid: sahil-khokhar
date: day1
Expand Down Expand Up @@ -426,6 +428,18 @@
speakerIDs: []
sponsorIDs: [] # TODO: Add sponsor IDs
youtube: ""
- date: day1
startsAt: "16:40"
endsAt: "17:40"
track: B
kind: STREAM
stream: A
- date: day1
startsAt: "16:40"
endsAt: "17:40"
track: C
kind: STREAM
stream: A
- date: day1
startsAt: "17:40"
endsAt: "17:50"
Expand All @@ -449,13 +463,37 @@
speakerIDs: []
sponsorIDs: []
youtube: ""
- date: day1
startsAt: "17:50"
endsAt: "18:30"
track: B
kind: STREAM
stream: A
- date: day1
startsAt: "17:50"
endsAt: "18:30"
track: C
kind: STREAM
stream: A
- uuid: day1-
date: day1
startsAt: "18:30"
endsAt: "18:40"
track: A
kind: CLOSING_TALK
youtube: ""
- date: day1
startsAt: "18:30"
endsAt: "18:40"
track: B
kind: STREAM
stream: A
- date: day1
startsAt: "18:30"
endsAt: "18:40"
track: C
kind: STREAM
stream: A
- uuid: day1-
date: day1
startsAt: "18:40"
Expand Down
3 changes: 2 additions & 1 deletion 2024/src/data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type TalkType = {
kind:
| "OPEN"
| "OPENING_TALK"
| "OPENING_TALK_STREAM"
| "STREAM"
| "TALK"
| "BREAK"
| "CLOSING_TALK"
Expand All @@ -19,6 +19,7 @@ export type TalkType = {
speakerIDs: string[]
sponsorIDs: string[]
date: "day1"
stream?: Rooms
startsAt: string
endsAt: string
hiddenTimeBoxes: string[] | null
Expand Down
5 changes: 5 additions & 0 deletions 2024/src/gatsby-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2175,6 +2175,7 @@ type Query_talksYamlArgs = {
spokenLanguage: InputMaybe<StringQueryOperatorInput>;
sponsorIDs: InputMaybe<StringQueryOperatorInput>;
startsAt: InputMaybe<StringQueryOperatorInput>;
stream: InputMaybe<StringQueryOperatorInput>;
title: InputMaybe<StringQueryOperatorInput>;
titleJa: InputMaybe<StringQueryOperatorInput>;
track: InputMaybe<StringQueryOperatorInput>;
Expand Down Expand Up @@ -3353,6 +3354,7 @@ type TalksYaml = Node & {
readonly spokenLanguage: Maybe<Scalars['String']>;
readonly sponsorIDs: Maybe<ReadonlyArray<Maybe<Scalars['String']>>>;
readonly startsAt: Maybe<Scalars['String']>;
readonly stream: Maybe<Scalars['String']>;
readonly title: Maybe<Scalars['String']>;
readonly titleJa: Maybe<Scalars['String']>;
readonly track: Maybe<Scalars['String']>;
Expand Down Expand Up @@ -3421,6 +3423,7 @@ type TalksYamlFieldSelector = {
readonly spokenLanguage: InputMaybe<FieldSelectorEnum>;
readonly sponsorIDs: InputMaybe<FieldSelectorEnum>;
readonly startsAt: InputMaybe<FieldSelectorEnum>;
readonly stream: InputMaybe<FieldSelectorEnum>;
readonly title: InputMaybe<FieldSelectorEnum>;
readonly titleJa: InputMaybe<FieldSelectorEnum>;
readonly track: InputMaybe<FieldSelectorEnum>;
Expand All @@ -3444,6 +3447,7 @@ type TalksYamlFilterInput = {
readonly spokenLanguage: InputMaybe<StringQueryOperatorInput>;
readonly sponsorIDs: InputMaybe<StringQueryOperatorInput>;
readonly startsAt: InputMaybe<StringQueryOperatorInput>;
readonly stream: InputMaybe<StringQueryOperatorInput>;
readonly title: InputMaybe<StringQueryOperatorInput>;
readonly titleJa: InputMaybe<StringQueryOperatorInput>;
readonly track: InputMaybe<StringQueryOperatorInput>;
Expand Down Expand Up @@ -3512,6 +3516,7 @@ type TalksYamlSortInput = {
readonly spokenLanguage: InputMaybe<SortOrderEnum>;
readonly sponsorIDs: InputMaybe<SortOrderEnum>;
readonly startsAt: InputMaybe<SortOrderEnum>;
readonly stream: InputMaybe<SortOrderEnum>;
readonly title: InputMaybe<SortOrderEnum>;
readonly titleJa: InputMaybe<SortOrderEnum>;
readonly track: InputMaybe<SortOrderEnum>;
Expand Down
2 changes: 1 addition & 1 deletion 2024/src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const en = {
"〒210-0024 27-7-903 Nisshincho Kawasaki-ku Kawasaki-shi Kanagawa",
"talk.open": "Doors Open",
"talk.opening talk": "Opening Talk",
"talk.opening talk stream": "Opening Talk (Stream)",
"talk.stream": " (Stream)",
"talk.Break": "Break",
"talk.closing talk": "Closing Talk",
"talk.party": "Party",
Expand Down
3 changes: 2 additions & 1 deletion 2024/src/i18n/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const ja: {
"jna-address": "〒210-0024 神奈川県川崎市川崎区日進町27-7-903",
"talk.open": "開場",
"talk.opening talk": "オープニング/開場説明",
"talk.opening talk stream": "オープニング/開場説明 ストリーム",
"talk.opening talk stream": "オープニング/開場説明",
"talk.stream": " ストリーム",
"talk.Break": "休憩",
"talk.closing talk": "クロージング",
"talk.party": "懇親会",
Expand Down
27 changes: 22 additions & 5 deletions 2024/src/pages/schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Breadcrumb } from "../components/Breadcrumb"
import { EventTime } from "../components/EventTime"
import { EventSpeakers } from "../components/EventSpeakers"
import { RoomLegend } from "../components/RoomLegend"
import { TalkType, SpeakerType } from "../data/types"
import { TalkType, SpeakerType, Session } from "../data/types"
import { generateTimetable } from "../util/generateTimetable"
import { rangeTimeBoxes, escapeTime } from "../util/rangeTimeBoxes"
import { Dates, times, Rooms, rooms } from "../util/misc"
Expand Down Expand Up @@ -212,6 +212,7 @@ export default function SchedulePage() {
startsAt
endsAt
track
stream
date
}
}
Expand Down Expand Up @@ -245,16 +246,32 @@ export default function SchedulePage() {
window.scrollTo({ top })
}, [])

function getSessionName(talk: TalkType) {
function getStreamSession(
talk: TalkType,
sessions: Session[],
): string | undefined {
const session = sessions.find(
session =>
session.date === talk.date &&
session.startsAt === talk.startsAt &&
session.track === talk.stream,
)
if (!session) {
return
}
return getSessionName(session, sessions)
}

function getSessionName(talk: TalkType, sessions: Session[]): string {
switch (talk.kind) {
case "OPEN": {
return i18n.t("talk.open")
}
case "OPENING_TALK": {
return i18n.t("talk.opening talk")
}
case "OPENING_TALK_STREAM": {
return i18n.t("talk.opening talk stream")
case "STREAM": {
return `${getStreamSession(talk, sessions) ?? "???"}${i18n.t("talk.stream")}`
}
case "BREAK": {
return i18n.t("talk.Break")
Expand Down Expand Up @@ -318,7 +335,7 @@ export default function SchedulePage() {
<AreaTitle>
<EventTime session={s} />
</AreaTitle>
<Text>{getSessionName(s)}</Text>
<Text>{getSessionName(s, sessions)}</Text>
<EventSpeakers session={s} />

<AreaFooter>
Expand Down

0 comments on commit e35e99d

Please sign in to comment.