-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#74 introduced FullEvent.lineupSpeakers aimed at being able to list s…
…peakers even when we don't have any schedule yet
- Loading branch information
Showing
12 changed files
with
103 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,57 @@ | ||
import { ListableEvent } from "../../../../shared/event-list.firestore"; | ||
import {BreakTimeSlot, DailySchedule, DetailedTalk, Talk} from "../../../../shared/daily-schedule.firestore"; | ||
import { | ||
BreakTimeSlot, | ||
DailySchedule, | ||
DetailedTalk, | ||
} from "../../../../shared/daily-schedule.firestore"; | ||
import {ConferenceDescriptor} from "../../../../shared/conference-descriptor.firestore"; | ||
import {Replace} from "../../../../shared/type-utils"; | ||
import {LineupSpeaker} from "../../../../shared/event-lineup.firestore"; | ||
import {match, P} from "ts-pattern"; | ||
|
||
export type BreakTimeslotWithPotentiallyUnknownIcon = Replace<BreakTimeSlot, { | ||
break: Replace<BreakTimeSlot['break'], { | ||
icon: BreakTimeSlot['break']['icon'] | 'unknown' | ||
}> | ||
}> | ||
|
||
export interface FullEvent { | ||
export type FullEvent = { | ||
id: string, | ||
conferenceDescriptor: Omit<ConferenceDescriptor, "eventFamily"|"eventName"|"websiteUrl"|"visibility"|"spaceToken">, | ||
info: Omit<ListableEvent, "eventFamily"|"eventName"|"websiteUrl"|"visibility"|"spaceToken">, | ||
daySchedules: DailySchedule[], | ||
talks: DetailedTalk[], | ||
lineupSpeakers: LineupSpeaker[], | ||
} | ||
|
||
export function detailedTalksToSpeakersLineup(talks: DetailedTalk[]): LineupSpeaker[] { | ||
return talks.reduce((speakers, talk) => { | ||
talk.speakers.forEach(speaker => { | ||
const lineupSpeaker = match(speakers.find(lineupSpeaker => lineupSpeaker.id === speaker.id)) | ||
.with(P.not(P.nullish), lineupSpeaker => lineupSpeaker) | ||
.otherwise(() => { | ||
const newLineupSpeaker: LineupSpeaker = { | ||
...speaker, | ||
talks: [] | ||
} | ||
speakers.push(newLineupSpeaker); | ||
return newLineupSpeaker; | ||
}) | ||
|
||
lineupSpeaker.talks.push({ | ||
id: talk.id, | ||
title: talk.title, | ||
format: talk.format, | ||
language: talk.language, | ||
track: talk.track, | ||
tags: talk.tags, | ||
allocation: { | ||
room: talk.room, | ||
start: talk.start, | ||
end: talk.end, | ||
}, | ||
}) | ||
}) | ||
return speakers; | ||
}, [] as LineupSpeaker[]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {Room, Speaker, TalkAsset, TalkFormat, Track} from "./daily-schedule.firestore"; | ||
import type {ISODatetime} from "./type-utils"; | ||
|
||
export type LineupTalk = { | ||
id: string, | ||
title: string, | ||
format: TalkFormat, | ||
language: string, | ||
track: Track, | ||
tags: string[], | ||
allocation: { | ||
room: Room, | ||
start: ISODatetime, | ||
end: ISODatetime, | ||
}|undefined, | ||
} | ||
|
||
export type LineupSpeaker = Speaker & { | ||
talks: LineupTalk[], | ||
} |