diff options
| author | Terry Truong <terry06890@gmail.com> | 2023-01-14 16:10:31 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2023-01-14 16:10:31 +1100 |
| commit | 96805eeb9edbbdde2277d155090c955cfa664506 (patch) | |
| tree | b06e80281dca99e8cd2c8af2d7f3447a6db699fb /src/lib.ts | |
| parent | 3704ad2b88263705ee8352505845c38e0e5aa71f (diff) | |
Allow showing events without images
Add setting for showing such events
Fix searches not always avoiding filtered categories
Diffstat (limited to 'src/lib.ts')
| -rw-r--r-- | src/lib.ts | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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 |
