Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/containers/locationBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default class LocationBuilder {
private url?: string;
private location?: string;
private menu?: string;
private image?: URL;
private coordinates?: ICoordinate;
private acceptsOnlineOrders?: boolean;
private times?: ITimeRange[];
Expand Down Expand Up @@ -71,6 +72,11 @@ export default class LocationBuilder {
this.description = $("div.description p").text().trim();
this.menu = $("div.navItems > a#getMenu").attr("href");
this.location = $("div.location a").text().trim();

const conceptImageUrl = $(".conceptImage").children("img").first().prop("src");
// assert(conceptImageUrl != undefined, `concept ${this.url} did not have a Concept Image!`)
this.image = conceptImageUrl ? new URL(conceptImageUrl) : undefined;

this.acceptsOnlineOrders =
$("div.navItems.orderOnline").toArray().length > 0;

Expand Down Expand Up @@ -102,7 +108,8 @@ export default class LocationBuilder {
this.url === undefined ||
this.location === undefined ||
this.conceptId === undefined ||
this.name === undefined
this.name === undefined ||
this.image === undefined
) {
throw Error(
"Didn't finish configuring location before building metadata!"
Expand All @@ -121,6 +128,7 @@ export default class LocationBuilder {
url: this.url,
location: this.location,
menu: this.menu,
image: this.image,
coordinates: this.coordinates,
acceptsOnlineOrders: this.acceptsOnlineOrders,
times: this.times,
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface ILocation {
description: string;
url: string;
menu?: string;
image: URL;
location: string;
coordinates?: ICoordinate;
acceptsOnlineOrders: boolean;
Expand Down
Loading