From 96805eeb9edbbdde2277d155090c955cfa664506 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sat, 14 Jan 2023 16:10:31 +1100 Subject: Allow showing events without images Add setting for showing such events Fix searches not always avoiding filtered categories --- src/lib.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib.ts') diff --git a/src/lib.ts b/src/lib.ts index 53ce401..6a9f553 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -315,8 +315,8 @@ export class EventInfo { event: HistEvent; desc: string | null; wikiId: number; - imgInfo: ImgInfo; - constructor(event: HistEvent, desc: string, wikiId: number, imgInfo: ImgInfo){ + imgInfo: ImgInfo | null; + constructor(event: HistEvent, desc: string, wikiId: number, imgInfo: ImgInfo | null){ this.event = event; this.desc = desc; this.wikiId = wikiId; @@ -459,7 +459,7 @@ export type EventInfoJson = { event: HistEventJson, desc: string, wikiId: number, - imgInfo: ImgInfoJson, + imgInfo: ImgInfoJson | null, } export type ImgInfoJson = { url: string, @@ -490,8 +490,8 @@ export function jsonToHistEvent(json: HistEventJson): HistEvent { export function jsonToEventInfo(json: EventInfoJson): EventInfo { return new EventInfo(jsonToHistEvent(json.event), json.desc, json.wikiId, jsonToImgInfo(json.imgInfo)); } -export function jsonToImgInfo(json: ImgInfoJson): ImgInfo { - return new ImgInfo(json.url, json.license, json.artist, json.credit); +export function jsonToImgInfo(json: ImgInfoJson | null): ImgInfo | null { + return json == null ? null : new ImgInfo(json.url, json.license, json.artist, json.credit); } // For dates in a timeline -- cgit v1.2.3