Skip to content

Commit

Permalink
#13 re-introduced infos tab, based on some conf descriptor new configs
Browse files Browse the repository at this point in the history
  • Loading branch information
fcamblor committed Oct 1, 2023
1 parent 2701363 commit a6900fb
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 133 deletions.
45 changes: 32 additions & 13 deletions cloud/functions/src/crawlers/crawler-parsers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {z, ZodLiteral} from "zod";
import {ISODatetime, ISOLocalDate} from "../../../../shared/type-utils";
import {ISODatetime, ISOLocalDate, SocialMediaType} from "../../../../shared/type-utils";
import {ConferenceDescriptor} from "../../../../shared/conference-descriptor.firestore";


Expand Down Expand Up @@ -53,6 +53,19 @@ export const EVENT_THEME_PARSER = z.object({
})
})

export const SOCIAL_MEDIA_TYPE = z.union([
z.literal('website'),
z.literal('twitter'),
z.literal('linkedin'),
z.literal('mastodon'),
z.literal('instagram'),
z.literal('youtube'),
z.literal('twitch'),
z.literal('github'),
z.literal('facebook'),
z.literal('flickr'),
])

export const LISTABLE_EVENT_PARSER = z.object({
id: z.string(),
title: z.string(),
Expand All @@ -71,12 +84,21 @@ export const LISTABLE_EVENT_PARSER = z.object({
theming: EVENT_THEME_PARSER,
})

export const INFOS_PARSER = z.object({
venuePicture: z.string(),
eventDescription: z.string(),
plans: z.array(z.object({
title: z.string(), pictureUrl: z.string()
})).optional()
});

export const EVENT_DESCRIPTOR_PARSER = LISTABLE_EVENT_PARSER.extend({
headingTitle: z.string(),
features: z.object({
roomsDisplayed: z.boolean(),
favoritesEnabled: z.boolean(),
remindMeOnceVideosAreAvailableEnabled: z.boolean(),
showInfosTab: z.boolean().optional(),
// for multi-lang conferences, where we want to hide "default" (implicit) conference lang (ex: in devoxxfr, we'd hide FR)
hideLanguages: z.array(z.string()),
ratings: z.object({
Expand Down Expand Up @@ -121,10 +143,14 @@ export const EVENT_DESCRIPTOR_PARSER = LISTABLE_EVENT_PARSER.extend({
talkTracks: z.array(THEMABLE_TALK_TRACK_PARSER),
supportedTalkLanguages: z.array(THEMABLE_LANGUAGE_PARSER),
rooms: z.array(ROOM_PARSER),
infos: z.object({
venuePicture: z.string(),
eventDescription: z.string()
})
infos: INFOS_PARSER,
socialMedias: z.array(z.object({
type: SOCIAL_MEDIA_TYPE,
href: z.string()
})).optional(),
sponsors: z.array(z.object({
name: z.string(), type: z.string(), typeColor: z.string(), typeFontColor: z.string().optional(), logoUrl: z.string(), href: z.string(),
})).optional()
})

export const DAILY_TALKS_STATS_PARSER = z.object({
Expand All @@ -142,14 +168,7 @@ export const SPEAKER_PARSER = z.object({
id: z.string(),
bio: z.string().nullish(),
social: z.array(z.object({
type: z.union([
z.literal('twitter'),
z.literal('linkedin'),
z.literal('mastodon'),
z.literal('instagram'),
z.literal('youtube'),
z.literal('twitch'),
]),
type: SOCIAL_MEDIA_TYPE,
url: z.string()
}))
})
Expand Down
21 changes: 17 additions & 4 deletions cloud/functions/src/crawlers/devoxx/crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Temporal } from "@js-temporal/polyfill";
import {z} from "zod";
import {ConferenceDescriptor} from "../../../../../shared/conference-descriptor.firestore";
import axios from "axios";
import {EVENT_DESCRIPTOR_PARSER, TALK_FORMAT_PARSER} from "../crawler-parsers";
import {EVENT_DESCRIPTOR_PARSER, INFOS_PARSER, TALK_FORMAT_PARSER} from "../crawler-parsers";
import {CrawlerKind, TALK_FORMAT_FALLBACK_COLORS} from "../crawl";
import {match} from "ts-pattern";

Expand All @@ -37,7 +37,11 @@ export const DEVOXX_DESCRIPTOR_PARSER = EVENT_DESCRIPTOR_PARSER.omit({
}).extend({
cfpId: z.string().nullish(),
cfpBaseUrl: z.string().nullish(),
eventFamily: z.string()
eventFamily: z.string(),
infos: INFOS_PARSER.extend({
address: z.string().nullish(),
coords: z.object({ latitude: z.number(), longitude: z.number() }).nullish(),
})
})

export const DEVOXX_CRAWLER: CrawlerKind<typeof DEVOXX_DESCRIPTOR_PARSER> = {
Expand Down Expand Up @@ -77,7 +81,11 @@ export const DEVOXX_CRAWLER: CrawlerKind<typeof DEVOXX_DESCRIPTOR_PARSER> = {
logoUrl: descriptor.logoUrl,
backgroundUrl: descriptor.backgroundUrl,
websiteUrl: e.website,
location: { city: e.locationCity, country: e.locationCountry },
location: {
city: e.locationCity, country: e.locationCountry,
...(descriptor.infos.address ? {address: descriptor.infos.address} : {}),
...(descriptor.infos.coords ? {coords: descriptor.infos.coords} : {}),
},
theming: descriptor.theming,
keywords: descriptor.keywords
} as ListableEvent
Expand Down Expand Up @@ -112,7 +120,12 @@ export const DEVOXX_CRAWLER: CrawlerKind<typeof DEVOXX_DESCRIPTOR_PARSER> = {
talkTracks: descriptor.talkTracks,
supportedTalkLanguages: descriptor.supportedTalkLanguages,
rooms: eventRooms,
infos: descriptor.infos
infos: {
eventDescription: descriptor.infos.eventDescription,
venuePicture: descriptor.infos.venuePicture,
},
...(descriptor.socialMedias ? {socialMedias: descriptor.socialMedias} : {}),
...(descriptor.sponsors ? {sponsors: descriptor.sponsors} : {}),
}

const event: FullEvent = {
Expand Down
4 changes: 4 additions & 0 deletions mobile/src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ const en = {
New_content_available_click_on_reload_button_to_update: "New content available. Click on reload button to update in background then auto-reload page once content is downloaded.",
Reload: "Reload",
No_talks_matching_search_terms: "No talks found for selected day",
Social_media: "Social media",
Event_plans: "Event plans",
Event_summary: "Event summary",
Sponsors: "Sponsors",
} satisfies BaseTranslation

export default en
32 changes: 32 additions & 0 deletions mobile/src/i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,22 @@ type RootTranslation = {
* N​o​ ​t​a​l​k​s​ ​f​o​u​n​d​ ​f​o​r​ ​s​e​l​e​c​t​e​d​ ​d​a​y
*/
No_talks_matching_search_terms: string
/**
* S​o​c​i​a​l​ ​m​e​d​i​a
*/
Social_media: string
/**
* E​v​e​n​t​ ​p​l​a​n​s
*/
Event_plans: string
/**
* E​v​e​n​t​ ​s​u​m​m​a​r​y
*/
Event_summary: string
/**
* S​p​o​n​s​o​r​s
*/
Sponsors: string
}

export type TranslationFunctions = {
Expand Down Expand Up @@ -684,6 +700,22 @@ export type TranslationFunctions = {
* No talks found for selected day
*/
No_talks_matching_search_terms: () => LocalizedString
/**
* Social media
*/
Social_media: () => LocalizedString
/**
* Event plans
*/
Event_plans: () => LocalizedString
/**
* Event summary
*/
Event_summary: () => LocalizedString
/**
* Sponsors
*/
Sponsors: () => LocalizedString
}

export type Formatters = {}
Loading

0 comments on commit a6900fb

Please sign in to comment.