mirror of
https://github.com/placeAtlas/atlas.git
synced 2025-01-13 23:34:28 +01:00
Handle when entry descriptions/links are missing
Just for safekeeping, all properties should still be defined even if it is empty
This commit is contained in:
parent
d292ffc825
commit
94147ae2dc
2 changed files with 5 additions and 5 deletions
|
@ -102,7 +102,7 @@ function createInfoBlock(entry, isPreview) {
|
|||
}
|
||||
}
|
||||
|
||||
if (entry.links.subreddit?.length) {
|
||||
if (entry.links?.subreddit?.length) {
|
||||
const subredditGroupElement = baseGroupElement.cloneNode()
|
||||
linkListElement.appendChild(subredditGroupElement)
|
||||
|
||||
|
@ -116,7 +116,7 @@ function createInfoBlock(entry, isPreview) {
|
|||
})
|
||||
}
|
||||
|
||||
if (entry.links.website?.length) {
|
||||
if (entry.links?.website?.length) {
|
||||
const websiteGroupElement = baseGroupElement.cloneNode()
|
||||
linkListElement.appendChild(websiteGroupElement)
|
||||
|
||||
|
@ -134,7 +134,7 @@ function createInfoBlock(entry, isPreview) {
|
|||
})
|
||||
}
|
||||
|
||||
if (entry.links.discord?.length) {
|
||||
if (entry.links?.discord?.length) {
|
||||
const discordGroupElement = baseGroupElement.cloneNode()
|
||||
linkListElement.appendChild(discordGroupElement)
|
||||
|
||||
|
@ -147,7 +147,7 @@ function createInfoBlock(entry, isPreview) {
|
|||
})
|
||||
}
|
||||
|
||||
if (entry.links.wiki?.length) {
|
||||
if (entry.links?.wiki?.length) {
|
||||
const wikiGroupElement = baseGroupElement.cloneNode()
|
||||
linkListElement.appendChild(wikiGroupElement)
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ function buildObjectsList(filter, sort = defaultSort) {
|
|||
atlasDisplay = atlas.filter(entry => {
|
||||
return (
|
||||
entry.name.toLowerCase().includes(filter.toLowerCase())
|
||||
|| entry.description.toLowerCase().includes(filter.toLowerCase())
|
||||
|| entry.description?.toLowerCase().includes(filter.toLowerCase())
|
||||
|| Object.values(entry.links).flat().some(str => str.toLowerCase().includes(filter))
|
||||
|| entry.id === filter
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue