From 55543dd7b13c35cc599ae079b0f435b43f38d215 Mon Sep 17 00:00:00 2001
From: Sam Carlton
Date: Sat, 11 Jun 2022 11:58:58 -0500
Subject: [PATCH] Enable fallback source url
---
.../listing-parts/game-reports.astro | 62 +++++++++++--------
1 file changed, 37 insertions(+), 25 deletions(-)
diff --git a/src/components/listing-parts/game-reports.astro b/src/components/listing-parts/game-reports.astro
index c124192..238d362 100644
--- a/src/components/listing-parts/game-reports.astro
+++ b/src/components/listing-parts/game-reports.astro
@@ -12,6 +12,18 @@ const details = ensureListingDetails(listing)
const hasReports = Array.isArray( details.api.reports ) && details.api.reports.length > 0
+const defaultSourceUrl = 'https://applesilicongames.com/'
+
+function getSourceUrl ( report ) {
+ // Try to get the source url from the report first
+ if ( report['Source'].includes('https://') ) {
+ return report['Source']
+ }
+
+ // Otherwise, fall back to the default source url
+ return defaultSourceUrl
+}
+
---
{ hasReports && (
@@ -38,37 +50,37 @@ const hasReports = Array.isArray( details.api.reports ) && details.api.reports.l
>
🖥 { report['Resolution'] }
- report['Settings'].length !== 0
-
- ⚙️ { report['Settings'] }
-
+ { report['Settings'].length !== 0 && (
+
+ ⚙️ { report['Settings'] }
+
+ )}
- { report['Source'].includes('https://') && (
-